diff --git a/contracts/asset-proxy/package.json b/contracts/asset-proxy/package.json index a39c3c18b5..4bd866af5b 100644 --- a/contracts/asset-proxy/package.json +++ b/contracts/asset-proxy/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/asset-proxy/test/authorizable.ts b/contracts/asset-proxy/test/authorizable.ts index 37b8cbaee1..4a7794734c 100644 --- a/contracts/asset-proxy/test/authorizable.ts +++ b/contracts/asset-proxy/test/authorizable.ts @@ -1,11 +1,4 @@ -import { - chaiSetup, - constants, - expectTransactionFailedAsync, - provider, - txDefaults, - web3Wrapper, -} from '@0x/contracts-test-utils'; +import { chaiSetup, expectTransactionFailedAsync, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils'; import { BlockchainLifecycle } from '@0x/dev-utils'; import { RevertReason } from '@0x/types'; import { BigNumber } from '@0x/utils'; @@ -60,21 +53,13 @@ describe('Authorizable', () => { }); it('should allow owner to add an authorized address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const isAuthorized = await authorizable.authorized.callAsync(address); expect(isAuthorized).to.be.true(); }); it('should revert if owner attempts to authorize a duplicate address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); return expectTransactionFailedAsync( authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }), RevertReason.TargetAlreadyAuthorized, @@ -84,11 +69,7 @@ describe('Authorizable', () => { describe('removeAuthorizedAddress', () => { it('should revert if not called by owner', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); await expectTransactionFailedAsync( authorizable.removeAuthorizedAddress.sendTransactionAsync(address, { from: notOwner }), RevertReason.OnlyContractOwner, @@ -96,16 +77,8 @@ describe('Authorizable', () => { }); it('should allow owner to remove an authorized address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); + await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const isAuthorized = await authorizable.authorized.callAsync(address); expect(isAuthorized).to.be.false(); }); @@ -122,11 +95,7 @@ describe('Authorizable', () => { describe('removeAuthorizedAddressAtIndex', () => { it('should revert if not called by owner', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const index = new BigNumber(0); await expectTransactionFailedAsync( authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { @@ -137,11 +106,7 @@ describe('Authorizable', () => { }); it('should revert if index is >= authorities.length', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const index = new BigNumber(1); return expectTransactionFailedAsync( authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { @@ -164,16 +129,8 @@ describe('Authorizable', () => { it('should revert if address at index does not match target', async () => { const address1 = address; const address2 = notOwner; - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address1, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address2, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address1, { from: owner }); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address2, { from: owner }); const address1Index = new BigNumber(0); return expectTransactionFailedAsync( authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, { @@ -184,18 +141,11 @@ describe('Authorizable', () => { }); it('should allow owner to remove an authorized address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const index = new BigNumber(0); - await authorizable.removeAuthorizedAddressAtIndex.awaitTransactionSuccessAsync( - address, - index, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.removeAuthorizedAddressAtIndex.awaitTransactionSuccessAsync(address, index, { + from: owner, + }); const isAuthorized = await authorizable.authorized.callAsync(address); expect(isAuthorized).to.be.false(); }); @@ -205,19 +155,11 @@ describe('Authorizable', () => { it('should return all authorized addresses', async () => { const initial = await authorizable.getAuthorizedAddresses.callAsync(); expect(initial).to.have.length(0); - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const afterAdd = await authorizable.getAuthorizedAddresses.callAsync(); expect(afterAdd).to.have.length(1); expect(afterAdd).to.include(address); - await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const afterRemove = await authorizable.getAuthorizedAddresses.callAsync(); expect(afterRemove).to.have.length(0); }); diff --git a/contracts/asset-proxy/test/erc1155_proxy.ts b/contracts/asset-proxy/test/erc1155_proxy.ts index 64783ba085..c06f351e23 100644 --- a/contracts/asset-proxy/test/erc1155_proxy.ts +++ b/contracts/asset-proxy/test/erc1155_proxy.ts @@ -72,16 +72,8 @@ describe('ERC1155Proxy', () => { const usedAddresses = ([owner, notAuthorized, authorized, spender, receiver] = _.slice(accounts, 0, 5)); erc1155ProxyWrapper = new ERC1155ProxyWrapper(provider, usedAddresses, owner); erc1155Proxy = await erc1155ProxyWrapper.deployProxyAsync(); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - authorized, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - erc1155Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(authorized, { from: owner }); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(erc1155Proxy.address, { from: owner }); // deploy & configure ERC1155 tokens and receiver [erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync(); erc1155Contract = erc1155Wrapper.getContract(); @@ -696,25 +688,18 @@ describe('ERC1155Proxy', () => { const tokenUri = ''; for (const tokenToCreate of tokensToCreate) { // create token - await erc1155Wrapper.getContract().createWithType.awaitTransactionSuccessAsync( - tokenToCreate, - tokenUri, - { + await erc1155Wrapper + .getContract() + .createWithType.awaitTransactionSuccessAsync(tokenToCreate, tokenUri, { from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + }); // mint balance for spender - await erc1155Wrapper.getContract().mintFungible.awaitTransactionSuccessAsync( - tokenToCreate, - [spender], - [spenderInitialBalance], - { + await erc1155Wrapper + .getContract() + .mintFungible.awaitTransactionSuccessAsync(tokenToCreate, [spender], [spenderInitialBalance], { from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + }); } ///// Step 2/5 ///// // Check balances before transfer @@ -805,25 +790,18 @@ describe('ERC1155Proxy', () => { const tokenUri = ''; for (const tokenToCreate of tokensToCreate) { // create token - await erc1155Wrapper.getContract().createWithType.awaitTransactionSuccessAsync( - tokenToCreate, - tokenUri, - { + await erc1155Wrapper + .getContract() + .createWithType.awaitTransactionSuccessAsync(tokenToCreate, tokenUri, { from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + }); // mint balance for spender - await erc1155Wrapper.getContract().mintFungible.awaitTransactionSuccessAsync( - tokenToCreate, - [spender], - [spenderInitialBalance], - { + await erc1155Wrapper + .getContract() + .mintFungible.awaitTransactionSuccessAsync(tokenToCreate, [spender], [spenderInitialBalance], { from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + }); } ///// Step 2/5 ///// // Check balances before transfer @@ -937,25 +915,18 @@ describe('ERC1155Proxy', () => { const tokenUri = ''; for (const tokenToCreate of tokensToCreate) { // create token - await erc1155Wrapper.getContract().createWithType.awaitTransactionSuccessAsync( - tokenToCreate, - tokenUri, - { + await erc1155Wrapper + .getContract() + .createWithType.awaitTransactionSuccessAsync(tokenToCreate, tokenUri, { from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + }); // mint balance for spender - await erc1155Wrapper.getContract().mintFungible.awaitTransactionSuccessAsync( - tokenToCreate, - [spender], - [spenderInitialBalance], - { + await erc1155Wrapper + .getContract() + .mintFungible.awaitTransactionSuccessAsync(tokenToCreate, [spender], [spenderInitialBalance], { from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + }); } ///// Step 2/5 ///// // Check balances before transfer @@ -1667,13 +1638,9 @@ describe('ERC1155Proxy', () => { it('should propagate revert reason from erc1155 contract failure', async () => { // disable transfers const shouldRejectTransfer = true; - await erc1155Receiver.setRejectTransferFlag.awaitTransactionSuccessAsync( - shouldRejectTransfer, - { - from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc1155Receiver.setRejectTransferFlag.awaitTransactionSuccessAsync(shouldRejectTransfer, { + from: owner, + }); // setup test parameters const tokenHolders = [spender, receiverContract]; const tokensToTransfer = fungibleTokens.slice(0, 1); diff --git a/contracts/asset-proxy/test/proxies.ts b/contracts/asset-proxy/test/proxies.ts index 2d7d01aa9f..20a00b98e3 100644 --- a/contracts/asset-proxy/test/proxies.ts +++ b/contracts/asset-proxy/test/proxies.ts @@ -105,64 +105,24 @@ describe('Asset Transfer Proxies', () => { ); // Configure ERC20Proxy - await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - authorized, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(authorized, { from: owner }); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: owner }); // Configure ERC721Proxy - await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - authorized, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(authorized, { from: owner }); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: owner }); // Configure ERC115Proxy erc1155ProxyWrapper = new ERC1155ProxyWrapper(provider, usedAddresses, owner); erc1155Proxy = await erc1155ProxyWrapper.deployProxyAsync(); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - authorized, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(authorized, { from: owner }); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: owner }); // Configure MultiAssetProxy - await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - authorized, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync( - erc20Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync( - erc721Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync( - erc1155Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(authorized, { from: owner }); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, { from: owner }); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address, { from: owner }); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc1155Proxy.address, { from: owner }); // Deploy and configure ERC20 tokens const numDummyErc20ToDeploy = 2; @@ -192,19 +152,13 @@ describe('Asset Transfer Proxies', () => { ); await erc20Wrapper.setBalancesAndAllowancesAsync(); - await noReturnErc20Token.setBalance.awaitTransactionSuccessAsync( - fromAddress, - constants.INITIAL_ERC20_BALANCE, - { - from: owner, - }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await noReturnErc20Token.setBalance.awaitTransactionSuccessAsync(fromAddress, constants.INITIAL_ERC20_BALANCE, { + from: owner, + }); await noReturnErc20Token.approve.awaitTransactionSuccessAsync( erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { from: fromAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, ); await multipleReturnErc20Token.setBalance.awaitTransactionSuccessAsync( fromAddress, @@ -212,13 +166,11 @@ describe('Asset Transfer Proxies', () => { { from: owner, }, - constants.AWAIT_TRANSACTION_MINED_MS, ); await multipleReturnErc20Token.approve.awaitTransactionSuccessAsync( erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { from: fromAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, ); // Deploy and configure ERC721 tokens and receiver @@ -407,12 +359,9 @@ describe('Asset Transfer Proxies', () => { toAddress, amount, ); - await erc20TokenA.approve.awaitTransactionSuccessAsync( - erc20Proxy.address, - allowance, - { from: fromAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc20TokenA.approve.awaitTransactionSuccessAsync(erc20Proxy.address, allowance, { + from: fromAddress, + }); const erc20Balances = await erc20Wrapper.getBalancesAsync(); // Perform a transfer; expect this to fail. await expectTransactionFailedAsync( @@ -439,12 +388,9 @@ describe('Asset Transfer Proxies', () => { toAddress, amount, ); - await noReturnErc20Token.approve.awaitTransactionSuccessAsync( - erc20Proxy.address, - allowance, - { from: fromAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await noReturnErc20Token.approve.awaitTransactionSuccessAsync(erc20Proxy.address, allowance, { + from: fromAddress, + }); const initialFromBalance = await noReturnErc20Token.balanceOf.callAsync(fromAddress); const initialToBalance = await noReturnErc20Token.balanceOf.callAsync(toAddress); // Perform a transfer; expect this to fail. @@ -680,19 +626,13 @@ describe('Asset Transfer Proxies', () => { const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId); expect(ownerFromAsset).to.be.equal(fromAddress); // Remove blanket transfer approval for fromAddress. - await erc721TokenA.setApprovalForAll.awaitTransactionSuccessAsync( - erc721Proxy.address, - false, - { from: fromAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc721TokenA.setApprovalForAll.awaitTransactionSuccessAsync(erc721Proxy.address, false, { + from: fromAddress, + }); // Remove token transfer approval for fromAddress. - await erc721TokenA.approve.awaitTransactionSuccessAsync( - constants.NULL_ADDRESS, - erc721AFromTokenId, - { from: fromAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc721TokenA.approve.awaitTransactionSuccessAsync(constants.NULL_ADDRESS, erc721AFromTokenId, { + from: fromAddress, + }); // Perform a transfer; expect this to fail. const amount = new BigNumber(1); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( diff --git a/contracts/asset-proxy/test/utils/erc20_wrapper.ts b/contracts/asset-proxy/test/utils/erc20_wrapper.ts index 8fdd210b24..2076040bd8 100644 --- a/contracts/asset-proxy/test/utils/erc20_wrapper.ts +++ b/contracts/asset-proxy/test/utils/erc20_wrapper.ts @@ -70,13 +70,11 @@ export class ERC20Wrapper { tokenOwnerAddress, constants.INITIAL_ERC20_BALANCE, { from: this._contractOwnerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, ); await dummyTokenContract.approve.awaitTransactionSuccessAsync( (this._proxyContract as ERC20ProxyContract).address, constants.INITIAL_ERC20_ALLOWANCE, { from: tokenOwnerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, ); } } @@ -88,12 +86,9 @@ export class ERC20Wrapper { } public async setBalanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise { const tokenContract = this._getTokenContractFromAssetData(assetData); - await tokenContract.setBalance.awaitTransactionSuccessAsync( - userAddress, - amount, - { from: this._contractOwnerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.setBalance.awaitTransactionSuccessAsync(userAddress, amount, { + from: this._contractOwnerAddress, + }); } public async getProxyAllowanceAsync(userAddress: string, assetData: string): Promise { const tokenContract = this._getTokenContractFromAssetData(assetData); @@ -104,12 +99,7 @@ export class ERC20Wrapper { public async setAllowanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise { const tokenContract = this._getTokenContractFromAssetData(assetData); const proxyAddress = (this._proxyContract as ERC20ProxyContract).address; - await tokenContract.approve.awaitTransactionSuccessAsync( - proxyAddress, - amount, - { from: userAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.approve.awaitTransactionSuccessAsync(proxyAddress, amount, { from: userAddress }); } public async getBalancesAsync(): Promise { this._validateDummyTokenContractsExistOrThrow(); diff --git a/contracts/asset-proxy/test/utils/erc721_wrapper.ts b/contracts/asset-proxy/test/utils/erc721_wrapper.ts index 3ff03f3d19..e2ae988930 100644 --- a/contracts/asset-proxy/test/utils/erc721_wrapper.ts +++ b/contracts/asset-proxy/test/utils/erc721_wrapper.ts @@ -93,22 +93,14 @@ export class ERC721Wrapper { ): Promise { const tokenContract = this._getTokenContractFromAssetData(tokenAddress); const proxyAddress = (this._proxyContract as ERC721ProxyContract).address; - await tokenContract.setApprovalForAll.awaitTransactionSuccessAsync( - proxyAddress, - isApproved, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.setApprovalForAll.awaitTransactionSuccessAsync(proxyAddress, isApproved, { + from: ownerAddress, + }); } public async approveAsync(to: string, tokenAddress: string, tokenId: BigNumber): Promise { const tokenContract = this._getTokenContractFromAssetData(tokenAddress); const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId); - await tokenContract.approve.awaitTransactionSuccessAsync( - to, - tokenId, - { from: tokenOwner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.approve.awaitTransactionSuccessAsync(to, tokenId, { from: tokenOwner }); } public async transferFromAsync( tokenAddress: string, @@ -117,31 +109,19 @@ export class ERC721Wrapper { userAddress: string, ): Promise { const tokenContract = this._getTokenContractFromAssetData(tokenAddress); - await tokenContract.transferFrom.awaitTransactionSuccessAsync( - currentOwner, - userAddress, - tokenId, - { from: currentOwner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.transferFrom.awaitTransactionSuccessAsync(currentOwner, userAddress, tokenId, { + from: currentOwner, + }); } public async mintAsync(tokenAddress: string, tokenId: BigNumber, userAddress: string): Promise { const tokenContract = this._getTokenContractFromAssetData(tokenAddress); - await tokenContract.mint.awaitTransactionSuccessAsync( - userAddress, - tokenId, - { from: this._contractOwnerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.mint.awaitTransactionSuccessAsync(userAddress, tokenId, { + from: this._contractOwnerAddress, + }); } public async burnAsync(tokenAddress: string, tokenId: BigNumber, owner: string): Promise { const tokenContract = this._getTokenContractFromAssetData(tokenAddress); - await tokenContract.burn.awaitTransactionSuccessAsync( - owner, - tokenId, - { from: this._contractOwnerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await tokenContract.burn.awaitTransactionSuccessAsync(owner, tokenId, { from: this._contractOwnerAddress }); } public async ownerOfAsync(tokenAddress: string, tokenId: BigNumber): Promise { const tokenContract = this._getTokenContractFromAssetData(tokenAddress); diff --git a/contracts/coordinator/package.json b/contracts/coordinator/package.json index 16de8c364c..037ea6909f 100644 --- a/contracts/coordinator/package.json +++ b/contracts/coordinator/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/dev-utils/package.json b/contracts/dev-utils/package.json index b88780e996..99ba92c705 100644 --- a/contracts/dev-utils/package.json +++ b/contracts/dev-utils/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/erc1155/package.json b/contracts/erc1155/package.json index f931f4ec11..f3111ac48c 100644 --- a/contracts/erc1155/package.json +++ b/contracts/erc1155/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/erc1155/test/utils/erc1155_wrapper.ts b/contracts/erc1155/test/utils/erc1155_wrapper.ts index 5f2ea1483f..984935db17 100644 --- a/contracts/erc1155/test/utils/erc1155_wrapper.ts +++ b/contracts/erc1155/test/utils/erc1155_wrapper.ts @@ -1,4 +1,4 @@ -import { constants, LogDecoder } from '@0x/contracts-test-utils'; +import { LogDecoder } from '@0x/contracts-test-utils'; import { BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; @@ -100,7 +100,6 @@ export class Erc1155Wrapper { beneficiaries, tokenAmountsAsArray, { from: this._contractOwner }, - constants.AWAIT_TRANSACTION_MINED_MS, ); } public async mintNonFungibleTokensAsync(beneficiaries: string[]): Promise<[BigNumber, BigNumber[]]> { @@ -114,12 +113,9 @@ export class Erc1155Wrapper { // tslint:disable-next-line no-unnecessary-type-assertion const createFungibleTokenLog = tx.logs[0] as LogWithDecodedArgs; const token = createFungibleTokenLog.args.id; - await this._erc1155Contract.mintNonFungible.awaitTransactionSuccessAsync( - token, - beneficiaries, - { from: this._contractOwner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await this._erc1155Contract.mintNonFungible.awaitTransactionSuccessAsync(token, beneficiaries, { + from: this._contractOwner, + }); const encodedNftIds: BigNumber[] = []; const nftIdBegin = 1; const nftIdEnd = beneficiaries.length + 1; diff --git a/contracts/erc20/package.json b/contracts/erc20/package.json index 6e2d280cfc..bd851a7056 100644 --- a/contracts/erc20/package.json +++ b/contracts/erc20/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/erc721/package.json b/contracts/erc721/package.json index cc3c04f2a1..2bbebbba84 100644 --- a/contracts/erc721/package.json +++ b/contracts/erc721/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/exchange-forwarder/package.json b/contracts/exchange-forwarder/package.json index a14a5a8cd1..7a517399ea 100644 --- a/contracts/exchange-forwarder/package.json +++ b/contracts/exchange-forwarder/package.json @@ -23,7 +23,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", "coverage:report:html": "istanbul report html && open coverage/index.html", diff --git a/contracts/exchange-libs/package.json b/contracts/exchange-libs/package.json index e21a07ead7..0e88be8bd4 100644 --- a/contracts/exchange-libs/package.json +++ b/contracts/exchange-libs/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/exchange/package.json b/contracts/exchange/package.json index 6f09054ea8..e61e224f68 100644 --- a/contracts/exchange/package.json +++ b/contracts/exchange/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/exchange/src/wrapper_interfaces.ts b/contracts/exchange/src/wrapper_interfaces.ts index 88ed09502b..2c8fe219b1 100644 --- a/contracts/exchange/src/wrapper_interfaces.ts +++ b/contracts/exchange/src/wrapper_interfaces.ts @@ -1,4 +1,5 @@ import { PromiseWithTransactionHash } from '@0x/base-contract'; +import { AwaitTransactionSuccessOpts } from '@0x/types'; import { BlockParam, CallData, TransactionReceiptWithDecodedLogs, TxData } from 'ethereum-types'; // Generated Wrapper Interfaces @@ -7,8 +8,7 @@ export interface AssetProxyDispatcher { awaitTransactionSuccessAsync: ( assetProxy: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + txOpts?: AwaitTransactionSuccessOpts, ) => PromiseWithTransactionHash; }; getAssetProxy: { @@ -21,16 +21,14 @@ export interface Authorizable extends Ownable { awaitTransactionSuccessAsync: ( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + txOpts?: AwaitTransactionSuccessOpts, ) => PromiseWithTransactionHash; }; removeAuthorizedAddress: { awaitTransactionSuccessAsync: ( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + txOpts?: AwaitTransactionSuccessOpts, ) => PromiseWithTransactionHash; }; authorized: { @@ -46,8 +44,7 @@ export interface Ownable { awaitTransactionSuccessAsync: ( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + txOpts?: AwaitTransactionSuccessOpts, ) => PromiseWithTransactionHash; }; owner: { diff --git a/contracts/exchange/test/match_orders.ts b/contracts/exchange/test/match_orders.ts index 3c74932c8c..c2d1a09bb3 100644 --- a/contracts/exchange/test/match_orders.ts +++ b/contracts/exchange/test/match_orders.ts @@ -141,56 +141,30 @@ describe('matchOrders', () => { await exchangeWrapper.registerAssetProxyAsync(erc1155Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(multiAssetProxyContract.address, owner); // Authorize proxies. - await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchange.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchange.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchange.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxyContract.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchange.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxyContract.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxyContract.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxyContract.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxyContract.registerAssetProxy.awaitTransactionSuccessAsync( - erc20Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxyContract.registerAssetProxy.awaitTransactionSuccessAsync( - erc721Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await multiAssetProxyContract.registerAssetProxy.awaitTransactionSuccessAsync( - erc1155Proxy.address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { from: owner }); + await multiAssetProxyContract.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, { + from: owner, + }); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxyContract.address, { + from: owner, + }); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxyContract.address, { + from: owner, + }); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxyContract.address, { + from: owner, + }); + await multiAssetProxyContract.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, { + from: owner, + }); + await multiAssetProxyContract.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address, { + from: owner, + }); + await multiAssetProxyContract.registerAssetProxy.awaitTransactionSuccessAsync(erc1155Proxy.address, { + from: owner, + }); // Set default addresses defaultERC20MakerAssetAddress = erc20Tokens[0].address; diff --git a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts index 89cf4e801e..bee9116bc4 100644 --- a/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts +++ b/contracts/exchange/test/utils/fill_order_combinatorial_utils.ts @@ -123,65 +123,37 @@ export async function fillOrderCombinatorialUtilsFactoryAsync( await exchangeWrapper.registerAssetProxyAsync(erc1155Proxy.address, ownerAddress); await exchangeWrapper.registerAssetProxyAsync(multiAssetProxy.address, ownerAddress); - await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchangeContract.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchangeContract.address, { + from: ownerAddress, + }); - await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchangeContract.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchangeContract.address, { + from: ownerAddress, + }); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchangeContract.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchangeContract.address, { + from: ownerAddress, + }); - await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - exchangeContract.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchangeContract.address, { + from: ownerAddress, + }); - await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxy.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { from: ownerAddress }); - await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxy.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { + from: ownerAddress, + }); - await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync( - multiAssetProxy.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, { + from: ownerAddress, + }); - await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync( - erc20Proxy.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, { from: ownerAddress }); - await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync( - erc721Proxy.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address, { from: ownerAddress }); - await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync( - erc1155Proxy.address, - { from: ownerAddress }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc1155Proxy.address, { from: ownerAddress }); const orderFactory = new OrderFactoryFromScenario( userAddresses, diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 982f4edf5e..6d7716c0a3 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json index 1e4d940868..bc861442a5 100644 --- a/contracts/multisig/package.json +++ b/contracts/multisig/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/staking/package.json b/contracts/staking/package.json index 884892949b..47e010ba2f 100644 --- a/contracts/staking/package.json +++ b/contracts/staking/package.json @@ -23,7 +23,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/utils/package.json b/contracts/utils/package.json index 76834fe6d9..a1d1f697dd 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -22,7 +22,7 @@ "compile": "sol-compiler", "watch": "sol-compiler -w", "clean": "shx rm -rf lib generated-artifacts generated-wrappers", - "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", + "generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers", "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts", "coverage:report:text": "istanbul report text", diff --git a/contracts/utils/test/authorizable.ts b/contracts/utils/test/authorizable.ts index df70f84e19..b2a1a46876 100644 --- a/contracts/utils/test/authorizable.ts +++ b/contracts/utils/test/authorizable.ts @@ -63,11 +63,7 @@ describe('Authorizable', () => { }); it('should revert if owner attempts to authorize a duplicate address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const expectedError = new AuthorizableRevertErrors.TargetAlreadyAuthorizedError(address); const tx = authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }); return expect(tx).to.revertWith(expectedError); @@ -76,27 +72,15 @@ describe('Authorizable', () => { describe('removeAuthorizedAddress', () => { it('should revert if not called by owner', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const expectedError = new OwnableRevertErrors.OnlyOwnerError(notOwner, owner); const tx = authorizable.removeAuthorizedAddress.sendTransactionAsync(address, { from: notOwner }); return expect(tx).to.revertWith(expectedError); }); it('should allow owner to remove an authorized address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); + await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const isAuthorized = await authorizable.authorized.callAsync(address); expect(isAuthorized).to.be.false(); }); @@ -110,11 +94,7 @@ describe('Authorizable', () => { describe('removeAuthorizedAddressAtIndex', () => { it('should revert if not called by owner', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const index = new BigNumber(0); const expectedError = new OwnableRevertErrors.OnlyOwnerError(notOwner, owner); const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { @@ -124,11 +104,7 @@ describe('Authorizable', () => { }); it('should revert if index is >= authorities.length', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const index = new BigNumber(1); const expectedError = new AuthorizableRevertErrors.IndexOutOfBoundsError(index, index); const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, { @@ -149,16 +125,8 @@ describe('Authorizable', () => { it('should revert if address at index does not match target', async () => { const address1 = address; const address2 = notOwner; - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address1, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address2, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address1, { from: owner }); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address2, { from: owner }); const address1Index = new BigNumber(0); const expectedError = new AuthorizableRevertErrors.AuthorizedAddressMismatchError(address1, address2); const tx = authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address2, address1Index, { @@ -168,18 +136,11 @@ describe('Authorizable', () => { }); it('should allow owner to remove an authorized address', async () => { - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const index = new BigNumber(0); - await authorizable.removeAuthorizedAddressAtIndex.awaitTransactionSuccessAsync( - address, - index, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.removeAuthorizedAddressAtIndex.awaitTransactionSuccessAsync(address, index, { + from: owner, + }); const isAuthorized = await authorizable.authorized.callAsync(address); expect(isAuthorized).to.be.false(); }); @@ -189,19 +150,11 @@ describe('Authorizable', () => { it('should return all authorized addresses', async () => { const initial = await authorizable.getAuthorizedAddresses.callAsync(); expect(initial).to.have.length(0); - await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const afterAdd = await authorizable.getAuthorizedAddresses.callAsync(); expect(afterAdd).to.have.length(1); expect(afterAdd).to.include(address); - await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync( - address, - { from: owner }, - constants.AWAIT_TRANSACTION_MINED_MS, - ); + await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync(address, { from: owner }); const afterRemove = await authorizable.getAuthorizedAddresses.callAsync(); expect(afterRemove).to.have.length(0); }); diff --git a/packages/0x.js/src/index.ts b/packages/0x.js/src/index.ts index 5f857bb0fa..291ab39c5b 100644 --- a/packages/0x.js/src/index.ts +++ b/packages/0x.js/src/index.ts @@ -83,6 +83,8 @@ export { SimpleEvmOutput, SimpleEvmBytecodeOutput, EIP712DomainWithDefaultSchema, + AwaitTransactionSuccessOpts, + SendTransactionOpts, EventCallback, IndexedFilterValues, DecodedLogEvent, diff --git a/packages/abi-gen-wrappers/CHANGELOG.json b/packages/abi-gen-wrappers/CHANGELOG.json index d1fb15b3c8..e58a45f47a 100644 --- a/packages/abi-gen-wrappers/CHANGELOG.json +++ b/packages/abi-gen-wrappers/CHANGELOG.json @@ -1,4 +1,25 @@ [ + { + "version": "5.4.0-beta.1", + "changes": [ + { + "note": "Remove debug functions `getABIDecodedTransactionData` and `getABIDecodedReturnData`", + "pr": 2243 + }, + { + "note": "Remove `getABIEncodedTransactionData` for constant functions (pure and view)", + "pr": 2243 + }, + { + "note": "Introduce TxOpts object for `sendTransactionAsync` and `awaitTransactionSuccessAsync`. Replaces `timeoutMs` and `pollingIntervalMs` arguments for `awaitTransactionSuccessAsync`", + "pr": 2243 + }, + { + "note": "Remove `validateAndSendTransactionAsync`. Replaced with `shouldValidate` key in TxOpts. Defaults to true", + "pr": 2243 + } + ] + }, { "version": "5.4.0-beta.0", "changes": [ diff --git a/packages/abi-gen-wrappers/package.json b/packages/abi-gen-wrappers/package.json index 48925f10e3..74d41fee72 100644 --- a/packages/abi-gen-wrappers/package.json +++ b/packages/abi-gen-wrappers/package.json @@ -34,21 +34,20 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md", "devDependencies": { "@0x/abi-gen": "^4.3.0-beta.0", - "@0x/assert": "^2.2.0-beta.0", - "@0x/json-schemas": "^4.1.0-beta.0", + "@0x/contract-artifacts": "^2.3.0-beta.0", "@0x/tslint-config": "^3.0.1", - "@0x/types": "^2.5.0-beta.0", - "@0x/utils": "^4.6.0-beta.0", - "@0x/web3-wrapper": "^6.1.0-beta.0", - "ethereum-types": "^2.2.0-beta.0", - "ethers": "~4.0.4", - "lodash": "^4.17.11", "shx": "^0.2.2" }, "dependencies": { + "@0x/assert": "^2.2.0-beta.0", "@0x/base-contract": "^5.5.0-beta.0", "@0x/contract-addresses": "^3.3.0-beta.0", - "@0x/contract-artifacts": "^2.3.0-beta.0" + "@0x/json-schemas": "^4.1.0-beta.0", + "@0x/types": "^2.5.0-beta.0", + "@0x/utils": "^4.6.0-beta.0", + "@0x/web3-wrapper": "^6.1.0-beta.0", + "ethereum-types": "^2.2.0-beta.0", + "ethers": "~4.0.4" }, "publishConfig": { "access": "public" 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 7f9cb9d1e0..1e6aee0d1a 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 @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -113,8 +119,10 @@ export interface AssetProxyOwnerTimeLockChangeEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class AssetProxyOwnerContract extends BaseContract { - public static deployedBytecode = - '0x6080604052600436106101a15760003560e01c80639ace38c2116100e1578063c01a8c841161008a578063d74f8edd11610064578063d74f8edd146104ff578063dc8452cd14610514578063e20056e614610529578063ee22610b14610549576101a1565b8063c01a8c841461049f578063c6427474146104bf578063d38f2d82146104df576101a1565b8063b5dc40c3116100bb578063b5dc40c31461044a578063b77bf6001461046a578063ba51a6df1461047f576101a1565b80639ace38c2146103cb578063a0e67e2b146103fb578063a8abe69a1461041d576101a1565b8063547415251161014e578063784547a711610128578063784547a71461033d5780637ad28c511461035d5780637f05c8b61461037d5780638b51d13f146103ab576101a1565b806354741525146102dd5780637065cb48146102fd578063751ad5601461031d576101a1565b80632f54bf6e1161017f5780632f54bf6e1461026e5780633411c81c1461029b57806337bd78a0146102bb576101a1565b8063025e7c27146101f8578063173825d91461022e57806320ea8d861461024e575b34156101f6573373ffffffffffffffffffffffffffffffffffffffff167fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c346040516101ed9190612b44565b60405180910390a25b005b34801561020457600080fd5b50610218610213366004612580565b610569565b6040516102259190612616565b60405180910390f35b34801561023a57600080fd5b506101f6610249366004612303565b61059d565b34801561025a57600080fd5b506101f6610269366004612580565b61084c565b34801561027a57600080fd5b5061028e610289366004612303565b6109a7565b6040516102259190612745565b3480156102a757600080fd5b5061028e6102b6366004612598565b6109bc565b3480156102c757600080fd5b506102d06109dc565b6040516102259190612b44565b3480156102e957600080fd5b506102d06102f83660046124c0565b6109e2565b34801561030957600080fd5b506101f6610318366004612303565b610a4e565b34801561032957600080fd5b506101f66103383660046124f4565b610c73565b34801561034957600080fd5b5061028e610358366004612580565b610cbe565b34801561036957600080fd5b506101f6610378366004612580565b610d52565b34801561038957600080fd5b5061039d610398366004612563565b610dcb565b604051610225929190612750565b3480156103b757600080fd5b506102d06103c6366004612580565b610e04565b3480156103d757600080fd5b506103eb6103e6366004612580565b610e80565b6040516102259493929190612637565b34801561040757600080fd5b50610410610f69565b60405161022591906126b4565b34801561042957600080fd5b5061043d6104383660046125bc565b610fd9565b604051610225919061270d565b34801561045657600080fd5b50610410610465366004612580565b611104565b34801561047657600080fd5b506102d06112bc565b34801561048b57600080fd5b506101f661049a366004612580565b6112c2565b3480156104ab57600080fd5b506101f66104ba366004612580565b61139e565b3480156104cb57600080fd5b506102d06104da366004612357565b611568565b3480156104eb57600080fd5b506102d06104fa366004612580565b611587565b34801561050b57600080fd5b506102d0611599565b34801561052057600080fd5b506102d061159e565b34801561053557600080fd5b506101f661054436600461231f565b6115a4565b34801561055557600080fd5b506101f6610564366004612580565b61182e565b6003818154811061057657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b3330146105df576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a68565b60405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff16610640576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906129fa565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b6003547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff018110156107bc578273ffffffffffffffffffffffffffffffffffffffff16600382815481106106dc57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614156107b457600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061073457fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff909216918390811061076757fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506107bc565b60010161068c565b50600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906107ee9082612100565b50600354600454111561080757600354610807906112c2565b60405173ffffffffffffffffffffffffffffffffffffffff8316907f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9090600090a25050565b3360008181526002602052604090205460ff16610895576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906129fa565b60008281526001602090815260408083203380855292529091205483919060ff166108ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612955565b600084815260208190526040902060030154849060ff161561093a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612ad6565b600085815260016020908152604080832033808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555187927ff6a317157440607f36269043eb55f1287a5a19ba2216afeab88cd46cbcfb88e991a35050505050565b60026020526000908152604090205460ff1681565b600160209081526000928352604080842090915290825290205460ff1681565b60065481565b6000805b600554811015610a4757838015610a0f575060008181526020819052604090206003015460ff16155b80610a335750828015610a33575060008181526020819052604090206003015460ff165b15610a3f576001820191505b6001016109e6565b5092915050565b333014610a87576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a68565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040902054819060ff1615610ae9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612879565b8173ffffffffffffffffffffffffffffffffffffffff8116610b37576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d69061280b565b60038054905060010160045460328211158015610b545750818111155b8015610b5f57508015155b8015610b6a57508115155b610ba0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612b0d565b73ffffffffffffffffffffffffffffffffffffffff851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055517ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d9190a25050505050565b333014610cac576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a68565b610cb884848484611b79565b50505050565b600080805b600354811015610d4a5760008481526001602052604081206003805491929184908110610cec57fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610d2d576001820191505b600454821415610d4257600192505050610d4d565b600101610cc3565b50505b919050565b333014610d8b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a68565b60068190556040517fd1c9101a34feff75cccef14a28785a0279cb0b49c1f321f21f5f422e746b437790610dc0908390612b44565b60405180910390a150565b600860209081526000928352604080842090915290825290205460ff81169061010090046fffffffffffffffffffffffffffffffff1682565b6000805b600354811015610e7a5760008381526001602052604081206003805491929184908110610e3157fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff1615610e72576001820191505b600101610e08565b50919050565b60006020818152918152604090819020805460018083015460028085018054875161010095821615959095027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f810188900488028401880190965285835273ffffffffffffffffffffffffffffffffffffffff90931695909491929190830182828015610f565780601f10610f2b57610100808354040283529160200191610f56565b820191906000526020600020905b815481529060010190602001808311610f3957829003601f168201915b5050506003909301549192505060ff1684565b60606003805480602002602001604051908101604052809291908181526020018280548015610fce57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610fa3575b505050505090505b90565b606080600554604051908082528060200260200182016040528015611008578160200160208202803883390190505b5090506000805b60055481101561108957858015611038575060008181526020819052604090206003015460ff16155b8061105c575084801561105c575060008181526020819052604090206003015460ff165b15611081578083838151811061106e57fe5b6020026020010181815250506001820191505b60010161100f565b8787036040519080825280602002602001820160405280156110b5578160200160208202803883390190505b5093508790505b868110156110f9578281815181106110d057fe5b602002602001015184898303815181106110e657fe5b60209081029190910101526001016110bc565b505050949350505050565b606080600380549050604051908082528060200260200182016040528015611136578160200160208202803883390190505b5090506000805b60035481101561122d576000858152600160205260408120600380549192918490811061116657fe5b600091825260208083209091015473ffffffffffffffffffffffffffffffffffffffff16835282019290925260400190205460ff161561122557600381815481106111ad57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168383815181106111e457fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001820191505b60010161113d565b81604051908082528060200260200182016040528015611257578160200160208202803883390190505b509350600090505b818110156112b45782818151811061127357fe5b602002602001015184828151811061128757fe5b73ffffffffffffffffffffffffffffffffffffffff9092166020928302919091019091015260010161125f565b505050919050565b60055481565b3330146112fb576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a68565b60035481603282118015906113105750818111155b801561131b57508015155b801561132657508115155b61135c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612b0d565b60048390556040517fa3f1ee9126a074d9326c682f561767f710e927faa811f7a99829d49dc421797a90611391908590612b44565b60405180910390a1505050565b3360008181526002602052604090205460ff166113e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906129fa565b600082815260208190526040902054829073ffffffffffffffffffffffffffffffffffffffff16611444576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d69061291e565b60008381526001602090815260408083203380855292529091205484919060ff161561149c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906128b0565b846114a681610cbe565b156114dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a9f565b600086815260016020818152604080842033808652925280842080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016909317909255905188927f4a504a94899432a9846e1aa406dceb1bcfd538bb839071d49d1e5e23f5be30ef91a361155186610cbe565b15611560576115608642611cb1565b505050505050565b6000611575848484611d00565b90506115808161139e565b9392505050565b60076020526000908152604090205481565b603281565b60045481565b3330146115dd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a68565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff1661163e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906129fa565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902054829060ff16156116a0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612879565b60005b60035481101561175c578473ffffffffffffffffffffffffffffffffffffffff16600382815481106116d157fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561175457836003828154811061170757fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061175c565b6001016116a3565b5073ffffffffffffffffffffffffffffffffffffffff80851660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0090811690915593871682528082208054909416600117909355915190917f8001553a916ef2f495d26a907cc54d96ed840d7bda71e73194bf5a9df7a76b9091a260405173ffffffffffffffffffffffffffffffffffffffff8416907ff39e6e1eb0edcf53c221607b54b00cd28f3196fed0a24994dc308b8f611b682d90600090a250505050565b600081815260208190526040902060030154819060ff161561187c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612ad6565b8161188681610cbe565b6118bc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906128e7565b6000838152602081815260409182902060038101805460017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909116811790915560028083018054865161010094821615949094027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff011691909104601f81018590048502830185019095528482529193606093849384939290918301828280156119a85780601f1061197d576101008083540402835291602001916119a8565b820191906000526020600020905b81548152906001019060200180831161198b57829003601f168201915b50505050508060200190516119c091908101906123ec565b9250925092506000835190508251811480156119dc5750815181145b611a12576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d69061298c565b600088815260076020526040812054905b828114611b4257611a5b82878381518110611a3a57fe5b6020026020010151878481518110611a4e57fe5b6020026020010151611e5e565b6000858281518110611a6957fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff16858381518110611a9357fe5b6020026020010151888481518110611aa757fe5b6020026020010151604051611abc91906125fa565b60006040518083038185875af1925050503d8060008114611af9576040519150601f19603f3d011682016040523d82523d6000602084013e611afe565b606091505b5050905080611b39576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d6906129c3565b50600101611a23565b5060405189907f33e13ecb54c3076d8e8bb8c2881800a4d972b792045ffae98fdf46df365fed7590600090a2505050505050505050565b600084611b87576000611b89565b815b9050611b93612129565b5060408051808201825286151581526fffffffffffffffffffffffffffffffff80841660208084019182527fffffffff00000000000000000000000000000000000000000000000000000000891660009081526008825285812073ffffffffffffffffffffffffffffffffffffffff8a168252909152849020835181549251909316610100027fffffffffffffffffffffffffffffff00000000000000000000000000000000ff9315157fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00909316929092179290921617905590517f694405724de467488eda192d814f39ffe7f6503fe0b1eefd4ea332f9c611c5ec90611ca190879087908a908790612772565b60405180910390a1505050505050565b600082815260076020526040908190208290555182907f0b237afe65f1514fd7ea3f923ea4fe792bdd07000a912b6cd1602a8e7f573c8d90611cf4908490612b44565b60405180910390a25050565b60008373ffffffffffffffffffffffffffffffffffffffff8116611d50576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d69061280b565b6005546040805160808101825273ffffffffffffffffffffffffffffffffffffffff8881168252602080830189815283850189815260006060860181905287815280845295909520845181547fffffffffffffffffffffffff00000000000000000000000000000000000000001694169390931783555160018301559251805194965091939092611de8926002850192910190612140565b5060609190910151600390910180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001691151591909117905560058054600101905560405182907fc0ba8fe4b176c1714197d43b9cc6bcf797a4a7461c5fe8d0ef6e184ae7601e5190600090a2509392505050565b6000611e70838263ffffffff611fbd16565b9050611e7a612129565b507fffffffff000000000000000000000000000000000000000000000000000000008116600090815260086020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845282529182902082518084019093525460ff811615801584526101009091046fffffffffffffffffffffffffffffffff1691830191909152611f69576020810151611f2b9086906fffffffffffffffffffffffffffffffff1663ffffffff61201816565b421015611f64576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612a31565b611fb6565b600654611f7d90869063ffffffff61201816565b421015611fb6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105d690612842565b5050505050565b60008160040183511015611fe357611fe3611fde6003855185600401612034565b6120d9565b5060208183018101519101907fffffffff00000000000000000000000000000000000000000000000000000000165b92915050565b60008282018381101561158057611580611fde600086866120e1565b6060632800659560e01b848484604051602401612053939291906127fd565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b805160208201fd5b606063e946c1bb60e01b848484604051602401612053939291906127db565b815481835581811115612124576000838152602090206121249181019083016121be565b505050565b604080518082019091526000808252602082015290565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061218157805160ff19168380011785556121ae565b828001600101855582156121ae579182015b828111156121ae578251825591602001919060010190612193565b506121ba9291506121be565b5090565b610fd691905b808211156121ba57600081556001016121c4565b600082601f8301126121e8578081fd5b81516121fb6121f682612b74565b612b4d565b81815291506020808301908481018184028601820187101561221c57600080fd5b60005b8481101561224457815161223281612c02565b8452928201929082019060010161221f565b505050505092915050565b600082601f83011261225f578081fd5b815161226d6121f682612b74565b81815291506020808301908481018184028601820187101561228e57600080fd5b60005b8481101561224457815184529282019290820190600101612291565b8035801515811461201257600080fd5b600082601f8301126122cd578081fd5b81516122db6121f682612b94565b91508082528360208285010111156122f257600080fd5b610a47816020840160208601612bd6565b600060208284031215612314578081fd5b813561158081612c02565b60008060408385031215612331578081fd5b823561233c81612c02565b9150602083013561234c81612c02565b809150509250929050565b60008060006060848603121561236b578081fd5b833561237681612c02565b925060208401359150604084013567ffffffffffffffff811115612398578182fd5b80850186601f8201126123a9578283fd5b803591506123b96121f683612b94565b8281528760208484010111156123cd578384fd5b8260208301602083013783602084830101528093505050509250925092565b600080600060608486031215612400578283fd5b835167ffffffffffffffff80821115612417578485fd5b81860187601f820112612428578586fd5b805192506124386121f684612b74565b83815260208082019190838101895b878110156124705761245e8d8484518901016122bd565b85529382019390820190600101612447565b50508901519097509350505080821115612488578384fd5b612494878388016121d8565b935060408601519150808211156124a9578283fd5b506124b68682870161224f565b9150509250925092565b600080604083850312156124d2578182fd5b6124dc84846122ad565b91506124eb84602085016122ad565b90509250929050565b60008060008060808587031215612509578081fd5b843561251481612c27565b9350602085013561252481612c35565b9250604085013561253481612c02565b915060608501356fffffffffffffffffffffffffffffffff81168114612558578182fd5b939692955090935050565b60008060408385031215612575578182fd5b823561233c81612c35565b600060208284031215612591578081fd5b5035919050565b600080604083850312156125aa578182fd5b82359150602083013561234c81612c02565b600080600080608085870312156125d1578182fd5b843593506020850135925060408501356125ea81612c27565b9150606085013561255881612c27565b6000825161260c818460208701612bd6565b9190910192915050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600073ffffffffffffffffffffffffffffffffffffffff861682528460208301526080604083015283518060808401526126788160a0850160208801612bd6565b921515606083015250601f919091017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0160160a0019392505050565b602080825282518282018190526000918401906040840190835b8181101561270257835173ffffffffffffffffffffffffffffffffffffffff168352602093840193909201916001016126ce565b509095945050505050565b602080825282518282018190526000918401906040840190835b81811015612702578351835260209384019390920191600101612727565b901515815260200190565b91151582526fffffffffffffffffffffffffffffffff16602082015260400190565b7fffffffff0000000000000000000000000000000000000000000000000000000094909416845273ffffffffffffffffffffffffffffffffffffffff929092166020840152151560408301526fffffffffffffffffffffffffffffffff16606082015260800190565b60608101600485106127e957fe5b938152602081019290925260409091015290565b60608101600885106127e957fe5b6020808252600c908201527f4e554c4c5f414444524553530000000000000000000000000000000000000000604082015260600190565b6020808252601c908201527f44454641554c545f54494d455f4c4f434b5f494e434f4d504c45544500000000604082015260600190565b6020808252600c908201527f4f574e45525f4558495354530000000000000000000000000000000000000000604082015260600190565b60208082526014908201527f54585f414c52454144595f434f4e4649524d4544000000000000000000000000604082015260600190565b60208082526016908201527f54585f4e4f545f46554c4c595f434f4e4649524d454400000000000000000000604082015260600190565b6020808252600f908201527f54585f444f45534e545f45584953540000000000000000000000000000000000604082015260600190565b60208082526010908201527f54585f4e4f545f434f4e4649524d454400000000000000000000000000000000604082015260600190565b60208082526016908201527f455155414c5f4c454e475448535f524551554952454400000000000000000000604082015260600190565b60208082526010908201527f4641494c45445f455845435554494f4e00000000000000000000000000000000604082015260600190565b60208082526012908201527f4f574e45525f444f45534e545f45584953540000000000000000000000000000604082015260600190565b6020808252601b908201527f435553544f4d5f54494d455f4c4f434b5f494e434f4d504c4554450000000000604082015260600190565b60208082526017908201527f4f4e4c595f43414c4c41424c455f42595f57414c4c4554000000000000000000604082015260600190565b60208082526012908201527f54585f46554c4c595f434f4e4649524d45440000000000000000000000000000604082015260600190565b60208082526013908201527f54585f414c52454144595f455845435554454400000000000000000000000000604082015260600190565b60208082526014908201527f494e56414c49445f524551554952454d454e5453000000000000000000000000604082015260600190565b90815260200190565b60405181810167ffffffffffffffff81118282101715612b6c57600080fd5b604052919050565b600067ffffffffffffffff821115612b8a578081fd5b5060209081020190565b600067ffffffffffffffff821115612baa578081fd5b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b60005b83811015612bf1578181015183820152602001612bd9565b83811115610cb85750506000910152565b73ffffffffffffffffffffffffffffffffffffffff81168114612c2457600080fd5b50565b8015158114612c2457600080fd5b7fffffffff0000000000000000000000000000000000000000000000000000000081168114612c2457600080fdfea365627a7a723158200ac5186607cd3ec8212bb7bd34d7047a94bed6fb931222d7ea453055d00701cd6c6578706572696d656e74616cf564736f6c634300050c0040'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; public MAX_OWNER_COUNT = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -157,41 +165,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows to add a new owner. Transaction has to be sent by wallet. @@ -204,7 +177,11 @@ export class AssetProxyOwnerContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + owner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); @@ -220,6 +197,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.addOwner.callAsync(owner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -234,20 +215,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( owner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData); + const txHashPromise = self.addOwner.sendTransactionAsync(owner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -277,11 +257,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { - await (this as any).addOwner.callAsync(owner, txData); - const txHash = await (this as any).addOwner.sendTransactionAsync(owner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -338,30 +313,6 @@ export class AssetProxyOwnerContract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner.toLowerCase()]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows to change the number of required confirmations. Transaction has to be sent by wallet. @@ -374,7 +325,11 @@ export class AssetProxyOwnerContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(_required: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + _required: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('_required', _required); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); @@ -390,6 +345,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.changeRequirement.callAsync(_required, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -404,20 +363,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( _required: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('_required', _required); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.changeRequirement.sendTransactionAsync(_required, txData); + const txHashPromise = self.changeRequirement.sendTransactionAsync(_required, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -447,14 +405,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _required: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).changeRequirement.callAsync(_required, txData); - const txHash = await (this as any).changeRequirement.sendTransactionAsync(_required, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -515,30 +465,6 @@ export class AssetProxyOwnerContract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Changes the duration of the time lock for transactions. @@ -555,6 +481,7 @@ export class AssetProxyOwnerContract extends BaseContract { async sendTransactionAsync( _secondsTimeLocked: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); const self = (this as any) as AssetProxyOwnerContract; @@ -571,6 +498,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.changeTimeLock.callAsync(_secondsTimeLocked, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -586,20 +517,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( _secondsTimeLocked: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('_secondsTimeLocked', _secondsTimeLocked); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData); + const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -630,14 +560,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _secondsTimeLocked: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).changeTimeLock.callAsync(_secondsTimeLocked, txData); - const txHash = await (this as any).changeTimeLock.sendTransactionAsync(_secondsTimeLocked, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -702,30 +624,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows an owner to confirm a transaction. @@ -738,7 +636,11 @@ export class AssetProxyOwnerContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('transactionId', transactionId); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId]); @@ -754,6 +656,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.confirmTransaction.callAsync(transactionId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -768,20 +674,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( transactionId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('transactionId', transactionId); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId, txData); + const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -811,14 +716,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).confirmTransaction.callAsync(transactionId, txData); - const txHash = await (this as any).confirmTransaction.sendTransactionAsync(transactionId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -881,30 +778,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public confirmationTimes = { /** @@ -953,42 +826,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public confirmations = { /** @@ -1042,46 +879,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows anyone to execute a confirmed transaction. @@ -1097,7 +894,11 @@ export class AssetProxyOwnerContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('transactionId', transactionId); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId]); @@ -1113,6 +914,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.executeTransaction.callAsync(transactionId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1127,20 +932,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( transactionId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('transactionId', transactionId); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId, txData); + const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1170,14 +974,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).executeTransaction.callAsync(transactionId, txData); - const txHash = await (this as any).executeTransaction.sendTransactionAsync(transactionId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1240,30 +1036,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public functionCallTimeLocks = { /** @@ -1317,46 +1089,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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 AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('functionCallTimeLocks(bytes4,address)', [ - index_0, - index_1.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('functionCallTimeLocks(bytes4,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [boolean, BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('functionCallTimeLocks(bytes4,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[boolean, BigNumber]>(returnData); - return abiDecodedReturnData; - }, }; /** * Returns number of confirmations of a transaction. @@ -1410,45 +1142,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transactionId Transaction ID. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(transactionId: BigNumber): string { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmationCount(uint256)', [ - transactionId, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns array with owner addresses, which confirmed transaction. @@ -1502,43 +1195,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transactionId Transaction ID. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(transactionId: BigNumber): string { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getConfirmations(uint256)', [transactionId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns list of owners. @@ -1586,41 +1242,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getOwners()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getOwners()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getOwners()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns total number of transactions after filers are applied. @@ -1677,48 +1298,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param pending Include pending transactions. - * @param executed Include executed transactions. - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): boolean { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns list of transaction IDs in defined range. @@ -1786,52 +1365,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param from Index start position of transaction array. - * @param to Index end position of transaction array. - * @param pending Include pending transactions. - * @param executed Include executed transactions. - * @returns The ABI encoded transaction data as a 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], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber[] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns the confirmation status of a transaction. @@ -1885,43 +1418,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transactionId Transaction ID. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(transactionId: BigNumber): string { - assert.isBigNumber('transactionId', transactionId); - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('isConfirmed(uint256)', [transactionId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public isOwner = { /** @@ -1970,42 +1466,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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()]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owners = { /** @@ -2054,42 +1514,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Registers a custom timelock to a specific function selector / destination combo @@ -2112,6 +1536,7 @@ export class AssetProxyOwnerContract extends BaseContract { destination: string, newSecondsTimeLocked: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isBoolean('hasCustomTimeLock', hasCustomTimeLock); assert.isString('functionSelector', functionSelector); @@ -2136,6 +1561,16 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.registerFunctionCall.callAsync( + hasCustomTimeLock, + functionSelector, + destination, + newSecondsTimeLocked, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2157,8 +1592,7 @@ export class AssetProxyOwnerContract extends BaseContract { destination: string, newSecondsTimeLocked: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBoolean('hasCustomTimeLock', hasCustomTimeLock); assert.isString('functionSelector', functionSelector); @@ -2171,6 +1605,7 @@ export class AssetProxyOwnerContract extends BaseContract { destination.toLowerCase(), newSecondsTimeLocked, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -2178,8 +1613,8 @@ export class AssetProxyOwnerContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2227,29 +1662,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - hasCustomTimeLock: boolean, - functionSelector: string, - destination: string, - newSecondsTimeLocked: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).registerFunctionCall.callAsync( - hasCustomTimeLock, - functionSelector, - destination, - newSecondsTimeLocked, - txData, - ); - const txHash = await (this as any).registerFunctionCall.sendTransactionAsync( - hasCustomTimeLock, - functionSelector, - destination, - newSecondsTimeLocked, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2340,30 +1752,6 @@ export class AssetProxyOwnerContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [boolean, string, string, BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('registerFunctionCall(bool,bytes4,address,uint128)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[boolean, string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('registerFunctionCall(bool,bytes4,address,uint128)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows to remove an owner. Transaction has to be sent by wallet. @@ -2376,7 +1764,11 @@ export class AssetProxyOwnerContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + owner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('removeOwner(address)', [owner.toLowerCase()]); @@ -2392,6 +1784,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeOwner.callAsync(owner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2406,20 +1802,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( owner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('owner', owner); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData); + const txHashPromise = self.removeOwner.sendTransactionAsync(owner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2449,11 +1844,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(owner: string, txData?: Partial | undefined): Promise { - await (this as any).removeOwner.callAsync(owner, txData); - const txHash = await (this as any).removeOwner.sendTransactionAsync(owner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2512,30 +1902,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows to replace an owner with a new owner. Transaction has to be sent by wallet. @@ -2553,6 +1919,7 @@ export class AssetProxyOwnerContract extends BaseContract { owner: string, newOwner: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('owner', owner); assert.isString('newOwner', newOwner); @@ -2573,6 +1940,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.replaceOwner.callAsync(owner, newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2589,8 +1960,7 @@ export class AssetProxyOwnerContract extends BaseContract { owner: string, newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('owner', owner); assert.isString('newOwner', newOwner); @@ -2599,6 +1969,7 @@ export class AssetProxyOwnerContract extends BaseContract { owner.toLowerCase(), newOwner.toLowerCase(), txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -2606,8 +1977,8 @@ export class AssetProxyOwnerContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2642,15 +2013,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - owner: string, - newOwner: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).replaceOwner.callAsync(owner, newOwner, txData); - const txHash = await (this as any).replaceOwner.sendTransactionAsync(owner, newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2722,30 +2084,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public required = { /** @@ -2789,41 +2127,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('required()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('required()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('required()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows an owner to revoke a confirmation for a transaction. @@ -2836,7 +2139,11 @@ export class AssetProxyOwnerContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(transactionId: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + transactionId: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('transactionId', transactionId); const self = (this as any) as AssetProxyOwnerContract; const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId]); @@ -2852,6 +2159,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.revokeConfirmation.callAsync(transactionId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2866,20 +2177,19 @@ export class AssetProxyOwnerContract extends BaseContract { awaitTransactionSuccessAsync( transactionId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('transactionId', transactionId); const self = (this as any) as AssetProxyOwnerContract; - const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId, txData); + const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2909,14 +2219,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - transactionId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).revokeConfirmation.callAsync(transactionId, txData); - const txHash = await (this as any).revokeConfirmation.sendTransactionAsync(transactionId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2979,30 +2281,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public secondsTimeLocked = { /** @@ -3046,41 +2324,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('secondsTimeLocked()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows an owner to submit and confirm a transaction. @@ -3100,6 +2343,7 @@ export class AssetProxyOwnerContract extends BaseContract { value: BigNumber, data: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('destination', destination); assert.isBigNumber('value', value); @@ -3122,6 +2366,10 @@ export class AssetProxyOwnerContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.submitTransaction.callAsync(destination, value, data, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3140,8 +2388,7 @@ export class AssetProxyOwnerContract extends BaseContract { value: BigNumber, data: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('destination', destination); assert.isBigNumber('value', value); @@ -3152,6 +2399,7 @@ export class AssetProxyOwnerContract extends BaseContract { value, data, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -3159,8 +2407,8 @@ export class AssetProxyOwnerContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -3203,16 +2451,6 @@ export class AssetProxyOwnerContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - destination: string, - value: BigNumber, - data: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).submitTransaction.callAsync(destination, value, data, txData); - const txHash = await (this as any).submitTransaction.sendTransactionAsync(destination, value, data, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -3292,30 +2530,6 @@ export class AssetProxyOwnerContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transactionCount = { /** @@ -3359,41 +2573,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactionCount()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('transactionCount()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('transactionCount()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transactions = { /** @@ -3442,44 +2621,6 @@ export class AssetProxyOwnerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, BigNumber, string, boolean] { - const self = (this as any) as AssetProxyOwnerContract; - const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean]>( - returnData, - ); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index 482663decc..56348dfb51 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class CoordinatorContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; /** * Recovers the address of a signer given a hash and signature. @@ -62,7 +71,7 @@ export class CoordinatorContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -75,48 +84,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param hash Any 32 byte hash. - * @param signature Proof that the hash has been signed by signer. - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract. @@ -171,49 +138,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transaction 0x transaction containing salt, signerAddress, and data. - * @returns The ABI encoded transaction data as a string - */ - 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; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): { salt: BigNumber; signerAddress: string; data: string } { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - salt: BigNumber; - signerAddress: string; - data: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract. @@ -275,63 +199,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param approval Coordinator approval message containing the transaction - * hash, transaction signature, and expiration of the approval. - * @returns The ABI encoded transaction data as a string - */ - 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; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - } { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - txOrigin: string; - transactionHash: string; - transactionSignature: string; - approvalExpirationTimeSeconds: BigNumber; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata. @@ -359,6 +226,7 @@ export class CoordinatorContract extends BaseContract { approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); @@ -387,6 +255,17 @@ export class CoordinatorContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.executeTransaction.callAsync( + transaction, + txOrigin, + transactionSignature, + approvalExpirationTimeSeconds, + approvalSignatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -413,8 +292,7 @@ export class CoordinatorContract extends BaseContract { approvalExpirationTimeSeconds: BigNumber[], approvalSignatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('txOrigin', txOrigin); assert.isString('transactionSignature', transactionSignature); @@ -428,6 +306,7 @@ export class CoordinatorContract extends BaseContract { approvalExpirationTimeSeconds, approvalSignatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -435,8 +314,8 @@ export class CoordinatorContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -493,32 +372,6 @@ export class CoordinatorContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - transaction: { salt: BigNumber; signerAddress: string; data: string }, - txOrigin: string, - transactionSignature: string, - approvalExpirationTimeSeconds: BigNumber[], - approvalSignatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).executeTransaction.callAsync( - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - txData, - ); - const txHash = await (this as any).executeTransaction.sendTransactionAsync( - transaction, - txOrigin, - transactionSignature, - approvalExpirationTimeSeconds, - approvalSignatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -631,38 +484,6 @@ export class CoordinatorContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [{ salt: BigNumber; signerAddress: string; data: string }, string, string, BigNumber[], string[]] { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [{ salt: BigNumber; signerAddress: string; data: string }, string, string, BigNumber[], string[]] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { /** @@ -706,41 +527,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Validates that the 0x transaction has been approved by all of the feeRecipients @@ -820,77 +606,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transaction 0x transaction containing salt, signerAddress, and data. - * @param txOrigin Required signer of Ethereum transaction calling this - * function. - * @param transactionSignature Proof that the transaction has been signed by - * the signer. - * @param approvalExpirationTimeSeconds Array of expiration times in seconds - * for which each corresponding approval signature expires. - * @param approvalSignatures Array of signatures that correspond to the - * feeRecipients of each order in the transaction's Exchange calldata. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData( - 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, - ], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [{ salt: BigNumber; signerAddress: string; data: string }, string, string, BigNumber[], string[]] { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [{ salt: BigNumber; signerAddress: string; data: string }, string, string, BigNumber[], string[]] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Decodes the orders from Exchange calldata representing any fill method. @@ -938,7 +653,7 @@ export class CoordinatorContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -966,73 +681,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param data Exchange calldata representing a fill method. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(data: string): string { - assert.isString('data', data); - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = 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; - }> - >(returnData); - return abiDecodedReturnData; - }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { /** @@ -1076,41 +724,6 @@ export class CoordinatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as CoordinatorContract; - const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as CoordinatorContract; - const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 827b221b04..f76b2ed8a3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -40,6 +46,9 @@ export interface CoordinatorRegistryCoordinatorEndpointSetEventArgs extends Deco // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class CoordinatorRegistryContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; /** * Called by a Coordinator operator to set the endpoint of their Coordinator. @@ -52,7 +61,11 @@ export class CoordinatorRegistryContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(coordinatorEndpoint: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + coordinatorEndpoint: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('coordinatorEndpoint', coordinatorEndpoint); const self = (this as any) as CoordinatorRegistryContract; const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint]); @@ -68,6 +81,10 @@ export class CoordinatorRegistryContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setCoordinatorEndpoint.callAsync(coordinatorEndpoint, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -82,20 +99,19 @@ export class CoordinatorRegistryContract extends BaseContract { awaitTransactionSuccessAsync( coordinatorEndpoint: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('coordinatorEndpoint', coordinatorEndpoint); const self = (this as any) as CoordinatorRegistryContract; - const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData); + const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -125,14 +141,6 @@ export class CoordinatorRegistryContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - coordinatorEndpoint: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).setCoordinatorEndpoint.callAsync(coordinatorEndpoint, txData); - const txHash = await (this as any).setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -195,30 +203,6 @@ export class CoordinatorRegistryContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the endpoint for a Coordinator. @@ -273,45 +257,6 @@ export class CoordinatorRegistryContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param coordinatorOperator operator of the Coordinator endpoint. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(coordinatorOperator: string): string { - assert.isString('coordinatorOperator', coordinatorOperator); - const self = (this as any) as CoordinatorRegistryContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [ - coordinatorOperator.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as CoordinatorRegistryContract; - const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts index ea3cf1904a..0f25b73cce 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DevUtilsContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b506004361061025c5760003560e01c80639a7e752611610145578063cafd3a07116100bd578063d3d862d11161008c578063e4e6e7da11610071578063e4e6e7da1461063a578063e77286eb1461065b578063ee4f5a941461067d5761025c565b8063d3d862d114610605578063e25cabf7146106185761025c565b8063cafd3a071461059e578063d001c5dc146105bf578063d186037f146105d2578063d3637905146105e55761025c565b8063a6627e9f11610114578063b43cffe1116100f9578063b43cffe114610548578063bbb2dcf61461055b578063bc03f9641461057d5761025c565b8063a6627e9f14610512578063acaedc74146105255761025c565b80639a7e7526146104985780639eadc835146104bb578063a0901e51146104df578063a5cd62ba146104f25761025c565b8063459be5e2116101d85780636f83188e116101a75780637b66ad341161018c5780637b66ad34146104515780637d727512146104725780638f4ce479146104855761025c565b80636f83188e1461040d5780637914b2ec146104305761025c565b8063459be5e21461038a5780634dfdac20146103ab578063590aa875146103cb57806365129042146103eb5761025c565b80632322cf761161022f578063327d305411610214578063327d30541461033257806332aae3ad146103455780633db6dc61146103675761025c565b80632322cf76146102f0578063314853ff146103105761025c565b806302d0aec31461026157806304a5618a1461028b5780630d7b7d76146102ad578063165979e1146102ce575b600080fd5b61027461026f3660046149dd565b61069f565b6040516102829291906152e4565b60405180910390f35b61029e6102993660046149dd565b6106fb565b60405161028293929190615387565b6102c06102bb366004614565565b6107a9565b604051610282929190615292565b6102e16102dc3660046149dd565b6107cb565b604051610282939291906154c2565b6103036102fe366004614565565b610828565b6040516102829190615731565b61032361031e3660046149dd565b610850565b604051610282939291906152b9565b6102c06103403660046149dd565b610897565b6103586103533660046149dd565b6108d9565b60405161028293929190615438565b61037a6103753660046149dd565b61092c565b6040516102829493929190615258565b61039d6103983660046149dd565b610976565b6040516102829291906154ab565b6103be6103b936600461448c565b6109cc565b60405161028291906151f2565b6103de6103d936600461435d565b610a4f565b60405161028291906153e7565b6103fe6103f93660046149dd565b610ad3565b60405161028293929190614fdf565b61042061041b3660046149dd565b610b0d565b6040516102829493929190615535565b61044361043e3660046149dd565b61164e565b604051610282929190615301565b61046461045f3660046149dd565b611686565b604051610282929190614fc5565b610303610480366004614565565b6116be565b6104436104933660046149dd565b611dd3565b6104ab6104a63660046149dd565b611e63565b60405161028294939291906154f1565b6104ce6104c93660046149dd565b611ec4565b604051610282959493929190615324565b6103be6104ed3660046145d4565b611f6f565b61050561050036600461463a565b611fe8565b60405161028291906150f9565b6103de6105203660046145a9565b6120ac565b6105386105333660046149dd565b612133565b6040516102829493929190615055565b6103de6105563660046144da565b61216f565b61056e6105693660046149dd565b6121fc565b604051610282939291906153b2565b61059061058b3660046149dd565b6122a9565b6040516102829291906152a0565b6105b16105ac3660046149dd565b6122e2565b604051610282929190615528565b6103be6105cd36600461448c565b612330565b6103036105e0366004614565565b61239e565b6105f86105f3366004614a94565b6129e1565b60405161028291906154dd565b6103de6106133660046147e2565b612f7e565b61062b6106263660046146be565b612fb6565b60405161028293929190615146565b61064d61064836600461448c565b6130ee565b604051610282929190615233565b61066e610669366004614aec565b613107565b604051610282939291906156d5565b61069061068b3660046149dd565b613341565b60405161028293929190615481565b6000806106b3836106ae61337e565b6133a2565b60006106cc60048551866133fc9092919063ffffffff16565b8060200190516106df9190810190614990565b909350905060ff811660068111156106f357fe5b915050915091565b6000808061070f848263ffffffff61343f16565b92506001600160e01b031983167f02571792000000000000000000000000000000000000000000000000000000001461077d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107749061569e565b60405180910390fd5b61078e84601063ffffffff61347316565b91506107a184602463ffffffff6134a616565b929491935050565b6000806107b684846116be565b91506107c2848461239e565b90509250929050565b60008060006107dc846106ae6134b2565b60006107f560048651876133fc9092919063ffffffff16565b8060200190516108089190810190614d20565b9094509250905060ff8116600281111561081e57fe5b9350509193909250565b600080600061083785856107a9565b9150915061084582826134d6565b925050505b92915050565b6000606080610861846106ae6134ec565b835161087790859060049063ffffffff6133fc16565b80602001905161088a9190810190614930565b9196909550909350915050565b6000806108a6836106ae613510565b82516108bc90849060049063ffffffff6133fc16565b8060200190516108cf91908101906148d2565b9094909350915050565b60008060606108ea846106ae613534565b600061090360048651876133fc9092919063ffffffff16565b8060200190516109169190810190614cd4565b9094509250905060ff8116600181111561081e57fe5b60008060608061093e856106ae613558565b845161095490869060049063ffffffff6133fc16565b806020019051610967919081019061488e565b92989197509550909350915050565b600080610985836106ae61357c565b600061099e60048551866133fc9092919063ffffffff16565b8060200190516109b19190810190614c07565b9250905060ff811660038111156109c457fe5b925050915091565b6060600082519050806040519080825280602002602001820160405280156109fe578160200160208202803883390190505b50915060005b818114610a4757610a2885858381518110610a1b57fe5b602002602001015161239e565b838281518110610a3457fe5b6020908102919091010152600101610a04565b505092915050565b6040516060907ff47261b00000000000000000000000000000000000000000000000000000000090610a85908490602401614fb1565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091529050919050565b6000806000610ae4846106ae6135a0565b8351610afa90859060049063ffffffff6133fc16565b80602001905161088a91908101906143b2565b60608080806000610b24868263ffffffff61343f16565b90506001600160e01b031981167fdedfc1f1000000000000000000000000000000000000000000000000000000001415610b95576040518060400160405280601181526020017f626174636843616e63656c4f72646572730000000000000000000000000000008152509450611124565b6001600160e01b031981167f9694a402000000000000000000000000000000000000000000000000000000001415610c04576040518060400160405280600f81526020017f626174636846696c6c4f726465727300000000000000000000000000000000008152509450611124565b6001600160e01b031981167f8ea8dfe4000000000000000000000000000000000000000000000000000000001415610c73576040518060400160405280601681526020017f626174636846696c6c4f72646572734e6f5468726f77000000000000000000008152509450611124565b6001600160e01b031981167fbeee2e14000000000000000000000000000000000000000000000000000000001415610ce2576040518060400160405280601581526020017f626174636846696c6c4f724b696c6c4f726465727300000000000000000000008152509450611124565b6001600160e01b031981167f2da62987000000000000000000000000000000000000000000000000000000001415610d51576040518060400160405280600b81526020017f63616e63656c4f726465720000000000000000000000000000000000000000008152509450611124565b6001600160e01b031981167f9b44d556000000000000000000000000000000000000000000000000000000001415610dc0576040518060400160405280600981526020017f66696c6c4f7264657200000000000000000000000000000000000000000000008152509450611124565b6001600160e01b031981167fe14b58c4000000000000000000000000000000000000000000000000000000001415610e2f576040518060400160405280600f81526020017f66696c6c4f724b696c6c4f7264657200000000000000000000000000000000008152509450611124565b6001600160e01b031981167f78d29ac1000000000000000000000000000000000000000000000000000000001415610e9e576040518060400160405280601681526020017f6d61726b65744275794f72646572734e6f5468726f77000000000000000000008152509450611124565b6001600160e01b031981167f369da099000000000000000000000000000000000000000000000000000000001415610f0d576040518060400160405280601781526020017f6d61726b657453656c6c4f72646572734e6f5468726f770000000000000000008152509450611124565b6001600160e01b031981167f8bc8efb3000000000000000000000000000000000000000000000000000000001415610f7c576040518060400160405280601981526020017f6d61726b65744275794f726465727346696c6c4f724b696c6c000000000000008152509450611124565b6001600160e01b031981167fa6c3bf33000000000000000000000000000000000000000000000000000000001415610feb576040518060400160405280601a81526020017f6d61726b657453656c6c4f726465727346696c6c4f724b696c6c0000000000008152509450611124565b6001600160e01b031981167f88ec79fb00000000000000000000000000000000000000000000000000000000141561105a576040518060400160405280600b81526020017f6d617463684f72646572730000000000000000000000000000000000000000008152509450611124565b6001600160e01b031981167f4f9559b10000000000000000000000000000000000000000000000000000000014806110bb57506001600160e01b031981167f2280c91000000000000000000000000000000000000000000000000000000000145b156110f2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077490615630565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610774906155f9565b6001600160e01b031981167fdedfc1f10000000000000000000000000000000000000000000000000000000014156111c957855161116c90879060049063ffffffff6135c416565b80602001905161117f9190810190614607565b604080516000808252602082019092529195505b50604080516000808252602082019092529194506111c1565b60608152602001906001900390816111ac5790505b509150611646565b6001600160e01b031981167fbeee2e1400000000000000000000000000000000000000000000000000000000148061122a57506001600160e01b031981167f9694a40200000000000000000000000000000000000000000000000000000000145b8061125e57506001600160e01b031981167f8ea8dfe400000000000000000000000000000000000000000000000000000000145b156112785761126c86613644565b91955093509150611646565b6001600160e01b031981167f2da629870000000000000000000000000000000000000000000000000000000014156113605760408051600180825281830190925290816020015b6112c7613c90565b8152602001906001900390816112bf57505086519094506112f290879060049063ffffffff6135c416565b8060200190516113059190810190614a61565b8460008151811061131257fe5b602002602001018190525060006040519080825280602002602001820160405280156111935781602001602082028038833901905050604080516000808252602082019092529194506111c1565b6001600160e01b031981167fe14b58c40000000000000000000000000000000000000000000000000000000014806113c157506001600160e01b031981167f9b44d55600000000000000000000000000000000000000000000000000000000145b156113cf5761126c86613673565b6001600160e01b031981167f78d29ac100000000000000000000000000000000000000000000000000000000148061143057506001600160e01b031981167f369da09900000000000000000000000000000000000000000000000000000000145b8061146457506001600160e01b031981167f8bc8efb300000000000000000000000000000000000000000000000000000000145b8061149857506001600160e01b031981167fa6c3bf3300000000000000000000000000000000000000000000000000000000145b156114a65761126c8661376d565b6001600160e01b031981167f88ec79fb000000000000000000000000000000000000000000000000000000001415611646576114e0613c90565b6114e8613c90565b60608061150260048b518c6135c49092919063ffffffff16565b8060200190516115159190810190614b43565b604080516002808252606082019092529498509296509094509250816020015b61153d613c90565b815260200190600190039081611535579050509750838860008151811061156057fe5b6020026020010181905250828860018151811061157957fe5b602090810291909101015260408051600280825260608201909252908160200160208202803883390190505096508360a00151876000815181106115b957fe5b6020026020010181815250508260a00151876001815181106115d757fe5b60209081029190910101526040805160028082526060820190925290816020015b60608152602001906001900390816115f8579050509550818660008151811061161d57fe5b6020026020010181905250808660018151811061163657fe5b6020026020010181905250505050505b509193509193565b60008061165d836106ae6137e1565b825161167390849060049063ffffffff6133fc16565b8060200190516108cf91908101906149b4565b600080611695836106ae613805565b82516116ab90849060049063ffffffff6133fc16565b8060200190516108cf9190810190614379565b6000806116d1838263ffffffff61343f16565b90506001600160e01b031981167ff47261b000000000000000000000000000000000000000000000000000000000141561184657600061171884601063ffffffff61347316565b6040519091506060907f70a082310000000000000000000000000000000000000000000000000000000090611751908890602401614fb1565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060006060836001600160a01b0316836040516117cc9190614f95565b600060405180830381855afa9150503d8060008114611807576040519150601f19603f3d011682016040523d82523d6000602084013e61180c565b606091505b509150915081801561181f575080516020145b61182a57600061183b565b61183b81600063ffffffff6134a616565b955050505050611dcc565b6001600160e01b031981167f025717920000000000000000000000000000000000000000000000000000000014156119e157600080611884856106fb565b6040519194509250606091507f6352211e00000000000000000000000000000000000000000000000000000000906118c0908490602401615731565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060006060846001600160a01b03168360405161193b9190614f95565b600060405180830381855afa9150503d8060008114611976576040519150601f19603f3d011682016040523d82523d6000602084013e61197b565b606091505b50915091506000828015611990575081516020145b61199b5760006119ac565b6119ac82600c63ffffffff61347316565b9050896001600160a01b0316816001600160a01b0316146119ce5760006119d1565b60015b60ff169750505050505050611dcc565b6001600160e01b031981167fa7cb5fb7000000000000000000000000000000000000000000000000000000001415611bc4576000606080611a2186611ec4565b5081519296509094509250905060005b818114611bba5783516060907efdd58e00000000000000000000000000000000000000000000000000000000908b90879085908110611a6c57fe5b6020026020010151604051602401611a85929190615089565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060006060876001600160a01b031683604051611b009190614f95565b600060405180830381855afa9150503d8060008114611b3b576040519150601f19603f3d011682016040523d82523d6000602084013e611b40565b606091505b50915091506000828015611b55575081516020145b611b60576000611b71565b611b7182600063ffffffff6134a616565b90506000878681518110611b8157fe5b60200260200101518281611b9157fe5b0490508b811080611ba057508b155b15611ba957809b505b505060019093019250611a31915050565b5050505050611dcc565b6001600160e01b031981167fc339d10a000000000000000000000000000000000000000000000000000000001415611d15576040516060907fa85e59e40000000000000000000000000000000000000000000000000000000090611c33908690600090819081906024016153fa565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199094169390931790925260045491519092506000916001600160a01b031690611c9a908490614f95565b600060405180830381855afa9150503d8060008114611cd5576040519150601f19603f3d011682016040523d82523d6000602084013e611cda565b606091505b5050905080611cea576000611d0c565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff5b93505050611dcc565b6001600160e01b031981167f94cfcdd7000000000000000000000000000000000000000000000000000000001415611dcc57606080611d53856121fc565b80519194509250905060005b818114611dc7576000611d8589858481518110611d7857fe5b60200260200101516116be565b90506000858381518110611d9557fe5b60200260200101518281611da557fe5b04905087811080611db4575087155b15611dbd578097505b5050600101611d5f565b505050505b5092915050565b600080611de6838263ffffffff61343f16565b91506001600160e01b031982167ff47261b00000000000000000000000000000000000000000000000000000000014611e4b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107749061569e565b611e5c83601063ffffffff61347316565b9050915091565b60008060006060611e76856106ae613829565b6000611e8f60048751886133fc9092919063ffffffff16565b806020019051611ea29190810190614c76565b91965094509250905060ff81166006811115611eba57fe5b9450509193509193565b60008060608080611edb868563ffffffff61343f16565b94506001600160e01b031985167fa7cb5fb70000000000000000000000000000000000000000000000000000000014611f40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107749061569e565b505050506024828101516044840151606485015160848601519496929591820184019490820184019391010190565b6060808251604051908082528060200260200182016040528015611f9d578160200160208202803883390190505b50905060005b83518114611dcc57838181518110611fb757fe5b60200260200101516001600160a01b031631828281518110611fd557fe5b6020908102919091010152600101611fa3565b60606000845190508060405190808252806020026020018201604052801561201a578160200160208202803883390190505b50915060005b8181146120a25761206b86828151811061203657fe5b602002602001015186838151811061204a57fe5b602002602001015186848151811061205e57fe5b60200260200101516129e1565b83828151811061207757fe5b6020026020010190600481111561208a57fe5b9081600481111561209757fe5b905250600101612020565b50505b9392505050565b6040516060907f0257179200000000000000000000000000000000000000000000000000000000906120e49085908590602401615089565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b031990931692909217909152905092915050565b60006060806060612146856106ae61384d565b845161215c90869060049063ffffffff6133fc16565b80602001905161096791908101906143f4565b6040516060907fa7cb5fb700000000000000000000000000000000000000000000000000000000906121ab908790879087908790602401615003565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b0319909316929092179091529050949350505050565b6000606080612211848463ffffffff61343f16565b92506001600160e01b031983167f94cfcdd70000000000000000000000000000000000000000000000000000000014612276576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107749061569e565b835161228c90859060049063ffffffff6135c416565b80602001905161229f9190810190614817565b9395909450915050565b600060606122b9836106ae613871565b82516122cf90849060049063ffffffff6133fc16565b8060200190516108cf91908101906148f5565b6000806122f1836106ae613895565b600061230a60048551866133fc9092919063ffffffff16565b80602001905161231d9190810190614c07565b9250905060ff811660018111156109c457fe5b606060008251905080604051908082528060200260200182016040528015612362578160200160208202803883390190505b50915060005b818114610a475761237f85858381518110611d7857fe5b83828151811061238b57fe5b6020908102919091010152600101612368565b6000806123b1838263ffffffff61343f16565b90506001600160e01b031981167f94cfcdd7000000000000000000000000000000000000000000000000000000001415612463576060806123f1856121fc565b80519194509250905060005b81811461245857600061241689858481518110610a1b57fe5b9050600085838151811061242657fe5b6020026020010151828161243657fe5b04905087811080612445575087155b1561244e578097505b50506001016123fd565b5061084a9350505050565b6001600160e01b031981167ff47261b00000000000000000000000000000000000000000000000000000000014156124ee5760006124a884601063ffffffff61347316565b6001546040519192506060917fdd62ed3e00000000000000000000000000000000000000000000000000000000916117519189916001600160a01b031690602401614fc5565b6001600160e01b031981167f025717920000000000000000000000000000000000000000000000000000000014156127de5760008061252c856106fb565b600254604051929550909350606092507fe985e9c50000000000000000000000000000000000000000000000000000000091612578918a916001600160a01b0390911690602401614fc5565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060006060846001600160a01b0316836040516125f39190614f95565b600060405180830381855afa9150503d806000811461262e576040519150601f19603f3d011682016040523d82523d6000602084013e612633565b606091505b509150915081158061264757508051602014155b80612663575061265e81600063ffffffff6134a616565b600114155b156127b1576040516060907f081812fc000000000000000000000000000000000000000000000000000000009061269e908790602401615731565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050856001600160a01b0316816040516127159190614f95565b600060405180830381855afa9150503d8060008114612750576040519150601f19603f3d011682016040523d82523d6000602084013e612755565b606091505b509093509150828015612769575081516020145b801561279857506002546001600160a01b031661278d83600c63ffffffff61347316565b6001600160a01b0316145b6127a35760006127a6565b60015b60ff16975050611bba565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff96505050505050611dcc565b6001600160e01b031981167fa7cb5fb700000000000000000000000000000000000000000000000000000000141561298657600061281b84611ec4565b5050600354604051929450606093507fe985e9c50000000000000000000000000000000000000000000000000000000092612865925089916001600160a01b031690602401614fc5565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050905060006060836001600160a01b0316836040516128e09190614f95565b600060405180830381855afa9150503d806000811461291b576040519150601f19603f3d011682016040523d82523d6000602084013e612920565b606091505b5091509150818015612933575080516020145b801561294f575061294b81600063ffffffff6134a616565b6001145b61295a57600061183b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff955050505050611dcc565b6001600160e01b031981167fc339d10a000000000000000000000000000000000000000000000000000000001415611dcc57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9392505050565b60006129eb613d23565b612a7c8584600560009054906101000a90046001600160a01b03166001600160a01b0316631ce4c78b6040518163ffffffff1660e01b815260040160206040518083038186803b158015612a3e57600080fd5b505afa158015612a52573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250612a769190810190614bef565b3a6138b9565b60408051600480825260a0820190925291925060609190816020015b6060815260200190600190039081612a9857505060408051600480825260a082019092529192506060919060208201608080388339505060408051600480825260a08201909252929350606092915060208201608080388339505060408051600480825260a0820190925292935060609291506020820160808038833901905050905088610160015184600081518110612b2e57fe5b60200260200101819052508783600081518110612b4757fe5b60200260200101906001600160a01b031690816001600160a01b031681525050886000015182600081518110612b7957fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508681600081518110612ba757fe5b60200260200101818152505088610140015184600181518110612bc657fe5b6020026020010181905250886000015183600181518110612be357fe5b60200260200101906001600160a01b031690816001600160a01b0316815250508782600181518110612c1157fe5b60200260200101906001600160a01b031690816001600160a01b031681525050846000015181600181518110612c4357fe5b602002602001018181525050886101a0015184600281518110612c6257fe5b60200260200101819052508783600281518110612c7b57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050886040015182600281518110612cad57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050846060015181600281518110612cdf57fe5b60200260200101818152505088610180015184600381518110612cfe57fe5b6020026020010181905250886000015183600381518110612d1b57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050886040015182600381518110612d4d57fe5b60200260200101906001600160a01b031690816001600160a01b031681525050846040015181600381518110612d7f57fe5b60209081029190910101526040516060907fb04fbddd0000000000000000000000000000000000000000000000000000000090612dc69087908790879087906024016150a2565b60408051601f198184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199094169390931790925260055491519092506060916001600160a01b031690612e2d908490614f95565b6000604051808303816000865af19150503d8060008114612e6a576040519150601f19603f3d011682016040523d82523d6000602084013e612e6f565b606091505b50915060009050612e86828263ffffffff61343f16565b9050612e90613534565b6001600160e01b031982811691161415612ed2576000612eaf836108d9565b5091505060ff81166004811115612ec257fe5b99505050505050505050506120a5565b612eda6134ec565b6001600160e01b031982811691161415612f0d576000612ef983610850565b509091505060ff81166004811115612ec257fe5b815160208301207ff43f26ea5a94b478394a975e856464913dc1a8a1ca70939d974aa7c238aa0ce01415612f4c576004985050505050505050506120a5565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610774906155c2565b6040516060907f94cfcdd700000000000000000000000000000000000000000000000000000000906120e49085908590602401615205565b606080606060008551905080604051908082528060200260200182016040528015612ffb57816020015b612fe8613d52565b815260200190600190039081612fe05790505b50935080604051908082528060200260200182016040528015613028578160200160208202803883390190505b50925080604051908082528060200260200182016040528015613055578160200160208202803883390190505b50915060005b8181146130e55761309287828151811061307157fe5b602002602001015187838151811061308557fe5b6020026020010151613107565b87518890859081106130a057fe5b602002602001018785815181106130b357fe5b602002602001018786815181106130c657fe5b931515602094850291909101909301929092529190525260010161305b565b50509250925092565b6060806130fb8484612330565b91506107c284846109cc565b61310f613d52565b600080546040517f9d3fa4b900000000000000000000000000000000000000000000000000000000815282916001600160a01b031690639d3fa4b9906131599088906004016156f9565b60606040518083038186803b15801561317157600080fd5b505afa158015613185573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506131a99190810190614a10565b85516000546040517fa12dcc6f00000000000000000000000000000000000000000000000000000000815292955090916001600160a01b039091169063a12dcc6f906131fb908990899060040161570c565b60206040518083038186803b15801561321357600080fd5b505afa158015613227573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061324b919081019061486e565b9150600061325e82886101400151610828565b60a088015160c08901516101808a01516101408b01519394509192909160009161328d9163ffffffff61393016565b156132ba576132b3846132ad848d6080015161395590919063ffffffff16565b85613971565b9050613313565b816132ce576132b3848b6080015185613971565b60006132df868c6101800151610828565b905060006132f2868d6080015187613971565b90506000613301838688613971565b905061330d82826134d6565b93505050505b61333361332d89604001518561399b90919063ffffffff16565b826134d6565b965050505050509250925092565b6000806000613352846106ae6139ba565b600061336b60048651876133fc9092919063ffffffff16565b8060200190516108089190810190614c34565b7ffdb6ca8d0000000000000000000000000000000000000000000000000000000090565b60006133af83600061343f565b90506001600160e01b0319808216908316146133f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161077490615667565b505050565b60608183111561341a5761341a613415600085856139de565b613a4d565b83518211156134335761343361341560018487516139de565b50819003910190815290565b600081600401835110156134605761346061341560038551856004016139de565b5001602001516001600160e01b03191690565b600081601401835110156134945761349461341560048551856014016139de565b5001601401516001600160a01b031690565b60006120a58383613a55565b7f18e4b1410000000000000000000000000000000000000000000000000000000090565b60008183106134e557816120a5565b5090919050565b7f4678472b0000000000000000000000000000000000000000000000000000000090565b7fb6555d6f0000000000000000000000000000000000000000000000000000000090565b7f488219a60000000000000000000000000000000000000000000000000000000090565b7f1b8388f70000000000000000000000000000000000000000000000000000000090565b7fe94a7ed00000000000000000000000000000000000000000000000000000000090565b7f4ad312750000000000000000000000000000000000000000000000000000000090565b6060818311156135dd576135dd613415600085856139de565b83518211156135f6576135f661341560018487516139de565b8282036040519080825280601f01601f191660200182016040528015613623576020820181803883390190505b5090506120a561363282613a7f565b8461363c87613a7f565b018351613a85565b606080606061366060048551866135c49092919063ffffffff16565b80602001905161088a9190810190614715565b60408051600180825281830190925260609182918291816020015b613696613c90565b81526020019060019003908161368e5750506040805160018082528183019092529194506020808301908038833901905050604080516001808252818301909252919350816020015b60608152602001906001900390816136df575050845190915061370c90859060049063ffffffff6135c416565b80602001905161371f9190810190614b9c565b8560008151811061372c57fe5b602002602001018560008151811061374057fe5b602002602001018560008151811061375457fe5b6020908102919091010192909252919052529193909250565b6040805160018082528183019092526060918291829160208083019080388339505085519193506137a99186915060049063ffffffff6135c416565b8060200190516137bc919081019061478f565b845185906000906137c957fe5b60209081029190910101919091529095929450925050565b7f11c7b7200000000000000000000000000000000000000000000000000000000090565b7fa15c0d060000000000000000000000000000000000000000000000000000000090565b7f7e5a23180000000000000000000000000000000000000000000000000000000090565b7f5bd0428d0000000000000000000000000000000000000000000000000000000090565b7f20d11f610000000000000000000000000000000000000000000000000000000090565b7ff59851840000000000000000000000000000000000000000000000000000000090565b6138c1613d23565b6020810184905260a085015160808601516138dd918691613b2a565b815260a085015160c08601516138f4918691613b2a565b604082015260a085015160e086015161390e918691613b2a565b6060820152613923828463ffffffff613b5e16565b6080820152949350505050565b6000815183511480156120a55750508051602091820120825192909101919091201490565b6000828201838110156120a5576120a561341560008686613b8b565b600061399383613987868563ffffffff613b5e16565b9063ffffffff613baa16565b949350505050565b6000828211156139b4576139b461341560028585613b8b565b50900390565b7fe53c76c80000000000000000000000000000000000000000000000000000000090565b6060632800659560e01b8484846040516024016139fd939291906154cf565b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff166001600160e01b03199093169290921790915290509392505050565b805160208201fd5b60008160200183511015613a7657613a7661341560058551856020016139de565b50016020015190565b60200190565b6020811015613aaf576001816020036101000a0380198351168185511680821786525050506133f7565b82821415613abc576133f7565b82821115613af65760208103905080820181840181515b82851015613aee578451865260209586019590940193613ad3565b9052506133f7565b60208103905080820181840183515b81861215613b215782518252601f199283019290910190613b05565b85525050505050565b6000613b37848484613bd4565b15613b4a57613b4a613415858585613c3a565b61399383613987868563ffffffff613b5e16565b600082613b6d5750600061084a565b82820282848281613b7a57fe5b04146120a5576120a5613415600186865b606063e946c1bb60e01b8484846040516024016139fd93929190615460565b600081613bc057613bc061341560038585613b8b565b6000828481613bcb57fe5b04949350505050565b600082613be657613be6613415613c59565b811580613bf1575083155b15613bfe575060006120a5565b60008380613c0857fe5b8584099050613c1d858463ffffffff613b5e16565b613c2f826103e863ffffffff613b5e16565b101595945050505050565b606063339f3de260e01b8484846040516024016139fd9392919061573a565b60408051808201909152600481527fa791837c00000000000000000000000000000000000000000000000000000000602082015290565b604051806101c0016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b803561084a81615816565b805161084a81615816565b600082601f830112613d98578081fd5b8135613dab613da682615777565b615750565b818152915060208083019084810181840286018201871015613dcc57600080fd5b60005b84811015611dc7578135613de281615816565b84529282019290820190600101613dcf565b600082601f830112613e04578081fd5b8151613e12613da682615777565b8181529150602080830190840160005b83811015613e4f57613e3a8760208451890101614074565b83526020928301929190910190600101613e22565b5050505092915050565b600082601f830112613e69578081fd5b8135613e77613da682615777565b8181529150602080830190840160005b83811015613e4f57613e9f8760208435890101614026565b83526020928301929190910190600101613e87565b600082601f830112613ec4578081fd5b8151613ed2613da682615777565b8181529150602080830190840160005b83811015613e4f57613efa8760208451890101614209565b83526020928301929190910190600101613ee2565b600082601f830112613f1f578081fd5b8135613f2d613da682615777565b8181529150602080830190840160005b83811015613e4f57613f5587602084358901016140ba565b83526020928301929190910190600101613f3d565b600082601f830112613f7a578081fd5b8151613f88613da682615777565b818152915060208083019084810181840286018201871015613fa957600080fd5b60005b84811015611dc757815184529282019290820190600101613fac565b600082601f830112613fd8578081fd5b8135613fe6613da682615777565b81815291506020808301908481018184028601820187101561400757600080fd5b60005b84811015611dc75781358452928201929082019060010161400a565b600082601f830112614036578081fd5b8135614044613da682615797565b915080825283602082850101111561405b57600080fd5b8060208401602084013760009082016020015292915050565b600082601f830112614084578081fd5b8151614092613da682615797565b91508082528360208285010111156140a957600080fd5b611dcc8160208401602086016157bb565b60006101c08083850312156140cd578182fd5b6140d681615750565b9150506140e38383613d72565b81526140f28360208401613d72565b60208201526141048360408401613d72565b60408201526141168360608401613d72565b60608201526080820135608082015260a082013560a082015260c082013560c082015260e082013560e08201526101008083013581830152506101208083013581830152506101408083013567ffffffffffffffff8082111561417857600080fd5b61418486838701614026565b838501526101609250828501359150808211156141a057600080fd5b6141ac86838701614026565b838501526101809250828501359150808211156141c857600080fd5b6141d486838701614026565b838501526101a09250828501359150808211156141f057600080fd5b506141fd85828601614026565b82840152505092915050565b60006101c080838503121561421c578182fd5b61422581615750565b9150506142328383613d7d565b81526142418360208401613d7d565b60208201526142538360408401613d7d565b60408201526142658360608401613d7d565b60608201526080820151608082015260a082015160a082015260c082015160c082015260e082015160e08201526101008083015181830152506101208083015181830152506101408083015167ffffffffffffffff808211156142c757600080fd5b6142d386838701614074565b838501526101609250828501519150808211156142ef57600080fd5b6142fb86838701614074565b8385015261018092508285015191508082111561431757600080fd5b61432386838701614074565b838501526101a092508285015191508082111561433f57600080fd5b506141fd85828601614074565b805160ff8116811461084a57600080fd5b60006020828403121561436e578081fd5b81356120a581615816565b6000806040838503121561438b578081fd5b825161439681615816565b60208401519092506143a781615816565b809150509250929050565b6000806000606084860312156143c6578081fd5b83516143d181615816565b60208501519093506143e281615816565b80925050604084015190509250925092565b60008060008060808587031215614409578182fd5b845161441481615816565b602086015190945067ffffffffffffffff80821115614431578384fd5b61443d88838901614074565b94506040870151915080821115614452578384fd5b61445e88838901614074565b93506060870151915080821115614473578283fd5b5061448087828801614074565b91505092959194509250565b6000806040838503121561449e578182fd5b82356144a981615816565b9150602083013567ffffffffffffffff8111156144c4578182fd5b6144d085828601613e59565b9150509250929050565b600080600080608085870312156144ef578182fd5b84356144fa81615816565b9350602085013567ffffffffffffffff80821115614516578384fd5b61452288838901613fc8565b94506040870135915080821115614537578384fd5b61454388838901613fc8565b93506060870135915080821115614558578283fd5b5061448087828801614026565b60008060408385031215614577578182fd5b823561458281615816565b9150602083013567ffffffffffffffff81111561459d578182fd5b6144d085828601614026565b600080604083850312156145bb578182fd5b82356145c681615816565b946020939093013593505050565b6000602082840312156145e5578081fd5b813567ffffffffffffffff8111156145fb578182fd5b61399384828501613d88565b600060208284031215614618578081fd5b815167ffffffffffffffff81111561462e578182fd5b61399384828501613eb4565b60008060006060848603121561464e578081fd5b833567ffffffffffffffff80821115614665578283fd5b61467187838801613f0f565b94506020860135915080821115614686578283fd5b61469287838801613d88565b935060408601359150808211156146a7578283fd5b506146b486828701613fc8565b9150509250925092565b600080604083850312156146d0578182fd5b823567ffffffffffffffff808211156146e7578384fd5b6146f386838701613f0f565b93506020850135915080821115614708578283fd5b506144d085828601613e59565b600080600060608486031215614729578081fd5b835167ffffffffffffffff80821115614740578283fd5b61474c87838801613eb4565b94506020860151915080821115614761578283fd5b61476d87838801613f6a565b93506040860151915080821115614782578283fd5b506146b486828701613df4565b6000806000606084860312156147a3578081fd5b835167ffffffffffffffff808211156147ba578283fd5b6147c687838801613eb4565b9450602086015193506040860151915080821115614782578283fd5b600080604083850312156147f4578182fd5b823567ffffffffffffffff8082111561480b578384fd5b6146f386838701613fc8565b60008060408385031215614829578182fd5b825167ffffffffffffffff80821115614840578384fd5b61484c86838701613f6a565b93506020850151915080821115614861578283fd5b506144d085828601613df4565b60006020828403121561487f578081fd5b815180151581146120a5578182fd5b600080600080608085870312156148a3578182fd5b8451935060208501516148b581615816565b604086015190935067ffffffffffffffff80821115614452578384fd5b600080604083850312156148e4578182fd5b505080516020909101519092909150565b60008060408385031215614907578182fd5b82519150602083015167ffffffffffffffff811115614924578182fd5b6144d085828601614074565b600080600060608486031215614944578081fd5b83519250602084015167ffffffffffffffff80821115614962578283fd5b61496e87838801614074565b93506040860151915080821115614983578283fd5b506146b486828701614074565b600080604083850312156149a2578182fd5b8251915060208301516143a78161582b565b600080604083850312156149c6578182fd5b82516001600160e01b031981168114614396578283fd5b6000602082840312156149ee578081fd5b813567ffffffffffffffff811115614a04578182fd5b61399384828501614026565b60006060828403128015614a22578182fd5b8015614a2c578182fd5b50614a376060615750565b8251614a428161582b565b8152602083810151908201526040928301519281019290925250919050565b600060208284031215614a72578081fd5b815167ffffffffffffffff811115614a88578182fd5b61399384828501614209565b600080600060608486031215614aa8578081fd5b833567ffffffffffffffff811115614abe578182fd5b614aca868287016140ba565b9350506020840135614adb81615816565b929592945050506040919091013590565b60008060408385031215614afe578182fd5b823567ffffffffffffffff80821115614b15578384fd5b614b21868387016140ba565b93506020850135915080821115614b36578283fd5b506144d085828601614026565b60008060008060808587031215614b58578182fd5b845167ffffffffffffffff80821115614b6f578384fd5b614b7b88838901614209565b95506020870151915080821115614b90578384fd5b61443d88838901614209565b600080600060608486031215614bb0578081fd5b835167ffffffffffffffff80821115614bc7578283fd5b614bd387838801614209565b9450602086015193506040860151915080821115614983578283fd5b600060208284031215614c00578081fd5b5051919050565b60008060408385031215614c19578182fd5b8251614c248161582b565b6020939093015192949293505050565b600080600060608486031215614c48578081fd5b8351614c538161582b565b602085015160408601519194509250614c6b81615816565b809150509250925092565b60008060008060808587031215614c8b578182fd5b614c95868661434c565b9350602085015192506040850151614cac81615816565b606086015190925067ffffffffffffffff811115614cc8578182fd5b61448087828801614074565b600080600060608486031215614ce8578081fd5b614cf2858561434c565b925060208401519150604084015167ffffffffffffffff811115614d14578182fd5b6146b486828701614074565b600080600060608486031215614d34578081fd5b614d3e858561434c565b925060208401519150604084015190509250925092565b1515815260200190565b6000614d6b8383614e78565b505060600190565b6001600160a01b03169052565b6000815180845260208401935060208301825b82811015614dba5781516001600160a01b0316865260209586019590910190600101614d93565b5093949350505050565b600081518084526020840180819550602083028101915060208501845b84811015614e0f578284038852614df9848351614e4c565b6020988901989094509190910190600101614de1565b50919695505050505050565b6000815180845260208401935060208301825b82811015614dba578151865260209586019590910190600101614e2e565b60008151808452614e648160208601602086016157bb565b601f01601f19169290920160200192915050565b805160ff16825260208082015190830152604090810151910152565b60006101c0614ea4848451614d73565b6020830151614eb66020860182614d73565b506040830151614ec96040860182614d73565b506060830151614edc6060860182614d73565b506080830151608085015260a083015160a085015260c083015160c085015260e083015160e0850152610100808401518186015250610120808401518186015250610140808401518282870152614f3583870182614e4c565b91505061016091508184015185820383870152614f528282614e4c565b925050506101808084015185830382870152614f6e8382614e4c565b9150506101a091508184015185820383870152614f8b8282614e4c565b9695505050505050565b60008251614fa78184602087016157bb565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0392831681529116602082015260400190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b60006001600160a01b0386168252608060208301526150256080830186614e1b565b82810360408401526150378186614e1b565b83810360608501526150498186614e4c565b98975050505050505050565b60006001600160a01b0386168252608060208301526150776080830186614e4c565b82810360408401526150378186614e4c565b6001600160a01b03929092168252602082015260400190565b6000608082526150b56080830187614dc4565b82810360208401526150c78187614d80565b83810360408501526150d98187614d80565b91505082810360608401526150ee8185614e1b565b979650505050505050565b602080825282518282018190526000918401906040840190835b8181101561513b5783516005811061512757fe5b835260209384019390920191600101615113565b509095945050505050565b6000606082016060835280865161515d8184615731565b9150602088019250835b8181101561518b5761517a838551614d5f565b602094909401939250600101615167565b5050838103602085015261519f8187614e1b565b91505082810360408401528084516151b78184615731565b9150602086019250835b818110156151e5576151d4838551614d55565b6020949094019392506001016151c1565b5090979650505050505050565b6000602082526120a56020830184614e1b565b6000604082526152186040830185614e1b565b828103602084015261522a8185614dc4565b95945050505050565b6000604082526152466040830185614e1b565b828103602084015261522a8185614e1b565b60008582526001600160a01b0385166020830152608060408301526152806080830185614e4c565b82810360608401526150ee8185614e4c565b918252602082015260400190565b6000838252604060208301526139936040830184614e4c565b6000848252606060208301526152d26060830185614e4c565b8281036040840152614f8b8185614e4c565b828152604081016152f48361580c565b8260208301529392505050565b6001600160e01b03199290921682526001600160a01b0316602082015260400190565b60006001600160e01b0319871682526001600160a01b038616602083015260a0604083015261535660a0830186614e1b565b82810360608401526153688186614e1b565b838103608085015261537a8186614e4c565b9998505050505050505050565b6001600160e01b03199390931683526001600160a01b03919091166020830152604082015260600190565b60006001600160e01b031985168252606060208301526153d56060830185614e1b565b8281036040840152614f8b8185614dc4565b6000602082526120a56020830184614e4c565b60006080825261540d6080830187614e4c565b6001600160a01b03958616602084015293909416604082015260ff9190911660609091015292915050565b6000615443856157eb565b8482528360208301526060604083015261522a6060830184614e4c565b6060810161546d856157f8565b938152602081019290925260409091015290565b6060810161548e85615802565b93815260208101929092526001600160a01b031660409091015290565b604081016154b8846157f8565b9281526020015290565b6060810161546d85615802565b606081016008851061546d57fe5b60208101600583106154eb57fe5b91905290565b60006154fc8661580c565b8582528460208301526001600160a01b038416604083015260806060830152614f8b6080830184614e4c565b604081016154b8846157eb565b6000608082526155486080830187614e4c565b602083820381850152818751808452828401915082838202850101838a01865b8381101561559657601f19878403018552615584838351614e94565b94860194925090850190600101615568565b505086810360408801526155aa818a614e1b565b94505050505082810360608401526150ee8185614dc4565b60208082526013908201527f554e4b4e4f574e5f52455455524e5f4441544100000000000000000000000000604082015260600190565b60208082526019908201527f554e4b4e4f574e5f46554e4354494f4e5f53454c4543544f5200000000000000604082015260600190565b6020808252600d908201527f554e494d504c454d454e54454400000000000000000000000000000000000000604082015260600190565b6020808252600c908201527f4241445f53454c4543544f520000000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f57524f4e475f50524f58595f4944000000000000000000000000000000000000604082015260600190565b60a081016156e38286614e78565b8360608301528215156080830152949350505050565b6000602082526120a56020830184614e94565b60006040825261571f6040830185614e94565b828103602084015261522a8185614e4c565b90815260200190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff8111828210171561576f57600080fd5b604052919050565b600067ffffffffffffffff82111561578d578081fd5b5060209081020190565b600067ffffffffffffffff8211156157ad578081fd5b50601f01601f191660200190565b60005b838110156157d65781810151838201526020016157be565b838111156157e5576000848401525b50505050565b600281106157f557fe5b50565b600481106157f557fe5b600381106157f557fe5b600781106157f557fe5b6001600160a01b03811681146157f557600080fd5b60ff811681146157f557600080fdfea365627a7a723158200ea049525ebc74d73f3bf7858c601bd21168267b0dfb4abbdb7787cfd7233a2c6c6578706572696d656e74616cf564736f6c634300050c0040'; /** @@ -61,7 +70,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -74,45 +83,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeAssetProxyDispatchError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyDispatchError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [number, string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyDispatchError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded AssetProxyExistsError. @@ -145,7 +115,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -158,45 +128,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeAssetProxyExistsError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyExistsError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyExistsError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded AssetProxyTransferError. @@ -229,7 +160,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -242,45 +173,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeAssetProxyTransferError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyTransferError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyTransferError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded SignatureValidatorError. @@ -313,7 +205,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -326,47 +218,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeEIP1271SignatureError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeEIP1271SignatureError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string, string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeEIP1271SignatureError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, string, string]>( - returnData, - ); - return abiDecodedReturnData; - }, }; /** * Decode ERC-1155 asset data from the format described in the AssetProxy contract specification. @@ -400,7 +251,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -415,46 +266,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetData AssetProxy-compliant asset data describing an ERC-1155 set - * of assets. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(assetData: string): string { - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeERC1155AssetData(bytes)', [assetData]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string, BigNumber[], BigNumber[], string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - [string, string, BigNumber[], BigNumber[], string] - >(returnData); - return abiDecodedReturnData; - }, }; /** * Decode ERC-20 asset data from the format described in the AssetProxy contract specification. @@ -487,7 +298,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -500,43 +311,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetData AssetProxy-compliant asset data describing an ERC-20 asset. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(assetData: string): string { - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeERC20AssetData(bytes)', [assetData]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decode ERC-721 asset data from the format described in the AssetProxy contract specification. @@ -570,7 +344,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -583,44 +357,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetData AssetProxy-compliant asset data describing an ERC-721 - * asset. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(assetData: string): string { - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeERC721AssetData(bytes)', [assetData]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string, BigNumber] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded OrderStatusError. @@ -653,7 +389,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -666,45 +402,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeExchangeInvalidContextError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeExchangeInvalidContextError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [number, string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeExchangeInvalidContextError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded FillError. @@ -737,7 +434,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -750,43 +447,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeFillError(bytes)', [encoded]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeFillError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [number, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeFillError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded IncompleteFillError. @@ -819,7 +479,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -832,45 +492,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeIncompleteFillError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeIncompleteFillError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [number, BigNumber, BigNumber] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeIncompleteFillError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, BigNumber, BigNumber]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decode multi-asset data from the format described in the AssetProxy contract specification. @@ -903,7 +524,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -916,50 +537,11 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetData AssetProxy-compliant data describing a multi-asset basket. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(assetData: string): string { - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeMultiAssetData(bytes)', [assetData]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, BigNumber[], string[]] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, BigNumber[], string[]]>( - returnData, - ); - return abiDecodedReturnData; - }, - }; - /** - * Decompose an ABI-encoded NegativeSpreadError. - */ - public decodeNegativeSpreadError = { + }; + /** + * Decompose an ABI-encoded NegativeSpreadError. + */ + public decodeNegativeSpreadError = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -987,7 +569,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1000,45 +582,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeNegativeSpreadError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeNegativeSpreadError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeNegativeSpreadError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded OrderEpochError. @@ -1071,7 +614,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1084,43 +627,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrderEpochError(bytes)', [encoded]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeOrderEpochError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string, BigNumber] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeOrderEpochError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded OrderStatusError. @@ -1153,7 +659,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1166,43 +672,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeOrderStatusError(bytes)', [encoded]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeOrderStatusError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, number] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeOrderStatusError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, number]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded SignatureError. @@ -1235,7 +704,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1248,45 +717,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeSignatureError(bytes)', [encoded]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeSignatureError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [number, string, string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeSignatureError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string, string, string]>( - returnData, - ); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded SignatureValidatorNotApprovedError. @@ -1321,7 +751,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1334,46 +764,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'decodeSignatureValidatorNotApprovedError(bytes)', - [encoded], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeSignatureValidatorNotApprovedError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeSignatureValidatorNotApprovedError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded SignatureWalletError. @@ -1406,7 +796,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1419,47 +809,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeSignatureWalletError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeSignatureWalletError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string, string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeSignatureWalletError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, string, string]>( - returnData, - ); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded TransactionError. @@ -1492,7 +841,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1505,43 +854,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeTransactionError(bytes)', [encoded]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeTransactionError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [number, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeTransactionError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decompose an ABI-encoded TransactionExecutionError. @@ -1574,7 +886,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1587,45 +899,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param encoded ABI-encoded revert error. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(encoded: string): string { - assert.isString('encoded', encoded); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeTransactionExecutionError(bytes)', [ - encoded, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeTransactionExecutionError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeTransactionExecutionError(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); - return abiDecodedReturnData; - }, }; /** * Decodes the call data for an Exchange contract method call. @@ -1681,7 +954,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1716,106 +989,22 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, + }; + /** + * Encode ERC-1155 asset data into the format described in the AssetProxy contract specification. + */ + public encodeERC1155AssetData = { /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transactionData ABI-encoded calldata for an Exchange contract - * method call. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(transactionData: string): string { - assert.isString('transactionData', transactionData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decodeZeroExTransactionData(bytes)', [ - transactionData, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): [ - string, - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - BigNumber[], - string[] - ] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - [ - string, - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - BigNumber[], - string[] - ] - >(returnData); - return abiDecodedReturnData; - }, - }; - /** - * Encode ERC-1155 asset data into the format described in the AssetProxy contract specification. - */ - public encodeERC1155AssetData = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param tokenAddress The address of the ERC-1155 contract hosting the - * asset(s) to be traded. - * @param tokenIds The identifiers of the specific assets to be traded. - * @param tokenValues The amounts of each asset to be traded. - * @param callbackData Data to be passed to receiving contracts when a transfer - * is performed. - * @returns AssetProxy-compliant asset data describing the set of assets. + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param tokenAddress The address of the ERC-1155 contract hosting the + * asset(s) to be traded. + * @param tokenIds The identifiers of the specific assets to be traded. + * @param tokenValues The amounts of each asset to be traded. + * @param callbackData Data to be passed to receiving contracts when a transfer + * is performed. + * @returns AssetProxy-compliant asset data describing the set of assets. */ async callAsync( tokenAddress: string, @@ -1846,7 +1035,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1859,59 +1048,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param tokenAddress The address of the ERC-1155 contract hosting the - * asset(s) to be traded. - * @param tokenIds The identifiers of the specific assets to be traded. - * @param tokenValues The amounts of each asset to be traded. - * @param callbackData Data to be passed to receiving contracts when a transfer - * is performed. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData( - tokenAddress: string, - tokenIds: BigNumber[], - tokenValues: BigNumber[], - callbackData: string, - ): string { - assert.isString('tokenAddress', tokenAddress); - assert.isArray('tokenIds', tokenIds); - assert.isArray('tokenValues', tokenValues); - assert.isString('callbackData', callbackData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'encodeERC1155AssetData(address,uint256[],uint256[],bytes)', - [tokenAddress.toLowerCase(), tokenIds, tokenValues, callbackData], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Encode ERC-20 asset data into the format described in the AssetProxy contract specification. @@ -1947,7 +1083,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1960,46 +1096,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param tokenAddress The address of the ERC-20 contract hosting the asset to - * be traded. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(tokenAddress: string): string { - assert.isString('tokenAddress', tokenAddress); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('encodeERC20AssetData(address)', [ - tokenAddress.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Encode ERC-721 asset data into the format described in the AssetProxy specification. @@ -2039,7 +1135,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2052,49 +1148,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param tokenAddress The address of the ERC-721 contract hosting the asset to - * be traded. - * @param tokenId The identifier of the specific asset to be traded. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(tokenAddress: string, tokenId: BigNumber): string { - assert.isString('tokenAddress', tokenAddress); - assert.isBigNumber('tokenId', tokenId); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('encodeERC721AssetData(address,uint256)', [ - tokenAddress.toLowerCase(), - tokenId, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Encode data for multiple assets, per the AssetProxy contract specification. @@ -2134,7 +1187,7 @@ export class DevUtilsContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2147,49 +1200,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param amounts The amounts of each asset to be traded. - * @param nestedAssetData AssetProxy-compliant data describing each asset to be - * traded. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(amounts: BigNumber[], nestedAssetData: string[]): string { - assert.isArray('amounts', amounts); - assert.isArray('nestedAssetData', nestedAssetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('encodeMultiAssetData(uint256[],bytes[])', [ - amounts, - nestedAssetData, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber[] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns the number of asset(s) (described by assetData) that the corresponding AssetProxy contract is authorized to spend. When the asset data contains multiple assets (eg for Multi-Asset), the return value indicates how many complete "baskets" of those assets may be spent by all of the corresponding AssetProxy contracts. @@ -2250,49 +1260,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Owner of the assets specified by assetData. - * @param assetData Details of asset, encoded per the AssetProxy contract - * specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { - assert.isString('ownerAddress', ownerAddress); - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxyAllowance(address,bytes)', [ - ownerAddress.toLowerCase(), - assetData, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getAssetProxyAllowance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getAssetProxyAllowance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Returns the owner's balance of the assets(s) specified in assetData. When the asset data contains multiple assets (eg in ERC1155 or Multi-Asset), the return value indicates how many complete "baskets" of those assets are owned by owner. @@ -2353,49 +1320,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Owner of the assets specified by assetData. - * @param assetData Details of asset, encoded per the AssetProxy contract - * specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { - assert.isString('ownerAddress', ownerAddress); - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBalance(address,bytes)', [ - ownerAddress.toLowerCase(), - assetData, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBalance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBalance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Calls getBalance() and getAllowance() for assetData. @@ -2456,49 +1380,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Owner of the assets specified by assetData. - * @param assetData Details of asset, encoded per the AssetProxy contract - * specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { - assert.isString('ownerAddress', ownerAddress); - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getBalanceAndAssetProxyAllowance(address,bytes)', - [ownerAddress.toLowerCase(), assetData], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBalanceAndAssetProxyAllowance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [BigNumber, BigNumber] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBalanceAndAssetProxyAllowance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(returnData); - return abiDecodedReturnData; - }, }; /** * Calls getAssetProxyAllowance() for each element of assetData. @@ -2559,49 +1440,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Owner of the assets specified by assetData. - * @param assetData Array of asset details, each encoded per the AssetProxy - * contract specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string[]): string { - assert.isString('ownerAddress', ownerAddress); - assert.isArray('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getBatchAssetProxyAllowances(address,bytes[])', - [ownerAddress.toLowerCase(), assetData], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBatchAssetProxyAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber[] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBatchAssetProxyAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Calls getBalance() for each element of assetData. @@ -2662,49 +1500,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Owner of the assets specified by assetData. - * @param assetData Array of asset details, each encoded per the AssetProxy - * contract specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string[]): string { - assert.isString('ownerAddress', ownerAddress); - assert.isArray('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getBatchBalances(address,bytes[])', [ - ownerAddress.toLowerCase(), - assetData, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBatchBalances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber[] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBatchBalances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Calls getBatchBalances() and getBatchAllowances() for each element of assetData. @@ -2765,49 +1560,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Owner of the assets specified by assetData. - * @param assetData Array of asset details, each encoded per the AssetProxy - * contract specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string[]): string { - assert.isString('ownerAddress', ownerAddress); - assert.isArray('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getBatchBalancesAndAssetProxyAllowances(address,bytes[])', - [ownerAddress.toLowerCase(), assetData], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string[]] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBatchBalancesAndAssetProxyAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string[]]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [BigNumber[], BigNumber[]] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getBatchBalancesAndAssetProxyAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(returnData); - return abiDecodedReturnData; - }, }; /** * Batch fetches ETH balances @@ -2861,43 +1613,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param addresses Array of addresses. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(addresses: string[]): string { - assert.isArray('addresses', addresses); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string[] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber[] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Fetches all order-relevant information needed to validate if the supplied order is fillable. @@ -2966,127 +1681,18 @@ export class DevUtilsContract extends BaseContract { rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); - throw err; - } - BaseContract._throwIfCallResultIsRevertError(rawCallResult); - const abiEncoder = self._lookupAbiEncoder( - 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', - ); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue< - [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param order The order structure. - * @param signature Signature provided by maker that proves the order's - * authenticity. `0x01` can always be provided if the signature does not - * need to be validated. - * @returns The ABI encoded transaction data as a string - */ - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - signature: string, - ): string { - assert.isString('signature', signature); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', - [order, signature], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - string - ] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - string - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] { - const self = (this as any) as DevUtilsContract; + throw err; + } + BaseContract._throwIfCallResultIsRevertError(rawCallResult); const abiEncoder = self._lookupAbiEncoder( 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', ); // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< + const result = abiEncoder.strictDecodeReturnValue< [{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, BigNumber, boolean] - >(returnData); - return abiDecodedReturnData; + >(rawCallResult); + // tslint:enable boolean-naming + return result; }, }; /** @@ -3178,124 +1784,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param orders Array of order structures. - * @param signatures Array of signatures provided by makers that prove the - * authenticity of the orders. `0x01` can always be provided if a signature - * does not need to be validated. - * @returns The ABI encoded transaction data as a string - */ - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - signatures: string[], - ): string { - assert.isArray('orders', orders); - assert.isArray('signatures', signatures); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[])', - [orders, signatures], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - string[] - ] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - string[] - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - BigNumber[], - boolean[] - ] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - BigNumber[], - boolean[] - ] - >(returnData); - return abiDecodedReturnData; - }, }; /** * Simulates all of the transfers within an order and returns the index of the first failed transfer. @@ -3331,6 +1819,7 @@ export class DevUtilsContract extends BaseContract { takerAddress: string, takerAssetFillAmount: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('takerAddress', takerAddress); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -3351,6 +1840,15 @@ export class DevUtilsContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.getSimulatedOrderTransferResults.callAsync( + order, + takerAddress, + takerAssetFillAmount, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3385,8 +1883,7 @@ export class DevUtilsContract extends BaseContract { takerAddress: string, takerAssetFillAmount: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('takerAddress', takerAddress); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -3396,6 +1893,7 @@ export class DevUtilsContract extends BaseContract { takerAddress.toLowerCase(), takerAssetFillAmount, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -3403,8 +1901,8 @@ export class DevUtilsContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -3461,41 +1959,6 @@ export class DevUtilsContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - takerAddress: string, - takerAssetFillAmount: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).getSimulatedOrderTransferResults.callAsync( - order, - takerAddress, - takerAssetFillAmount, - txData, - ); - const txHash = await (this as any).getSimulatedOrderTransferResults.sendTransactionAsync( - order, - takerAddress, - takerAssetFillAmount, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -3609,66 +2072,6 @@ export class DevUtilsContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getSimulatedOrderTransferResults((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),address,uint256)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): number { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getSimulatedOrderTransferResults((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),address,uint256)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Simulates all of the transfers for each given order and returns the indices of each first failed transfer. @@ -3705,6 +2108,7 @@ export class DevUtilsContract extends BaseContract { takerAddresses: string[], takerAssetFillAmounts: BigNumber[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -3726,6 +2130,15 @@ export class DevUtilsContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.getSimulatedOrdersTransferResults.callAsync( + orders, + takerAddresses, + takerAssetFillAmounts, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3761,8 +2174,7 @@ export class DevUtilsContract extends BaseContract { takerAddresses: string[], takerAssetFillAmounts: BigNumber[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isArray('takerAddresses', takerAddresses); @@ -3773,6 +2185,7 @@ export class DevUtilsContract extends BaseContract { takerAddresses, takerAssetFillAmounts, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -3780,8 +2193,8 @@ export class DevUtilsContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -3840,41 +2253,6 @@ export class DevUtilsContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - takerAddresses: string[], - takerAssetFillAmounts: BigNumber[], - txData?: Partial | undefined, - ): Promise { - await (this as any).getSimulatedOrdersTransferResults.callAsync( - orders, - takerAddresses, - takerAssetFillAmounts, - txData, - ); - const txHash = await (this as any).getSimulatedOrdersTransferResults.sendTransactionAsync( - orders, - takerAddresses, - takerAssetFillAmounts, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -3992,68 +2370,6 @@ export class DevUtilsContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getSimulatedOrdersTransferResults((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],address[],uint256[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): number[] { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder( - 'getSimulatedOrdersTransferResults((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],address[],uint256[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the amount of an asset transferable by the owner. @@ -4114,49 +2430,6 @@ export class DevUtilsContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param ownerAddress Address of the owner of the asset. - * @param assetData Description of tokens, per the AssetProxy contract - * specification. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(ownerAddress: string, assetData: string): string { - assert.isString('ownerAddress', ownerAddress); - assert.isString('assetData', assetData); - const self = (this as any) as DevUtilsContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getTransferableAssetAmount(address,bytes)', [ - ownerAddress.toLowerCase(), - assetData, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getTransferableAssetAmount(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DevUtilsContract; - const abiEncoder = self._lookupAbiEncoder('getTransferableAssetAmount(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 b8b2279a97..6821ab56f8 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 @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,8 +54,10 @@ export interface DummyERC20TokenTransferEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC20TokenContract extends BaseContract { - public static deployedBytecode = - '0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c806395d89b411161008c578063dd62ed3e11610066578063dd62ed3e146102e2578063e30443bc1461031d578063f2fde38b14610356578063fa9b701814610389576100ea565b806395d89b4114610282578063a0712d681461028a578063a9059cbb146102a9576100ea565b806323b872dd116100c857806323b872dd146101d3578063313ce5671461021657806370a082311461021e5780638da5cb5b14610251576100ea565b806306fdde03146100ef578063095ea7b31461016c57806318160ddd146101b9575b600080fd5b6100f7610391565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610131578181015183820152602001610119565b50505050905090810190601f16801561015e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101a56004803603604081101561018257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813516906020013561043d565b604080519115158252519081900360200190f35b6101c16104b0565b60408051918252519081900360200190f35b6101a5600480360360608110156101e957600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104b6565b6101c1610772565b6101c16004803603602081101561023457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610778565b6102596107a0565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100f76107bc565b6102a7600480360360208110156102a057600080fd5b5035610835565b005b6101a5600480360360408110156102bf57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356108bb565b6101c1600480360360408110156102f857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610a4a565b6102a76004803603604081101561033357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610a82565b6102a76004803603602081101561036c57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610b18565b6101c1610b95565b6004805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104355780601f1061040a57610100808354040283529160200191610435565b820191906000526020600020905b81548152906001019060200180831161041857829003601f168201915b505050505081565b33600081815260026020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60035490565b73ffffffffffffffffffffffffffffffffffffffff83166000818152600260209081526040808320338452825280832054938352600190915281205490919083111561056357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b828110156105d257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020526040902054838101101561066857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff808516600090815260016020526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156107025773ffffffffffffffffffffffffffffffffffffffff851660009081526002602090815260408083203384529091529020805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3506001949350505050565b60065481565b73ffffffffffffffffffffffffffffffffffffffff1660009081526001602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156104355780601f1061040a57610100808354040283529160200191610435565b69021e19e0c9bab24000008111156108ae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f56414c55455f544f4f5f4c415247450000000000000000000000000000000000604482015290519081900360640190fd5b6108b83382610ba3565b50565b3360009081526001602052604081205482111561093957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526001602052604090205482810110156109cf57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b3360008181526001602090815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260026020908152604080832093909416825291909152205490565b610a8a610c5c565b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205480821015610ad557610acd600354610ac88385610ca5565b610ca5565b600355610aee565b610aea600354610ae58484610ca5565b610cc4565b6003555b5073ffffffffffffffffffffffffffffffffffffffff909116600090815260016020526040902055565b610b20610c5c565b73ffffffffffffffffffffffffffffffffffffffff8116610b5057610b4b610b46610ce7565b610d1e565b6108b8565b6000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b69021e19e0c9bab240000081565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902054610bd4908290610cc4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020526040902055600354610c079082610cc4565b60035560408051828152905173ffffffffffffffffffffffffffffffffffffffff8416916000917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9181900360200190a35050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610ca357600054610ca390610b4690339073ffffffffffffffffffffffffffffffffffffffff16610d26565b565b600082821115610cbe57610cbe610b4660028585610db2565b50900390565b600082820183811015610ce057610ce0610b4660008686610db2565b9392505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b805160208201fd5b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1de45ad10000000000000000000000000000000000000000000000000000000017905292915050565b606063e946c1bb60e01b84848460405160240180846003811115610dd257fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050939250505056fea265627a7a7231582089c03e503c77db7069bea8a94ec1c47ee5201d8bdb53857e70a882a1130e1ac364736f6c634300050c0032'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; public MAX_MINT_AMOUNT = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -92,41 +100,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public allowance = { /** @@ -183,48 +156,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner The address of the account owning tokens - * @param _spender The address of the account able to transfer the tokens - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * `msg.sender` approves `_spender` to spend `_value` tokens @@ -242,6 +173,7 @@ export class DummyERC20TokenContract extends BaseContract { _spender: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); @@ -262,6 +194,10 @@ export class DummyERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approve.callAsync(_spender, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -278,21 +214,20 @@ export class DummyERC20TokenContract extends BaseContract { _spender: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -331,15 +266,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _spender: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).approve.callAsync(_spender, _value, txData); - const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -412,30 +338,6 @@ export class DummyERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Query the balance of owner @@ -489,43 +391,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner The address from which the balance will be retrieved - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_owner: string): string { - assert.isString('_owner', _owner); - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public decimals = { /** @@ -569,41 +434,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Mints new tokens for sender @@ -616,7 +446,11 @@ export class DummyERC20TokenContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(_value: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + _value: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('mint(uint256)', [_value]); @@ -632,6 +466,10 @@ export class DummyERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.mint.callAsync(_value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -646,20 +484,19 @@ export class DummyERC20TokenContract extends BaseContract { awaitTransactionSuccessAsync( _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('_value', _value); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.mint.sendTransactionAsync(_value, txData); + const txHashPromise = self.mint.sendTransactionAsync(_value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -689,14 +526,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).mint.callAsync(_value, txData); - const txHash = await (this as any).mint.sendTransactionAsync(_value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -753,30 +582,6 @@ export class DummyERC20TokenContract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public name = { /** @@ -820,41 +625,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -898,41 +668,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Sets the balance of target address @@ -950,6 +685,7 @@ export class DummyERC20TokenContract extends BaseContract { _target: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_target', _target); assert.isBigNumber('_value', _value); @@ -970,6 +706,10 @@ export class DummyERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setBalance.callAsync(_target, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -986,21 +726,20 @@ export class DummyERC20TokenContract extends BaseContract { _target: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.setBalance.sendTransactionAsync(_target.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1039,15 +778,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _target: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).setBalance.callAsync(_target, _value, txData); - const txHash = await (this as any).setBalance.sendTransactionAsync(_target, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1119,30 +849,6 @@ export class DummyERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public symbol = { /** @@ -1186,41 +892,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Query total supply of token @@ -1268,41 +939,6 @@ export class DummyERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * send `value` token to `to` from `msg.sender` @@ -1320,6 +956,7 @@ export class DummyERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -1337,6 +974,10 @@ export class DummyERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transfer.callAsync(_to, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1353,21 +994,20 @@ export class DummyERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1399,15 +1039,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transfer.callAsync(_to, _value, txData); - const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1477,30 +1108,6 @@ export class DummyERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717 @@ -1520,6 +1127,7 @@ export class DummyERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1542,6 +1150,10 @@ export class DummyERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(_from, _to, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1560,8 +1172,7 @@ export class DummyERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1572,6 +1183,7 @@ export class DummyERC20TokenContract extends BaseContract { _to.toLowerCase(), _value, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1579,8 +1191,8 @@ export class DummyERC20TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1623,16 +1235,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(_from, _to, _value, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1712,30 +1314,6 @@ export class DummyERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -1744,7 +1322,11 @@ export class DummyERC20TokenContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC20TokenContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -1760,6 +1342,10 @@ export class DummyERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1773,20 +1359,19 @@ export class DummyERC20TokenContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC20TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1815,11 +1400,6 @@ export class DummyERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1876,30 +1456,6 @@ export class DummyERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 5540962892..8e78e37b76 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 @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -58,8 +64,10 @@ export interface DummyERC721TokenTransferEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DummyERC721TokenContract extends BaseContract { - public static deployedBytecode = - '0x608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a22cb46511610066578063a22cb46514610362578063b88d4fde1461039d578063e985e9c51461043a578063f2fde38b14610489576100f5565b806370a08231146102d45780638da5cb5b1461031957806395d89b41146103215780639dc29fac14610329576100f5565b806323b872dd116100d357806323b872dd146101f857806340c10f191461023b57806342842e0e146102745780636352211e146102b7576100f5565b806306fdde03146100fa578063081812fc14610177578063095ea7b3146101bd575b600080fd5b6101026104bc565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561013c578181015183820152602001610124565b50505050905090810190601f1680156101695780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101946004803603602081101561018d57600080fd5b5035610568565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101f6600480360360408110156101d357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610590565b005b6101f66004803603606081101561020e57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356106b2565b6101f66004803603604081101561025157600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610a20565b6101f66004803603606081101561028a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610a2e565b610194600480360360208110156102cd57600080fd5b5035610bc8565b610307600480360360208110156102ea57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610c5f565b60408051918252519081900360200190f35b610194610d0c565b610102610d28565b6101f66004803603604081101561033f57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610da1565b6101f66004803603604081101561037857600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515610db3565b6101f6600480360360808110156103b357600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235811692602081013590911691604082013591908101906080810160608201356401000000008111156103fb57600080fd5b82018360208201111561040d57600080fd5b8035906020019184600183028401116401000000008311171561042f57600080fd5b509092509050610e4c565b6104756004803603604081101561045057600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516611017565b604080519115158252519081900360200190f35b6101f66004803603602081101561049f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611052565b6005805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156105605780601f1061053557610100808354040283529160200191610560565b820191906000526020600020905b81548152906001019060200180831161054357829003601f168201915b505050505081565b60009081526002602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b600061059b82610bc8565b90503373ffffffffffffffffffffffffffffffffffffffff821614806105c657506105c68133611017565b61063157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f494e56414c49445f53454e4445520000000000000000000000604482015290519081900360640190fd5b60008281526002602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b73ffffffffffffffffffffffffffffffffffffffff821661073457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b600061073f82610bc8565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146107db57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b3360006107e784610568565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16148061082857506108288383611017565b8061085e57508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b6108c957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f494e56414c49445f5350454e44455200000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561091a57600084815260026020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b600084815260016020818152604080842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8b8116919091179091558a168452600390915290912054610984916110ce565b73ffffffffffffffffffffffffffffffffffffffff80881660009081526003602052604080822093909355908716815220546109c19060016110ed565b73ffffffffffffffffffffffffffffffffffffffff808716600081815260036020526040808220949094559251879391928a16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050505050565b610a2a8282611110565b5050565b610a398383836106b2565b813b8015610bc257604080517f150b7a0200000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8681166024830152604482018590526080606483015260006084830181905292519086169163150b7a029160c480830192602092919082900301818787803b158015610ace57600080fd5b505af1158015610ae2573d6000803e3d6000fd5b505050506040513d6020811015610af857600080fd5b505160405190915080602f61166c8239602f01905060405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610bc057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b505b50505050565b60008181526001602052604081205473ffffffffffffffffffffffffffffffffffffffff1680610c5957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff8216610ce357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6006805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156105605780601f1061053557610100808354040283529160200191610560565b610da96112e3565b610a2a828261132c565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b610e578585856106b2565b833b801561100f576040517f150b7a02000000000000000000000000000000000000000000000000000000008152336004820181815273ffffffffffffffffffffffffffffffffffffffff89811660248501526044840188905260806064850190815260848501879052600094918a169363150b7a029390928c928b928b928b929060a401848480828437600081840152601f19601f8201169050808301925050509650505050505050602060405180830381600087803b158015610f1b57600080fd5b505af1158015610f2f573d6000803e3d6000fd5b505050506040513d6020811015610f4557600080fd5b505160405190915080602f61166c8239602f01905060405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461100d57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b505b505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260046020908152604080832093909416825291909152205460ff1690565b61105a6112e3565b73ffffffffffffffffffffffffffffffffffffffff811661108a57611085611080611501565b611538565b6110cb565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b6000828211156110e7576110e761108060028585611540565b50900390565b6000828201838110156111095761110961108060008686611540565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff821661119257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b60008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff16801561122457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f4552433732315f4f574e45525f414c52454144595f4558495354530000000000604482015290519081900360640190fd5b600082815260016020818152604080842080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8916908117909155845260039091529091205461128a916110ed565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600360205260408082209390935591518492907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4505050565b60005473ffffffffffffffffffffffffffffffffffffffff16331461132a5760005461132a9061108090339073ffffffffffffffffffffffffffffffffffffffff166115df565b565b73ffffffffffffffffffffffffffffffffffffffff82166113ae57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4552433732315f5a45524f5f4f574e45525f4144445245535300000000000000604482015290519081900360640190fd5b60008181526001602052604090205473ffffffffffffffffffffffffffffffffffffffff908116908316811461144557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b600082815260016020818152604080842080547fffffffffffffffffffffffff000000000000000000000000000000000000000016905573ffffffffffffffffffffffffffffffffffffffff871684526003909152909120546114a7916110ce565b73ffffffffffffffffffffffffffffffffffffffff8416600081815260036020526040808220939093559151849291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a4505050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b805160208201fd5b606063e946c1bb60e01b8484846040516024018084600381111561156057fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044808301919091528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1de45ad1000000000000000000000000000000000000000000000000000000001790529291505056fe6f6e455243373231526563656976656428616464726573732c616464726573732c75696e743235362c627974657329a265627a7a723158207bb3c4b1d40aa051fbb8e4f8230bb310013e75ca9fa97c528018b4c4aba3b92564736f6c634300050c0032'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; /** * The zero address indicates there is no approved address. * Throws unless `msg.sender` is the current NFT owner, or an authorized @@ -78,6 +86,7 @@ export class DummyERC721TokenContract extends BaseContract { _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); @@ -98,6 +107,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approve.callAsync(_approved, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -114,21 +127,20 @@ export class DummyERC721TokenContract extends BaseContract { _approved: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -167,15 +179,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _approved: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).approve.callAsync(_approved, _tokenId, txData); - const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -247,30 +250,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * NFTs assigned to the zero address are considered invalid, and this @@ -325,43 +304,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner An address for whom to query the balance - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_owner: string): string { - assert.isString('_owner', _owner); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Function to burn a token @@ -380,6 +322,7 @@ export class DummyERC721TokenContract extends BaseContract { _owner: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_owner', _owner); assert.isBigNumber('_tokenId', _tokenId); @@ -397,6 +340,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.burn.callAsync(_owner, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -413,21 +360,20 @@ export class DummyERC721TokenContract extends BaseContract { _owner: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.burn.sendTransactionAsync(_owner.toLowerCase(), _tokenId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -463,15 +409,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _owner: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).burn.callAsync(_owner, _tokenId, txData); - const txHash = await (this as any).burn.sendTransactionAsync(_owner, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -540,30 +477,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Throws if `_tokenId` is not a valid NFT. @@ -617,43 +530,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _tokenId The NFT to find the approved address for - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_tokenId: BigNumber): string { - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public isApprovedForAll = { /** @@ -710,48 +586,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner The address that owns the NFTs - * @param _operator The address that acts on behalf of the owner - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Function to mint a new token @@ -770,6 +604,7 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_to', _to); assert.isBigNumber('_tokenId', _tokenId); @@ -787,6 +622,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.mint.callAsync(_to, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -803,21 +642,20 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.mint.sendTransactionAsync(_to.toLowerCase(), _tokenId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -853,15 +691,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _to: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).mint.callAsync(_to, _tokenId, txData); - const txHash = await (this as any).mint.sendTransactionAsync(_to, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -930,30 +759,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public name = { /** @@ -997,41 +802,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -1075,41 +845,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * NFTs assigned to zero address are considered invalid, and queries @@ -1164,43 +899,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _tokenId The identifier for an NFT - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_tokenId: BigNumber): string { - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * This works identically to the other function with an extra data parameter, @@ -1221,6 +919,7 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1243,6 +942,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.safeTransferFrom1.callAsync(_from, _to, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1261,8 +964,7 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1273,6 +975,7 @@ export class DummyERC721TokenContract extends BaseContract { _to.toLowerCase(), _tokenId, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1280,8 +983,8 @@ export class DummyERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1324,16 +1027,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData); - const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1412,30 +1105,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, BigNumber] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -1463,6 +1132,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, _data: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1487,6 +1157,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1507,8 +1181,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId: BigNumber, _data: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1521,6 +1194,7 @@ export class DummyERC721TokenContract extends BaseContract { _tokenId, _data, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1528,8 +1202,8 @@ export class DummyERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1576,23 +1250,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData); - const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync( - _from, - _to, - _tokenId, - _data, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1676,30 +1333,6 @@ export class DummyERC721TokenContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, BigNumber, string] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber, string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Emits the ApprovalForAll event. The contract MUST allow @@ -1718,6 +1351,7 @@ export class DummyERC721TokenContract extends BaseContract { _operator: string, _approved: boolean, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); @@ -1738,6 +1372,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setApprovalForAll.callAsync(_operator, _approved, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1754,8 +1392,7 @@ export class DummyERC721TokenContract extends BaseContract { _operator: string, _approved: boolean, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); @@ -1764,6 +1401,7 @@ export class DummyERC721TokenContract extends BaseContract { _operator.toLowerCase(), _approved, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1771,8 +1409,8 @@ export class DummyERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1811,15 +1449,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _operator: string, - _approved: boolean, - txData?: Partial | undefined, - ): Promise { - await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData); - const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1891,30 +1520,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, boolean] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, boolean]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public symbol = { /** @@ -1958,41 +1563,6 @@ export class DummyERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -2015,6 +1585,7 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -2037,6 +1608,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(_from, _to, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2055,8 +1630,7 @@ export class DummyERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -2067,6 +1641,7 @@ export class DummyERC721TokenContract extends BaseContract { _to.toLowerCase(), _tokenId, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -2074,8 +1649,8 @@ export class DummyERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2118,16 +1693,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2206,30 +1771,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, BigNumber] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -2238,7 +1779,11 @@ export class DummyERC721TokenContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC721TokenContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -2254,6 +1799,10 @@ export class DummyERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2267,20 +1816,19 @@ export class DummyERC721TokenContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as DummyERC721TokenContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2309,11 +1857,6 @@ export class DummyERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2370,30 +1913,6 @@ export class DummyERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as DummyERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 c0d8d3fb7c..7111992209 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class DutchAuctionContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; /** * Calculates the Auction Details for the given order @@ -56,6 +65,7 @@ export class DutchAuctionContract extends BaseContract { takerAssetData: string; }, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { const self = (this as any) as DutchAuctionContract; const encodedData = self._strictEncodeArguments( @@ -74,6 +84,10 @@ export class DutchAuctionContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.getAuctionDetails.callAsync(order, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -101,19 +115,18 @@ export class DutchAuctionContract extends BaseContract { takerAssetData: string; }, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { const self = (this as any) as DutchAuctionContract; - const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData); + const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -161,27 +174,6 @@ export class DutchAuctionContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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 { - await (this as any).getAuctionDetails.callAsync(order, txData); - const txHash = await (this as any).getAuctionDetails.sendTransactionAsync(order, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -289,78 +281,6 @@ export class DutchAuctionContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - } { - const self = (this as any) as DutchAuctionContract; - const abiEncoder = self._lookupAbiEncoder( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - 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); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - beginTimeSeconds: BigNumber; - endTimeSeconds: BigNumber; - beginAmount: BigNumber; - endAmount: BigNumber; - currentAmount: BigNumber; - currentTimeSeconds: BigNumber; - } { - const self = (this as any) as DutchAuctionContract; - const abiEncoder = self._lookupAbiEncoder( - 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - beginTimeSeconds: BigNumber; - endTimeSeconds: BigNumber; - beginAmount: BigNumber; - endAmount: BigNumber; - currentAmount: BigNumber; - currentTimeSeconds: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Matches the buy and sell orders at an amount given the following: the current block time, the auction @@ -424,6 +344,7 @@ export class DutchAuctionContract extends BaseContract { buySignature: string, sellSignature: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); @@ -444,6 +365,10 @@ export class DutchAuctionContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.matchOrders.callAsync(buyOrder, sellOrder, buySignature, sellSignature, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -492,8 +417,7 @@ export class DutchAuctionContract extends BaseContract { buySignature: string, sellSignature: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('buySignature', buySignature); assert.isString('sellSignature', sellSignature); @@ -504,6 +428,7 @@ export class DutchAuctionContract extends BaseContract { buySignature, sellSignature, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -511,8 +436,8 @@ export class DutchAuctionContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -583,49 +508,6 @@ export class DutchAuctionContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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 { - await (this as any).matchOrders.callAsync(buyOrder, sellOrder, buySignature, sellSignature, txData); - const txHash = await (this as any).matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buySignature, - sellSignature, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -795,92 +677,6 @@ export class DutchAuctionContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - } { - const self = (this as any) as DutchAuctionContract; - 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 abiDecodedCallData = abiEncoder.strictDecode<{ - 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); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - } { - const self = (this as any) as DutchAuctionContract; - const 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 abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - }; - leftMakerAssetSpreadAmount: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts index ad2fcd745e..8fe2202022 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,6 +54,9 @@ export interface ERC1155ProxyAuthorizedAddressRemovedEventArgs extends DecodedLo // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC1155ProxyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b50600436106100be5760003560e01c8063a85e59e411610076578063b91816111161005b578063b918161114610285578063d39de6e9146102cc578063f2fde38b14610324576100be565b8063a85e59e4146101b2578063ae25532e14610248576100be565b806370712939116100a7578063707129391461013e5780638da5cb5b146101715780639ad2674414610179576100be565b806342f1181e146100c3578063494503d4146100f8575b600080fd5b6100f6600480360360208110156100d957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610357565b005b6101156004803603602081101561010e57600080fd5b5035610543565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6100f66004803603602081101561015457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610577565b61011561086a565b6100f66004803603604081101561018f57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610886565b6100f6600480360360808110156101c857600080fd5b8101906020810181356401000000008111156101e357600080fd5b8201836020820111156101f557600080fd5b8035906020019184600183028401116401000000008311171561021757600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610c37565b610250611138565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b6102b86004803603602081101561029b57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16611159565b604080519115158252519081900360200190f35b6102d461116e565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103105781810151838201526020016102f8565b505050509050019250505060405180910390f35b6100f66004803603602081101561033a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111dd565b60005473ffffffffffffffffffffffffffffffffffffffff1633146103dd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561047257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b6002818154811061055057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60005473ffffffffffffffffffffffffffffffffffffffff1633146105fd57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff1661069157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600254811015610823578173ffffffffffffffffffffffffffffffffffffffff166002828154811061070b57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561081b57600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061076357fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061079657fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906108159082611407565b50610823565b6001016106dd565b50604051339073ffffffffffffffffffffffffffffffffffffffff8316907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a350565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461090c57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff166109a057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610a1057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110610a3457fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610ac257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610b3d57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610b7057fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610bef9082611407565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b3360009081526001602052604090205460ff16610cb557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f53454e4445525f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b60006060806060610d0b60048a8a90508b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff6112c3169050565b8060200190516080811015610d1f57600080fd5b815160208301805160405192949293830192919084640100000000821115610d4657600080fd5b908301906020820185811115610d5b57600080fd5b8251866020820283011164010000000082111715610d7857600080fd5b82525081516020918201928201910280838360005b83811015610da5578181015183820152602001610d8d565b5050505090500160405260200180516040519392919084640100000000821115610dce57600080fd5b908301906020820185811115610de357600080fd5b8251866020820283011164010000000082111715610e0057600080fd5b82525081516020918201928201910280838360005b83811015610e2d578181015183820152602001610e15565b5050505090500160405260200180516040519392919084640100000000821115610e5657600080fd5b908301906020820185811115610e6b57600080fd5b8251640100000000811182820188101715610e8557600080fd5b82525081516020918201929091019080838360005b83811015610eb2578181015183820152602001610e9a565b50505050905090810190601f168015610edf5780820380516001836020036101000a031916815260200191505b506040525050509350935093509350600082519050606081604051908082528060200260200182016040528015610f20578160200160208202803883390190505b50905060005b828114610f6957610f4a858281518110610f3c57fe5b602002602001015189611306565b828281518110610f5657fe5b6020908102919091010152600101610f26565b508573ffffffffffffffffffffffffffffffffffffffff16632eb2c2d68a8a8885886040518663ffffffff1660e01b8152600401808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561104657818101518382015260200161102e565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561108557818101518382015260200161106d565b50505050905001848103825285818151815260200191508051906020019080838360005b838110156110c15781810151838201526020016110a9565b50505050905090810190601f1680156110ee5780820380516001836020036101000a031916815260200191505b5098505050505050505050600060405180830381600087803b15801561111357600080fd5b505af1158015611127573d6000803e3d6000fd5b505050505050505050505050505050565b6000604051808061144f603091396030019050604051809103902090505b90565b60016020526000908152604090205460ff1681565b606060028054806020026020016040519081016040528092919081815260200182805480156111d357602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116111a8575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff16331461126357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156112c057600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b6060818311156112e1576112e16112dc60008585611340565b6113df565b83518211156112fa576112fa6112dc6001848751611340565b50819003910190815290565b6000826113155750600061133a565b8282028284828161132257fe5b0414611337576113376112dc600186866113e7565b90505b92915050565b6060632800659560e01b8484846040516024018084600781111561136057fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b805160208201fd5b606063e946c1bb60e01b8484846040516024018084600381111561136057fe5b81548183558181111561142b5760008381526020902061142b918101908301611430565b505050565b61115691905b8082111561144a5760008155600101611436565b509056fe4552433131353541737365747328616464726573732c75696e743235365b5d2c75696e743235365b5d2c627974657329a265627a7a72315820be5e6597d38133fd52aac17250498790f106d5d4d0e4ab30d0e854a2db1e2ffe64736f6c634300050c0032'; /** @@ -61,7 +70,11 @@ export class ERC1155ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as ERC1155ProxyContract; const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); @@ -77,6 +90,10 @@ export class ERC1155ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -91,20 +108,19 @@ export class ERC1155ProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC1155ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -134,11 +150,6 @@ export class ERC1155ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).addAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -197,30 +208,6 @@ export class ERC1155ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorities = { /** @@ -269,42 +256,6 @@ export class ERC1155ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(index_0: BigNumber): string { - assert.isBigNumber('index_0', index_0); - const self = (this as any) as ERC1155ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorities(uint256)', [index_0]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorized = { /** @@ -353,44 +304,6 @@ export class ERC1155ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(index_0: string): string { - assert.isString('index_0', index_0); - const self = (this as any) as ERC1155ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('authorized(address)', [ - index_0.toLowerCase(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets all authorized addresses. @@ -438,41 +351,6 @@ export class ERC1155ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the proxy id associated with the proxy address. @@ -499,7 +377,7 @@ export class ERC1155ProxyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -512,41 +390,6 @@ export class ERC1155ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -590,41 +433,6 @@ export class ERC1155ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -637,7 +445,11 @@ export class ERC1155ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as ERC1155ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); @@ -653,6 +465,10 @@ export class ERC1155ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -667,20 +483,19 @@ export class ERC1155ProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC1155ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -710,11 +525,6 @@ export class ERC1155ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).removeAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -773,30 +583,6 @@ export class ERC1155ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -814,6 +600,7 @@ export class ERC1155ProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); @@ -834,6 +621,10 @@ export class ERC1155ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -850,8 +641,7 @@ export class ERC1155ProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); assert.isBigNumber('index', index); @@ -860,6 +650,7 @@ export class ERC1155ProxyContract extends BaseContract { target.toLowerCase(), index, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -867,8 +658,8 @@ export class ERC1155ProxyContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -907,19 +698,6 @@ export class ERC1155ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData); - const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync( - target, - index, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -991,30 +769,6 @@ export class ERC1155ProxyContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Transfers batch of ERC1155 assets. Either succeeds or throws. @@ -1038,6 +792,7 @@ export class ERC1155ProxyContract extends BaseContract { to: string, amount: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('assetData', assetData); assert.isString('from', from); @@ -1062,6 +817,10 @@ export class ERC1155ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(assetData, from, to, amount, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1084,8 +843,7 @@ export class ERC1155ProxyContract extends BaseContract { to: string, amount: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('assetData', assetData); assert.isString('from', from); @@ -1098,6 +856,7 @@ export class ERC1155ProxyContract extends BaseContract { to.toLowerCase(), amount, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1105,8 +864,8 @@ export class ERC1155ProxyContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1155,17 +914,6 @@ export class ERC1155ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1253,30 +1001,6 @@ export class ERC1155ProxyContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, string, BigNumber] { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -1285,7 +1009,11 @@ export class ERC1155ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC1155ProxyContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -1301,6 +1029,10 @@ export class ERC1155ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1314,20 +1046,19 @@ export class ERC1155ProxyContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ERC1155ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1356,11 +1087,6 @@ export class ERC1155ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1417,30 +1143,6 @@ export class ERC1155ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC1155ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 f50041fe22..59ae25dd46 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,6 +54,9 @@ export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogA // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC20ProxyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b50600436106100a35760003560e01c80639ad2674411610076578063b91816111161005b578063b918161114610374578063d39de6e9146103bb578063f2fde38b14610413576100a3565b80639ad26744146102fe578063ae25532e14610337576100a3565b806342f1181e14610248578063494503d41461027d57806370712939146102c35780638da5cb5b146102f6575b7fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e40000000000000000000000000000000000000000000000000000000081141561024257604080513381526001602082015290812054610177577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b50602860043501357f23b872dd0000000000000000000000000000000000000000000000000000000060005260606024600437602060006064600080855af1600080511160203d14163d15178116905080156101cf57005b50507f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f5452414e534645525f4641494c454400000000000000000000000000604052600060605260646000fd5b50600080fd5b61027b6004803603602081101561025e57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610446565b005b61029a6004803603602081101561029357600080fd5b5035610632565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61027b600480360360208110156102d957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610666565b61029a610959565b61027b6004803603604081101561031457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610975565b61033f610d26565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b6103a76004803603602081101561038a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610d5c565b604080519115158252519081900360200190f35b6103c3610d71565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156103ff5781810151838201526020016103e7565b505050509050019250505060405180910390f35b61027b6004803603602081101561042957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610de0565b60005473ffffffffffffffffffffffffffffffffffffffff1633146104cc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff161561056157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b6002818154811061063f57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60005473ffffffffffffffffffffffffffffffffffffffff1633146106ec57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff1661078057604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600254811015610912578173ffffffffffffffffffffffffffffffffffffffff16600282815481106107fa57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561090a57600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061085257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff909216918390811061088557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01906109049082610ec6565b50610912565b6001016107cc565b50604051339073ffffffffffffffffffffffffffffffffffffffff8316907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a350565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1633146109fb57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610a8f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610aff57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110610b2357fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610bb157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610c2c57fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610c5f57fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610cde9082610ec6565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f4552433230546f6b656e28616464726573732900000000000000000000000000815290519081900360130190205b90565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610dd657602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dab575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e6657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610ec357600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610eea57600083815260209020610eea918101908301610eef565b505050565b610d5991905b80821115610f095760008155600101610ef5565b509056fea265627a7a72315820cb3312567959522bd12ea03b9812cab2bace85fe5f172b3ae8014b3eacc85fa864736f6c634300050b0032'; /** @@ -61,7 +70,11 @@ export class ERC20ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); @@ -77,6 +90,10 @@ export class ERC20ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -91,20 +108,19 @@ export class ERC20ProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -134,11 +150,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).addAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -197,30 +208,6 @@ export class ERC20ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorities = { /** @@ -269,42 +256,6 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -317,7 +268,11 @@ export class ERC20ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); @@ -333,6 +288,10 @@ export class ERC20ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -347,20 +306,19 @@ export class ERC20ProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -390,11 +348,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).removeAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -453,30 +406,6 @@ export class ERC20ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -520,41 +449,6 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -572,6 +466,7 @@ export class ERC20ProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); @@ -592,6 +487,10 @@ export class ERC20ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -608,8 +507,7 @@ export class ERC20ProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); assert.isBigNumber('index', index); @@ -618,6 +516,7 @@ export class ERC20ProxyContract extends BaseContract { target.toLowerCase(), index, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -625,8 +524,8 @@ export class ERC20ProxyContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -665,19 +564,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData); - const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync( - target, - index, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -749,30 +635,6 @@ export class ERC20ProxyContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the proxy id associated with the proxy address. @@ -799,7 +661,7 @@ export class ERC20ProxyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -812,41 +674,6 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorized = { /** @@ -895,44 +722,6 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets all authorized addresses. @@ -980,41 +769,6 @@ export class ERC20ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -1023,7 +777,11 @@ export class ERC20ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC20ProxyContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -1039,6 +797,10 @@ export class ERC20ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1052,20 +814,19 @@ export class ERC20ProxyContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ERC20ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1094,11 +855,6 @@ export class ERC20ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1155,30 +911,6 @@ export class ERC20ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC20ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 7ce2e25780..1cc9c8e0d0 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,8 +54,10 @@ export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC20TokenContract extends BaseContract { - public static deployedBytecode = - '0x608060405234801561001057600080fd5b50600436106100725760003560e01c806370a082311161005057806370a0823114610121578063a9059cbb14610154578063dd62ed3e1461018d57610072565b8063095ea7b31461007757806318160ddd146100c457806323b872dd146100de575b600080fd5b6100b06004803603604081101561008d57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356101c8565b604080519115158252519081900360200190f35b6100cc61023b565b60408051918252519081900360200190f35b6100b0600480360360608110156100f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610241565b6100cc6004803603602081101561013757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661049d565b6100b06004803603604081101561016a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356104c5565b6100cc600480360360408110156101a357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610652565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b60025490565b73ffffffffffffffffffffffffffffffffffffffff83166000908152602081905260408120548211156102d557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8416600090815260016020908152604080832033845290915290205482111561037457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f45524332305f494e53554646494349454e545f414c4c4f57414e434500000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8316600090815260208190526040902054828101101561040a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff80841660008181526020818152604080832080548801905593881680835284832080548890039055600182528483203384528252918490208054879003905583518681529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35060019392505050565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b3360009081526020819052604081205482111561054357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f45524332305f494e53554646494349454e545f42414c414e4345000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110156105d957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f55494e543235365f4f564552464c4f5700000000000000000000000000000000604482015290519081900360640190fd5b336000818152602081815260408083208054879003905573ffffffffffffffffffffffffffffffffffffffff871680845292819020805487019055805186815290519293927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929181900390910190a350600192915050565b73ffffffffffffffffffffffffffffffffffffffff91821660009081526001602090815260408083209390941682529190915220549056fea265627a7a723158205713efa92f66e67a8d01b80af8500df66bd6e9862dcf791e587181109d8ab0c464736f6c634300050b0032'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; /** * `msg.sender` approves `_spender` to spend `_value` tokens */ @@ -66,6 +74,7 @@ export class ERC20TokenContract extends BaseContract { _spender: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); @@ -86,6 +95,10 @@ export class ERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approve.callAsync(_spender, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -102,21 +115,20 @@ export class ERC20TokenContract extends BaseContract { _spender: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -155,15 +167,6 @@ export class ERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _spender: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).approve.callAsync(_spender, _value, txData); - const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -236,30 +239,6 @@ export class ERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Query total supply of token @@ -307,41 +286,6 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * send `value` token to `to` from `from` on the condition it is approved by `from` @@ -361,6 +305,7 @@ export class ERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -383,6 +328,10 @@ export class ERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(_from, _to, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -401,8 +350,7 @@ export class ERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -413,6 +361,7 @@ export class ERC20TokenContract extends BaseContract { _to.toLowerCase(), _value, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -420,8 +369,8 @@ export class ERC20TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -464,16 +413,6 @@ export class ERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(_from, _to, _value, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -553,30 +492,6 @@ export class ERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Query the balance of owner @@ -630,43 +545,6 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner The address from which the balance will be retrieved - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_owner: string): string { - assert.isString('_owner', _owner); - const self = (this as any) as ERC20TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * send `value` token to `to` from `msg.sender` @@ -684,6 +562,7 @@ export class ERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -701,6 +580,10 @@ export class ERC20TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transfer.callAsync(_to, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -717,21 +600,20 @@ export class ERC20TokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -763,15 +645,6 @@ export class ERC20TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transfer.callAsync(_to, _value, txData); - const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -841,30 +714,6 @@ export class ERC20TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public allowance = { /** @@ -921,48 +770,6 @@ export class ERC20TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner The address of the account owning tokens - * @param _spender The address of the account able to transfer the tokens - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ERC20TokenContract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 c93e5df751..9f3d13bc8a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,6 +54,9 @@ export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLog // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC721ProxyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b50600436106100a35760003560e01c80639ad2674411610076578063b91816111161005b578063b9181611146103ea578063d39de6e914610431578063f2fde38b14610489576100a3565b80639ad2674414610374578063ae25532e146103ad576100a3565b806342f1181e146102be578063494503d4146102f357806370712939146103395780638da5cb5b1461036c575b7fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e4000000000000000000000000000000000000000000000000000000008114156102b857604080513381526001602082015290812054610177577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b50600160643503156101f4577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0e494e56414c49445f414d4f554e540000000000000000000000000000604052600060605260646000fd5b7f23b872dd000000000000000000000000000000000000000000000000000000006000526040602460043760043560206048820160443760288101356000806064600080855af1915050801561024657005b507f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f5452414e534645525f4641494c454400000000000000000000000000604052600060605260646000fd5b50600080fd5b6102f1600480360360208110156102d457600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166104bc565b005b6103106004803603602081101561030957600080fd5b50356106a8565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6102f16004803603602081101561034f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166106dc565b6103106109cf565b6102f16004803603604081101561038a57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001356109eb565b6103b5610d9c565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b61041d6004803603602081101561040057600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610dd2565b604080519115158252519081900360200190f35b610439610de7565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561047557818101518382015260200161045d565b505050509050019250505060405180910390f35b6102f16004803603602081101561049f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610e56565b60005473ffffffffffffffffffffffffffffffffffffffff16331461054257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff16156105d757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600081815260016020819052604080832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168317905560028054928301815583527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace90910180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b600281815481106106b557fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b60005473ffffffffffffffffffffffffffffffffffffffff16331461076257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526001602052604090205460ff166107f657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260016020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600254811015610988578173ffffffffffffffffffffffffffffffffffffffff166002828154811061087057fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16141561098057600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81019081106108c857fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff90921691839081106108fb57fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019061097a9082610f3c565b50610988565b600101610842565b50604051339073ffffffffffffffffffffffffffffffffffffffff8316907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a350565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a7157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526001602052604090205460ff16610b0557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6002548110610b7557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff1660028281548110610b9957fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff1614610c2757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260016020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610ca257fe5b6000918252602090912001546002805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610cd557fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610d549082610f3c565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f455243373231546f6b656e28616464726573732c75696e7432353629000000008152905190819003601c0190205b90565b60016020526000908152604090205460ff1681565b60606002805480602002602001604051908101604052809291908181526020018280548015610e4c57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610e21575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff163314610edc57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811615610f3957600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b815481835581811115610f6057600083815260209020610f60918101908301610f65565b505050565b610dcf91905b80821115610f7f5760008155600101610f6b565b509056fea265627a7a723158201e53a891f6df3931041b820f71387e9eecd97f7ea0d346c54fab37668bd022ec64736f6c634300050b0032'; /** @@ -61,7 +70,11 @@ export class ERC721ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); @@ -77,6 +90,10 @@ export class ERC721ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -91,20 +108,19 @@ export class ERC721ProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -134,11 +150,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).addAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -197,30 +208,6 @@ export class ERC721ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorities = { /** @@ -269,42 +256,6 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -317,7 +268,11 @@ export class ERC721ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); @@ -333,6 +288,10 @@ export class ERC721ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -347,20 +306,19 @@ export class ERC721ProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -390,11 +348,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).removeAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -453,30 +406,6 @@ export class ERC721ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -520,41 +449,6 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -572,6 +466,7 @@ export class ERC721ProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); @@ -592,6 +487,10 @@ export class ERC721ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -608,8 +507,7 @@ export class ERC721ProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); assert.isBigNumber('index', index); @@ -618,6 +516,7 @@ export class ERC721ProxyContract extends BaseContract { target.toLowerCase(), index, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -625,8 +524,8 @@ export class ERC721ProxyContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -665,19 +564,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData); - const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync( - target, - index, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -749,30 +635,6 @@ export class ERC721ProxyContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the proxy id associated with the proxy address. @@ -799,7 +661,7 @@ export class ERC721ProxyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -812,41 +674,6 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorized = { /** @@ -895,44 +722,6 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets all authorized addresses. @@ -980,41 +769,6 @@ export class ERC721ProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ERC721ProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -1023,7 +777,11 @@ export class ERC721ProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ERC721ProxyContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -1039,6 +797,10 @@ export class ERC721ProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1052,20 +814,19 @@ export class ERC721ProxyContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ERC721ProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1094,11 +855,6 @@ export class ERC721ProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1155,30 +911,6 @@ export class ERC721ProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721ProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 6609198dec..883ba300c3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -58,8 +64,10 @@ export interface ERC721TokenTransferEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ERC721TokenContract extends BaseContract { - public static deployedBytecode = - '0x608060405234801561001057600080fd5b50600436106100a35760003560e01c80636352211e11610076578063a22cb4651161005b578063a22cb46514610211578063b88d4fde1461024c578063e985e9c5146102e9576100a3565b80636352211e146101af57806370a08231146101cc576100a3565b8063081812fc146100a8578063095ea7b3146100ee57806323b872dd1461012957806342842e0e1461016c575b600080fd5b6100c5600480360360208110156100be57600080fd5b5035610338565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6101276004803603604081101561010457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610360565b005b6101276004803603606081101561013f57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610482565b6101276004803603606081101561018257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356107ef565b6100c5600480360360208110156101c557600080fd5b5035610989565b6101ff600480360360208110156101e257600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610a20565b60408051918252519081900360200190f35b6101276004803603604081101561022757600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81351690602001351515610acd565b6101276004803603608081101561026257600080fd5b73ffffffffffffffffffffffffffffffffffffffff8235811692602081013590911691604082013591908101906080810160608201356401000000008111156102aa57600080fd5b8201836020820111156102bc57600080fd5b803590602001918460018302840111640100000000831117156102de57600080fd5b509092509050610b66565b610324600480360360408110156102ff57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff81358116916020013516610d31565b604080519115158252519081900360200190f35b60009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b600061036b82610989565b90503373ffffffffffffffffffffffffffffffffffffffff8216148061039657506103968133610d31565b61040157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f494e56414c49445f53454e4445520000000000000000000000604482015290519081900360640190fd5b60008281526001602052604080822080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff87811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b73ffffffffffffffffffffffffffffffffffffffff821661050457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f5a45524f5f544f5f4144445245535300000000000000000000604482015290519081900360640190fd5b600061050f82610989565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16146105ab57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f4552433732315f4f574e45525f4d49534d415443480000000000000000000000604482015290519081900360640190fd5b3360006105b784610338565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614806105f857506105f88383610d31565b8061062e57508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b61069957604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4552433732315f494e56414c49445f5350454e44455200000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116156106ea57600084815260016020526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555b60008481526020818152604080832080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8a811691909117909155891683526002909152902054610753906001610d6c565b73ffffffffffffffffffffffffffffffffffffffff8088166000908152600260205260408082209390935590871681522054610790906001610d90565b73ffffffffffffffffffffffffffffffffffffffff808716600081815260026020526040808220949094559251879391928a16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050505050565b6107fa838383610482565b813b801561098357604080517f150b7a0200000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8681166024830152604482018590526080606483015260006084830181905292519086169163150b7a029160c480830192602092919082900301818787803b15801561088f57600080fd5b505af11580156108a3573d6000803e3d6000fd5b505050506040513d60208110156108b957600080fd5b505160405190915080602f610e5b8239602f01905060405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461098157604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b505b50505050565b60008181526020819052604081205473ffffffffffffffffffffffffffffffffffffffff1680610a1a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b92915050565b600073ffffffffffffffffffffffffffffffffffffffff8216610aa457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f4552433732315f5a45524f5f4f574e4552000000000000000000000000000000604482015290519081900360640190fd5b5073ffffffffffffffffffffffffffffffffffffffff1660009081526002602052604090205490565b33600081815260036020908152604080832073ffffffffffffffffffffffffffffffffffffffff87168085529083529281902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016861515908117909155815190815290519293927f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31929181900390910190a35050565b610b71858585610482565b833b8015610d29576040517f150b7a02000000000000000000000000000000000000000000000000000000008152336004820181815273ffffffffffffffffffffffffffffffffffffffff89811660248501526044840188905260806064850190815260848501879052600094918a169363150b7a029390928c928b928b928b929060a401848480828437600081840152601f19601f8201169050808301925050509650505050505050602060405180830381600087803b158015610c3557600080fd5b505af1158015610c49573d6000803e3d6000fd5b505050506040513d6020811015610c5f57600080fd5b505160405190915080602f610e5b8239602f01905060405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614610d2757604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552433732315f494e56414c49445f53454c4543544f52000000000000000000604482015290519081900360640190fd5b505b505050505050565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260036020908152604080832093909416825291909152205460ff1690565b600082821115610d8a57610d8a610d8560028585610db3565b610e52565b50900390565b600082820183811015610dac57610dac610d8560008686610db3565b9392505050565b606063e946c1bb60e01b84848460405160240180846003811115610dd357fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b805160208201fdfe6f6e455243373231526563656976656428616464726573732c616464726573732c75696e743235362c627974657329a265627a7a723158204bc74831490bca4fbe1805808d58d6b0e12f618a37565e744e91d8dc73dc18b164736f6c634300050c0032'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; /** * The zero address indicates there is no approved address. * Throws unless `msg.sender` is the current NFT owner, or an authorized @@ -78,6 +86,7 @@ export class ERC721TokenContract extends BaseContract { _approved: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_approved', _approved); assert.isBigNumber('_tokenId', _tokenId); @@ -98,6 +107,10 @@ export class ERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approve.callAsync(_approved, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -114,21 +127,20 @@ export class ERC721TokenContract extends BaseContract { _approved: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.approve.sendTransactionAsync(_approved.toLowerCase(), _tokenId, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -167,15 +179,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _approved: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).approve.callAsync(_approved, _tokenId, txData); - const txHash = await (this as any).approve.sendTransactionAsync(_approved, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -247,30 +250,6 @@ export class ERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * NFTs assigned to the zero address are considered invalid, and this @@ -325,43 +304,6 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner An address for whom to query the balance - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_owner: string): string { - assert.isString('_owner', _owner); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Throws if `_tokenId` is not a valid NFT. @@ -415,43 +357,6 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _tokenId The NFT to find the approved address for - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_tokenId: BigNumber): string { - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public isApprovedForAll = { /** @@ -508,48 +413,6 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _owner The address that owns the NFTs - * @param _operator The address that acts on behalf of the owner - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * NFTs assigned to zero address are considered invalid, and queries @@ -604,43 +467,6 @@ export class ERC721TokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param _tokenId The identifier for an NFT - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_tokenId: BigNumber): string { - assert.isBigNumber('_tokenId', _tokenId); - const self = (this as any) as ERC721TokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * This works identically to the other function with an extra data parameter, @@ -661,6 +487,7 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -683,6 +510,10 @@ export class ERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.safeTransferFrom1.callAsync(_from, _to, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -701,8 +532,7 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -713,6 +543,7 @@ export class ERC721TokenContract extends BaseContract { _to.toLowerCase(), _tokenId, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -720,8 +551,8 @@ export class ERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -764,16 +595,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).safeTransferFrom1.callAsync(_from, _to, _tokenId, txData); - const txHash = await (this as any).safeTransferFrom1.sendTransactionAsync(_from, _to, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -852,30 +673,6 @@ export class ERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, BigNumber] { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -903,6 +700,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, _data: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -927,6 +725,10 @@ export class ERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -947,8 +749,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId: BigNumber, _data: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -961,6 +762,7 @@ export class ERC721TokenContract extends BaseContract { _tokenId, _data, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -968,8 +770,8 @@ export class ERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1016,23 +818,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).safeTransferFrom2.callAsync(_from, _to, _tokenId, _data, txData); - const txHash = await (this as any).safeTransferFrom2.sendTransactionAsync( - _from, - _to, - _tokenId, - _data, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1116,30 +901,6 @@ export class ERC721TokenContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, BigNumber, string] { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber, string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Emits the ApprovalForAll event. The contract MUST allow @@ -1158,6 +919,7 @@ export class ERC721TokenContract extends BaseContract { _operator: string, _approved: boolean, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); @@ -1178,6 +940,10 @@ export class ERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setApprovalForAll.callAsync(_operator, _approved, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1194,8 +960,7 @@ export class ERC721TokenContract extends BaseContract { _operator: string, _approved: boolean, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_operator', _operator); assert.isBoolean('_approved', _approved); @@ -1204,6 +969,7 @@ export class ERC721TokenContract extends BaseContract { _operator.toLowerCase(), _approved, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1211,8 +977,8 @@ export class ERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1251,15 +1017,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _operator: string, - _approved: boolean, - txData?: Partial | undefined, - ): Promise { - await (this as any).setApprovalForAll.callAsync(_operator, _approved, txData); - const txHash = await (this as any).setApprovalForAll.sendTransactionAsync(_operator, _approved, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1331,30 +1088,6 @@ export class ERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, boolean] { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, boolean]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -1377,6 +1110,7 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1399,6 +1133,10 @@ export class ERC721TokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(_from, _to, _tokenId, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1417,8 +1155,7 @@ export class ERC721TokenContract extends BaseContract { _to: string, _tokenId: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -1429,6 +1166,7 @@ export class ERC721TokenContract extends BaseContract { _to.toLowerCase(), _tokenId, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1436,8 +1174,8 @@ export class ERC721TokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1480,16 +1218,6 @@ export class ERC721TokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(_from, _to, _tokenId, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _tokenId, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1568,30 +1296,6 @@ export class ERC721TokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, BigNumber] { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ERC721TokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 c973546cf0..ef8097adfd 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 @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,8 +34,10 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class EthBalanceCheckerContract extends BaseContract { - public static deployedBytecode = - '0x608060405234801561001057600080fd5b506004361061002b5760003560e01c8063a0901e5114610030575b600080fd5b6100d36004803603602081101561004657600080fd5b81019060208101813564010000000081111561006157600080fd5b82018360208201111561007357600080fd5b8035906020019184602083028401116401000000008311171561009557600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610123945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561010f5781810151838201526020016100f7565b505050509050019250505060405180910390f35b6060808251604051908082528060200260200182016040528015610151578160200160208202803883390190505b50905060005b835181146101a95783818151811061016b57fe5b602002602001015173ffffffffffffffffffffffffffffffffffffffff163182828151811061019657fe5b6020908102919091010152600101610157565b509291505056fea265627a7a7231582094309783f0b63086d85d9cb4f6e5be253699056ac1580a863367c5076ecb5c1864736f6c634300050b0032'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; /** * Batch fetches ETH balances */ @@ -82,43 +90,6 @@ export class EthBalanceCheckerContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param addresses Array of addresses. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(addresses: string[]): string { - assert.isArray('addresses', addresses); - const self = (this as any) as EthBalanceCheckerContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getEthBalances(address[])', [addresses]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string[] { - const self = (this as any) as EthBalanceCheckerContract; - const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber[] { - const self = (this as any) as EthBalanceCheckerContract; - const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index bb8fc0584c..64458c76b3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -107,8 +113,10 @@ export interface ExchangeTransactionExecutionEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ExchangeContract extends BaseContract { - public static deployedBytecode = - '0x6080604052600436106102d15760003560e01c80638da5cb5b11610179578063beee2e14116100d6578063dd885e2d1161008a578063eea086ba11610064578063eea086ba14610715578063f2fde38b1461072a578063fc74896d1461074a576102d1565b8063dd885e2d146106cd578063dedfc1f1146106ef578063e14b58c414610702576102d1565b8063c26cfecd116100bb578063c26cfecd14610678578063c585bb931461068d578063d9bfa73e146106ad576102d1565b8063beee2e1414610645578063c0fa16cc14610658576102d1565b80639d3fa4b91161012d578063a6c3bf3311610112578063a6c3bf33146105ff578063b04fbddd14610612578063b718e29214610632576102d1565b80639d3fa4b9146105b2578063a12dcc6f146105df576102d1565b80639331c7421161015e5780639331c7421461056c5780639694a4021461058c5780639b44d5561461059f576102d1565b80638da5cb5b146105375780638ea8dfe41461054c576102d1565b80636a1a80fd116102325780638171c407116101e657806388ec79fb116101c057806388ec79fb146104e45780638bc8efb3146105045780638d45cd2314610517576102d1565b80638171c4071461048f57806382c174d0146104af578063850a1501146104cf576102d1565b806377fcce681161021757806377fcce681461044957806378d29ac11461045c5780637b8e35141461046f576102d1565b80636a1a80fd146104165780636fcf3e9e14610436576102d1565b80632da629871161028957806346c02d7a1161026e57806346c02d7a146103c35780634f9559b1146103d657806360704108146103e9576102d1565b80632da629871461038e578063369da099146103a3576102d1565b80632280c910116102ba5780632280c9101461032e578063288cdc911461034e5780632ac126221461036e576102d1565b80630228e168146102d65780631ce4c78b1461030c575b600080fd5b3480156102e257600080fd5b506102f66102f1366004614e64565b61076a565b60405161030391906154c4565b60405180910390f35b34801561031857600080fd5b5061032161077f565b60405161030391906154cf565b61034161033c366004615108565b610785565b60405161030391906156a0565b34801561035a57600080fd5b50610321610369366004614e64565b6107c7565b34801561037a57600080fd5b506102f6610389366004614e64565b6107d9565b6103a161039c366004614f82565b6107ee565b005b6103b66103b1366004614d60565b610812565b60405161030391906159c2565b6103a16103d1366004614e64565b610939565b6103a16103e4366004614e64565b6109ac565b3480156103f557600080fd5b50610409610404366004614eed565b610ab9565b604051610303919061535b565b610429610424366004614c40565b610b07565b604051610303919061594b565b610429610444366004614c40565b610b3f565b6103a1610457366004614b2a565b610b5d565b6103b661046a366004614d60565b610c20565b34801561047b57600080fd5b506102f661048a366004614af6565b610d70565b34801561049b57600080fd5b506102f66104aa366004614ea0565b610d90565b3480156104bb57600080fd5b506102f66104ca366004614e7c565b610def565b3480156104db57600080fd5b50610409610e0f565b6104f76104f236600461500c565b610e2b565b60405161030391906159d0565b6103b6610512366004614d60565b610e49565b34801561052357600080fd5b506102f6610532366004615108565b610e7d565b34801561054357600080fd5b50610409610ea2565b61055f61055a366004614cdc565b610ebe565b60405161030391906154b1565b34801561057857600080fd5b506103a1610587366004614e64565b610fe9565b61055f61059a366004614cdc565b611031565b6103b66105ad3660046150a8565b6110f8565b3480156105be57600080fd5b506105d26105cd366004614f82565b61111d565b6040516103039190615a12565b3480156105eb57600080fd5b506102f66105fa366004614fb5565b611201565b6103b661060d366004614d60565b611226565b34801561061e57600080fd5b506103a161062d366004614b65565b61125a565b6104f761064036600461500c565b611306565b61055f610653366004614cdc565b611324565b34801561066457600080fd5b506103a1610673366004614adb565b6113d9565b34801561068457600080fd5b5061032161147c565b34801561069957600080fd5b506103a16106a8366004614adb565b611482565b3480156106b957600080fd5b506103216106c8366004614af6565b611616565b3480156106d957600080fd5b506106e2611633565b604051610303919061562b565b6103a16106fd366004614c0d565b611657565b6103b66107103660046150a8565b611699565b34801561072157600080fd5b506104096116b4565b34801561073657600080fd5b506103a1610745366004614adb565b6116d0565b61075d610758366004614db3565b611748565b6040516103039190615433565b60056020526000908152604090205460ff1681565b60035481565b606061078f61187b565b156107a55761079e838361189d565b90506107c1565b6107ad6119b7565b6107b7838361189d565b90506107c16119f9565b92915050565b60096020526000908152604090205481565b600a6020526000908152604090205460ff1681565b6107f6611a2b565b6107ff81611a9a565b610807611ad7565b61080f611aeb565b50565b61081a614561565b61082261187b565b156108b857835160005b8181146108b157600061084c846020015187611b1590919063ffffffff16565b9050610856614561565b61088788848151811061086557fe5b60200260200101518388868151811061087a57fe5b6020026020010151611b34565b90506108938582611c75565b9450868560200151106108a75750506108b1565b505060010161082c565b5050610932565b6108c06119b7565b835160005b8181146109285760006108e5846020015187611b1590919063ffffffff16565b90506108ef614561565b6108fe88848151811061086557fe5b905061090a8582611c75565b94508685602001511061091e575050610928565b50506001016108c5565b50506109326119f9565b9392505050565b610941611a2b565b600061094b611d10565b600083815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff90941683529290522080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905550610807611ad7565b6109b4611a2b565b60006109be611d10565b9050600073ffffffffffffffffffffffffffffffffffffffff821633146109e557336109e8565b60005b73ffffffffffffffffffffffffffffffffffffffff8084166000908152600b60209081526040808320938516835292905220549091506001840190808211610a3d57610a3d610a38858584611d42565b611de7565b73ffffffffffffffffffffffffffffffffffffffff8085166000818152600b602090815260408083209488168084529490915290819020859055517f82af639571738f4ebd4268fb0363d8957ebe1bbb9e78dba5ebd69eed39b154f090610aa59086906154cf565b60405180910390a350505050610807611ad7565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526002602052604090205473ffffffffffffffffffffffffffffffffffffffff165b919050565b610b0f614590565b610b17611a2b565b610b25858585856001611def565b9050610b2f611ad7565b610b37611aeb565b949350505050565b610b47614590565b610b4f611a2b565b610b25858585856000611def565b610b65611a2b565b6000610b6f611d10565b73ffffffffffffffffffffffffffffffffffffffff8181166000818152600860209081526040808320948916808452949091529081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00168715151790555192935090917fa8656e308026eeabce8f0bc18048433252318ab80ac79da0b3d3d8697dfba89190610c039086906154c4565b60405180910390a350610c14611ad7565b610c1c611aeb565b5050565b610c28614561565b610c3061187b565b15610cee57835160005b8181146108b1578251600090610c5790879063ffffffff611b1516565b90506000610c94888481518110610c6a57fe5b602002602001015160a00151898581518110610c8257fe5b6020026020010151608001518461215c565b9050610c9e614561565b610cc2898581518110610cad57fe5b60200260200101518389878151811061087a57fe5b9050610cce8682611c75565b955087866000015110610ce3575050506108b1565b505050600101610c3a565b610cf66119b7565b835160005b818114610928578251600090610d1890879063ffffffff611b1516565b90506000610d2b888481518110610c6a57fe5b9050610d35614561565b610d44898581518110610cad57fe5b9050610d508682611c75565b955087866000015110610d6557505050610928565b505050600101610cfb565b600860209081526000928352604080842090915290825290205460ff1681565b600080610d9e85858561217e565b90506005816008811115610dae57fe5b1480610dc557506007816008811115610dc357fe5b145b15610dda57610dda610a3860058787876121fd565b610de6818686866122a5565b95945050505050565b600760209081526000928352604080842090915290825290205460ff1681565b60045473ffffffffffffffffffffffffffffffffffffffff1681565b610e336145b8565b610e3b611a2b565b610b25858585856000612515565b610e51614561565b610e5c848484610c20565b9050828160000151101561093257610932610a386000858460000151612602565b600080610e956001548561262190919063ffffffff16565b9050610b37848285612635565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6060610ec861187b565b15610f6b578351604080518281526020808402820101909152818015610f0857816020015b610ef5614561565b815260200190600190039081610eed5790505b50915060005b8181146108b157610f4c868281518110610f2457fe5b6020026020010151868381518110610f3857fe5b602002602001015186848151811061087a57fe5b838281518110610f5857fe5b6020908102919091010152600101610f0e565b610f736119b7565b8351604080518281526020808402820101909152818015610fae57816020015b610f9b614561565b815260200190600190039081610f935790505b50915060005b81811461092857610fca868281518110610f2457fe5b838281518110610fd657fe5b6020908102919091010152600101610fb4565b610ff16126bb565b7f3a3e76d7a75e198aef1f53137e4f2a8a2ec74e2e9526db8404d08ccc9f1e621d60035482604051611024929190615543565b60405180910390a1600355565b606061103b611a2b565b835160408051828152602080840282010190915281801561107657816020015b611063614561565b81526020019060019003908161105b5790505b50915060005b8181146110e6576110c786828151811061109257fe5b60200260200101518683815181106110a657fe5b60200260200101518684815181106110ba57fe5b6020026020010151612702565b8382815181106110d357fe5b602090810291909101015260010161107c565b50506110f0611ad7565b610932611aeb565b611100614561565b611108611a2b565b611113848484612702565b90506110f0611ad7565b6111256145ec565b61112e826127a4565b60408301526020820152608082015161114e5760015b60ff168152610b02565b60a082015161115e576002611144565b8160a00151816040015110611174576005611144565b8161010001514210611187576004611144565b6020808201516000908152600a909152604090205460ff16156111ab576006611144565b610120820151825173ffffffffffffffffffffffffffffffffffffffff9081166000908152600b6020908152604080832060608801519094168352929052205411156111f8576006611144565b60038152919050565b600080611219600154856127d590919063ffffffff16565b9050610b378482856127e4565b61122e614561565b611239848484610812565b9050828160200151101561093257610932610a386001858460200151612602565b835160005b8181146112ca576112c28160001b87838151811061127957fe5b602002602001015187848151811061128d57fe5b60200260200101518785815181106112a157fe5b60200260200101518786815181106112b557fe5b6020026020010151612839565b60010161125f565b506040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112fd90615914565b60405180910390fd5b61130e6145b8565b611316611a2b565b610b25858585856001612515565b606061132e611a2b565b835160408051828152602080840282010190915281801561136957816020015b611356614561565b81526020019060019003908161134e5790505b50915060005b8181146110e6576113ba86828151811061138557fe5b602002602001015186838151811061139957fe5b60200260200101518684815181106113ad57fe5b60200260200101516129f3565b8382815181106113c657fe5b602090810291909101015260010161136f565b6113e16126bb565b6004546040517fe1a5430ebec577336427f40f15822f1f36c5e3509ff209d6db9e6c9e6941cb0b9161142d9173ffffffffffffffffffffffffffffffffffffffff90911690849061537c565b60405180910390a1600480547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b60015481565b61148a6126bb565b60008173ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156114d257600080fd5b505afa1580156114e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061150a9190810190614f09565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526002602052604090205490915073ffffffffffffffffffffffffffffffffffffffff16801561156857611568610a388383612a26565b7fffffffff0000000000000000000000000000000000000000000000000000000082166000908152600260205260409081902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8616179055517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c03194906116099084908690615658565b60405180910390a1505050565b600b60209081526000928352604080842090915290825290205481565b7f20c13b0b0000000000000000000000000000000000000000000000000000000081565b61165f611a2b565b805160005b81811461168f5761168783828151811061167a57fe5b6020026020010151611a9a565b600101611664565b5050610807611ad7565b6116a1614561565b6116a9611a2b565b6111138484846129f3565b60065473ffffffffffffffffffffffffffffffffffffffff1681565b6116d86126bb565b73ffffffffffffffffffffffffffffffffffffffff8116611703576116fe610a38612ac8565b61080f565b6000805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff000000000000000000000000000000000000000090911617905550565b606061175261187b565b156117f457825160408051828152602080840282010190915260609082801561178f57816020015b606081526020019060019003908161177a5790505b50905060005b8281146117eb576117cc8682815181106117ab57fe5b60200260200101518683815181106117bf57fe5b602002602001015161189d565b8282815181106117d857fe5b6020908102919091010152600101611795565b509150506107c1565b6117fc6119b7565b825160408051828152602080840282010190915260609082801561183457816020015b606081526020019060019003908161181f5790505b50905060005b82811461186f576118508682815181106117ab57fe5b82828151811061185c57fe5b602090810291909101015260010161183a565b509150506107c16119f9565b6000547501000000000000000000000000000000000000000000900460ff1690565b606060006118b66001548561262190919063ffffffff16565b90506118c3848483612aff565b60608401516118d28180612bd3565b60008281526005602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055608087015190516060913091611920919061530e565b600060405180830381855af49150503d806000811461195b576040519150601f19603f3d011682016040523d82523d6000602084013e611960565b606091505b50915091508161197757611977610a388583612c36565b611982836000612bd3565b60405184907fa4a7329f1dd821363067e07d359e347b4af9b1efe4b6cccf13240228af3c800d90600090a29695505050505050565b600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff167501000000000000000000000000000000000000000000179055565b600080547fffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffffff169055611a29612c53565b565b60005474010000000000000000000000000000000000000000900460ff1615611a5957611a59610a38612c88565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1674010000000000000000000000000000000000000000179055565b611aa26145ec565b611aab8261111d565b9050611ab78282612cbf565b805160ff16600314611ac9575061080f565b610c1c828260200151612d6e565b611adf61187b565b611a2957611a29612c53565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff169055565b600082821115611b2e57611b2e610a3860028585612e17565b50900390565b611b3c614561565b6040516060907f9b44d5560000000000000000000000000000000000000000000000000000000090611b7690879087908790602401615a58565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060603073ffffffffffffffffffffffffffffffffffffffff1683604051611bfe919061530e565b600060405180830381855af49150503d8060008114611c39576040519150601f19603f3d011682016040523d82523d6000602084013e611c3e565b606091505b50915091508115611c6b57805160a014611c5457fe5b80806020019051611c689190810190614f25565b93505b5050509392505050565b611c7d614561565b81518351611c909163ffffffff612e3616565b815260208083015190840151611cab9163ffffffff612e3616565b602082015260408083015190840151611cc99163ffffffff612e3616565b604082015260608083015190840151611ce79163ffffffff612e3616565b606082015260808083015190840151611d059163ffffffff612e3616565b608082015292915050565b60065460009073ffffffffffffffffffffffffffffffffffffffff16818115611d395781611d3b565b335b9250505090565b6060634ad3127560e01b848484604051602401611d61939291906153a3565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b805160208201fd5b611df7614590565b8551611e0a57611e0a610a386000612e52565b8451611e1d57611e1d610a386001612e52565b8351865114611e3357611e33610a386002612e52565b8251855114611e4957611e49610a386003612e52565b8551604051908082528060200260200182016040528015611e8457816020015b611e71614561565b815260200190600190039081611e695790505b5081528451604080518281526020808402820101909152908015611ec257816020015b611eaf614561565b815260200190600190039081611ea75790505b506020820152600080611ed361460c565b88600081518110611ee057fe5b60200260200101519050611ef261460c565b88600081518110611eff57fe5b602002602001015190506000611f14836127a4565b9150506000611f22836127a4565b915050611f2d614561565b611f35614561565b611f3d6145b8565b611f7087878f8c81518110611f4e57fe5b60200260200101518f8c81518110611f6257fe5b60200260200101518f612515565b805160200151909150611f8a90869063ffffffff612e3616565b9450611fa781602001516020015185612e3690919063ffffffff16565b9350611fb7838260000151611c75565b9250611fc7828260200151611c75565b9150611fe481604001518b60400151612e3690919063ffffffff16565b60408b0152606080820151908b01516120029163ffffffff612e3616565b60608b015260a087015185106120ad578951805160018b019a859291811061202657fe5b60200260200101819052506040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525092508e5189141561208a57818a60200151898151811061207957fe5b60200260200101819052505061214b565b8e898151811061209657fe5b602002602001015196506120a9876127a4565b9550505b8560a00151841061214557818a6020015189806001019a50815181106120cf57fe5b60200260200101819052506040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525091508d5188141561212257828a600001518a8151811061207957fe5b8d888151811061212e57fe5b60200260200101519550612141866127a4565b9450505b50611f35565b505050505050505095945050505050565b6000610b3783612172868563ffffffff612ef116565b9063ffffffff612f2216565b600061218b848484612f4c565b905073ffffffffffffffffffffffffffffffffffffffff83166121b8576121b8610a3860068686866121fd565b600881818111156121c557fe5b60ff16106121dd576121dd610a3860038686866121fd565b60008160088111156121eb57fe5b141561093257610932610a3860048686865b6060637e5a231860e01b8585858560405160240161221e94939291906158b9565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050949350505050565b600060018560088111156122b557fe5b14156122dc5781516001146122d4576122d4610a3860028686866121fd565b506000610b37565b60028560088111156122ea57fe5b14156123e357815160421461230957612309610a3860028686866121fd565b60008260008151811061231857fe5b016020015160f81c9050600061233584600163ffffffff612f8b16565b9050600061234a85602163ffffffff612f8b16565b9050600060018885858560405160008152602001604052604051612371949392919061560d565b6020604051602081039080840390855afa158015612393573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015173ffffffffffffffffffffffffffffffffffffffff8981169116149550610b37945050505050565b60038560088111156123f157fe5b141561249e57815160421461241057612410610a3860028686866121fd565b60008260008151811061241f57fe5b016020015160f81c9050600061243c84600163ffffffff612f8b16565b9050600061245185602163ffffffff612f8b16565b90506000600188604051602001612468919061532a565b6040516020818303038152906040528051906020012085858560405160008152602001604052604051612371949392919061560d565b60048560088111156124ac57fe5b14156124c4576124bd848484612fb5565b9050610b37565b60068560088111156124d257fe5b146124d957fe5b50600083815260076020908152604080832073ffffffffffffffffffffffffffffffffffffffff8616845290915290205460ff16949350505050565b61251d6145b8565b61016080870151610140808801919091528701519086015261253d6145ec565b6125468761111d565b90506125506145ec565b6125598761111d565b90506000612565611d10565b90506125738984838a6131ab565b61257f888383896131ab565b6125938989856020015185602001516132e1565b6125ac8989856040015185604001516003543a8b61332c565b93506125c78982856020015186604001518860000151613481565b6125e08882846020015185604001518860200151613481565b6125f6836020015183602001518b8b858961355f565b50505095945050505050565b60606318e4b14160e01b848484604051602401611d619392919061589e565b60006109328261263085613706565b61378e565b60608301516000908161264985838661217e565b9050600581600881111561265957fe5b141561267b5761267461266c87876137c8565b868487613800565b92506126b2565b600781600881111561268957fe5b14156126a35761267461269c87876137c8565b83866138b4565b6126af818684876122a5565b92505b50509392505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611a2957600054611a2990610a3890339073ffffffffffffffffffffffffffffffffffffffff166138c3565b61270a614561565b6127126145ec565b61271b8561111d565b90506000612727611d10565b9050612735868383876131ab565b600061275283604001518860a00151611b1590919063ffffffff16565b9050600061276087836138e0565b905061277088826003543a6138f6565b945060008460200151905061278c89858388604001518a613481565b612798818a868961396d565b50505050509392505050565b6000806127bc600154846127d590919063ffffffff16565b6000818152600960205260409020549092509050915091565b60006109328261263085613a04565b8251600090816127f585838661217e565b9050600581600881111561280557fe5b14156128185761267461266c8787613adb565b600781600881111561282657fe5b14156126a35761267461269c8787613adb565b80156129ec57600384511161285757612857610a3860008787613b13565b6000612869858263ffffffff613b3216565b7fffffffff00000000000000000000000000000000000000000000000000000000811660009081526002602052604090205490915073ffffffffffffffffffffffffffffffffffffffff16806128c8576128c8610a3860018989613b13565b6040516060907fa85e59e400000000000000000000000000000000000000000000000000000000906129049089908990899089906024016156b3565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608373ffffffffffffffffffffffffffffffffffffffff168360405161298c919061530e565b6000604051808303816000865af19150503d80600081146129c9576040519150601f19603f3d011682016040523d82523d6000602084013e6129ce565b606091505b5091509150816129e6576129e6610a388b8b84613b7e565b50505050505b5050505050565b6129fb614561565b612a06848484612702565b90508281602001511461093257610932610a386002858460200151612602565b60606311c7b72060e01b8383604051602401612a43929190615658565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b82602001514210612b1857612b18610a38600183613b9d565b60408301513a8114612b3257612b32610a38833a84613bba565b60065473ffffffffffffffffffffffffffffffffffffffff168015612b5e57612b5e610a388483613bd9565b60008381526005602052604090205460ff1615612b8357612b83610a38600085613b9d565b606085015173ffffffffffffffffffffffffffffffffffffffff81163314801590612bb65750612bb4868587612635565b155b15612bcb57612bcb610a3860018684896121fd565b505050505050565b73ffffffffffffffffffffffffffffffffffffffff82163314610c1c576006805473ffffffffffffffffffffffffffffffffffffffff83167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b60606320d11f6160e01b8383604051602401612a43929190615551565b3031801561080f57604051339082156108fc029083906000818181858888f19350505050158015610c1c573d6000803e3d6000fd5b60408051808201909152600481527f0c3b823f00000000000000000000000000000000000000000000000000000000602082015290565b606082015173ffffffffffffffffffffffffffffffffffffffff1615612d1357606082015173ffffffffffffffffffffffffffffffffffffffff163314612d1357612d13610a386002836020015133613bf6565b6000612d1d611d10565b90508073ffffffffffffffffffffffffffffffffffffffff16836000015173ffffffffffffffffffffffffffffffffffffffff1614612d6957612d69610a386000846020015184613bf6565b505050565b6000818152600a60205260409081902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558281015183516101408501516101608601519351859473ffffffffffffffffffffffffffffffffffffffff9485169493909316927f02c310a9a43963ff31a754a4099cc435ed498049687539d72d7818d9b093415c92612e0b92909190339061571b565b60405180910390a45050565b606063e946c1bb60e01b848484604051602401611d6193929190615846565b60008282018381101561093257610932610a3860008686612e17565b606063d4092f4f60e01b82604051602401612e6d9190615833565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b600082612f00575060006107c1565b82820282848281612f0d57fe5b041461093257610932610a3860018686612e17565b600081612f3857612f38610a3860038585612e17565b6000828481612f4357fe5b04949350505050565b6000815160001415612f6857612f68610a3860028686866121fd565b81600183510381518110612f7857fe5b016020015160f81c6008811115610b3757fe5b60008160200183511015612fac57612fac610a386005855185602001613c15565b50016020015190565b8051600090612fec837fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff830163ffffffff613c3416565b6040516060907f1626ba7e00000000000000000000000000000000000000000000000000000000906130249088908790602401615551565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290506130b3848363ffffffff613c3416565b600060608673ffffffffffffffffffffffffffffffffffffffff16836040516130dc919061530e565b600060405180830381855afa9150503d8060008114613117576040519150601f19603f3d011682016040523d82523d6000602084013e61311c565b606091505b509150915081801561312f575080516020145b15613191577fb06713810000000000000000000000000000000000000000000000000000000061316682600063ffffffff613b3216565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614945050505050610932565b6131a0610a3889898985613c38565b505050509392505050565b825160ff166003146131da576131da610a388460200151856000015160ff1660068111156131d557fe5b613c59565b606084015173ffffffffffffffffffffffffffffffffffffffff161561322e57606084015173ffffffffffffffffffffffffffffffffffffffff16331461322e5761322e610a386002856020015133613bf6565b602084015173ffffffffffffffffffffffffffffffffffffffff1615613298578173ffffffffffffffffffffffffffffffffffffffff16846020015173ffffffffffffffffffffffffffffffffffffffff161461329857613298610a386001856020015185613bf6565b8351604084015115806132b557506132b584602001518284613c76565b156129ec576132c9858560200151846127e4565b6129ec576129ec610a386000866020015184866121fd565b60a080840151908501516132fa9163ffffffff612ef116565b608080850151908601516133139163ffffffff612ef116565b101561332657613326610a388383613cc9565b50505050565b6133346145b8565b60a088015160009061334c908863ffffffff611b1516565b905060006133638a608001518b60a0015184613ce6565b9050600061337e888b60a00151611b1590919063ffffffff16565b905060006133958b608001518c60a0015184613ce6565b905085156133b2576133ab8c8c85878587613d1a565b94506133c3565b6133c08c8c85878587613dec565b94505b84515160808d015160c08e01516133db929190613ce6565b85516040015284516020015160a08d015160e08e01516133fc929190613ce6565b85516060015260208501515160808c015160c08d015161341d929190613ce6565b856020015160400181815250506134458560200151602001518c60a001518d60e00151613ce6565b6020860151606001526000613460888a63ffffffff612ef116565b86516080908101829052602088015101525050505050979650505050505050565b602081015161349790839063ffffffff612e3616565b600960008581526020019081526020016000208190555082856040015173ffffffffffffffffffffffffffffffffffffffff16866000015173ffffffffffffffffffffffffffffffffffffffff167f6869791f0a34781b29882982cc39e882768cf2c96995c2a110c577c53bc932d58861014001518961016001518a61018001518b6101a001518b338a600001518b602001518c604001518d606001518e608001516040516135509b9a99989796959493929190615767565b60405180910390a45050505050565b8351835160408087015190860151610140870151855160200151613588918b9186908890612839565b6135a28a8961014001518686896020015160200151612839565b6135bc898861018001518584896020015160400151612839565b6135d68a8961018001518685896000015160400151612839565b6135ec8a89610140015186898960400151612839565b6136028988610140015185898960600151612839565b600061361a8b8b88600001516080015188888c613e85565b905080613637578551600060809182018190526020880151909101525b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614801561368757506101a080890151908a01516136879163ffffffff613ee216565b156136c5576136c08b8a6101a0015189866136bb8b60200151606001518c6000015160600151612e3690919063ffffffff16565b612839565b6136f9565b6136df8a896101a0015189858a6020015160600151612839565b6136f98b8a6101a0015189868a6000015160600151612839565b5050505050505050505050565b608081810151825160208085015160408087015160609788015186519685019690962082517fec69816980a3a3ca4554410e60253953e9ff375ba4536a98adfa15cc71541508815294850195909552908301919091529481019490945273ffffffffffffffffffffffffffffffffffffffff9091169183019190915260a082015260c0902090565b6040517f19010000000000000000000000000000000000000000000000000000000000008152600281019290925260228201526042902090565b6040516060907fde047db40000000000000000000000000000000000000000000000000000000090612a439085908590602401615a83565b8051600090601581101561381e5761381e610a3860028787876121fd565b6000613852847fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeb840163ffffffff613f0716565b73ffffffffffffffffffffffffffffffffffffffff80871660009081526008602090815260408083209385168352929052205490915060ff1661389c5761389c610a388683613f47565b6138a98188866015613f64565b979650505050505050565b6000610b378385846001613f64565b6060631de45ad160e01b8383604051602401612a4392919061537c565b60008183106138ef5781610932565b5090919050565b6138fe614561565b6020810184905260a0850151608086015161391a918691613ce6565b815260a085015160c0860151613931918691613ce6565b604082015260a085015160e086015161394b918691613ce6565b6060820152613960828463ffffffff612ef116565b6080820152949350505050565b613987848461016001518486600001518560200151612839565b6139a1848461014001518560000151858560000151612839565b6139bb84846101a001518486604001518560600151612839565b6139d984846101800151856000015186604001518560400151612839565b60006139ef85836080015186600001518661413b565b9050806129ec57600060808301525050505050565b6101408101516101608201516101808301516101a08401516000937ff80322eb8376aafb64eadf8f0d7623f22130fd9491a221e902b713cb984a753493909290916020871015613a5057fe5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe087018051610140890180516101608b0180516101808d0180516101a08f0180519d89528c5160209d8e012087528b519b8d019b909b2084528951998c01999099208152875197909a019690962088526101e085209390945290529190529252919091529050919050565b6040516060907f3efe50c80000000000000000000000000000000000000000000000000000000090612a439085908590602401615a36565b606063488219a660e01b848484604051602401611d619392919061580b565b60008160040183511015613b5357613b53610a386003855185600401613c15565b5001602001517fffffffff000000000000000000000000000000000000000000000000000000001690565b6060634678472b60e01b848484604051602401611d619392919061556a565b606063f598518460e01b8383604051602401612a439291906158fd565b606063a26dac0960e01b848484604051602401611d61939291906155f7565b606063dec4aedf60e01b8383604051602401612a439291906154d8565b606063e53c76c860e01b848484604051602401611d6193929190615867565b6060632800659560e01b848484604051602401611d61939291906158ab565b9052565b6060631b8388f760e01b8585858560405160240161221e94939291906154fc565b606063fdb6ca8d60e01b8383604051602401612a43929190615595565b600080613c84858585612f4c565b90506004816008811115613c9457fe5b1480613cab57506005816008811115613ca957fe5b145b80610de657506007816008811115613cbf57fe5b1495945050505050565b606063b6555d6f60e01b8383604051602401612a43929190615543565b6000613cf3848484614181565b15613d0657613d06610a388585856141e7565b610b3783612172868563ffffffff612ef116565b613d226145b8565b81851184841184861115613d4257613d3b898686614206565b9250613d91565b86841115613d825782518790528251602001869052608088015160a0890151613d6c919089613ce6565b6020808501805192909252905101879052613d91565b613d8e87878787614243565b92505b8115613db7576020808401510151835151613db19163ffffffff611b1516565b60408401525b8015613ddf5782516020908101519084015151613dd99163ffffffff611b1516565b60608401525b50505b9695505050505050565b613df46145b8565b82841115613e0e57613e07878484614206565b9050613e5c565b82841015613e4d5780518590528051602090810185905281015184905260a08601516080870151613e4091908661426e565b6020808301510152613e5c565b613e5985858585614243565b90505b6020808201510151815151613e769163ffffffff611b1516565b60408201529695505050505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff168015613ed85730316000613eb98a84848b8b8a6142c2565b9050613ecb89848385038b8a8a6142c2565b5060019350505050613de2565b6000915050613de2565b6000815183511480156109325750508051602091820120825192909101919091201490565b60008160140183511015613f2857613f28610a386004855185601401613c15565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b606063a15c0d0660e01b8383604051602401612a4392919061537c565b8151600090613f7b8484830363ffffffff613c3416565b6040516060907f20c13b0b0000000000000000000000000000000000000000000000000000000090613fb390889088906024016156f6565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050614042858363ffffffff613c3416565b600060608873ffffffffffffffffffffffffffffffffffffffff168360405161406b919061530e565b600060405180830381855afa9150503d80600081146140a6576040519150601f19603f3d011682016040523d82523d6000602084013e6140ab565b606091505b50915091508180156140be575080516020145b15614120577f20c13b0b000000000000000000000000000000000000000000000000000000006140f582600063ffffffff613b3216565b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614945050505050610b37565b61412f610a388a8a8a856143fa565b50505050949350505050565b60045460009073ffffffffffffffffffffffffffffffffffffffff1680156141775761416c868230318888886142c2565b506001915050610b37565b6000915050610b37565b60008261419357614193610a3861441b565b81158061419e575083155b156141ab57506000610932565b600083806141b557fe5b85840990506141ca858463ffffffff612ef116565b6141dc826103e863ffffffff612ef116565b101595945050505050565b606063339f3de260e01b848484604051602401611d61939291906155f7565b61420e6145b8565b60208082018051859052518101839052815101839052608084015160a0850151614239919085613ce6565b8151529392505050565b61424b6145b8565b805194909452835160209081019390935282840180519290925290519091015290565b600061427b848484614452565b1561428e5761428e610a388585856141e7565b610b37836121726142a682600163ffffffff611b1516565b6142b6888763ffffffff612ef116565b9063ffffffff612e3616565b60008385106142ce5750825b6040516060907fa3b4a3270000000000000000000000000000000000000000000000000000000090614308908690869089906024016153a3565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050509050600060608873ffffffffffffffffffffffffffffffffffffffff168484604051614391919061530e565b60006040518083038185875af1925050503d80600081146143ce576040519150601f19603f3d011682016040523d82523d6000602084013e6143d3565b606091505b5091509150816143ed576143ed610a388b898989866144b6565b5050509695505050505050565b6060635bd0428d60e01b8585858560405160240161221e94939291906153d4565b60408051808201909152600481527fa791837c00000000000000000000000000000000000000000000000000000000602082015290565b60008261446457614464610a3861441b565b81158061446f575083155b1561447c57506000610932565b6000838061448657fe5b85840990508361449c818363ffffffff611b1516565b816144a357fe5b0690506141ca858463ffffffff612ef116565b60606387cb1e7560e01b86868686866040516024016144d99594939291906155b2565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905095945050505050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b6040518060800160405280606081526020016060815260200160008152602001600081525090565b60405180608001604052806145cb614561565b81526020016145d8614561565b815260200160008152602001600081525090565b604080516060810182526000808252602082018190529181019190915290565b604051806101c00160405280600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b803573ffffffffffffffffffffffffffffffffffffffff811681146107c157600080fd5b600082601f830112614707578081fd5b813561471a61471582615b14565b615aed565b81815291506020808301908481018184028601820187101561473b57600080fd5b60005b848110156147625761475088836146d3565b8452928201929082019060010161473e565b505050505092915050565b600082601f83011261477d578081fd5b813561478b61471582615b14565b8181529150602080830190840160005b838110156147c8576147b3876020843589010161488b565b8352602092830192919091019060010161479b565b5050505092915050565b600082601f8301126147e2578081fd5b81356147f061471582615b14565b8181529150602080830190840160005b838110156147c8576148188760208435890101614912565b83526020928301929190910190600101614800565b600082601f83011261483d578081fd5b813561484b61471582615b14565b81815291506020808301908481018184028601820187101561486c57600080fd5b60005b848110156147625781358452928201929082019060010161486f565b600082601f83011261489b578081fd5b813567ffffffffffffffff8111156148b1578182fd5b6148e260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601615aed565b91508082528360208285010111156148f957600080fd5b8060208401602084013760009082016020015292915050565b60006101c0808385031215614925578182fd5b61492e81615aed565b91505061493b83836146d3565b815261494a83602084016146d3565b602082015261495c83604084016146d3565b604082015261496e83606084016146d3565b60608201526080820135608082015260a082013560a082015260c082013560c082015260e082013560e08201526101008083013581830152506101208083013581830152506101408083013567ffffffffffffffff808211156149d057600080fd5b6149dc8683870161488b565b838501526101609250828501359150808211156149f857600080fd5b614a048683870161488b565b83850152610180925082850135915080821115614a2057600080fd5b614a2c8683870161488b565b838501526101a0925082850135915080821115614a4857600080fd5b50614a558582860161488b565b82840152505092915050565b600060a08284031215614a72578081fd5b614a7c60a0615aed565b90508135815260208201356020820152604082013560408201526060820135614aa481615b88565b6060820152608082013567ffffffffffffffff811115614ac357600080fd5b614acf8482850161488b565b60808301525092915050565b600060208284031215614aec578081fd5b61093283836146d3565b60008060408385031215614b08578081fd5b614b1284846146d3565b9150614b2184602085016146d3565b90509250929050565b60008060408385031215614b3c578182fd5b614b4684846146d3565b915060208301358015158114614b5a578182fd5b809150509250929050565b60008060008060808587031215614b7a578182fd5b843567ffffffffffffffff80821115614b91578384fd5b614b9d8883890161476d565b95506020870135915080821115614bb2578384fd5b614bbe888389016146f7565b94506040870135915080821115614bd3578384fd5b614bdf888389016146f7565b93506060870135915080821115614bf4578283fd5b50614c018782880161482d565b91505092959194509250565b600060208284031215614c1e578081fd5b813567ffffffffffffffff811115614c34578182fd5b610b37848285016147d2565b60008060008060808587031215614c55578182fd5b843567ffffffffffffffff80821115614c6c578384fd5b614c78888389016147d2565b95506020870135915080821115614c8d578384fd5b614c99888389016147d2565b94506040870135915080821115614cae578384fd5b614cba8883890161476d565b93506060870135915080821115614ccf578283fd5b50614c018782880161476d565b600080600060608486031215614cf0578081fd5b833567ffffffffffffffff80821115614d07578283fd5b614d13878388016147d2565b94506020860135915080821115614d28578283fd5b614d348783880161482d565b93506040860135915080821115614d49578283fd5b50614d568682870161476d565b9150509250925092565b600080600060608486031215614d74578081fd5b833567ffffffffffffffff80821115614d8b578283fd5b614d97878388016147d2565b9450602086013593506040860135915080821115614d49578283fd5b60008060408385031215614dc5578182fd5b823567ffffffffffffffff80821115614ddc578384fd5b81850186601f820112614ded578485fd5b80359250614dfd61471584615b14565b83815260208082019190838101885b87811015614e3557614e238c848435890101614a61565b85529382019390820190600101614e0c565b50919750880135945050505080821115614e4d578283fd5b50614e5a8582860161476d565b9150509250929050565b600060208284031215614e75578081fd5b5035919050565b60008060408385031215614e8e578182fd5b823591506020830135614b5a81615b88565b600080600060608486031215614eb4578081fd5b833592506020840135614ec681615b88565b9150604084013567ffffffffffffffff811115614ee1578182fd5b614d568682870161488b565b600060208284031215614efe578081fd5b813561093281615baa565b600060208284031215614f1a578081fd5b815161093281615baa565b600060a0828403128015614f37578182fd5b8015614f41578182fd5b50614f4c60a0615aed565b82518152602083015160208201526040830151604082015260608301516060820152608083015160808201528091505092915050565b600060208284031215614f93578081fd5b813567ffffffffffffffff811115614fa9578182fd5b610b3784828501614912565b60008060408385031215614fc7578182fd5b823567ffffffffffffffff80821115614fde578384fd5b614fea86838701614912565b93506020850135915080821115614fff578283fd5b50614e5a8582860161488b565b60008060008060808587031215615021578182fd5b843567ffffffffffffffff80821115615038578384fd5b61504488838901614912565b95506020870135915080821115615059578384fd5b61506588838901614912565b9450604087013591508082111561507a578384fd5b6150868883890161488b565b9350606087013591508082111561509b578283fd5b50614c018782880161488b565b6000806000606084860312156150bc578081fd5b833567ffffffffffffffff808211156150d3578283fd5b6150df87838801614912565b94506020860135935060408601359150808211156150fb578283fd5b50614d568682870161488b565b6000806040838503121561511a578182fd5b823567ffffffffffffffff80821115615131578384fd5b614fea86838701614a61565b73ffffffffffffffffffffffffffffffffffffffff169052565b6000815180845260208401935060208301825b828110156151935761517d8683516151e7565b60a095909501946020919091019060010161516a565b5093949350505050565b600081518084526151b5816020860160208601615b34565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b80518252602081015160208301526040810151604083015260608101516060830152608081015160808301525050565b60006101c061522784845161513d565b6020830151615239602086018261513d565b50604083015161524c604086018261513d565b50606083015161525f606086018261513d565b506080830151608085015260a083015160a085015260c083015160c085015260e083015160e08501526101008084015181860152506101208084015181860152506101408084015182828701526152b88387018261519d565b915050610160915081840151858203838701526152d5828261519d565b9250505061018080840151858303828701526152f1838261519d565b9150506101a091508184015185820383870152613de2828261519d565b60008251615320818460208701615b34565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b600073ffffffffffffffffffffffffffffffffffffffff8616825260806020830152615403608083018661519d565b8281036040840152615415818661519d565b8381036060850152615427818661519d565b98975050505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b828110156154a4577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc088860301845261549285835161519d565b94509285019290850190600101615458565b5092979650505050505050565b6000602082526109326020830184615157565b901515815260200190565b90815260200190565b91825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b600085825273ffffffffffffffffffffffffffffffffffffffff8516602083015260806040830152615531608083018561519d565b82810360608401526138a9818561519d565b918252602082015260400190565b600083825260406020830152610b37604083018461519d565b600084825260606020830152615583606083018561519d565b8281036040840152613de2818561519d565b828152604081016155a583615b7e565b8260208301529392505050565b600086825285602083015273ffffffffffffffffffffffffffffffffffffffff808616604084015280851660608401525060a060808301526138a960a083018461519d565b9283526020830191909152604082015260600190565b93845260ff9290921660208401526040830152606082015260800190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b7fffffffff0000000000000000000000000000000000000000000000000000000092909216825273ffffffffffffffffffffffffffffffffffffffff16602082015260400190565b600060208252610932602083018461519d565b6000608082526156c6608083018761519d565b73ffffffffffffffffffffffffffffffffffffffff95861660208401529390941660408201526060015292915050565b600060408252615709604083018561519d565b8281036020840152610de6818561519d565b60006060825261572e606083018661519d565b8281036020840152615740818661519d565b91505073ffffffffffffffffffffffffffffffffffffffff83166040830152949350505050565b600061016080835261577b8184018f61519d565b838103602085015261578d818f61519d565b91505082810360408401526157a2818d61519d565b83810360608501526157b4818d61519d565b73ffffffffffffffffffffffffffffffffffffffff9b8c16608086015299909a1660a0840152505060c081019590955260e08501939093526101008401919091526101208301526101409091015295945050505050565b600061581685615b60565b84825283602083015260606040830152610de6606083018461519d565b6020810161584083615b6a565b91905290565b6060810161585385615b6a565b938152602081019290925260409091015290565b6060810161587485615b74565b938152602081019290925273ffffffffffffffffffffffffffffffffffffffff1660409091015290565b6060810161585385615b74565b606081016008851061585357fe5b60006158c486615b7e565b85825284602083015273ffffffffffffffffffffffffffffffffffffffff8416604083015260806060830152613de2608083018461519d565b6040810161590a84615b60565b9281526020015290565b60208082526014908201527f5452414e53464552535f5355434345535346554c000000000000000000000000604082015260600190565b60006020825282516080602084015261596760a0840182615157565b602085015191507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08482030160408501526159a28183615157565b604086015160608601526060860151608086015280935050505092915050565b60a081016107c182846151e7565b6000610180820190506159e48284516151e7565b60208301516159f660a08401826151e7565b5060408301516101408301526060909201516101609091015290565b815160ff168152602080830151908201526040918201519181019190915260600190565b600060408252615a496040830185615217565b90508260208301529392505050565b600060608252615a6b6060830186615217565b8460208401528281036040840152613de2818561519d565b60006040825283516040830152602084015160608301526040840151608083015273ffffffffffffffffffffffffffffffffffffffff60608501511660a0830152608084015160a060c0840152615add60e084018261519d565b9150508260208301529392505050565b60405181810167ffffffffffffffff81118282101715615b0c57600080fd5b604052919050565b600067ffffffffffffffff821115615b2a578081fd5b5060209081020190565b60005b83811015615b4f578181015183820152602001615b37565b838111156133265750506000910152565b6002811061080f57fe5b6004811061080f57fe5b6003811061080f57fe5b6007811061080f57fe5b73ffffffffffffffffffffffffffffffffffffffff8116811461080f57600080fd5b7fffffffff000000000000000000000000000000000000000000000000000000008116811461080f57600080fd5b8351602094850120835193850193909320604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f815295860194909452928401929092526060830152608082015260a090209056fea365627a7a723158206fc97c5a1d6fde6b2ada9eb4429966e52d7e2da39180893c04bf55c840b346a16c6578706572696d656e74616cf564736f6c634300050c0040'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; public EIP1271_MAGIC_VALUE = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -151,41 +159,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('EIP1271_MAGIC_VALUE()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('EIP1271_MAGIC_VALUE()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('EIP1271_MAGIC_VALUE()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { /** @@ -229,41 +202,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public allowedValidators = { /** @@ -317,46 +255,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Executes multiple calls of cancelOrder. @@ -387,6 +285,7 @@ export class ExchangeContract extends BaseContract { takerFeeAssetData: string; }>, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); const self = (this as any) as ExchangeContract; @@ -406,6 +305,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchCancelOrders.callAsync(orders, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -435,20 +338,19 @@ export class ExchangeContract extends BaseContract { takerFeeAssetData: string; }>, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders, txData); + const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -499,29 +401,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - txData?: Partial | undefined, - ): Promise { - await (this as any).batchCancelOrders.callAsync(orders, txData); - const txHash = await (this as any).batchCancelOrders.sendTransactionAsync(orders, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -622,72 +501,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - ] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Executes a batch of Exchange method calls in the context of signer(s). @@ -712,6 +525,7 @@ export class ExchangeContract extends BaseContract { }>, signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('transactions', transactions); assert.isArray('signatures', signatures); @@ -732,6 +546,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchExecuteTransactions.callAsync(transactions, signatures, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -755,21 +573,25 @@ export class ExchangeContract extends BaseContract { }>, signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('transactions', transactions); assert.isArray('signatures', signatures); const self = (this as any) as ExchangeContract; - const txHashPromise = self.batchExecuteTransactions.sendTransactionAsync(transactions, signatures, txData); + const txHashPromise = self.batchExecuteTransactions.sendTransactionAsync( + transactions, + signatures, + txData, + opts, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -815,25 +637,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - transactions: Array<{ - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }>, - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).batchExecuteTransactions.callAsync(transactions, signatures, txData); - const txHash = await (this as any).batchExecuteTransactions.sendTransactionAsync( - transactions, - signatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -925,50 +728,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchExecuteTransactions((uint256,uint256,uint256,address,bytes)[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchExecuteTransactions((uint256,uint256,uint256,address,bytes)[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Executes multiple calls of fillOrKillOrder. @@ -1004,6 +763,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); @@ -1025,6 +785,15 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchFillOrKillOrders.callAsync( + orders, + takerAssetFillAmounts, + signatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1059,8 +828,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); @@ -1071,6 +839,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1078,8 +847,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1137,36 +906,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).batchFillOrKillOrders.callAsync(orders, takerAssetFillAmounts, signatures, txData); - const txHash = await (this as any).batchFillOrKillOrders.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1298,84 +1037,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }> - >(returnData); - return abiDecodedReturnData; - }, }; /** * Executes multiple calls of fillOrder. @@ -1411,6 +1072,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); @@ -1432,6 +1094,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchFillOrders.callAsync(orders, takerAssetFillAmounts, signatures, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1466,8 +1132,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); @@ -1478,6 +1143,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1485,8 +1151,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1544,47 +1210,17 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).batchFillOrders.callAsync(orders, takerAssetFillAmounts, signatures, txData); - const txHash = await (this as any).batchFillOrders.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return txHash; - }, - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. - * @param orders Array of order specifications. - * @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell - * in orders. - * @param signatures Proofs that orders have been created by makers. - * @returns Array of amounts filled and fees paid by makers and taker. - */ - async callAsync( + /** + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. + * @param orders Array of order specifications. + * @param takerAssetFillAmounts Array of desired amounts of takerAsset to sell + * in orders. + * @param signatures Proofs that orders have been created by makers. + * @returns Array of amounts filled and fees paid by makers and taker. + */ + async callAsync( orders: Array<{ makerAddress: string; takerAddress: string; @@ -1705,84 +1341,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }> - >(returnData); - return abiDecodedReturnData; - }, }; /** * Executes multiple calls of fillOrder. If any fill reverts, the error is caught and ignored. @@ -1818,6 +1376,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); @@ -1839,6 +1398,15 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchFillOrdersNoThrow.callAsync( + orders, + takerAssetFillAmounts, + signatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1873,8 +1441,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts: BigNumber[], signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isArray('takerAssetFillAmounts', takerAssetFillAmounts); @@ -1885,6 +1452,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmounts, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -1892,8 +1460,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1951,36 +1519,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).batchFillOrdersNoThrow.callAsync(orders, takerAssetFillAmounts, signatures, txData); - const txHash = await (this as any).batchFillOrdersNoThrow.sendTransactionAsync( - orders, - takerAssetFillAmounts, - signatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2112,84 +1650,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }> - >(returnData); - return abiDecodedReturnData; - }, }; /** * Match complementary orders that have a profitable spread. @@ -2245,6 +1705,7 @@ export class ExchangeContract extends BaseContract { leftSignatures: string[], rightSignatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('leftOrders', leftOrders); assert.isArray('rightOrders', rightOrders); @@ -2267,6 +1728,16 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchMatchOrders.callAsync( + leftOrders, + rightOrders, + leftSignatures, + rightSignatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2319,8 +1790,7 @@ export class ExchangeContract extends BaseContract { leftSignatures: string[], rightSignatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('leftOrders', leftOrders); assert.isArray('rightOrders', rightOrders); @@ -2333,6 +1803,7 @@ export class ExchangeContract extends BaseContract { leftSignatures, rightSignatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -2340,8 +1811,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2418,59 +1889,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - leftOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - rightOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - leftSignatures: string[], - rightSignatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).batchMatchOrders.callAsync( - leftOrders, - rightOrders, - leftSignatures, - rightSignatures, - txData, - ); - const txHash = await (this as any).batchMatchOrders.sendTransactionAsync( - leftOrders, - rightOrders, - leftSignatures, - rightSignatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2658,123 +2076,25 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, + }; + /** + * Match complementary orders that have a profitable spread. + * Each order is maximally filled at their respective price point, and + * the matcher receives a profit denominated in either the left maker asset, + * right maker asset, or a combination of both. + */ + public batchMatchOrdersWithMaximalFill = { /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchMatchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - left: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - right: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchMatchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - left: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - right: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, - }; - /** - * Match complementary orders that have a profitable spread. - * Each order is maximally filled at their respective price point, and - * the matcher receives a profit denominated in either the left maker asset, - * right maker asset, or a combination of both. - */ - public batchMatchOrdersWithMaximalFill = { - /** - * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write - * Ethereum operation and will cost gas. - * @param leftOrders Set of orders with the same maker / taker asset. - * @param rightOrders Set of orders to match against `leftOrders` - * @param leftSignatures Proof that left orders were created by the left - * makers. - * @param rightSignatures Proof that right orders were created by the right - * makers. - * @param txData Additional data for transaction - * @returns The hash of the transaction + * Sends an Ethereum transaction executing this method with the supplied parameters. This is a read/write + * Ethereum operation and will cost gas. + * @param leftOrders Set of orders with the same maker / taker asset. + * @param rightOrders Set of orders to match against `leftOrders` + * @param leftSignatures Proof that left orders were created by the left + * makers. + * @param rightSignatures Proof that right orders were created by the right + * makers. + * @param txData Additional data for transaction + * @returns The hash of the transaction */ async sendTransactionAsync( leftOrders: Array<{ @@ -2812,6 +2132,7 @@ export class ExchangeContract extends BaseContract { leftSignatures: string[], rightSignatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('leftOrders', leftOrders); assert.isArray('rightOrders', rightOrders); @@ -2834,6 +2155,16 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.batchMatchOrdersWithMaximalFill.callAsync( + leftOrders, + rightOrders, + leftSignatures, + rightSignatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2886,8 +2217,7 @@ export class ExchangeContract extends BaseContract { leftSignatures: string[], rightSignatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('leftOrders', leftOrders); assert.isArray('rightOrders', rightOrders); @@ -2900,6 +2230,7 @@ export class ExchangeContract extends BaseContract { leftSignatures, rightSignatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -2907,8 +2238,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2985,59 +2316,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - leftOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - rightOrders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - leftSignatures: string[], - rightSignatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).batchMatchOrdersWithMaximalFill.callAsync( - leftOrders, - rightOrders, - leftSignatures, - rightSignatures, - txData, - ); - const txHash = await (this as any).batchMatchOrdersWithMaximalFill.sendTransactionAsync( - leftOrders, - rightOrders, - leftSignatures, - rightSignatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -3225,104 +2503,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchMatchOrdersWithMaximalFill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - left: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - right: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'batchMatchOrdersWithMaximalFill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - left: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - right: Array<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * After calling, the order can not be filled anymore. @@ -3353,6 +2533,7 @@ export class ExchangeContract extends BaseContract { takerFeeAssetData: string; }, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments( @@ -3371,6 +2552,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.cancelOrder.callAsync(order, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3400,19 +2585,18 @@ export class ExchangeContract extends BaseContract { takerFeeAssetData: string; }, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { const self = (this as any) as ExchangeContract; - const txHashPromise = self.cancelOrder.sendTransactionAsync(order, txData); + const txHashPromise = self.cancelOrder.sendTransactionAsync(order, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -3462,29 +2646,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - txData?: Partial | undefined, - ): Promise { - await (this as any).cancelOrder.callAsync(order, txData); - const txHash = await (this as any).cancelOrder.sendTransactionAsync(order, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -3581,72 +2742,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } - ] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes))', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes))', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch @@ -3661,7 +2756,11 @@ export class ExchangeContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(targetOrderEpoch: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + targetOrderEpoch: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch]); @@ -3677,6 +2776,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.cancelOrdersUpTo.callAsync(targetOrderEpoch, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -3692,20 +2795,19 @@ export class ExchangeContract extends BaseContract { awaitTransactionSuccessAsync( targetOrderEpoch: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('targetOrderEpoch', targetOrderEpoch); const self = (this as any) as ExchangeContract; - const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData); + const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -3736,14 +2838,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - targetOrderEpoch: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).cancelOrdersUpTo.callAsync(targetOrderEpoch, txData); - const txHash = await (this as any).cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -3808,30 +2902,6 @@ export class ExchangeContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public cancelled = { /** @@ -3880,48 +2950,12 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, + }; + public currentContextAddress = { /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, - }; - public currentContextAddress = { - /** - * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an - * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas - * since they don't modify state. + * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an + * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas + * since they don't modify state. */ async callAsync(callData: Partial = {}, defaultBlock?: BlockParam): Promise { assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [ @@ -3959,41 +2993,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('currentContextAddress()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Executes an Exchange method call in the context of signer. @@ -4017,6 +3016,7 @@ export class ExchangeContract extends BaseContract { }, signature: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('signature', signature); const self = (this as any) as ExchangeContract; @@ -4036,6 +3036,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.executeTransaction.callAsync(transaction, signature, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -4058,20 +3062,19 @@ export class ExchangeContract extends BaseContract { }, signature: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('signature', signature); const self = (this as any) as ExchangeContract; - const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, signature, txData); + const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction, signature, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -4115,21 +3118,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - transaction: { - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }, - signature: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).executeTransaction.callAsync(transaction, signature, txData); - const txHash = await (this as any).executeTransaction.sendTransactionAsync(transaction, signature, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -4217,48 +3205,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,uint256,uint256,address,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'executeTransaction((uint256,uint256,uint256,address,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Fills the input order. Reverts if exact takerAssetFillAmount not filled. @@ -4293,6 +3239,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); @@ -4313,6 +3260,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.fillOrKillOrder.callAsync(order, takerAssetFillAmount, signature, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -4346,8 +3297,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); @@ -4357,6 +3307,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount, signature, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -4364,8 +3315,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -4421,36 +3372,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).fillOrKillOrder.callAsync(order, takerAssetFillAmount, signature, txData); - const txHash = await (this as any).fillOrKillOrder.sendTransactionAsync( - order, - takerAssetFillAmount, - signature, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -4573,80 +3494,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Fills the input order. @@ -4681,6 +3528,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signature: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); assert.isString('signature', signature); @@ -4701,6 +3549,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.fillOrder.callAsync(order, takerAssetFillAmount, signature, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -4734,21 +3586,26 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signature: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.fillOrder.sendTransactionAsync( + order, + takerAssetFillAmount, + signature, + txData, + opts, + ); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -4804,36 +3661,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - takerAssetFillAmount: BigNumber, - signature: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).fillOrder.callAsync(order, takerAssetFillAmount, signature, txData); - const txHash = await (this as any).fillOrder.sendTransactionAsync( - order, - takerAssetFillAmount, - signature, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -4957,80 +3784,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; public filled = { /** @@ -5079,47 +3832,11 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, - }; - /** - * Gets an asset proxy. - */ - public getAssetProxy = { + }; + /** + * Gets an asset proxy. + */ + public getAssetProxy = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -5168,43 +3885,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetProxyId Id of the asset proxy. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(assetProxyId: string): string { - assert.isString('assetProxyId', assetProxyId); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets information about an order: status, hash, and amount filled. @@ -5281,102 +3961,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param order Order to gather information on. - * @returns The ABI encoded transaction data as a string - */ - 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; - makerFeeAssetData: string; - takerFeeAssetData: 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,bytes,bytes))', - [order], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes))', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes))', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - orderStatus: number; - orderHash: string; - orderTakerAssetFilledAmount: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Verifies that a hash has been signed by the given signer. @@ -5440,50 +4024,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param hash Any 32-byte hash. - * @param signerAddress Address that should have signed the given hash. - * @param signature Proof that the hash has been signed by signer. - * @returns The ABI encoded transaction data as a 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( - 'isValidHashSignature(bytes32,address,bytes)', - [hash, signerAddress.toLowerCase(), signature], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('isValidHashSignature(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('isValidHashSignature(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Verifies that a signature for an order is valid. @@ -5559,101 +4099,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param order The order. - * @param signature Proof that the order has been signed by signer. - * @returns The ABI encoded transaction data as a string - */ - 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - signature: string, - ): string { - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'isValidOrderSignature((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', - [order, signature], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'isValidOrderSignature((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'isValidOrderSignature((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Verifies that a signature for a transaction is valid. @@ -5720,74 +4165,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param transaction The transaction. - * @param signature Proof that the order has been signed by signer. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData( - transaction: { - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }, - signature: string, - ): string { - assert.isString('signature', signature); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'isValidTransactionSignature((uint256,uint256,uint256,address,bytes),bytes)', - [transaction, signature], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'isValidTransactionSignature((uint256,uint256,uint256,address,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - salt: BigNumber; - expirationTimeSeconds: BigNumber; - gasPrice: BigNumber; - signerAddress: string; - data: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'isValidTransactionSignature((uint256,uint256,uint256,address,bytes),bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Calls marketBuyOrdersNoThrow then reverts if < makerAssetFillAmount has been bought. @@ -5823,6 +4200,7 @@ export class ExchangeContract extends BaseContract { makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -5844,6 +4222,15 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.marketBuyOrdersFillOrKill.callAsync( + orders, + makerAssetFillAmount, + signatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -5877,8 +4264,7 @@ export class ExchangeContract extends BaseContract { makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -5889,6 +4275,7 @@ export class ExchangeContract extends BaseContract { makerAssetFillAmount, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -5896,8 +4283,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -5954,36 +4341,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).marketBuyOrdersFillOrKill.callAsync(orders, makerAssetFillAmount, signatures, txData); - const txHash = await (this as any).marketBuyOrdersFillOrKill.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -6109,82 +4466,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersFillOrKill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersFillOrKill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Executes multiple calls of fillOrder until total amount of makerAsset is bought by taker. @@ -6221,6 +4502,7 @@ export class ExchangeContract extends BaseContract { makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -6242,6 +4524,15 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.marketBuyOrdersNoThrow.callAsync( + orders, + makerAssetFillAmount, + signatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -6275,8 +4566,7 @@ export class ExchangeContract extends BaseContract { makerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount); @@ -6287,6 +4577,7 @@ export class ExchangeContract extends BaseContract { makerAssetFillAmount, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -6294,8 +4585,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -6332,55 +4623,25 @@ export class ExchangeContract extends BaseContract { 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,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 validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).marketBuyOrdersNoThrow.callAsync(orders, makerAssetFillAmount, signatures, txData); - const txHash = await (this as any).marketBuyOrdersNoThrow.sendTransactionAsync( - orders, - makerAssetFillAmount, - signatures, - txData, + const self = (this as any) as ExchangeContract; + const encodedData = self._strictEncodeArguments( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', + [orders, makerAssetFillAmount, signatures], ); - return txHash; + const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( + { + to: self.address, + ...txData, + data: encodedData, + }, + self._web3Wrapper.getContractDefaults(), + ); + if (txDataWithDefaults.from !== undefined) { + txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -6507,82 +4768,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Calls marketSellOrdersNoThrow then reverts if < takerAssetFillAmount has been sold. @@ -6618,6 +4803,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -6639,6 +4825,15 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.marketSellOrdersFillOrKill.callAsync( + orders, + takerAssetFillAmount, + signatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -6672,8 +4867,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -6684,6 +4878,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -6691,8 +4886,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -6749,36 +4944,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).marketSellOrdersFillOrKill.callAsync(orders, takerAssetFillAmount, signatures, txData); - const txHash = await (this as any).marketSellOrdersFillOrKill.sendTransactionAsync( - orders, - takerAssetFillAmount, - signatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -6904,82 +5069,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersFillOrKill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersFillOrKill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. @@ -7016,6 +5105,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -7037,6 +5127,15 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.marketSellOrdersNoThrow.callAsync( + orders, + takerAssetFillAmount, + signatures, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -7070,8 +5169,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount: BigNumber, signatures: string[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isBigNumber('takerAssetFillAmount', takerAssetFillAmount); @@ -7082,6 +5180,7 @@ export class ExchangeContract extends BaseContract { takerAssetFillAmount, signatures, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -7089,8 +5188,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -7147,36 +5246,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData?: Partial | undefined, - ): Promise { - await (this as any).marketSellOrdersNoThrow.callAsync(orders, takerAssetFillAmount, signatures, txData); - const txHash = await (this as any).marketSellOrdersNoThrow.sendTransactionAsync( - orders, - takerAssetFillAmount, - signatures, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -7302,82 +5371,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }> - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Match two complementary orders that have a profitable spread. @@ -7432,6 +5425,7 @@ export class ExchangeContract extends BaseContract { leftSignature: string, rightSignature: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); @@ -7452,6 +5446,16 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.matchOrders.callAsync( + leftOrder, + rightOrder, + leftSignature, + rightSignature, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -7502,8 +5506,7 @@ export class ExchangeContract extends BaseContract { leftSignature: string, rightSignature: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); @@ -7514,6 +5517,7 @@ export class ExchangeContract extends BaseContract { leftSignature, rightSignature, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -7521,8 +5525,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -7590,57 +5594,10 @@ export class ExchangeContract extends BaseContract { ); if (txDataWithDefaults.from !== undefined) { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); - } - - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - async validateAndSendTransactionAsync( - 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; - makerFeeAssetData: string; - takerFeeAssetData: 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - leftSignature: string, - rightSignature: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).matchOrders.callAsync(leftOrder, rightOrder, leftSignature, rightSignature, txData); - const txHash = await (this as any).matchOrders.sendTransactionAsync( - leftOrder, - rightOrder, - leftSignature, - rightSignature, - txData, - ); - return txHash; + } + + const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); + return gas; }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -7821,102 +5778,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; /** * Match two complementary orders that have a profitable spread. @@ -7971,6 +5832,7 @@ export class ExchangeContract extends BaseContract { leftSignature: string, rightSignature: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); @@ -7991,6 +5853,16 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.matchOrdersWithMaximalFill.callAsync( + leftOrder, + rightOrder, + leftSignature, + rightSignature, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -8041,8 +5913,7 @@ export class ExchangeContract extends BaseContract { leftSignature: string, rightSignature: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('leftSignature', leftSignature); assert.isString('rightSignature', rightSignature); @@ -8053,6 +5924,7 @@ export class ExchangeContract extends BaseContract { leftSignature, rightSignature, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -8060,8 +5932,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -8134,59 +6006,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - 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; - makerFeeAssetData: string; - takerFeeAssetData: 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; - makerFeeAssetData: string; - takerFeeAssetData: string; - }, - leftSignature: string, - rightSignature: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).matchOrdersWithMaximalFill.callAsync( - leftOrder, - rightOrder, - leftSignature, - rightSignature, - txData, - ); - const txHash = await (this as any).matchOrdersWithMaximalFill.sendTransactionAsync( - leftOrder, - rightOrder, - leftSignature, - rightSignature, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -8366,102 +6185,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'matchOrdersWithMaximalFill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - } { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'matchOrdersWithMaximalFill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - left: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - right: { - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - protocolFeePaid: BigNumber; - }; - profitInLeftMakerAsset: BigNumber; - profitInRightMakerAsset: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; public orderEpoch = { /** @@ -8515,46 +6238,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -8598,41 +6281,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Approves a hash on-chain. @@ -8646,7 +6294,11 @@ export class ExchangeContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(hash: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + hash: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('hash', hash); const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('preSign(bytes32)', [hash]); @@ -8662,6 +6314,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.preSign.callAsync(hash, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -8676,20 +6332,19 @@ export class ExchangeContract extends BaseContract { awaitTransactionSuccessAsync( hash: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('hash', hash); const self = (this as any) as ExchangeContract; - const txHashPromise = self.preSign.sendTransactionAsync(hash, txData); + const txHashPromise = self.preSign.sendTransactionAsync(hash, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -8719,11 +6374,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(hash: string, txData?: Partial | undefined): Promise { - await (this as any).preSign.callAsync(hash, txData); - const txHash = await (this as any).preSign.sendTransactionAsync(hash, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -8780,30 +6430,6 @@ export class ExchangeContract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32)', [hash]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('preSign(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('preSign(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public preSigned = { /** @@ -8857,46 +6483,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public protocolFeeCollector = { /** @@ -8940,41 +6526,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('protocolFeeCollector()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('protocolFeeCollector()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('protocolFeeCollector()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public protocolFeeMultiplier = { /** @@ -9018,41 +6569,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('protocolFeeMultiplier()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('protocolFeeMultiplier()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('protocolFeeMultiplier()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Registers an asset proxy to its asset proxy id. @@ -9066,7 +6582,11 @@ export class ExchangeContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + assetProxy: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('assetProxy', assetProxy); const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); @@ -9082,6 +6602,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.registerAssetProxy.callAsync(assetProxy, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -9096,20 +6620,19 @@ export class ExchangeContract extends BaseContract { awaitTransactionSuccessAsync( assetProxy: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('assetProxy', assetProxy); const self = (this as any) as ExchangeContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -9139,14 +6662,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).registerAssetProxy.callAsync(assetProxy, txData); - const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(assetProxy, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -9209,30 +6724,6 @@ export class ExchangeContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows the owner to update the protocolFeeCollector address. @@ -9249,6 +6740,7 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync( updatedProtocolFeeCollector: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('updatedProtocolFeeCollector', updatedProtocolFeeCollector); const self = (this as any) as ExchangeContract; @@ -9267,6 +6759,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setProtocolFeeCollectorAddress.callAsync(updatedProtocolFeeCollector, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -9282,14 +6778,14 @@ export class ExchangeContract extends BaseContract { awaitTransactionSuccessAsync( updatedProtocolFeeCollector: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('updatedProtocolFeeCollector', updatedProtocolFeeCollector); const self = (this as any) as ExchangeContract; const txHashPromise = self.setProtocolFeeCollectorAddress.sendTransactionAsync( updatedProtocolFeeCollector.toLowerCase(), txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -9297,8 +6793,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -9334,17 +6830,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - updatedProtocolFeeCollector: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).setProtocolFeeCollectorAddress.callAsync(updatedProtocolFeeCollector, txData); - const txHash = await (this as any).setProtocolFeeCollectorAddress.sendTransactionAsync( - updatedProtocolFeeCollector, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -9411,30 +6896,6 @@ export class ExchangeContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('setProtocolFeeCollectorAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('setProtocolFeeCollectorAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Allows the owner to update the protocol fee multiplier. @@ -9450,6 +6911,7 @@ export class ExchangeContract extends BaseContract { async sendTransactionAsync( updatedProtocolFeeMultiplier: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isBigNumber('updatedProtocolFeeMultiplier', updatedProtocolFeeMultiplier); const self = (this as any) as ExchangeContract; @@ -9468,6 +6930,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setProtocolFeeMultiplier.callAsync(updatedProtocolFeeMultiplier, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -9482,14 +6948,14 @@ export class ExchangeContract extends BaseContract { awaitTransactionSuccessAsync( updatedProtocolFeeMultiplier: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('updatedProtocolFeeMultiplier', updatedProtocolFeeMultiplier); const self = (this as any) as ExchangeContract; const txHashPromise = self.setProtocolFeeMultiplier.sendTransactionAsync( updatedProtocolFeeMultiplier, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -9497,8 +6963,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -9533,17 +6999,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - updatedProtocolFeeMultiplier: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).setProtocolFeeMultiplier.callAsync(updatedProtocolFeeMultiplier, txData); - const txHash = await (this as any).setProtocolFeeMultiplier.sendTransactionAsync( - updatedProtocolFeeMultiplier, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -9608,30 +7063,6 @@ export class ExchangeContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('setProtocolFeeMultiplier(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('setProtocolFeeMultiplier(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Approves/unnapproves a Validator contract to verify signatures on signer's behalf @@ -9650,6 +7081,7 @@ export class ExchangeContract extends BaseContract { validatorAddress: string, approval: boolean, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); @@ -9670,6 +7102,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.setSignatureValidatorApproval.callAsync(validatorAddress, approval, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -9686,8 +7122,7 @@ export class ExchangeContract extends BaseContract { validatorAddress: string, approval: boolean, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('validatorAddress', validatorAddress); assert.isBoolean('approval', approval); @@ -9696,6 +7131,7 @@ export class ExchangeContract extends BaseContract { validatorAddress.toLowerCase(), approval, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -9703,8 +7139,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -9743,19 +7179,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - validatorAddress: string, - approval: boolean, - txData?: Partial | undefined, - ): Promise { - await (this as any).setSignatureValidatorApproval.callAsync(validatorAddress, approval, txData); - const txHash = await (this as any).setSignatureValidatorApproval.sendTransactionAsync( - validatorAddress, - approval, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -9827,30 +7250,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, boolean] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, boolean]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * This function may be used to simulate any amount of transfers As they would occur through the Exchange contract. Note that this function will always revert, even if all transfers are successful. However, it may be used with eth_call or with a try/catch pattern in order to simulate the results of the transfers. @@ -9876,6 +7275,7 @@ export class ExchangeContract extends BaseContract { toAddresses: string[], amounts: BigNumber[], txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('assetData', assetData); assert.isArray('fromAddresses', fromAddresses); @@ -9898,6 +7298,16 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.simulateDispatchTransferFromCalls.callAsync( + assetData, + fromAddresses, + toAddresses, + amounts, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -9922,8 +7332,7 @@ export class ExchangeContract extends BaseContract { toAddresses: string[], amounts: BigNumber[], txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('assetData', assetData); assert.isArray('fromAddresses', fromAddresses); @@ -9936,6 +7345,7 @@ export class ExchangeContract extends BaseContract { toAddresses, amounts, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -9943,8 +7353,8 @@ export class ExchangeContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -9993,29 +7403,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetData: string[], - fromAddresses: string[], - toAddresses: string[], - amounts: BigNumber[], - txData?: Partial | undefined, - ): Promise { - await (this as any).simulateDispatchTransferFromCalls.callAsync( - assetData, - fromAddresses, - toAddresses, - amounts, - txData, - ); - const txHash = await (this as any).simulateDispatchTransferFromCalls.sendTransactionAsync( - assetData, - fromAddresses, - toAddresses, - amounts, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -10113,34 +7500,6 @@ export class ExchangeContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string[], string[], string[], BigNumber[]] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'simulateDispatchTransferFromCalls(bytes[],address[],address[],uint256[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string[], string[], string[], BigNumber[]]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder( - 'simulateDispatchTransferFromCalls(bytes[],address[],address[],uint256[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transactionsExecuted = { /** @@ -10189,42 +7548,6 @@ export class ExchangeContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(index_0: string): string { - assert.isString('index_0', index_0); - const self = (this as any) as ExchangeContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transactionsExecuted(bytes32)', [index_0]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('transactionsExecuted(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('transactionsExecuted(bytes32)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -10233,7 +7556,11 @@ export class ExchangeContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ExchangeContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -10249,6 +7576,10 @@ export class ExchangeContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -10262,20 +7593,19 @@ export class ExchangeContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ExchangeContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -10304,11 +7634,6 @@ export class ExchangeContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -10365,30 +7690,6 @@ export class ExchangeContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ExchangeContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index 64e7d4abd3..33a486db3b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,8 +34,10 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ForwarderContract extends BaseContract { - public static deployedBytecode = - '0x6080604052600436106100655760003560e01c8063942d33c011610043578063942d33c014610102578063ae93b97a14610124578063f2fde38b1461013757610065565b8063442026ed14610097578063630f1e6c146100b75780638da5cb5b146100d7575b60025473ffffffffffffffffffffffffffffffffffffffff1633146100955761009561009033610157565b6101f6565b005b3480156100a357600080fd5b506100956100b2366004611bc6565b6101fe565b3480156100c357600080fd5b506100956100d2366004611c06565b6104a8565b3480156100e357600080fd5b506100ec6104f1565b6040516100f99190611dc0565b60405180910390f35b610115610110366004611b1d565b61050d565b6040516100f993929190612047565b610115610132366004611aa0565b610542565b34801561014357600080fd5b50610095610152366004611a68565b61059d565b60606308b1869860e01b826040516024016101729190611dc0565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091529050919050565b805160208201fd5b600061024a600084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff610614169050565b905060405161025890611d97565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156104a35760015460405160009173ffffffffffffffffffffffffffffffffffffffff16906360704108906102d490611d97565b6040519081900381207fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16825261031291600401611e5f565b60206040518083038186803b15801561032a57600080fd5b505afa15801561033e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506103629190810190611a84565b905073ffffffffffffffffffffffffffffffffffffffff811661038a5761038a61009061066a565b60006103d6601086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929392505063ffffffff6106c4169050565b6040517f095ea7b300000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff82169063095ea7b39061044d9085907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90600401611de1565b602060405180830381600087803b15801561046757600080fd5b505af115801561047b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061049f9190810190611ba6565b5050505b505050565b6104b0610704565b6104a383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525085925061074d915050565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b600080600061051a610838565b6105258888886108cd565b90935091506105358386866109f0565b9050955095509592505050565b600080600061054f610838565b6000610573670de0b6b3a764000061056d888263ffffffff610b8f16565b34610bb2565b9050610580888289610bdc565b90945092506105908487876109f0565b9150509450945094915050565b6105a5610704565b73ffffffffffffffffffffffffffffffffffffffff81166105d0576105cb610090610d9f565b610611565b600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b60008160040183511015610635576106356100906003855185600401610dd6565b5060208183018101519101907fffffffff00000000000000000000000000000000000000000000000000000000165b92915050565b6040805160048152602481019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167ff3b96b8d0000000000000000000000000000000000000000000000000000000017905290565b600081601401835110156106e5576106e56100906004855185601401610dd6565b50016014015173ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff16331461074b5760005461074b9061009090339073ffffffffffffffffffffffffffffffffffffffff16610e7b565b565b600061075f838263ffffffff61061416565b905060405161076d90611d97565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614156107c9576107c48383610f1d565b6104a3565b6040516107d590611d45565b60405180910390207bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916141561082c576107c48383611085565b6104a361009082611152565b346108485761084861009061116d565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b1580156108b257600080fd5b505af11580156108c6573d6000803e3d6000fd5b5050505050565b82516000908190815b8181146109d1578681815181106108e957fe5b6020026020010151608001516000148061091a575086818151811061090a57fe5b602002602001015160a001516000145b15610924576109c9565b6000610936878563ffffffff6111c716565b905060008061096c8a858151811061094a57fe5b602002602001015189868151811061095e57fe5b6020026020010151856111e6565b915091506109928a858151811061097f57fe5b602002602001015161014001518261074d565b6109a2878363ffffffff610b8f16565b96506109b4868263ffffffff610b8f16565b95508886106109c5575050506109d1565b5050505b6001016108d6565b50848210156109e7576109e76100908684611339565b50935093915050565b600066b1a2bc2ec50000831115610a0d57610a0d61009084611356565b34841115610a2257610a226100908534611371565b6000610a34348663ffffffff6111c716565b9050610a4984670de0b6b3a764000087610bb2565b915080821115610a6057610a60610090838361138e565b8015610b87576002546040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90911690632e1a7d4d90610abc908490600401612030565b600060405180830381600087803b158015610ad657600080fd5b505af1158015610aea573d6000803e3d6000fd5b505050506000821115610b3c5760405173ffffffffffffffffffffffffffffffffffffffff84169083156108fc029084906000818181858888f19350505050158015610b3a573d6000803e3d6000fd5b505b6000610b4e828463ffffffff6111c716565b90508015610b8557604051339082156108fc029083906000818181858888f19350505050158015610b83573d6000803e3d6000fd5b505b505b509392505050565b600082820183811015610bab57610bab610090600086866113ab565b9392505050565b6000610bd483610bc8868563ffffffff6113ca16565b9063ffffffff6113fb16565b949350505050565b6000806000855190506000610c97600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16631ce4c78b6040518163ffffffff1660e01b815260040160206040518083038186803b158015610c5257600080fd5b505afa158015610c66573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610c8a9190810190611cad565b3a9063ffffffff6113ca16565b905060005b828114610d9457878181518110610caf57fe5b60200260200101516080015160001480610ce05750878181518110610cd057fe5b602002602001015160a001516000145b15610cea57610d8c565b6000610d0c83610d008a8963ffffffff6111c716565b9063ffffffff6111c716565b9050600080610d428b8581518110610d2057fe5b60200260200101518a8681518110610d3457fe5b602002602001015185611425565b91509150610d558b858151811061097f57fe5b610d65888363ffffffff610b8f16565b9750610d77878263ffffffff610b8f16565b9650898810610d8857505050610d94565b5050505b600101610c9c565b505050935093915050565b60408051808201909152600481527fe69edc3e00000000000000000000000000000000000000000000000000000000602082015290565b6060632800659560e01b848484604051602401610df593929190611ec1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915290509392505050565b6060631de45ad160e01b8383604051602401610e98929190611e07565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152905092915050565b6000610f3083601063ffffffff6106c416565b9050600060608273ffffffffffffffffffffffffffffffffffffffff16604051610f5990611d6e565b60405180910390203386604051602401610f74929190611de1565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909416939093179092529051610ffd9190611d29565b6000604051808303816000865af19150503d806000811461103a576040519150601f19603f3d011682016040523d82523d6000602084013e61103f565b606091505b50915091508161105557611055610090826114ea565b3d15611074576000915060203d14156110745760206000803e60005191505b816108c6576108c6610090826114ea565b806001146110995761109961009082611505565b60006110ac83601063ffffffff6106c416565b905060006110c184602463ffffffff61152016565b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815290915073ffffffffffffffffffffffffffffffffffffffff8316906323b872dd9061111a90309033908690600401611e2e565b600060405180830381600087803b15801561113457600080fd5b505af1158015611148573d6000803e3d6000fd5b5050505050505050565b6060637996a27160e01b826040516024016101729190611e5f565b6040805160048152602481019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8c0e562b0000000000000000000000000000000000000000000000000000000017905290565b6000828211156111e0576111e0610090600285856113ab565b50900390565b6000808460e001516000148061121257506101608501516101a08601516112129163ffffffff61152c16565b1561128057600061122c8660a00151876080015186611552565b905061123661172e565b61124187838861157c565b9050611272816080015161126683606001518460200151610b8f90919063ffffffff16565b9063ffffffff610b8f16565b905190935091506113319050565b6101408501516101a086015161129b9163ffffffff61152c16565b156113205760006112cb8660a001516112c58860e0015189608001516111c790919063ffffffff16565b86611552565b90506112d561172e565b6112e087838861157c565b90506112fd81608001518260200151610b8f90919063ffffffff16565b60608201518251919550611317919063ffffffff6111c716565b92505050611331565b611331610090866101a001516116e9565b935093915050565b60606391353a0c60e01b8383604051602401610e98929190612039565b6060631174fb8060e01b826040516024016101729190612030565b606063cdcbed5d60e01b8383604051602401610e98929190612039565b606063ecf40fd960e01b8383604051602401610e98929190612039565b606063e946c1bb60e01b848484604051602401610df593929190611e9f565b6000826113d957506000610664565b828202828482816113e657fe5b0414610bab57610bab610090600186866113ab565b60008161141157611411610090600385856113ab565b600082848161141c57fe5b04949350505050565b6000808460e001516000148061145157506101408501516101a08601516114519163ffffffff61152c16565b156114a85761145e61172e565b61146986858761157c565b905061148681608001518260200151610b8f90919063ffffffff16565b606082015182519194506114a0919063ffffffff6111c716565b915050611331565b6101608501516101a08601516114c39163ffffffff61152c16565b156113205760a085015160e086015160009161122c916112c590829063ffffffff610b8f16565b6060635e7eb60f60e01b826040516024016101729190611e8c565b606063baffa47460e01b826040516024016101729190612030565b6000610bab8383611704565b600081518351148015610bab575081805190602001208380519060200120149392505050565b6000610bd483610bc861156c82600163ffffffff6111c716565b611266888763ffffffff6113ca16565b61158461172e565b6040516060907f9b44d55600000000000000000000000000000000000000000000000000000000906115be90879087908790602401611ecf565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090941693909317909252600154915190925073ffffffffffffffffffffffffffffffffffffffff90911690600090606090839061166f908690611d29565b6000604051808303816000865af19150503d80600081146116ac576040519150601f19603f3d011682016040523d82523d6000602084013e6116b1565b606091505b509150915081156116de57805160a0146116c757fe5b808060200190516116db9190810190611c50565b94505b505050509392505050565b60606331360af160e01b826040516024016101729190611e8c565b60008160200183511015611725576117256100906005855185602001610dd6565b50016020015190565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b8035610664816120d4565b600082601f830112611778578081fd5b813561178b61178682612084565b61205d565b8181529150602080830190840160005b838110156117c8576117b387602084358901016119e1565b8352602092830192919091019060010161179b565b5050505092915050565b600082601f8301126117e2578081fd5b81356117f061178682612084565b818152915060208083019084810160005b8481101561198f57813587016101c0807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0838c0301121561184157600080fd5b61184a8161205d565b6118568b87850161175d565b81526118658b6040850161175d565b868201526118768b6060850161175d565b60408201526118888b6080850161175d565b606082015260a0830135608082015260c083013560a082015260e083013560c08201526101008084013560e0830152610120808501358284015261014091508185013581840152506101608085013567ffffffffffffffff808211156118ed57600080fd5b6118fb8f8b848a01016119e1565b8486015261018093508387013591508082111561191757600080fd5b6119258f8b848a01016119e1565b838601526101a092508287013591508082111561194157600080fd5b61194f8f8b848a01016119e1565b848601528587013593508084111561196657600080fd5b50506119768d89848801016119e1565b9083015250865250509282019290820190600101611801565b505050505092915050565b60008083601f8401126119ab578182fd5b50813567ffffffffffffffff8111156119c2578182fd5b6020830191508360208285010111156119da57600080fd5b9250929050565b600082601f8301126119f1578081fd5b813567ffffffffffffffff811115611a07578182fd5b611a3860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161205d565b9150808252836020828501011115611a4f57600080fd5b8060208401602084013760009082016020015292915050565b600060208284031215611a79578081fd5b8135610bab816120d4565b600060208284031215611a95578081fd5b8151610bab816120d4565b60008060008060808587031215611ab5578283fd5b843567ffffffffffffffff80821115611acc578485fd5b611ad8888389016117d2565b95506020870135915080821115611aed578485fd5b50611afa87828801611768565b935050604085013591506060850135611b12816120d4565b939692955090935050565b600080600080600060a08688031215611b34578081fd5b853567ffffffffffffffff80821115611b4b578283fd5b611b5789838a016117d2565b9650602088013595506040880135915080821115611b73578283fd5b50611b8088828901611768565b935050606086013591506080860135611b98816120d4565b809150509295509295909350565b600060208284031215611bb7578081fd5b81518015158114610bab578182fd5b60008060208385031215611bd8578182fd5b823567ffffffffffffffff811115611bee578283fd5b611bfa8582860161199a565b90969095509350505050565b600080600060408486031215611c1a578283fd5b833567ffffffffffffffff811115611c30578384fd5b611c3c8682870161199a565b909790965060209590950135949350505050565b600060a0828403128015611c62578182fd5b8015611c6c578182fd5b50611c7760a061205d565b82518152602083015160208201526040830151604082015260608301516060820152608083015160808201528091505092915050565b600060208284031215611cbe578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff169052565b60008151808452611cf78160208601602086016120a4565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008251611d3b8184602087016120a4565b9190910192915050565b7f455243373231546f6b656e28616464726573732c75696e7432353629000000008152601c0190565b7f7472616e7366657228616464726573732c75696e743235362900000000000000815260190190565b7f4552433230546f6b656e28616464726573732900000000000000000000000000815260130190565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff9384168152919092166020820152604081019190915260600190565b7fffffffff0000000000000000000000000000000000000000000000000000000091909116815260200190565b600060208252610bab6020830184611cdf565b6060810160048510611ead57fe5b938152602081019290925260409091015290565b6060810160088510611ead57fe5b600060608252611ee3606083018651611cc5565b6020850151611ef56080840182611cc5565b506040850151611f0860a0840182611cc5565b506060850151611f1b60c0840182611cc5565b50608085015160e083015260a0850151610100818185015260c08701519150610120828186015260e0880151925061014083818701528289015193506101609250838387015281890151935061018091508382870152808901519350506101c06101a08181880152611f91610220880186611cdf565b848b015195507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa09450848882030183890152611fcd8187611cdf565b925050828a0151945083878303016101e0880152611feb8286611cdf565b9250808a015194505050818582030161020086015261200a8184611cdf565b91505085602085015283810360408501526120258186611cdf565b979650505050505050565b90815260200190565b918252602082015260400190565b9283526020830191909152604082015260600190565b60405181810167ffffffffffffffff8111828210171561207c57600080fd5b604052919050565b600067ffffffffffffffff82111561209a578081fd5b5060209081020190565b60005b838110156120bf5781810151838201526020016120a7565b838111156120ce576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461061157600080fdfea365627a7a72315820afeb88c9cc19090963cb885eb76d709ca1a151f8f73996031898e2b50578a89b6c6578706572696d656e74616cf564736f6c634300050c0040'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; /** * Approves the respective proxy for a given asset to transfer tokens on the Forwarder contract's behalf. * This is necessary because an order fee denominated in the maker asset (i.e. a percentage fee) is sent by the @@ -45,7 +53,11 @@ export class ForwarderContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(assetData: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + assetData: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('assetData', assetData); const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments('approveMakerAssetProxy(bytes)', [assetData]); @@ -61,6 +73,10 @@ export class ForwarderContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approveMakerAssetProxy.callAsync(assetData, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -75,20 +91,19 @@ export class ForwarderContract extends BaseContract { awaitTransactionSuccessAsync( assetData: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('assetData', assetData); const self = (this as any) as ForwarderContract; - const txHashPromise = self.approveMakerAssetProxy.sendTransactionAsync(assetData, txData); + const txHashPromise = self.approveMakerAssetProxy.sendTransactionAsync(assetData, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -118,14 +133,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetData: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).approveMakerAssetProxy.callAsync(assetData, txData); - const txHash = await (this as any).approveMakerAssetProxy.sendTransactionAsync(assetData, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -182,30 +189,6 @@ export class ForwarderContract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('approveMakerAssetProxy(bytes)', [assetData]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('approveMakerAssetProxy(bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('approveMakerAssetProxy(bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction. @@ -249,6 +232,7 @@ export class ForwarderContract extends BaseContract { feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isBigNumber('makerAssetBuyAmount', makerAssetBuyAmount); @@ -272,6 +256,17 @@ export class ForwarderContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.marketBuyOrdersWithEth.callAsync( + orders, + makerAssetBuyAmount, + signatures, + feePercentage, + feeRecipient, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -311,8 +306,7 @@ export class ForwarderContract extends BaseContract { feePercentage: BigNumber, feeRecipient: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isBigNumber('makerAssetBuyAmount', makerAssetBuyAmount); @@ -327,6 +321,7 @@ export class ForwarderContract extends BaseContract { feePercentage, feeRecipient.toLowerCase(), txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -334,8 +329,8 @@ export class ForwarderContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -400,47 +395,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - makerAssetBuyAmount: BigNumber, - signatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).marketBuyOrdersWithEth.callAsync( - orders, - makerAssetBuyAmount, - signatures, - feePercentage, - feeRecipient, - txData, - ); - const txHash = await (this as any).marketBuyOrdersWithEth.sendTransactionAsync( - orders, - makerAssetBuyAmount, - signatures, - feePercentage, - feeRecipient, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -570,82 +524,6 @@ export class ForwarderContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - BigNumber, - string[], - BigNumber, - string - ] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[],uint256,address)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - BigNumber, - string[], - BigNumber, - string - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [BigNumber, BigNumber, BigNumber] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[],uint256,address)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber, BigNumber]>( - returnData, - ); - return abiDecodedReturnData; - }, }; /** * Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent @@ -685,6 +563,7 @@ export class ForwarderContract extends BaseContract { feePercentage: BigNumber, feeRecipient: string, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isArray('orders', orders); assert.isArray('signatures', signatures); @@ -707,6 +586,16 @@ export class ForwarderContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.marketSellOrdersWithEth.callAsync( + orders, + signatures, + feePercentage, + feeRecipient, + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -744,8 +633,7 @@ export class ForwarderContract extends BaseContract { feePercentage: BigNumber, feeRecipient: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isArray('orders', orders); assert.isArray('signatures', signatures); @@ -758,6 +646,7 @@ export class ForwarderContract extends BaseContract { feePercentage, feeRecipient.toLowerCase(), txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -765,8 +654,8 @@ export class ForwarderContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -828,44 +717,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - orders: Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - signatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).marketSellOrdersWithEth.callAsync( - orders, - signatures, - feePercentage, - feeRecipient, - txData, - ); - const txHash = await (this as any).marketSellOrdersWithEth.sendTransactionAsync( - orders, - signatures, - feePercentage, - feeRecipient, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -989,80 +840,6 @@ export class ForwarderContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - string[], - BigNumber, - string - ] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],uint256,address)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - makerFeeAssetData: string; - takerFeeAssetData: string; - }>, - string[], - BigNumber, - string - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [BigNumber, BigNumber, BigNumber] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder( - 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],uint256,address)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber, BigNumber]>( - returnData, - ); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -1106,41 +883,6 @@ export class ForwarderContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ForwarderContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -1149,7 +891,11 @@ export class ForwarderContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as ForwarderContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -1165,6 +911,10 @@ export class ForwarderContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1178,20 +928,19 @@ export class ForwarderContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as ForwarderContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1220,11 +969,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1281,30 +1025,6 @@ export class ForwarderContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Withdraws assets from this contract. The contract formerly required a ZRX balance in order @@ -1324,6 +1044,7 @@ export class ForwarderContract extends BaseContract { assetData: string, amount: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); @@ -1341,6 +1062,10 @@ export class ForwarderContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.withdrawAsset.callAsync(assetData, amount, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1357,21 +1082,20 @@ export class ForwarderContract extends BaseContract { assetData: string, amount: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('assetData', assetData); assert.isBigNumber('amount', amount); const self = (this as any) as ForwarderContract; - const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, amount, txData); + const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData, amount, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1407,15 +1131,6 @@ export class ForwarderContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetData: string, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).withdrawAsset.callAsync(assetData, amount, txData); - const txHash = await (this as any).withdrawAsset.sendTransactionAsync(assetData, amount, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1484,30 +1199,6 @@ export class ForwarderContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as ForwarderContract; - const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 4a91819df5..30aed03216 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 @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IAssetProxyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; /** * Transfers assets. Either succeeds or throws. @@ -49,6 +58,7 @@ export class IAssetProxyContract extends BaseContract { to: string, amount: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('assetData', assetData); assert.isString('from', from); @@ -73,6 +83,10 @@ export class IAssetProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(assetData, from, to, amount, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -93,8 +107,7 @@ export class IAssetProxyContract extends BaseContract { to: string, amount: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('assetData', assetData); assert.isString('from', from); @@ -107,6 +120,7 @@ export class IAssetProxyContract extends BaseContract { to.toLowerCase(), amount, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -114,8 +128,8 @@ export class IAssetProxyContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -162,17 +176,6 @@ export class IAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(assetData, from, to, amount, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(assetData, from, to, amount, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -256,30 +259,6 @@ export class IAssetProxyContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, string, BigNumber] { - const self = (this as any) as IAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as IAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the proxy id associated with the proxy address. @@ -306,7 +285,7 @@ export class IAssetProxyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -319,41 +298,6 @@ export class IAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as IAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as IAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as IAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 d1cd5b401b..a1a699fde1 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IValidatorContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; /** * Verifies that a signature is valid. @@ -91,51 +100,6 @@ export class IValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param hash Message hash that is signed. - * @param signerAddress Address that should have signed the given hash. - * @param signature Proof of signing. - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as IValidatorContract; - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as IValidatorContract; - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 9c8399f017..29a1001c9b 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class IWalletContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; /** * Validates a hash with the `Wallet` signature type. @@ -84,48 +93,6 @@ export class IWalletContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param hash Message hash that is signed. - * @param signature Proof of signing. - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as IWalletContract; - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as IWalletContract; - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, 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 ddac12e1de..33b681ef8b 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 @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -55,6 +61,9 @@ export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLog // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class MultiAssetProxyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b50600436106100d45760003560e01c80639ad2674411610081578063c585bb931161005b578063c585bb9314610789578063d39de6e9146107bc578063f2fde38b14610814576100d4565b80639ad26744146106cc578063ae25532e14610705578063b918161114610742576100d4565b806360704108116100b2578063607041081461065257806370712939146106915780638da5cb5b146106c4576100d4565b80633fd3c9971461059857806342f1181e14610600578063494503d414610635575b7fffffffff00000000000000000000000000000000000000000000000000000000600035167fa85e59e400000000000000000000000000000000000000000000000000000000811415610592573360005260026020526040600020546101a5577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1553454e4445525f4e4f545f415554484f52495a454400000000000000604052600060605260646000fd5b600480350180356020600482030660448210171561022e577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c19494e56414c49445f41535345545f444154415f4c454e475448000000604052600060605260646000fd5b602081018201368111156102ad577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c16494e56414c49445f41535345545f444154415f454e44000000000000604052600060605260646000fd5b5050602481013560448201356044820183016020810335925060448201840160208103358085031561034a577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c0f4c454e4754485f4d49534d4154434800000000000000000000000000604052600060605260646000fd5b5060646000803760806004526000936064359060200285805b82811015610587578086013584810281868204148615176103ef577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1055494e543235365f4f564552464c4f57000000000000000000000000604052600060605260646000fd5b60649081528287013589018b01604481019250018135600481101561049e577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1e4c454e4754485f475245415445525f5448414e5f335f5245515549526040527f454400000000000000000000000000000000000000000000000000000000000060605260646000fd5b7fffffffff000000000000000000000000000000000000000000000000000000008235168b8103156104df57809b508b608452600160a45260406084205495505b5084610556577f08c379a0000000000000000000000000000000000000000000000000000000006000527c20000000000000000000000000000000000000000000000000000000006020527c1a41535345545f50524f58595f444f45535f4e4f545f45584953540000604052600060605260646000fd5b60208101836084376000808260a401600080895af1925050508061057e573d6000803e3d6000fd5b50602001610363565b505050505050505050005b50600080fd5b6105d7600480360360208110156105ae57600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610847565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b6106336004803603602081101561061657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661086f565b005b6105d76004803603602081101561064b57600080fd5b5035610a5b565b6105d76004803603602081101561066857600080fd5b50357fffffffff0000000000000000000000000000000000000000000000000000000016610a8f565b610633600480360360208110156106a757600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610ad9565b6105d7610dcc565b610633600480360360408110156106e257600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610de8565b61070d611199565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b6107756004803603602081101561075857600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111cf565b604080519115158252519081900360200190f35b6106336004803603602081101561079f57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166111e4565b6107c4611446565b60408051602080825283518183015283519192839290830191858101910280838360005b838110156108005781810151838201526020016107e8565b505050509050019250505060405180910390f35b6106336004803603602081101561082a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff166114b5565b60016020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff1633146108f557604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090205460ff161561098a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f5441524745545f414c52454144595f415554484f52495a454400000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915560038054918201815583527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b0180547fffffffffffffffffffffffff00000000000000000000000000000000000000001684179055513392917f3147867c59d17e8fa9d522465651d44aae0a9e38f902f3475b97e58072f0ed4c91a350565b60038181548110610a6857fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff16905081565b7fffffffff000000000000000000000000000000000000000000000000000000001660009081526001602052604090205473ffffffffffffffffffffffffffffffffffffffff1690565b60005473ffffffffffffffffffffffffffffffffffffffff163314610b5f57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526002602052604090205460ff16610bf357604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8116600090815260026020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555b600354811015610d85578173ffffffffffffffffffffffffffffffffffffffff1660038281548110610c6d57fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161415610d7d57600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8101908110610cc557fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff9092169183908110610cf857fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190610d77908261159b565b50610d85565b600101610c3f565b50604051339073ffffffffffffffffffffffffffffffffffffffff8316907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a350565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b60005473ffffffffffffffffffffffffffffffffffffffff163314610e6e57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff821660009081526002602052604090205460ff16610f0257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f5441524745545f4e4f545f415554484f52495a45440000000000000000000000604482015290519081900360640190fd5b6003548110610f7257604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f494e4445585f4f55545f4f465f424f554e445300000000000000000000000000604482015290519081900360640190fd5b8173ffffffffffffffffffffffffffffffffffffffff1660038281548110610f9657fe5b60009182526020909120015473ffffffffffffffffffffffffffffffffffffffff161461102457604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f415554484f52495a45445f414444524553535f4d49534d415443480000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff8216600090815260026020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810190811061109f57fe5b6000918252602090912001546003805473ffffffffffffffffffffffffffffffffffffffff90921691839081106110d257fe5b600091825260209091200180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600380547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190611151908261159b565b50604051339073ffffffffffffffffffffffffffffffffffffffff8416907f1f32c1b084e2de0713b8fb16bd46bb9df710a3dbeae2f3ca93af46e016dcc6b090600090a35050565b604080517f4d756c746941737365742875696e743235365b5d2c62797465735b5d290000008152905190819003601d0190205b90565b60026020526000908152604090205460ff1681565b60005473ffffffffffffffffffffffffffffffffffffffff16331461126a57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b60008173ffffffffffffffffffffffffffffffffffffffff1663ae25532e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156112b257600080fd5b505afa1580156112c6573d6000803e3d6000fd5b505050506040513d60208110156112dc57600080fd5b50517fffffffff00000000000000000000000000000000000000000000000000000000811660009081526001602052604090205490915073ffffffffffffffffffffffffffffffffffffffff16801561139657604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f41535345545f50524f58595f414c52454144595f455849535453000000000000604482015290519081900360640190fd5b7fffffffff00000000000000000000000000000000000000000000000000000000821660008181526001602090815260409182902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff881690811790915582519384529083015280517fd2c6b762299c609bdb96520b58a49bfb80186934d4f71a86a367571a15c031949281900390910190a1505050565b606060038054806020026020016040519081016040528092919081815260200182805480156114ab57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611480575b5050505050905090565b60005473ffffffffffffffffffffffffffffffffffffffff16331461153b57604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4f4e4c595f434f4e54524143545f4f574e455200000000000000000000000000604482015290519081900360640190fd5b73ffffffffffffffffffffffffffffffffffffffff81161561159857600080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83161790555b50565b8154818355818111156115bf576000838152602090206115bf9181019083016115c4565b505050565b6111cc91905b808211156115de57600081556001016115ca565b509056fea265627a7a72315820ff218c9e47c47135d1028b03281d63826ba3569217fc501ee67c0661fa98fc5164736f6c634300050b0032'; public assetProxies = { @@ -100,42 +109,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Authorizes an address. @@ -148,7 +121,11 @@ export class MultiAssetProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target.toLowerCase()]); @@ -164,6 +141,10 @@ export class MultiAssetProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.addAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -178,20 +159,19 @@ export class MultiAssetProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -221,11 +201,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).addAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).addAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -284,30 +259,6 @@ export class MultiAssetProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorities = { /** @@ -356,42 +307,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): BigNumber { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets an asset proxy. @@ -445,43 +360,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetProxyId Id of the asset proxy. - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(assetProxyId: string): string { - assert.isString('assetProxyId', assetProxyId); - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -494,7 +372,11 @@ export class MultiAssetProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(target: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + target: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target.toLowerCase()]); @@ -510,6 +392,10 @@ export class MultiAssetProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddress.callAsync(target, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -524,20 +410,19 @@ export class MultiAssetProxyContract extends BaseContract { awaitTransactionSuccessAsync( target: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData); + const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -567,11 +452,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(target: string, txData?: Partial | undefined): Promise { - await (this as any).removeAuthorizedAddress.callAsync(target, txData); - const txHash = await (this as any).removeAuthorizedAddress.sendTransactionAsync(target, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -630,30 +510,6 @@ export class MultiAssetProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public owner = { /** @@ -697,41 +553,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('owner()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Removes authorizion of an address. @@ -749,6 +570,7 @@ export class MultiAssetProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('target', target); assert.isBigNumber('index', index); @@ -769,6 +591,10 @@ export class MultiAssetProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.removeAuthorizedAddressAtIndex.callAsync(target, index, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -785,8 +611,7 @@ export class MultiAssetProxyContract extends BaseContract { target: string, index: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('target', target); assert.isBigNumber('index', index); @@ -795,6 +620,7 @@ export class MultiAssetProxyContract extends BaseContract { target.toLowerCase(), index, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -802,8 +628,8 @@ export class MultiAssetProxyContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -842,19 +668,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - target: string, - index: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).removeAuthorizedAddressAtIndex.callAsync(target, index, txData); - const txHash = await (this as any).removeAuthorizedAddressAtIndex.sendTransactionAsync( - target, - index, - txData, - ); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -926,30 +739,6 @@ export class MultiAssetProxyContract extends BaseContract { ); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, BigNumber] { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the proxy id associated with the proxy address. @@ -976,7 +765,7 @@ export class MultiAssetProxyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -989,41 +778,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public authorized = { /** @@ -1072,44 +826,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Registers an asset proxy to its asset proxy id. @@ -1123,7 +839,11 @@ export class MultiAssetProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(assetProxy: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + assetProxy: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('assetProxy', assetProxy); const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy.toLowerCase()]); @@ -1139,6 +859,10 @@ export class MultiAssetProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.registerAssetProxy.callAsync(assetProxy, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1153,20 +877,19 @@ export class MultiAssetProxyContract extends BaseContract { awaitTransactionSuccessAsync( assetProxy: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('assetProxy', assetProxy); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData); + const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1196,14 +919,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - assetProxy: string, - txData?: Partial | undefined, - ): Promise { - await (this as any).registerAssetProxy.callAsync(assetProxy, txData); - const txHash = await (this as any).registerAssetProxy.sendTransactionAsync(assetProxy, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1266,30 +981,6 @@ export class MultiAssetProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets all authorized addresses. @@ -1337,41 +1028,6 @@ export class MultiAssetProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string[] { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferOwnership = { /** @@ -1380,7 +1036,11 @@ export class MultiAssetProxyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + newOwner: string, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('newOwner', newOwner); const self = (this as any) as MultiAssetProxyContract; const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner.toLowerCase()]); @@ -1396,6 +1056,10 @@ export class MultiAssetProxyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferOwnership.callAsync(newOwner, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1409,20 +1073,19 @@ export class MultiAssetProxyContract extends BaseContract { awaitTransactionSuccessAsync( newOwner: string, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('newOwner', newOwner); const self = (this as any) as MultiAssetProxyContract; - const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData); + const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner.toLowerCase(), txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1451,11 +1114,6 @@ export class MultiAssetProxyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(newOwner: string, txData?: Partial | undefined): Promise { - await (this as any).transferOwnership.callAsync(newOwner, txData); - const txHash = await (this as any).transferOwnership.sendTransactionAsync(newOwner, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1512,30 +1170,6 @@ export class MultiAssetProxyContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string] { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as MultiAssetProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 de5099cd21..9b3d0f6b4e 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class OrderValidatorContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode: string | undefined; public getOrderAndTraderInfo = { /** @@ -123,129 +132,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - 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 { - 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()], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - { - 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 OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - { - 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 - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - [ - { orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }, - { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } - ] - >(returnData); - return abiDecodedReturnData; - }, }; public getBalanceAndAllowance = { /** @@ -299,46 +185,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string] { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [BigNumber, BigNumber] { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(returnData); - return abiDecodedReturnData; - }, }; public getOrdersAndTradersInfo = { /** @@ -435,130 +281,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - 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 { - 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], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): [ - Array<{ - 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 OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - [ - Array<{ - 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[] - ] - >(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): [ - Array<{ orderStatus: number; orderHash: string; orderTakerAssetFilledAmount: BigNumber }>, - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - ] { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = 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; - }> - ] - >(returnData); - return abiDecodedReturnData; - }, }; public getTradersInfo = { /** @@ -649,118 +371,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - 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 { - 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], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): Array<{ - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - }> { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode< - Array<{ - 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); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue< - Array<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }> - >(returnData); - return abiDecodedReturnData; - }, }; public getERC721TokenOwner = { /** @@ -814,46 +424,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public getBalancesAndAllowances = { /** @@ -907,46 +477,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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, - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string[]] { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string[]]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): [BigNumber[], BigNumber[]] { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(returnData); - return abiDecodedReturnData; - }, }; public getTraderInfo = { /** @@ -1032,113 +562,6 @@ export class OrderValidatorContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - 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 { - 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()], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData( - callData: string, - ): { - makerAddress: string; - takerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - makerAssetAmount: BigNumber; - takerAssetAmount: BigNumber; - makerFee: BigNumber; - takerFee: BigNumber; - expirationTimeSeconds: BigNumber; - salt: BigNumber; - makerAssetData: string; - takerAssetData: string; - } { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<{ - 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); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData( - returnData: string, - ): { - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - } { - const self = (this as any) as OrderValidatorContract; - const abiEncoder = self._lookupAbiEncoder( - 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', - ); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{ - makerBalance: BigNumber; - makerAllowance: BigNumber; - takerBalance: BigNumber; - takerAllowance: BigNumber; - makerZrxBalance: BigNumber; - makerZrxAllowance: BigNumber; - takerZrxBalance: BigNumber; - takerZrxAllowance: BigNumber; - }>(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts index 954be6b254..e1298600cb 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class StaticCallProxyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a85e59e41461003b578063ae25532e146100d3575b600080fd5b6100d16004803603608081101561005157600080fd5b81019060208101813564010000000081111561006c57600080fd5b82018360208201111561007e57600080fd5b803590602001918460018302840111640100000000831117156100a057600080fd5b919350915073ffffffffffffffffffffffffffffffffffffffff813581169160208101359091169060400135610110565b005b6100db6103a5565b604080517fffffffff000000000000000000000000000000000000000000000000000000009092168252519081900360200190f35b6000606060006101656004898990508a8a8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092949392505063ffffffff6103c5169050565b806020019051606081101561017957600080fd5b8151602083018051604051929492938301929190846401000000008211156101a057600080fd5b9083019060208201858111156101b557600080fd5b82516401000000008111828201881017156101cf57600080fd5b82525081516020918201929091019080838360005b838110156101fc5781810151838201526020016101e4565b50505050905090810190601f1680156102295780820380516001836020036101000a031916815260200191505b5060405260200180519060200190929190505050925092509250600060608473ffffffffffffffffffffffffffffffffffffffff16846040518082805190602001908083835b602083106102ac57805182527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0909201916020918201910161026f565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855afa9150503d806000811461030c576040519150601f19603f3d011682016040523d82523d6000602084013e610311565b606091505b50915091508161032357805160208201fd5b8051602082012083811461039857604080517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f554e45585045435445445f5354415449435f43414c4c5f524553554c54000000604482015290519081900360640190fd5b5050505050505050505050565b600060405180806104b06021913960210190506040518091039020905090565b6060818311156103e3576103e36103de60008585610408565b6104a7565b83518211156103fc576103fc6103de6001848751610408565b50819003910190815290565b6060632800659560e01b8484846040516024018084600781111561042857fe5b60ff1681526020018381526020018281526020019350505050604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090509392505050565b805160208201fdfe53746174696343616c6c28616464726573732c62797465732c6279746573333229a265627a7a72315820c55cf13cfcaaf322238d786911313ce7d45854692241ae9b56709bdbfed4f54c64736f6c634300050b0032'; /** @@ -96,53 +105,6 @@ export class StaticCallProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @param assetData Byte array encoded with staticCallTarget, staticCallData, - * and expectedCallResultHash - * @param from This value is ignored. - * @param to This value is ignored. - * @param amount This value is ignored. - * @returns The ABI encoded transaction data as a 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 StaticCallProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments( - 'transferFrom(bytes,address,address,uint256)', - [assetData, from.toLowerCase(), to.toLowerCase(), amount], - ); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [string, string, string, BigNumber] { - const self = (this as any) as StaticCallProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[string, string, string, BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as StaticCallProxyContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * Gets the proxy id associated with the proxy address. @@ -169,7 +131,7 @@ export class StaticCallProxyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -182,41 +144,6 @@ export class StaticCallProxyContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as StaticCallProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getProxyId()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as StaticCallProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as StaticCallProxyContract; - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 699f18d94c..8b9f28a6b3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -64,8 +70,10 @@ export interface WETH9WithdrawalEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class WETH9Contract extends BaseContract { - public static deployedBytecode = - '0x6080604052600436106100925760003560e01c63ffffffff16806306fdde031461009c578063095ea7b31461012657806318160ddd1461016b57806323b872dd146101925780632e1a7d4d146101c9578063313ce567146101e157806370a082311461020c57806395d89b411461023a578063a9059cbb1461024f578063d0e30db014610092578063dd62ed3e14610280575b61009a6102b4565b005b3480156100a857600080fd5b506100b1610303565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100eb5781810151838201526020016100d3565b50505050905090810190601f1680156101185780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561013257600080fd5b5061015773ffffffffffffffffffffffffffffffffffffffff600435166024356103af565b604080519115158252519081900360200190f35b34801561017757600080fd5b50610180610422565b60408051918252519081900360200190f35b34801561019e57600080fd5b5061015773ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610427565b3480156101d557600080fd5b5061009a6004356105c7565b3480156101ed57600080fd5b506101f661065c565b6040805160ff9092168252519081900360200190f35b34801561021857600080fd5b5061018073ffffffffffffffffffffffffffffffffffffffff60043516610665565b34801561024657600080fd5b506100b1610677565b34801561025b57600080fd5b5061015773ffffffffffffffffffffffffffffffffffffffff600435166024356106ef565b34801561028c57600080fd5b5061018073ffffffffffffffffffffffffffffffffffffffff60043581169060243516610703565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103a75780601f1061037c576101008083540402835291602001916103a7565b820191906000526020600020905b81548152906001019060200180831161038a57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b303190565b73ffffffffffffffffffffffffffffffffffffffff831660009081526003602052604081205482111561045957600080fd5b73ffffffffffffffffffffffffffffffffffffffff841633148015906104cf575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105495773ffffffffffffffffffffffffffffffffffffffff8416600090815260046020908152604080832033845290915290205482111561051157600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b336000908152600360205260409020548111156105e357600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f19350505050158015610622573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f810184900484028201840190925281815292918301828280156103a75780601f1061037c576101008083540402835291602001916103a7565b60006106fc338484610427565b9392505050565b6004602090815260009283526040808420909152908252902054815600a165627a7a723058201ebe888a6b56dd871f599adbe0f19ec3c29c28aec0685788dfac9b37a99fc9d20029'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; public name = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -108,41 +116,6 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public approve = { /** @@ -151,7 +124,12 @@ export class WETH9Contract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(guy: string, wad: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + guy: string, + wad: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('guy', guy); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; @@ -168,6 +146,10 @@ export class WETH9Contract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approve.callAsync(guy, wad, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -182,21 +164,20 @@ export class WETH9Contract extends BaseContract { guy: string, wad: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.approve.sendTransactionAsync(guy.toLowerCase(), wad, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -226,15 +207,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - guy: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).approve.callAsync(guy, wad, txData); - const txHash = await (this as any).approve.sendTransactionAsync(guy, wad, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -299,30 +271,6 @@ export class WETH9Contract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public totalSupply = { /** @@ -366,41 +314,6 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transferFrom = { /** @@ -414,6 +327,7 @@ export class WETH9Contract extends BaseContract { dst: string, wad: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('src', src); assert.isString('dst', dst); @@ -436,6 +350,10 @@ export class WETH9Contract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(src, dst, wad, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -451,8 +369,7 @@ export class WETH9Contract extends BaseContract { dst: string, wad: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('src', src); assert.isString('dst', dst); @@ -463,6 +380,7 @@ export class WETH9Contract extends BaseContract { dst.toLowerCase(), wad, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -470,8 +388,8 @@ export class WETH9Contract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -511,16 +429,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - src: string, - dst: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(src, dst, wad, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(src, dst, wad, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -593,30 +501,6 @@ export class WETH9Contract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public withdraw = { /** @@ -625,7 +509,11 @@ export class WETH9Contract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + wad: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); @@ -641,6 +529,10 @@ export class WETH9Contract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.withdraw.callAsync(wad, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -654,20 +546,19 @@ export class WETH9Contract extends BaseContract { awaitTransactionSuccessAsync( wad: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; - const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData); + const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -696,11 +587,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { - await (this as any).withdraw.callAsync(wad, txData); - const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -755,30 +641,6 @@ export class WETH9Contract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): [BigNumber] { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode<[BigNumber]>(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public decimals = { /** @@ -822,41 +684,6 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): number { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public balanceOf = { /** @@ -905,44 +732,6 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public symbol = { /** @@ -986,41 +775,6 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as WETH9Contract; - const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transfer = { /** @@ -1029,7 +783,12 @@ export class WETH9Contract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(dst: string, wad: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + dst: string, + wad: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isString('dst', dst); assert.isBigNumber('wad', wad); const self = (this as any) as WETH9Contract; @@ -1046,6 +805,10 @@ export class WETH9Contract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transfer.callAsync(dst, wad, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1060,21 +823,20 @@ export class WETH9Contract extends BaseContract { dst: string, wad: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.transfer.sendTransactionAsync(dst.toLowerCase(), wad, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1104,15 +866,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - dst: string, - wad: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transfer.callAsync(dst, wad, txData); - const txHash = await (this as any).transfer.sendTransactionAsync(dst, wad, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1177,30 +930,6 @@ export class WETH9Contract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public deposit = { /** @@ -1209,7 +938,10 @@ export class WETH9Contract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(txData?: Partial | undefined): Promise { + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { const self = (this as any) as WETH9Contract; const encodedData = self._strictEncodeArguments('deposit()', []); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1224,6 +956,10 @@ export class WETH9Contract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.deposit.callAsync(txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1236,19 +972,18 @@ export class WETH9Contract extends BaseContract { */ awaitTransactionSuccessAsync( txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { const self = (this as any) as WETH9Contract; - const txHashPromise = self.deposit.sendTransactionAsync(txData); + const txHashPromise = self.deposit.sendTransactionAsync(txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1276,11 +1011,6 @@ export class WETH9Contract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(txData?: Partial | undefined): Promise { - await (this as any).deposit.callAsync(txData); - const txHash = await (this as any).deposit.sendTransactionAsync(txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1333,30 +1063,6 @@ export class WETH9Contract extends BaseContract { const abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('deposit()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): void { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('deposit()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public allowance = { /** @@ -1410,46 +1116,6 @@ export class WETH9Contract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as WETH9Contract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( 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 6f60e3abab..0eb90329e6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,8 +54,10 @@ export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class ZRXTokenContract extends BaseContract { - public static deployedBytecode = - '0x606060405236156100965763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166306fdde038114610098578063095ea7b31461014657806318160ddd1461018657806323b872dd146101a8578063313ce567146101ee57806370a082311461021457806395d89b411461024f578063a9059cbb146102fd578063dd62ed3e1461033d575bfe5b34156100a057fe5b6100a861037e565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561014e57fe5b61017273ffffffffffffffffffffffffffffffffffffffff600435166024356103b5565b604080519115158252519081900360200190f35b341561018e57fe5b61019661042d565b60408051918252519081900360200190f35b34156101b057fe5b61017273ffffffffffffffffffffffffffffffffffffffff60043581169060243516604435610433565b604080519115158252519081900360200190f35b34156101f657fe5b6101fe6105d4565b6040805160ff9092168252519081900360200190f35b341561021c57fe5b61019673ffffffffffffffffffffffffffffffffffffffff600435166105d9565b60408051918252519081900360200190f35b341561025757fe5b6100a8610605565b60408051602080825283518183015283519192839290830191850190808383821561010c575b80518252602083111561010c577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe090920191602091820191016100ce565b505050905090810190601f1680156101385780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561030557fe5b61017273ffffffffffffffffffffffffffffffffffffffff6004351660243561063c565b604080519115158252519081900360200190f35b341561034557fe5b61019673ffffffffffffffffffffffffffffffffffffffff60043581169060243516610727565b60408051918252519081900360200190f35b60408051808201909152601181527f30782050726f746f636f6c20546f6b656e000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff338116600081815260016020908152604080832094871680845294825280832086905580518681529051929493927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925929181900390910190a35060015b92915050565b60035481565b73ffffffffffffffffffffffffffffffffffffffff808416600081815260016020908152604080832033909516835293815283822054928252819052918220548390108015906104835750828110155b80156104b6575073ffffffffffffffffffffffffffffffffffffffff841660009081526020819052604090205483810110155b156105c65773ffffffffffffffffffffffffffffffffffffffff808516600090815260208190526040808220805487019055918716815220805484900390557fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110156105585773ffffffffffffffffffffffffffffffffffffffff808616600090815260016020908152604080832033909416835292905220805484900390555b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef856040518082815260200191505060405180910390a3600191506105cb565b600091505b5b509392505050565b601281565b73ffffffffffffffffffffffffffffffffffffffff81166000908152602081905260409020545b919050565b60408051808201909152600381527f5a52580000000000000000000000000000000000000000000000000000000000602082015281565b73ffffffffffffffffffffffffffffffffffffffff3316600090815260208190526040812054829010801590610699575073ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205482810110155b156107185773ffffffffffffffffffffffffffffffffffffffff33811660008181526020818152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a3506001610427565b506000610427565b5b92915050565b73ffffffffffffffffffffffffffffffffffffffff8083166000908152600160209081526040808320938516835292905220545b929150505600a165627a7a72305820d984298155c708a8164f1cbf83c7275bcc6851dd082c0404013c1f4463b238fa0029'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; public name = { /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an @@ -92,41 +100,6 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('name()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public approve = { /** @@ -139,6 +112,7 @@ export class ZRXTokenContract extends BaseContract { _spender: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_spender', _spender); assert.isBigNumber('_value', _value); @@ -159,6 +133,10 @@ export class ZRXTokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.approve.callAsync(_spender, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -173,21 +151,20 @@ export class ZRXTokenContract extends BaseContract { _spender: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.approve.sendTransactionAsync(_spender.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -224,15 +201,6 @@ export class ZRXTokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _spender: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).approve.callAsync(_spender, _value, txData); - const txHash = await (this as any).approve.sendTransactionAsync(_spender, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -300,30 +268,6 @@ export class ZRXTokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public totalSupply = { /** @@ -367,41 +311,6 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('totalSupply()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; /** * ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. @@ -421,6 +330,7 @@ export class ZRXTokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_from', _from); assert.isString('_to', _to); @@ -443,6 +353,10 @@ export class ZRXTokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transferFrom.callAsync(_from, _to, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -461,8 +375,7 @@ export class ZRXTokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isString('_from', _from); assert.isString('_to', _to); @@ -473,6 +386,7 @@ export class ZRXTokenContract extends BaseContract { _to.toLowerCase(), _value, txData, + opts, ); return new PromiseWithTransactionHash( txHashPromise, @@ -480,8 +394,8 @@ export class ZRXTokenContract extends BaseContract { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -524,16 +438,6 @@ export class ZRXTokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transferFrom.callAsync(_from, _to, _value, txData); - const txHash = await (this as any).transferFrom.sendTransactionAsync(_from, _to, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -613,30 +517,6 @@ export class ZRXTokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public decimals = { /** @@ -680,41 +560,6 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('decimals()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): number { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public balanceOf = { /** @@ -763,42 +608,6 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(_owner: string): string { - assert.isString('_owner', _owner); - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('balanceOf(address)', [_owner.toLowerCase()]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public symbol = { /** @@ -842,41 +651,6 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a string - */ - getABIEncodedTransactionData(): string { - const self = (this as any) as ZRXTokenContract; - const abiEncodedTransactionData = self._strictEncodeArguments('symbol()', []); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): void { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public transfer = { /** @@ -889,6 +663,7 @@ export class ZRXTokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { assert.isString('_to', _to); assert.isBigNumber('_value', _value); @@ -906,6 +681,10 @@ export class ZRXTokenContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.transfer.callAsync(_to, _value, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -920,21 +699,20 @@ export class ZRXTokenContract extends BaseContract { _to: string, _value: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): 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); + const txHashPromise = self.transfer.sendTransactionAsync(_to.toLowerCase(), _value, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -964,15 +742,6 @@ export class ZRXTokenContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync( - _to: string, - _value: BigNumber, - txData?: Partial | undefined, - ): Promise { - await (this as any).transfer.callAsync(_to, _value, txData); - const txHash = await (this as any).transfer.sendTransactionAsync(_to, _value, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1037,30 +806,6 @@ export class ZRXTokenContract extends BaseContract { ]); return abiEncodedTransactionData; }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): boolean { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; public allowance = { /** @@ -1114,46 +859,6 @@ export class ZRXTokenContract extends BaseContract { // tslint:enable boolean-naming return result; }, - /** - * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before - * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used - * to create a 0x transaction (see protocol spec for more details). - * @returns The ABI encoded transaction data as a 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(), - ]); - return abiEncodedTransactionData; - }, - /** - * Decode the ABI-encoded transaction data into its input arguments - * @param callData The ABI-encoded transaction data - * @returns An array representing the input arguments in order. Keynames of nested structs are preserved. - */ - getABIDecodedTransactionData(callData: string): string { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedCallData = abiEncoder.strictDecode(callData); - return abiDecodedCallData; - }, - /** - * Decode the ABI-encoded return data from a transaction - * @param returnData the data returned after transaction execution - * @returns An array representing the output results in order. Keynames of nested structs are preserved. - */ - getABIDecodedReturnData(returnData: string): BigNumber { - const self = (this as any) as ZRXTokenContract; - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); - return abiDecodedReturnData; - }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index 79d7557875..b1cbfed930 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -36,7 +36,7 @@ "watch:sol": "sol-compiler -w", "prettier_contract_wrappers": "prettier --write ./test-cli/output/typescript/* --config ../../.prettierrc", "generate_contract_wrappers": "run-p gen_typescript gen_python", - "gen_typescript": "abi-gen --abis ${npm_package_config_abis} --output ./test-cli/output/typescript --backend ethers", + "gen_typescript": "abi-gen --abis ${npm_package_config_abis} --debug --output ./test-cli/output/typescript --backend ethers", "gen_python": "pip install black && abi-gen --abis ${npm_package_config_abis} --output ./test-cli/output/python --language Python", "diff_contract_wrappers": "git diff --exit-code ./test-cli/output", "coverage:report:text": "istanbul report text", @@ -79,9 +79,11 @@ "yargs": "^10.0.3" }, "devDependencies": { + "@0x/assert": "^2.2.0-beta.0", "@0x/base-contract": "^5.5.0-beta.0", "@0x/contracts-gen": "^1.1.0-beta.0", "@0x/dev-utils": "^2.4.0-beta.0", + "@0x/json-schemas": "^4.1.0-beta.0", "@0x/sol-compiler": "^3.2.0-beta.0", "@0x/subproviders": "^5.1.0-beta.0", "@0x/tslint-config": "^3.0.1", @@ -96,6 +98,7 @@ "chai-as-promised": "^7.1.0", "chai-bignumber": "^3.0.0", "dirty-chai": "^2.0.1", + "ethers": "~4.0.4", "make-promises-safe": "^1.1.0", "mocha": "^6.2.0", "npm-run-all": "^4.1.2", diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index c7b243e97b..f9793aa5d6 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -44,6 +44,10 @@ const args = yargs normalize: true, demandOption: true, }) + .option('debug', { + describe: 'Includes debug functions in the wrappers such as `getABIDecodedTransactionData`', + type: 'boolean', + }) .option('partials', { describe: 'Glob pattern for the partial template files', type: 'string', @@ -73,12 +77,11 @@ const args = yargs default: 'TypeScript', }) .example( - "$0 --abis 'src/artifacts/**/*.json' --out 'src/contracts/generated/' --partials 'src/templates/partials/**/*.handlebars' --template 'src/templates/contract.handlebars'", + "$0 --abis 'src/artifacts/**/*.json' --out 'src/contracts/generated/' --debug --partials 'src/templates/partials/**/*.handlebars' --template 'src/templates/contract.handlebars'", 'Full usage example', ).argv; const templateFilename = args.template || `${__dirname}/../../templates/${args.language}/contract.handlebars`; - const mainTemplate = utils.getNamedContent(templateFilename); const template = Handlebars.compile(mainTemplate.content); const abiFileNames = globSync(args.abis); @@ -417,14 +420,17 @@ for (const abiFileName of abiFileNames) { return eventData; }); + const shouldIncludeBytecode = methodsData.find(methodData => methodData.stateMutability === 'pure') !== undefined; + const contextData = { contractName: namedContent.name, ctor, - deployedBytecode, + deployedBytecode: shouldIncludeBytecode ? deployedBytecode : undefined, ABI: ABI as ContractAbi, ABIString: JSON.stringify(ABI), methods: methodsData, events: eventsData, + debug: args.debug, }; const renderedCode = template(contextData); utils.writeOutputFile(outFilePath, renderedCode); diff --git a/packages/abi-gen/templates/TypeScript/contract.handlebars b/packages/abi-gen/templates/TypeScript/contract.handlebars index d7dd089680..2c84f35692 100644 --- a/packages/abi-gen/templates/TypeScript/contract.handlebars +++ b/packages/abi-gen/templates/TypeScript/contract.handlebars @@ -20,7 +20,7 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { AwaitTransactionSuccessOpts, EventCallback, IndexedFilterValues, SendTransactionOpts, SimpleContractArtifact } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -48,6 +48,9 @@ export enum {{contractName}}Events { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class {{contractName}}Contract extends BaseContract { + /** + * @ignore + */ {{#ifEquals this.deployedBytecode undefined~}} public static deployedBytecode: string | undefined; {{else~}} @@ -69,7 +72,7 @@ export class {{contractName}}Contract extends BaseContract { {{else}} {{> method_call contractName=../contractName}} {{/ifEquals}} - {{> method_abi_helper contractName=../contractName}} + {{> method_abi_helper contractName=../contractName debug=../debug}} }; {{/each}} {{#if events}}private readonly _subscriptionManager: SubscriptionManager<{{contractName}}EventArgs, {{contractName}}Events>; diff --git a/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars b/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars index 0c8f1893af..9fee7996f7 100644 --- a/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars +++ b/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars @@ -1,3 +1,27 @@ +{{!-- if ((NOT constant) AND (NOT debug)), to avoid repetition bbecause we use all 3 functions if (debug) --}} +{{^if constant~}} +{{^if debug~}} +/** + * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before + * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used + * to create a 0x transaction (see protocol spec for more details). +{{> params_docstring inputs=inputs docstrings=devdoc.params}} + * @returns The ABI encoded transaction data as a string + */ +getABIEncodedTransactionData( + {{> typed_params inputs=inputs}} + ): string { + {{#each inputs}} + {{#assertionType name type}}{{/assertionType}} + {{/each}} + const self = this as any as {{contractName}}Contract; + const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> normalized_params inputs=inputs}}]); + return abiEncodedTransactionData; +}, +{{/if~}} +{{/if~}} + +{{#if debug~}} /** * Returns the ABI encoded transaction data needed to send an Ethereum transaction calling this method. Before * sending the Ethereum tx, this encoded tx data can first be sent to a separate signing service or can be used @@ -43,3 +67,4 @@ getABIDecodedReturnData( const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(returnData); return abiDecodedReturnData; }, +{{/if}} diff --git a/packages/abi-gen/templates/TypeScript/partials/method_call_pure.handlebars b/packages/abi-gen/templates/TypeScript/partials/method_call_pure.handlebars index 3b7e1ab82c..2ec68190f9 100644 --- a/packages/abi-gen/templates/TypeScript/partials/method_call_pure.handlebars +++ b/packages/abi-gen/templates/TypeScript/partials/method_call_pure.handlebars @@ -29,7 +29,7 @@ async callAsync( let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; diff --git a/packages/abi-gen/templates/TypeScript/partials/method_tx.handlebars b/packages/abi-gen/templates/TypeScript/partials/method_tx.handlebars index d4bbdc9d75..de4e7eb324 100644 --- a/packages/abi-gen/templates/TypeScript/partials/method_tx.handlebars +++ b/packages/abi-gen/templates/TypeScript/partials/method_tx.handlebars @@ -8,6 +8,7 @@ async sendTransactionAsync( {{> typed_params inputs=inputs}} txData?: Partial | undefined, +opts: SendTransactionOpts = { shouldValidate: true }, ): Promise { {{#each inputs}} {{#assertionType name type}}{{/assertionType}} @@ -26,6 +27,15 @@ txData?: Partial | undefined, txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.{{languageSpecificName}}.callAsync( + {{#each inputs~}} + {{name}}, + {{/each~}} + txDataWithDefaults, + ); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -40,17 +50,16 @@ txData?: Partial | undefined, awaitTransactionSuccessAsync( {{> typed_params inputs=inputs}} txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { {{#each inputs}} {{#assertionType name type}}{{/assertionType}} {{/each}} const self = this as any as {{contractName}}Contract; {{#if inputs}} - const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync({{> normalized_params input=inputs}}, txData); + const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync({{> normalized_params input=inputs}}, txData, opts); {{else}} - const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync(txData); + const txHashPromise = self.{{languageSpecificName}}.sendTransactionAsync(txData, opts); {{/if}} return new PromiseWithTransactionHash( txHashPromise, @@ -58,8 +67,8 @@ awaitTransactionSuccessAsync( // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -94,21 +103,3 @@ async estimateGasAsync( const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, -async validateAndSendTransactionAsync( - {{> typed_params inputs=inputs}} - txData?: Partial | undefined, - ): Promise { - await (this as any).{{languageSpecificName}}.callAsync( - {{#each inputs~}} - {{name}}, - {{/each~}} - txData, - ); - const txHash = await (this as any).{{languageSpecificName}}.sendTransactionAsync( - {{#each inputs~}} - {{name}}, - {{/each~}} - txData, - ); - return txHash; -}, diff --git a/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts index 5b149586fb..8b626041d0 100644 --- a/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts @@ -19,7 +19,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { EventCallback, IndexedFilterValues, SimpleContractArtifact } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -46,6 +52,9 @@ export interface AbiGenDummySimpleEventEventArgs extends DecodedLogArgs { // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class AbiGenDummyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x608060405234801561001057600080fd5b50600436106101d95760003560e01c806376f15d5b11610104578063bb607362116100a2578063d88be12f11610071578063d88be12f1461039b578063ee8b86fb146103a3578063f408fb3114610279578063fa315f9d146103b6576101d9565b8063bb60736214610353578063bdab168814610369578063cd3c0b971461037e578063d6d7618c14610386576101d9565b80638ee52b4e116100de5780638ee52b4e146103225780639a3b618514610335578063a3c2f6b61461033d578063ae2dae1714610345576101d9565b806376f15d5b146102f25780637833bec0146102fa5780637a791e6e1461031a576101d9565b80634303a5421161017c57806359c28add1161014b57806359c28add146102b45780635ba3c7c0146102c957806363d69c88146102d1578063647341eb146102e4576101d9565b80634303a542146102875780634582eab21461028f57806345fdbdb714610297578063586f84b21461029f576101d9565b80632e1a7d4d116101b85780632e1a7d4d146102245780633687617d1461023757806336b32396146102595780633e9ef66a14610279576101d9565b806209e437146101de5780630527c28f146101e85780631310e444146101fb575b600080fd5b6101e66103c4565b005b6101e66101f6366004610c7f565b610401565b61020e610209366004610d34565b610404565b60405161021b919061139a565b60405180910390f35b6101e6610232366004610d34565b61040b565b61024a610245366004610eac565b61045c565b60405161021b93929190611103565b61026c610267366004610cbc565b6104fc565b60405161021b9190611045565b6101e66101f6366004610cff565b61020e6105de565b6101e66105e5565b6101e661064a565b6102a761067c565b60405161021b9190611325565b6102bc610684565b60405161021b9190611330565b6101e661068c565b61026c6102df366004610c2d565b6106f1565b6101e66101f6366004610e77565b61020e6106fa565b61030d610308366004610d4d565b610708565b60405161021b9190611239565b6101e66107c5565b61020e610330366004610d34565b6107ca565b6101e66107d0565b61020e6107db565b6101e66101f6366004610de7565b61035b6107e0565b60405161021b9291906113a3565b610371610819565b60405161021b9190611066565b6101e661081e565b61038e610855565b60405161021b9190611387565b61020e6109ae565b6101e66103b1366004610d34565b6101f6565b6101e66101f6366004610d34565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f690611202565b60405180910390fd5b565b50565b506107c790565b3373ffffffffffffffffffffffffffffffffffffffff167f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b6582604051610451919061139a565b60405180910390a250565b505060408051808201825260048082527f1234567800000000000000000000000000000000000000000000000000000000602080840191909152835180850185528281527f87654321000000000000000000000000000000000000000000000000000000008183015284518086019095529184527f616d657400000000000000000000000000000000000000000000000000000000908401529093909250565b600060606040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a33320000000081525090506000818760405160200161054d929190611023565b6040516020818303038152906040528051906020012090506001818787876040516000815260200160405260405161058894939291906110e5565b6020604051602081039080840390855afa1580156105aa573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015198975050505050505050565b6107c75b90565b604080518082018252601481527f5245564552545f574954485f434f4e5354414e54000000000000000000000000602082015290517f08c379a00000000000000000000000000000000000000000000000000000000081526103f69190600401611145565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103f6906111cb565b6105e26109b4565b6105e26109cc565b604080518082018252601581527f524551554952455f574954485f434f4e5354414e540000000000000000000000602082015290517f08c379a00000000000000000000000000000000000000000000000000000000081526103f69190600401611145565b50929392505050565b600080546001019081905590565b6107106109ec565b50604080516080810182529182528051808201825260048082527f123456780000000000000000000000000000000000000000000000000000000060208381019190915280850192909252825180840184528181527f87654321000000000000000000000000000000000000000000000000000000008184015284840152825180840190935282527f616d65740000000000000000000000000000000000000000000000000000000090820152606082015290565b6103ff565b60010190565b600080546001019055565b600190565b60408051808201909152600581527f68656c6c6f0000000000000000000000000000000000000000000000000000006020820152600191565b606090565b7f61a6029a4c7ddee5824d171331eecbd015d26a271310a223718b837facb5b77160405161084b9061115f565b60405180910390a1565b61085d610a1a565b6040805160028082526060828101909352816020015b60608152602001906001900390816108735790505090506040518060400160405280600581526020017f3078313233000000000000000000000000000000000000000000000000000000815250816000815181106108cd57fe5b60200260200101819052506040518060400160405280600581526020017f30783332310000000000000000000000000000000000000000000000000000008152508160018151811061091b57fe5b6020908102919091018101919091526040805160c0810182526005608082018181527f307831323300000000000000000000000000000000000000000000000000000060a0840152825281840152808201939093528051808201909152600381527f6162630000000000000000000000000000000000000000000000000000000000918101919091526060820152905090565b6104d290565b60405180602001604052806109c7610a48565b905290565b60405180604001604052806109df610a1a565b8152602001606081525090565b60405180608001604052806109ff610a5b565b81526020016060815260200160608152602001606081525090565b604051806080016040528060608152602001600063ffffffff16815260200160608152602001606081525090565b6040518060200160405280600081525090565b60405180606001604052806000815260200160608152602001606081525090565b600082601f830112610a8c578081fd5b813567ffffffffffffffff811115610aa2578182fd5b6020610ab181828402016113bc565b828152925080830184820160005b84811015610ae857610ad6888584358a0101610af3565b83529183019190830190600101610abf565b505050505092915050565b600082601f830112610b03578081fd5b813567ffffffffffffffff811115610b19578182fd5b610b4a60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116016113bc565b9150808252836020828501011115610b6157600080fd5b8060208401602084013760009082016020015292915050565b600060808284031215610b8b578081fd5b610b9560806113bc565b90506000823567ffffffffffffffff80821115610bb0578283fd5b610bbc86838701610af3565b84526020850135915063ffffffff82168214610bd6578283fd5b8160208501526040850135915080821115610bef578283fd5b610bfb86838701610a7c565b60408501526060850135915080821115610c13578283fd5b50610c2085828601610af3565b6060840152505092915050565b600080600080600060a08688031215610c4557600080fd5b8535610c5081611413565b945060208601359350604086013592506060860135610c6e81611413565b949793965091946080013592915050565b600060208284031215610c9157600080fd5b813567ffffffffffffffff811115610ca857600080fd5b610cb484828501610a7c565b949350505050565b60008060008060808587031215610cd257600080fd5b84359350602085013560ff81168114610cea57600080fd5b93969395505050506040820135916060013590565b600060208284031215610d1157600080fd5b813567ffffffffffffffff811115610d2857600080fd5b610cb484828501610af3565b600060208284031215610d4657600080fd5b5035919050565b600060208284031215610d5e578081fd5b813567ffffffffffffffff80821115610d75578283fd5b81840160608187031215610d87578384fd5b610d9160606113bc565b925080358352602081013582811115610da8578485fd5b610db487828401610af3565b602085015250604081013582811115610dcb578485fd5b610dd787828401610af3565b6040850152509195945050505050565b600060208284031215610df8578081fd5b813567ffffffffffffffff80821115610e0f578283fd5b81840160408187031215610e21578384fd5b610e2b60406113bc565b9250803582811115610e3b578485fd5b610e4787828401610b7a565b845250602081013582811115610e5b578485fd5b610e6787828401610af3565b6020850152509195945050505050565b600060208284031215610e8957600080fd5b813567ffffffffffffffff811115610ea057600080fd5b610cb484828501610b7a565b600080600060608486031215610ec0578081fd5b83359250602084013567ffffffffffffffff80821115610ede578283fd5b610eea87838801610af3565b93506040860135915080821115610eff578283fd5b50610f0c86828701610af3565b9150509250925092565b60008151808452610f2e8160208601602086016113e3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000815160808452610f756080850182610f16565b6020915063ffffffff82850151168286015260408401518582036040870152818151808452848401915084858202850101858401600094505b82851015610ffc577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868303018452610fe8828251610f16565b600195909501949387019391508601610fae565b506060880151955088810360608a01526110168187610f16565b9998505050505050505050565b600083516110358184602088016113e3565b9190910191825250602001919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b600060208083018184528085518083526040860191506040848202870101925083870160005b828110156110d8577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08886030184526110c6858351610f60565b9450928501929085019060010161108c565b5092979650505050505050565b93845260ff9290921660208401526040830152606082015260800190565b6000606082526111166060830186610f16565b82810360208401526111288186610f16565b838103604085015261113a8186610f16565b979650505050505050565b6000602082526111586020830184610f16565b9392505050565b60408082526004908201527f123456780000000000000000000000000000000000000000000000000000000060608201526080602082018190526005908201527f6c6f72656d00000000000000000000000000000000000000000000000000000060a082015260c00190565b6020808252600d908201527f53494d504c455f52455645525400000000000000000000000000000000000000604082015260600190565b6020808252600e908201527f53494d504c455f52455155495245000000000000000000000000000000000000604082015260600190565b600060208252825160806020840152805160a08401526020810151606060c0850152611269610100850182610f16565b604083015191507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff608582030160e08601526112a48183610f16565b9250505060208401517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0808584030160408601526112e28383610f16565b60408701519350818682030160608701526112fd8185610f16565b92505060608601519250808583030160808601525061131c8183610f16565b95945050505050565b905151815260200190565b60006020825282516040602084015261134c6060840182610f60565b602085015191507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe084820301604085015261131c8183610f16565b6000602082526111586020830184610f60565b90815260200190565b600083825260406020830152610cb46040830184610f16565b60405181810167ffffffffffffffff811182821017156113db57600080fd5b604052919050565b60005b838110156113fe5781810151838201526020016113e6565b8381111561140d576000848401525b50505050565b73ffffffffffffffffffffffffffffffffffffffff8116811461040157600080fdfea365627a7a723158207f0854b76fc684de0be1f1a5db2d486bc187ff28d1e99d27ca0f61b452a1942f6c6578706572696d656e74616cf564736f6c634300050b0040'; public simpleRequire = { @@ -69,7 +78,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -144,7 +153,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -224,7 +233,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -283,7 +292,11 @@ export class AbiGenDummyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { + async sendTransactionAsync( + wad: BigNumber, + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { assert.isBigNumber('wad', wad); const self = (this as any) as AbiGenDummyContract; const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad]); @@ -299,6 +312,10 @@ export class AbiGenDummyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.withdraw.callAsync(wad, txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -312,20 +329,19 @@ export class AbiGenDummyContract extends BaseContract { awaitTransactionSuccessAsync( wad: BigNumber, txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { assert.isBigNumber('wad', wad); const self = (this as any) as AbiGenDummyContract; - const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData); + const txHashPromise = self.withdraw.sendTransactionAsync(wad, txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -354,11 +370,6 @@ export class AbiGenDummyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(wad: BigNumber, txData?: Partial | undefined): Promise { - await (this as any).withdraw.callAsync(wad, txData); - const txHash = await (this as any).withdraw.sendTransactionAsync(wad, txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -475,7 +486,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -578,7 +589,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -662,7 +673,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -736,7 +747,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -806,7 +817,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -876,7 +887,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -952,7 +963,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1033,7 +1044,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1114,7 +1125,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1200,7 +1211,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1282,7 +1293,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1350,7 +1361,10 @@ export class AbiGenDummyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(txData?: Partial | undefined): Promise { + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { const self = (this as any) as AbiGenDummyContract; const encodedData = self._strictEncodeArguments('nonPureMethod()', []); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1365,6 +1379,10 @@ export class AbiGenDummyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.nonPureMethod.callAsync(txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1377,19 +1395,18 @@ export class AbiGenDummyContract extends BaseContract { */ awaitTransactionSuccessAsync( txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { const self = (this as any) as AbiGenDummyContract; - const txHashPromise = self.nonPureMethod.sendTransactionAsync(txData); + const txHashPromise = self.nonPureMethod.sendTransactionAsync(txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1417,11 +1434,6 @@ export class AbiGenDummyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(txData?: Partial | undefined): Promise { - await (this as any).nonPureMethod.callAsync(txData); - const txHash = await (this as any).nonPureMethod.sendTransactionAsync(txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1534,7 +1546,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1622,7 +1634,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1693,7 +1705,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -1750,7 +1762,10 @@ export class AbiGenDummyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(txData?: Partial | undefined): Promise { + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { const self = (this as any) as AbiGenDummyContract; const encodedData = self._strictEncodeArguments('nonPureMethodThatReturnsNothing()', []); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -1765,6 +1780,10 @@ export class AbiGenDummyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.nonPureMethodThatReturnsNothing.callAsync(txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -1777,19 +1796,18 @@ export class AbiGenDummyContract extends BaseContract { */ awaitTransactionSuccessAsync( txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { const self = (this as any) as AbiGenDummyContract; - const txHashPromise = self.nonPureMethodThatReturnsNothing.sendTransactionAsync(txData); + const txHashPromise = self.nonPureMethodThatReturnsNothing.sendTransactionAsync(txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -1817,11 +1835,6 @@ export class AbiGenDummyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(txData?: Partial | undefined): Promise { - await (this as any).nonPureMethodThatReturnsNothing.callAsync(txData); - const txHash = await (this as any).nonPureMethodThatReturnsNothing.sendTransactionAsync(txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -1920,7 +1933,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2005,7 +2018,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2105,7 +2118,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2178,7 +2191,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2240,7 +2253,10 @@ export class AbiGenDummyContract extends BaseContract { * @param txData Additional data for transaction * @returns The hash of the transaction */ - async sendTransactionAsync(txData?: Partial | undefined): Promise { + async sendTransactionAsync( + txData?: Partial | undefined, + opts: SendTransactionOpts = { shouldValidate: true }, + ): Promise { const self = (this as any) as AbiGenDummyContract; const encodedData = self._strictEncodeArguments('emitSimpleEvent()', []); const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( @@ -2255,6 +2271,10 @@ export class AbiGenDummyContract extends BaseContract { txDataWithDefaults.from = txDataWithDefaults.from.toLowerCase(); } + if (opts.shouldValidate !== false) { + await self.emitSimpleEvent.callAsync(txDataWithDefaults); + } + const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); return txHash; }, @@ -2267,19 +2287,18 @@ export class AbiGenDummyContract extends BaseContract { */ awaitTransactionSuccessAsync( txData?: Partial, - pollingIntervalMs?: number, - timeoutMs?: number, + opts: AwaitTransactionSuccessOpts = { shouldValidate: true }, ): PromiseWithTransactionHash { const self = (this as any) as AbiGenDummyContract; - const txHashPromise = self.emitSimpleEvent.sendTransactionAsync(txData); + const txHashPromise = self.emitSimpleEvent.sendTransactionAsync(txData, opts); return new PromiseWithTransactionHash( txHashPromise, (async (): Promise => { // When the transaction hash resolves, wait for it to be mined. return self._web3Wrapper.awaitTransactionSuccessAsync( await txHashPromise, - pollingIntervalMs, - timeoutMs, + opts.pollingIntervalMs, + opts.timeoutMs, ); })(), ); @@ -2307,11 +2326,6 @@ export class AbiGenDummyContract extends BaseContract { const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); return gas; }, - async validateAndSendTransactionAsync(txData?: Partial | undefined): Promise { - await (this as any).emitSimpleEvent.callAsync(txData); - const txHash = await (this as any).emitSimpleEvent.sendTransactionAsync(txData); - return txHash; - }, /** * Sends a read-only call to the contract method. Returns the result that would happen if one were to send an * Ethereum transaction to this method, given the current state of the blockchain. Calls do not cost gas @@ -2417,7 +2431,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2499,7 +2513,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2577,7 +2591,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2649,7 +2663,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -2721,7 +2735,7 @@ export class AbiGenDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; diff --git a/packages/abi-gen/test-cli/output/typescript/lib_dummy.ts b/packages/abi-gen/test-cli/output/typescript/lib_dummy.ts index 2d71295e25..bc01ce2d03 100644 --- a/packages/abi-gen/test-cli/output/typescript/lib_dummy.ts +++ b/packages/abi-gen/test-cli/output/typescript/lib_dummy.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,8 +34,10 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class LibDummyContract extends BaseContract { - public static deployedBytecode = - '0x73000000000000000000000000000000000000000030146080604052600080fdfea265627a7a72305820b14322cd05aa1dcae66812e472d3ab85cced78118ea7f9a5098d073b2accc45964736f6c634300050a0032'; + /** + * @ignore + */ + public static deployedBytecode: string | undefined; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, supportedProvider: SupportedProvider, diff --git a/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts index 275781c69c..edc8830abc 100644 --- a/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts @@ -18,7 +18,13 @@ import { SupportedProvider, } from 'ethereum-types'; import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils'; -import { SimpleContractArtifact, EventCallback, IndexedFilterValues } from '@0x/types'; +import { + AwaitTransactionSuccessOpts, + EventCallback, + IndexedFilterValues, + SendTransactionOpts, + SimpleContractArtifact, +} from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { assert } from '@0x/assert'; import * as ethers from 'ethers'; @@ -28,6 +34,9 @@ import * as ethers from 'ethers'; // tslint:disable:no-parameter-reassignment // tslint:disable-next-line:class-name export class TestLibDummyContract extends BaseContract { + /** + * @ignore + */ public static deployedBytecode = '0x6080604052348015600f57600080fd5b506004361060325760003560e01c806322935e921460375780632b82fdf0146063575b600080fd5b605160048036036020811015604b57600080fd5b5035607d565b60408051918252519081900360200190f35b605160048036036020811015607757600080fd5b5035608c565b60006086826095565b92915050565b6000608682609c565b6104d20190565b6001019056fea265627a7a72305820ddb720d14b34694daaefebcbd729af6ae04fa2232481812dd8fde63d6a4c32c164736f6c634300050a0032'; public publicAddConstant = { @@ -52,7 +61,7 @@ export class TestLibDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; @@ -124,7 +133,7 @@ export class TestLibDummyContract extends BaseContract { let rawCallResult; try { - rawCallResult = await self.evmExecAsync(encodedDataBytes); + rawCallResult = await self._evmExecAsync(encodedDataBytes); } catch (err) { BaseContract._throwIfThrownErrorIsRevertError(err); throw err; 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 80a4281061..948f909c7a 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 @@ -138,14 +138,6 @@ describe('AbiGenDummy Contract', () => { }); }); - describe('validate and send transaction', () => { - it('should call validateAndSendTransactionAsync', async () => { - const txHash = await abiGenDummy.nonPureMethod.validateAndSendTransactionAsync(); - const hexRegex = /^0x[a-fA-F0-9]+$/; - expect(txHash.match(hexRegex)).to.deep.equal([txHash]); - }); - }); - describe('event subscription', () => { const indexFilterValues = {}; const emptyCallback = () => {}; // tslint:disable-line:no-empty @@ -284,6 +276,13 @@ describe('AbiGenDummy Contract', () => { expect(decodedOutput, 'decoded output').to.be.deep.equal(output); }); }); + describe('awaitTransactionSuccessAsync', async () => { + it('should successfully call the non pure function', async () => { + expect( + abiGenDummy.nonPureMethod.awaitTransactionSuccessAsync({}, { pollingIntervalMs: 10, timeoutMs: 100 }), + ).to.be.fulfilled(''); + }); + }); }); describe('Lib dummy contract', () => { diff --git a/packages/asset-buyer/src/asset_buyer.ts b/packages/asset-buyer/src/asset_buyer.ts index 3dc0b96ea1..fd30833756 100644 --- a/packages/asset-buyer/src/asset_buyer.ts +++ b/packages/asset-buyer/src/asset_buyer.ts @@ -267,7 +267,7 @@ export class AssetBuyer { // if no ethAmount is provided, default to the worst ethAmount from buyQuote const value = ethAmount || worstCaseQuoteInfo.totalEthAmount; - const txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEth.validateAndSendTransactionAsync( + const txHash = await this._contractWrappers.forwarder.marketBuyOrdersWithEth.sendTransactionAsync( orders, assetBuyAmount, orders.map(o => o.signature), diff --git a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts index 981513fcf3..a81c2a2cc5 100644 --- a/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/exchange_swap_quote_consumer.ts @@ -144,7 +144,7 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature), @@ -156,7 +156,7 @@ export class ExchangeSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature), diff --git a/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts b/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts index f90f30fd0c..f4553572df 100644 --- a/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts +++ b/packages/asset-swapper/src/quote_consumers/forwarder_swap_quote_consumer.ts @@ -197,7 +197,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature), @@ -211,7 +211,7 @@ export class ForwarderSwapQuoteConsumer implements SwapQuoteConsumerBase o.signature), formattedFeePercentage, diff --git a/packages/base-contract/CHANGELOG.json b/packages/base-contract/CHANGELOG.json index 1e11866ef6..c691b66589 100644 --- a/packages/base-contract/CHANGELOG.json +++ b/packages/base-contract/CHANGELOG.json @@ -1,4 +1,17 @@ [ + { + "version": "5.5.0-beta.1", + "changes": [ + { + "note": "Make `evmExecAsync` protected and rename to `_evmExecAsync`", + "pr": 2243 + }, + { + "note": "Remove duplicate types `IndexedFilterValues`, `DecodedLogEvent`, `EventCallback`", + "pr": 2243 + } + ] + }, { "version": "5.5.0-beta.0", "changes": [ diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts index 2dc978569f..74b9f22c52 100644 --- a/packages/base-contract/src/index.ts +++ b/packages/base-contract/src/index.ts @@ -184,7 +184,7 @@ export class BaseContract { } return rawEncoded; } - public async evmExecAsync(input: Buffer): Promise { + protected async _evmExecAsync(input: Buffer): Promise { const addressBuf = Buffer.from(this.address.substr(2), 'hex'); // should only run once, the first time it is called if (this._evmIfExists === undefined) { diff --git a/packages/base-contract/src/subscription_manager.ts b/packages/base-contract/src/subscription_manager.ts index f6949d4f47..9f0bdd6cc2 100644 --- a/packages/base-contract/src/subscription_manager.ts +++ b/packages/base-contract/src/subscription_manager.ts @@ -13,7 +13,9 @@ import { import { Block, BlockAndLogStreamer, Log } from 'ethereumjs-blockstream'; import * as _ from 'lodash'; -import { EventCallback, IndexedFilterValues, SubscriptionErrors } from './types'; +import { EventCallback, IndexedFilterValues } from '@0x/types'; + +import { SubscriptionErrors } from './types'; import { filterUtils } from './utils/filter_utils'; const DEFAULT_BLOCK_POLLING_INTERVAL = 1000; @@ -80,7 +82,7 @@ export class SubscriptionManager; + this._filterCallbacks[filterToken] = callback as EventCallback; // tslint:disable-line:no-unnecessary-type-assertion return filterToken; } public async getLogsAsync( diff --git a/packages/base-contract/src/types.ts b/packages/base-contract/src/types.ts index 28048b7af1..5414dd2090 100644 --- a/packages/base-contract/src/types.ts +++ b/packages/base-contract/src/types.ts @@ -1,15 +1,6 @@ -import { ContractEventArg, DecodedLogArgs, LogEntryEvent, LogWithDecodedArgs } from 'ethereum-types'; +import { LogEntryEvent } from 'ethereum-types'; export type LogEvent = LogEntryEvent; -export interface DecodedLogEvent { - isRemoved: boolean; - log: LogWithDecodedArgs; -} - -export type EventCallback = ( - err: null | Error, - log?: DecodedLogEvent, -) => void; export interface ContractEvent { logIndex: number; @@ -27,7 +18,3 @@ export enum SubscriptionErrors { SubscriptionNotFound = 'SUBSCRIPTION_NOT_FOUND', SubscriptionAlreadyPresent = 'SUBSCRIPTION_ALREADY_PRESENT', } - -export interface IndexedFilterValues { - [index: string]: ContractEventArg; -} diff --git a/packages/contract-wrappers/src/index.ts b/packages/contract-wrappers/src/index.ts index 9da6d1ace8..96d46327cd 100644 --- a/packages/contract-wrappers/src/index.ts +++ b/packages/contract-wrappers/src/index.ts @@ -154,6 +154,8 @@ export { SignedZeroExTransaction, SimpleEvmOutput, SimpleEvmBytecodeOutput, + AwaitTransactionSuccessOpts, + SendTransactionOpts, EIP712DomainWithDefaultSchema, EventCallback, DecodedLogEvent, diff --git a/packages/contract-wrappers/src/types.ts b/packages/contract-wrappers/src/types.ts index 048e08981d..5ac052858c 100644 --- a/packages/contract-wrappers/src/types.ts +++ b/packages/contract-wrappers/src/types.ts @@ -40,6 +40,7 @@ export interface ContractWrappersConfig { blockPollingIntervalMs?: number; } +// TODO(xianny): remove after refactoring coordinator wrapper /** * gasPrice: Gas price in Wei to use for a transaction * gasLimit: The amount of gas to send with a transaction (in Gwei) @@ -51,6 +52,7 @@ export interface TransactionOpts { nonce?: number; } +// TODO(xianny): remove after refactoring coordinator wrapper /** * shouldValidate: Flag indicating whether the library should make attempts to validate a transaction before * broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default=true. diff --git a/packages/types/CHANGELOG.json b/packages/types/CHANGELOG.json index b6aca3e427..5c9a0722f3 100644 --- a/packages/types/CHANGELOG.json +++ b/packages/types/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "2.5.0-beta.1", + "changes": [ + { + "note": "Add `SendTransactionOpts` and `AwaitTransactionSuccessOpts` types for contract wrappers", + "pr": 2243 + } + ] + }, { "version": "2.5.0-beta.0", "changes": [ diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 64fa91da2f..ceac35918c 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -670,6 +670,18 @@ export interface Type { tupleElements?: Type[]; } +/** + * * shouldValidate: Flag indicating whether the library should make attempts to validate a transaction before + * broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default=true. + * * pollingIntervalMs: Used with `awaitTransactionSuccessAsync` to determine polling interval in milliseconds + * * timeoutMs: Used with `awaitTransactionSuccessAsync` to determine timeout in milliseconds + */ +export interface SendTransactionOpts { + shouldValidate?: boolean; + pollingIntervalMs?: number; + timeoutMs?: number; +} + export interface ElementType { name: string; typeDocType: TypeDocTypes; @@ -742,27 +754,6 @@ export interface Stats { orderCount: number; } -export interface SimpleContractArtifact { - schemaVersion: string; - contractName: string; - compilerOutput: SimpleStandardContractOutput; - networks: ContractNetworks; -} - -export interface SimpleStandardContractOutput { - abi: ContractAbi; - evm: SimpleEvmOutput; - devdoc?: DevdocOutput; -} - -export interface SimpleEvmOutput { - bytecode: SimpleEvmBytecodeOutput; -} - -export interface SimpleEvmBytecodeOutput { - object: string; -} - export interface DutchAuctionDetails { beginTimeSeconds: BigNumber; endTimeSeconds: BigNumber; @@ -862,3 +853,48 @@ export type EventCallback = ( export interface IndexedFilterValues { [index: string]: ContractEventArg; } + +/* Begin types for @0x/abi-gen-wrappers + * Allow these types to be imported when needed instead of having to import + * the whole package, which is large + */ + +/** + * Used with `sendTransactionAsync` + * * shouldValidate: Flag indicating whether the library should make attempts to validate a transaction before + * broadcasting it. For example, order has a valid signature, maker has sufficient funds, etc. Default=true. + */ +export interface SendTransactionOpts { + shouldValidate?: boolean; +} + +/** + * Used with `awaitTransactionSuccessAsync` + * * pollingIntervalMs: Determine polling intervals in milliseconds + * * timeoutMs: Determines timeout in milliseconds + */ +export interface AwaitTransactionSuccessOpts extends SendTransactionOpts { + pollingIntervalMs?: number; + timeoutMs?: number; +} + +export interface SimpleContractArtifact { + schemaVersion: string; + contractName: string; + compilerOutput: SimpleStandardContractOutput; + networks: ContractNetworks; +} + +export interface SimpleStandardContractOutput { + abi: ContractAbi; + evm: SimpleEvmOutput; + devdoc?: DevdocOutput; +} + +export interface SimpleEvmOutput { + bytecode: SimpleEvmBytecodeOutput; +} + +export interface SimpleEvmBytecodeOutput { + object: string; +}