Merge pull request #1797 from 0xProject/feature/abi-gen-templates/awaitTransactionSuccess

Add awaitTransactionSuccessAsync() to generated contract functions.
This commit is contained in:
Lawrence Forman
2019-04-30 14:13:13 -04:00
committed by GitHub
31 changed files with 3129 additions and 237 deletions

View File

@@ -1,4 +1,13 @@
[
{
"version": "2.1.2",
"changes": [
{
"note": "Update tests to use contract-built-in `awaitTransactionSuccessAsync`",
"pr": 1797
}
]
},
{
"version": "2.1.1",
"changes": [

View File

@@ -53,16 +53,18 @@ describe('Authorizable', () => {
);
});
it('should allow owner to add an authorized address', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const isAuthorized = await authorizable.authorized.callAsync(address);
expect(isAuthorized).to.be.true();
});
it('should throw if owner attempts to authorize a duplicate address', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
return expectTransactionFailedAsync(
@@ -74,8 +76,9 @@ describe('Authorizable', () => {
describe('removeAuthorizedAddress', () => {
it('should throw if not called by owner', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
return expectTransactionFailedAsync(
@@ -87,14 +90,14 @@ describe('Authorizable', () => {
});
it('should allow owner to remove an authorized address', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
from: owner,
}),
await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const isAuthorized = await authorizable.authorized.callAsync(address);
@@ -113,8 +116,9 @@ describe('Authorizable', () => {
describe('removeAuthorizedAddressAtIndex', () => {
it('should throw if not called by owner', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const index = new BigNumber(0);
@@ -126,8 +130,9 @@ describe('Authorizable', () => {
);
});
it('should throw if index is >= authorities.length', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const index = new BigNumber(1);
@@ -150,12 +155,14 @@ describe('Authorizable', () => {
it('should throw if address at index does not match target', async () => {
const address1 = address;
const address2 = notOwner;
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address1, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address1,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address2, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address2,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const address1Index = new BigNumber(0);
@@ -167,15 +174,16 @@ describe('Authorizable', () => {
);
});
it('should allow owner to remove an authorized address', async () => {
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, { from: owner }),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const index = new BigNumber(0);
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.removeAuthorizedAddressAtIndex.sendTransactionAsync(address, index, {
from: owner,
}),
await authorizable.removeAuthorizedAddressAtIndex.awaitTransactionSuccessAsync(
address,
index,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const isAuthorized = await authorizable.authorized.callAsync(address);
@@ -187,20 +195,17 @@ describe('Authorizable', () => {
it('should return all authorized addresses', async () => {
const initial = await authorizable.getAuthorizedAddresses.callAsync();
expect(initial).to.have.length(0);
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.addAuthorizedAddress.sendTransactionAsync(address, {
from: owner,
}),
await authorizable.addAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const afterAdd = await authorizable.getAuthorizedAddresses.callAsync();
expect(afterAdd).to.have.length(1);
expect(afterAdd).to.include(address);
await web3Wrapper.awaitTransactionSuccessAsync(
await authorizable.removeAuthorizedAddress.sendTransactionAsync(address, {
from: owner,
}),
await authorizable.removeAuthorizedAddress.awaitTransactionSuccessAsync(
address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const afterRemove = await authorizable.getAuthorizedAddresses.callAsync();

View File

@@ -70,16 +70,14 @@ describe('ERC1155Proxy', () => {
const usedAddresses = ([owner, notAuthorized, authorized, spender, receiver] = _.slice(accounts, 0, 5));
erc1155ProxyWrapper = new ERC1155ProxyWrapper(provider, usedAddresses, owner);
erc1155Proxy = await erc1155ProxyWrapper.deployProxyAsync();
await web3Wrapper.awaitTransactionSuccessAsync(
await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
from: owner,
}),
await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
authorized,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(erc1155Proxy.address, {
from: owner,
}),
await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
erc1155Proxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
// deploy & configure ERC1155 tokens and receiver
@@ -596,8 +594,8 @@ describe('ERC1155Proxy', () => {
it('should propagate revert reason from erc1155 contract failure', async () => {
// disable transfers
const shouldRejectTransfer = true;
await web3Wrapper.awaitTransactionSuccessAsync(
await erc1155Receiver.setRejectTransferFlag.sendTransactionAsync(shouldRejectTransfer),
await erc1155Receiver.setRejectTransferFlag.awaitTransactionSuccessAsync(
shouldRejectTransfer,
constants.AWAIT_TRANSACTION_MINED_MS,
);
// setup test parameters

View File

@@ -111,72 +111,62 @@ describe('Asset Transfer Proxies', () => {
);
// Configure ERC20Proxy
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
from: owner,
}),
await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
authorized,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
multiAssetProxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
// Configure ERC721Proxy
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
from: owner,
}),
await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
authorized,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
multiAssetProxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
// Configure ERC115Proxy
erc1155ProxyWrapper = new ERC1155ProxyWrapper(provider, usedAddresses, owner);
erc1155Proxy = await erc1155ProxyWrapper.deployProxyAsync();
await web3Wrapper.awaitTransactionSuccessAsync(
await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
from: owner,
}),
await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
authorized,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, {
from: owner,
}),
await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
multiAssetProxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
// Configure MultiAssetProxy
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(authorized, {
from: owner,
}),
await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(
authorized,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, {
from: owner,
}),
await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(
erc20Proxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, {
from: owner,
}),
await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(
erc721Proxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc1155Proxy.address, {
from: owner,
}),
await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(
erc1155Proxy.address,
{ from: owner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
@@ -206,31 +196,26 @@ describe('Asset Transfer Proxies', () => {
);
await erc20Wrapper.setBalancesAndAllowancesAsync();
await web3Wrapper.awaitTransactionSuccessAsync(
await noReturnErc20Token.setBalance.sendTransactionAsync(fromAddress, constants.INITIAL_ERC20_BALANCE),
await noReturnErc20Token.setBalance.awaitTransactionSuccessAsync(
fromAddress,
constants.INITIAL_ERC20_BALANCE,
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await noReturnErc20Token.approve.sendTransactionAsync(
erc20Proxy.address,
constants.INITIAL_ERC20_ALLOWANCE,
{ from: fromAddress },
),
await noReturnErc20Token.approve.awaitTransactionSuccessAsync(
erc20Proxy.address,
constants.INITIAL_ERC20_ALLOWANCE,
{ from: fromAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multipleReturnErc20Token.setBalance.sendTransactionAsync(
fromAddress,
constants.INITIAL_ERC20_BALANCE,
),
await multipleReturnErc20Token.setBalance.awaitTransactionSuccessAsync(
fromAddress,
constants.INITIAL_ERC20_BALANCE,
constants.AWAIT_TRANSACTION_MINED_MS,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await multipleReturnErc20Token.approve.sendTransactionAsync(
erc20Proxy.address,
constants.INITIAL_ERC20_ALLOWANCE,
{ from: fromAddress },
),
await multipleReturnErc20Token.approve.awaitTransactionSuccessAsync(
erc20Proxy.address,
constants.INITIAL_ERC20_ALLOWANCE,
{ from: fromAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
@@ -419,10 +404,10 @@ describe('Asset Transfer Proxies', () => {
toAddress,
amount,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
from: fromAddress,
}),
await erc20TokenA.approve.awaitTransactionSuccessAsync(
erc20Proxy.address,
allowance,
{ from: fromAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const erc20Balances = await erc20Wrapper.getBalancesAsync();
@@ -451,10 +436,10 @@ describe('Asset Transfer Proxies', () => {
toAddress,
amount,
);
await web3Wrapper.awaitTransactionSuccessAsync(
await noReturnErc20Token.approve.sendTransactionAsync(erc20Proxy.address, allowance, {
from: fromAddress,
}),
await noReturnErc20Token.approve.awaitTransactionSuccessAsync(
erc20Proxy.address,
allowance,
{ from: fromAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
const initialFromBalance = await noReturnErc20Token.balanceOf.callAsync(fromAddress);
@@ -692,10 +677,10 @@ describe('Asset Transfer Proxies', () => {
const ownerFromAsset = await erc721TokenA.ownerOf.callAsync(erc721AFromTokenId);
expect(ownerFromAsset).to.be.equal(fromAddress);
// Remove transfer approval for fromAddress.
await web3Wrapper.awaitTransactionSuccessAsync(
await erc721TokenA.approve.sendTransactionAsync(constants.NULL_ADDRESS, erc721AFromTokenId, {
from: fromAddress,
}),
await erc721TokenA.approve.awaitTransactionSuccessAsync(
constants.NULL_ADDRESS,
erc721AFromTokenId,
{ from: fromAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
// Perform a transfer; expect this to fail.

View File

@@ -2,7 +2,6 @@ import { artifacts as erc20Artifacts, DummyERC20TokenContract } from '@0x/contra
import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
import { assetDataUtils } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
@@ -11,7 +10,6 @@ import { artifacts, ERC20ProxyContract } from '../../src';
export class ERC20Wrapper {
private readonly _tokenOwnerAddresses: string[];
private readonly _contractOwnerAddress: string;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _provider: ZeroExProvider;
private readonly _dummyTokenContracts: DummyERC20TokenContract[];
private _proxyContract?: ERC20ProxyContract;
@@ -25,7 +23,6 @@ export class ERC20Wrapper {
*/
constructor(provider: ZeroExProvider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
this._dummyTokenContracts = [];
this._web3Wrapper = new Web3Wrapper(provider);
this._provider = provider;
this._tokenOwnerAddresses = tokenOwnerAddresses;
this._contractOwnerAddress = contractOwnerAddress;
@@ -67,20 +64,16 @@ export class ERC20Wrapper {
this._validateProxyContractExistsOrThrow();
for (const dummyTokenContract of this._dummyTokenContracts) {
for (const tokenOwnerAddress of this._tokenOwnerAddresses) {
await this._web3Wrapper.awaitTransactionSuccessAsync(
await dummyTokenContract.setBalance.sendTransactionAsync(
tokenOwnerAddress,
constants.INITIAL_ERC20_BALANCE,
{ from: this._contractOwnerAddress },
),
await dummyTokenContract.setBalance.awaitTransactionSuccessAsync(
tokenOwnerAddress,
constants.INITIAL_ERC20_BALANCE,
{ from: this._contractOwnerAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
await this._web3Wrapper.awaitTransactionSuccessAsync(
await dummyTokenContract.approve.sendTransactionAsync(
(this._proxyContract as ERC20ProxyContract).address,
constants.INITIAL_ERC20_ALLOWANCE,
{ from: tokenOwnerAddress },
),
await dummyTokenContract.approve.awaitTransactionSuccessAsync(
(this._proxyContract as ERC20ProxyContract).address,
constants.INITIAL_ERC20_ALLOWANCE,
{ from: tokenOwnerAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}
@@ -93,10 +86,10 @@ export class ERC20Wrapper {
}
public async setBalanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
const tokenContract = this._getTokenContractFromAssetData(assetData);
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.setBalance.sendTransactionAsync(userAddress, amount, {
from: this._contractOwnerAddress,
}),
await tokenContract.setBalance.awaitTransactionSuccessAsync(
userAddress,
amount,
{ from: this._contractOwnerAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}
@@ -109,10 +102,10 @@ export class ERC20Wrapper {
public async setAllowanceAsync(userAddress: string, assetData: string, amount: BigNumber): Promise<void> {
const tokenContract = this._getTokenContractFromAssetData(assetData);
const proxyAddress = (this._proxyContract as ERC20ProxyContract).address;
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.approve.sendTransactionAsync(proxyAddress, amount, {
from: userAddress,
}),
await tokenContract.approve.awaitTransactionSuccessAsync(
proxyAddress,
amount,
{ from: userAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}

View File

@@ -2,7 +2,6 @@ import { artifacts as erc721Artifacts, DummyERC721TokenContract } from '@0x/cont
import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
import { generatePseudoRandomSalt } from '@0x/order-utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
@@ -11,14 +10,12 @@ import { artifacts, ERC721ProxyContract } from '../../src';
export class ERC721Wrapper {
private readonly _tokenOwnerAddresses: string[];
private readonly _contractOwnerAddress: string;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _provider: ZeroExProvider;
private readonly _dummyTokenContracts: DummyERC721TokenContract[];
private _proxyContract?: ERC721ProxyContract;
private _proxyIdIfExists?: string;
private _initialTokenIdsByOwner: ERC721TokenIdsByOwner = {};
constructor(provider: ZeroExProvider, tokenOwnerAddresses: string[], contractOwnerAddress: string) {
this._web3Wrapper = new Web3Wrapper(provider);
this._provider = provider;
this._dummyTokenContracts = [];
this._tokenOwnerAddresses = tokenOwnerAddresses;
@@ -91,20 +88,20 @@ export class ERC721Wrapper {
const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
const proxyAddress = (this._proxyContract as ERC721ProxyContract).address;
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.setApprovalForAll.sendTransactionAsync(proxyAddress, isApproved, {
from: tokenOwner,
}),
await tokenContract.setApprovalForAll.awaitTransactionSuccessAsync(
proxyAddress,
isApproved,
{ from: tokenOwner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}
public async approveAsync(to: string, tokenAddress: string, tokenId: BigNumber): Promise<void> {
const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
const tokenOwner = await this.ownerOfAsync(tokenAddress, tokenId);
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.approve.sendTransactionAsync(to, tokenId, {
from: tokenOwner,
}),
await tokenContract.approve.awaitTransactionSuccessAsync(
to,
tokenId,
{ from: tokenOwner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}
@@ -115,28 +112,29 @@ export class ERC721Wrapper {
userAddress: string,
): Promise<void> {
const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.transferFrom.sendTransactionAsync(currentOwner, userAddress, tokenId, {
from: currentOwner,
}),
await tokenContract.transferFrom.awaitTransactionSuccessAsync(
currentOwner,
userAddress,
tokenId,
{ from: currentOwner },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}
public async mintAsync(tokenAddress: string, tokenId: BigNumber, userAddress: string): Promise<void> {
const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.mint.sendTransactionAsync(userAddress, tokenId, {
from: this._contractOwnerAddress,
}),
await tokenContract.mint.awaitTransactionSuccessAsync(
userAddress,
tokenId,
{ from: this._contractOwnerAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}
public async burnAsync(tokenAddress: string, tokenId: BigNumber, owner: string): Promise<void> {
const tokenContract = this._getTokenContractFromAssetData(tokenAddress);
await this._web3Wrapper.awaitTransactionSuccessAsync(
await tokenContract.burn.sendTransactionAsync(owner, tokenId, {
from: this._contractOwnerAddress,
}),
await tokenContract.burn.awaitTransactionSuccessAsync(
owner,
tokenId,
{ from: this._contractOwnerAddress },
constants.AWAIT_TRANSACTION_MINED_MS,
);
}

View File

@@ -1,4 +1,13 @@
[
{
"version": "2.1.0",
"changes": [
{
"note": "add `awaitTransactionSuccessAsync()` to `tx.handlebars`",
"pr": 1797
}
]
},
{
"version": "2.0.2",
"changes": [

View File

@@ -1,8 +1,20 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';

View File

@@ -25,6 +25,42 @@ public {{this.tsName}} = {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
{{> typed_params inputs=inputs}}
{{#this.payable}}
txData?: Partial<TxDataPayable> | number,
{{/this.payable}}
{{^this.payable}}
txData?: Partial<TxData> | number,
{{/this.payable}}
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as {{contractName}}Contract;
{{#if inputs}}
const txHashPromise = self.{{this.tsName}}.sendTransactionAsync({{> params input=inputs}}, txData);
{{else}}
const txHashPromise = self.{{this.tsName}}.sendTransactionAsync(txData);
{{/if}}
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
{{> typed_params inputs=inputs}}
txData: Partial<TxData> = {},

View File

@@ -1,4 +1,13 @@
[
{
"version": "4.3.0",
"changes": [
{
"note": "Update wrapper functions to expose `awaitTransactionSuccessAsync()` methods",
"pr": 1797
}
]
},
{
"version": "4.2.0",
"changes": [

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type AssetProxyOwnerEventArgs =
@@ -148,6 +159,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
owner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.removeOwner.sendTransactionAsync(owner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
owner: string,
txData: Partial<TxData> = {},
@@ -224,6 +263,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.revokeConfirmation.sendTransactionAsync(transactionId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
transactionId: BigNumber,
txData: Partial<TxData> = {},
@@ -358,6 +425,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(transactionId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
transactionId: BigNumber,
txData: Partial<TxData> = {},
@@ -493,6 +588,36 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
assetProxyContract: string,
isRegistered: boolean,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxyContract,
isRegistered
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
assetProxyContract: string,
isRegistered: boolean,
@@ -575,6 +700,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
owner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.addOwner.sendTransactionAsync(owner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
owner: string,
txData: Partial<TxData> = {},
@@ -679,6 +832,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_secondsTimeLocked: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.changeTimeLock.sendTransactionAsync(_secondsTimeLocked
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_secondsTimeLocked: BigNumber,
txData: Partial<TxData> = {},
@@ -953,6 +1134,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_required: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.changeRequirement.sendTransactionAsync(_required
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_required: BigNumber,
txData: Partial<TxData> = {},
@@ -1029,6 +1238,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.confirmTransaction.sendTransactionAsync(transactionId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
transactionId: BigNumber,
txData: Partial<TxData> = {},
@@ -1111,6 +1348,38 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
destination: string,
value: BigNumber,
data: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.submitTransaction.sendTransactionAsync(destination,
value,
data
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
destination: string,
value: BigNumber,
@@ -1282,6 +1551,36 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
owner: string,
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.replaceOwner.sendTransactionAsync(owner,
newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
owner: string,
newOwner: string,
@@ -1364,6 +1663,34 @@ export class AssetProxyOwnerContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
transactionId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as AssetProxyOwnerContract;
const txHashPromise = self.executeTransaction.sendTransactionAsync(transactionId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
transactionId: BigNumber,
txData: Partial<TxData> = {},
@@ -1489,7 +1816,7 @@ _secondsTimeLocked
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('AssetProxyOwner', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('AssetProxyOwner', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -80,6 +91,42 @@ export class CoordinatorContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
transaction: {salt: BigNumber;signerAddress: string;data: string},
txOrigin: string,
transactionSignature: string,
approvalExpirationTimeSeconds: BigNumber[],
approvalSignatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as CoordinatorContract;
const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction,
txOrigin,
transactionSignature,
approvalExpirationTimeSeconds,
approvalSignatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
transaction: {salt: BigNumber;signerAddress: string;data: string},
txOrigin: string,

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type CoordinatorRegistryEventArgs =
@@ -50,6 +61,34 @@ export class CoordinatorRegistryContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
coordinatorEndpoint: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as CoordinatorRegistryContract;
const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
coordinatorEndpoint: string,
txData: Partial<TxData> = {},

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type DummyERC20TokenEventArgs =
@@ -88,6 +99,36 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC20TokenContract;
const txHashPromise = self.approve.sendTransactionAsync(_spender,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_spender: string,
_value: BigNumber,
@@ -202,6 +243,38 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC20TokenContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
_to,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -396,6 +469,34 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC20TokenContract;
const txHashPromise = self.mint.sendTransactionAsync(_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_value: BigNumber,
txData: Partial<TxData> = {},
@@ -475,6 +576,36 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC20TokenContract;
const txHashPromise = self.transfer.sendTransactionAsync(_to,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_to: string,
_value: BigNumber,
@@ -590,6 +721,36 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_target: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC20TokenContract;
const txHashPromise = self.setBalance.sendTransactionAsync(_target,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_target: string,
_value: BigNumber,
@@ -672,6 +833,34 @@ export class DummyERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC20TokenContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -823,7 +1012,7 @@ _totalSupply
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('DummyERC20Token', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('DummyERC20Token', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type DummyERC721TokenEventArgs =
@@ -124,6 +135,36 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_approved: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.approve.sendTransactionAsync(_approved,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_approved: string,
_tokenId: BigNumber,
@@ -212,6 +253,38 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
_to,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -303,6 +376,36 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.mint.sendTransactionAsync(_to,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_to: string,
_tokenId: BigNumber,
@@ -391,6 +494,38 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from,
_to,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -590,6 +725,36 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_owner: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.burn.sendTransactionAsync(_owner,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_owner: string,
_tokenId: BigNumber,
@@ -675,6 +840,36 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_operator: string,
_approved: boolean,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator,
_approved
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_operator: string,
_approved: boolean,
@@ -766,6 +961,40 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from,
_to,
_tokenId,
_data
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -890,6 +1119,34 @@ export class DummyERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DummyERC721TokenContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -1001,7 +1258,7 @@ _symbol
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('DummyERC721Token', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('DummyERC721Token', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -38,6 +49,34 @@ export class DutchAuctionContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DutchAuctionContract;
const txHashPromise = self.getAuctionDetails.sendTransactionAsync(order
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
@@ -123,6 +162,40 @@ export class DutchAuctionContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as DutchAuctionContract;
const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder,
sellOrder,
buySignature,
sellSignature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
@@ -245,7 +318,7 @@ export class DutchAuctionContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('DutchAuction', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('DutchAuction', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type ERC20ProxyEventArgs =
@@ -57,6 +68,34 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20ProxyContract;
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -161,6 +200,34 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20ProxyContract;
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -266,6 +333,36 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20ProxyContract;
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
index
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -428,6 +525,34 @@ export class ERC20ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20ProxyContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -525,7 +650,7 @@ export class ERC20ProxyContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('ERC20Proxy', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('ERC20Proxy', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type ERC20TokenEventArgs =
@@ -62,6 +73,36 @@ export class ERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20TokenContract;
const txHashPromise = self.approve.sendTransactionAsync(_spender,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_spender: string,
_value: BigNumber,
@@ -176,6 +217,38 @@ export class ERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20TokenContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
_to,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -295,6 +368,36 @@ export class ERC20TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC20TokenContract;
const txHashPromise = self.transfer.sendTransactionAsync(_to,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_to: string,
_value: BigNumber,
@@ -428,7 +531,7 @@ export class ERC20TokenContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('ERC20Token', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('ERC20Token', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type ERC721ProxyEventArgs =
@@ -57,6 +68,34 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721ProxyContract;
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -161,6 +200,34 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721ProxyContract;
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -266,6 +333,36 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721ProxyContract;
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
index
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -428,6 +525,34 @@ export class ERC721ProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721ProxyContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -525,7 +650,7 @@ export class ERC721ProxyContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('ERC721Proxy', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('ERC721Proxy', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type ERC721TokenEventArgs =
@@ -98,6 +109,36 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_approved: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721TokenContract;
const txHashPromise = self.approve.sendTransactionAsync(_approved,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_approved: string,
_tokenId: BigNumber,
@@ -186,6 +227,38 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721TokenContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
_to,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -280,6 +353,38 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721TokenContract;
const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from,
_to,
_tokenId
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -427,6 +532,36 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_operator: string,
_approved: boolean,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721TokenContract;
const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator,
_approved
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_operator: string,
_approved: boolean,
@@ -518,6 +653,40 @@ export class ERC721TokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_tokenId: BigNumber,
_data: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ERC721TokenContract;
const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from,
_to,
_tokenId,
_data
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -663,7 +832,7 @@ export class ERC721TokenContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('ERC721Token', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('ERC721Token', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type ExchangeEventArgs =
@@ -127,6 +138,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.batchFillOrders.sendTransactionAsync(orders,
takerAssetFillAmounts,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
@@ -249,6 +292,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
hash: string,
signerAddress: string,
signature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.preSign.sendTransactionAsync(hash,
signerAddress,
signature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
hash: string,
signerAddress: string,
@@ -346,6 +421,40 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
leftSignature: string,
rightSignature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.matchOrders.sendTransactionAsync(leftOrder,
rightOrder,
leftSignature,
rightSignature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
@@ -446,6 +555,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
signature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.fillOrderNoThrow.sendTransactionAsync(order,
takerAssetFillAmount,
signature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
@@ -562,6 +703,34 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.batchCancelOrders.sendTransactionAsync(orders
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
txData: Partial<TxData> = {},
@@ -644,6 +813,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.batchFillOrKillOrders.sendTransactionAsync(orders,
takerAssetFillAmounts,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
@@ -732,6 +933,34 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
targetOrderEpoch: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.cancelOrdersUpTo.sendTransactionAsync(targetOrderEpoch
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
targetOrderEpoch: BigNumber,
txData: Partial<TxData> = {},
@@ -814,6 +1043,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.batchFillOrdersNoThrow.sendTransactionAsync(orders,
takerAssetFillAmounts,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmounts: BigNumber[],
@@ -964,6 +1225,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
signature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.fillOrKillOrder.sendTransactionAsync(order,
takerAssetFillAmount,
signature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
@@ -1055,6 +1348,36 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
validatorAddress: string,
approval: boolean,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.setSignatureValidatorApproval.sendTransactionAsync(validatorAddress,
approval
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
validatorAddress: string,
approval: boolean,
@@ -1173,6 +1496,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmount: BigNumber,
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.marketSellOrders.sendTransactionAsync(orders,
takerAssetFillAmount,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmount: BigNumber,
@@ -1383,6 +1738,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.marketBuyOrdersNoThrow.sendTransactionAsync(orders,
makerAssetFillAmount,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
@@ -1477,6 +1864,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
signature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.fillOrder.sendTransactionAsync(order,
takerAssetFillAmount,
signature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
takerAssetFillAmount: BigNumber,
@@ -1574,6 +1993,40 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
salt: BigNumber,
signerAddress: string,
data: string,
signature: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.executeTransaction.sendTransactionAsync(salt,
signerAddress,
data,
signature
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
salt: BigNumber,
signerAddress: string,
@@ -1668,6 +2121,34 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
assetProxy: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
assetProxy: string,
txData: Partial<TxData> = {},
@@ -1772,6 +2253,34 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.cancelOrder.sendTransactionAsync(order
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
@@ -1910,6 +2419,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmount: BigNumber,
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.marketSellOrdersNoThrow.sendTransactionAsync(orders,
takerAssetFillAmount,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
takerAssetFillAmount: BigNumber,
@@ -2030,6 +2571,38 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.marketBuyOrders.sendTransactionAsync(orders,
makerAssetFillAmount,
signatures
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
@@ -2144,6 +2717,34 @@ export class ExchangeContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ExchangeContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -2274,7 +2875,7 @@ export class ExchangeContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('Exchange', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('Exchange', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -56,6 +67,46 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
signatures: string[],
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
feeSignatures: string[],
feePercentage: BigNumber,
feeRecipient: string,
txData?: Partial<TxDataPayable> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ForwarderContract;
const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync(orders,
makerAssetFillAmount,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
makerAssetFillAmount: BigNumber,
@@ -171,6 +222,36 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
assetData: string,
amount: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ForwarderContract;
const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData,
amount
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
assetData: string,
amount: BigNumber,
@@ -294,6 +375,44 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
signatures: string[],
feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
feeSignatures: string[],
feePercentage: BigNumber,
feeRecipient: string,
txData?: Partial<TxDataPayable> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ForwarderContract;
const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync(orders,
signatures,
feeOrders,
feeSignatures,
feePercentage,
feeRecipient
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
signatures: string[],
@@ -400,6 +519,34 @@ export class ForwarderContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ForwarderContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -518,7 +665,7 @@ _wethAssetData
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('Forwarder', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('Forwarder', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -38,6 +49,34 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as IAssetProxyContract;
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -114,6 +153,34 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as IAssetProxyContract;
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -193,6 +260,36 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as IAssetProxyContract;
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
index
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -284,6 +381,40 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
assetData: string,
from: string,
to: string,
amount: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as IAssetProxyContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(assetData,
from,
to,
amount
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
assetData: string,
from: string,
@@ -430,6 +561,34 @@ export class IAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as IAssetProxyContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -91,7 +102,7 @@ export class IValidatorContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('IValidator', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('IValidator', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -89,7 +100,7 @@ export class IWalletContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('IWallet', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('IWallet', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type MultiAssetProxyEventArgs =
@@ -92,6 +103,34 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as MultiAssetProxyContract;
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -224,6 +263,34 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as MultiAssetProxyContract;
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
txData: Partial<TxData> = {},
@@ -329,6 +396,36 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
target: string,
index: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as MultiAssetProxyContract;
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
index
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
target: string,
index: BigNumber,
@@ -465,6 +562,34 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
assetProxy: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as MultiAssetProxyContract;
const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
assetProxy: string,
txData: Partial<TxData> = {},
@@ -567,6 +692,34 @@ export class MultiAssetProxyContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
newOwner: string,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as MultiAssetProxyContract;
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
newOwner: string,
txData: Partial<TxData> = {},
@@ -664,7 +817,7 @@ export class MultiAssetProxyContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('MultiAssetProxy', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('MultiAssetProxy', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
@@ -283,7 +294,7 @@ _zrxAssetData
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('OrderValidator', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('OrderValidator', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type WETH9EventArgs =
@@ -102,6 +113,36 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
guy: string,
wad: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as WETH9Contract;
const txHashPromise = self.approve.sendTransactionAsync(guy,
wad
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
guy: string,
wad: BigNumber,
@@ -216,6 +257,38 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
src: string,
dst: string,
wad: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as WETH9Contract;
const txHashPromise = self.transferFrom.sendTransactionAsync(src,
dst,
wad
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
src: string,
dst: string,
@@ -304,6 +377,34 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
wad: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as WETH9Contract;
const txHashPromise = self.withdraw.sendTransactionAsync(wad
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
wad: BigNumber,
txData: Partial<TxData> = {},
@@ -463,6 +564,36 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
dst: string,
wad: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as WETH9Contract;
const txHashPromise = self.transfer.sendTransactionAsync(dst,
wad
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
dst: string,
wad: BigNumber,
@@ -542,6 +673,32 @@ export class WETH9Contract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
txData?: Partial<TxDataPayable> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as WETH9Contract;
const txHashPromise = self.deposit.sendTransactionAsync(txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
txData: Partial<TxData> = {},
): Promise<number> {
@@ -663,7 +820,7 @@ export class WETH9Contract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('WETH9', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('WETH9', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,13 +1,24 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, TxData, TxDataPayable, SupportedProvider } from 'ethereum-types';
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
import {
BlockParam,
BlockParamLiteral,
CallData,
ContractAbi,
ContractArtifact,
DecodedLogArgs,
MethodAbi,
TransactionReceiptWithDecodedLogs,
TxData,
TxDataPayable,
SupportedProvider,
} from 'ethereum-types';
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
export type ZRXTokenEventArgs =
@@ -88,6 +99,36 @@ export class ZRXTokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_spender: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ZRXTokenContract;
const txHashPromise = self.approve.sendTransactionAsync(_spender,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_spender: string,
_value: BigNumber,
@@ -202,6 +243,38 @@ export class ZRXTokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_from: string,
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ZRXTokenContract;
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
_to,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_from: string,
_to: string,
@@ -373,6 +446,36 @@ export class ZRXTokenContract extends BaseContract {
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
awaitTransactionSuccessAsync(
_to: string,
_value: BigNumber,
txData?: Partial<TxData> | number,
pollingIntervalMs?: number,
timeoutMs?: number,
): PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs> {
// `txData` may be omitted on its own, so it might be set to `pollingIntervalMs`.
if (typeof(txData) === 'number') {
pollingIntervalMs = txData;
timeoutMs = pollingIntervalMs;
txData = {};
}
//
const self = this as any as ZRXTokenContract;
const txHashPromise = self.transfer.sendTransactionAsync(_to,
_value
, txData);
return new PromiseWithTransactionHash<TransactionReceiptWithDecodedLogs>(
txHashPromise,
(async (): Promise<TransactionReceiptWithDecodedLogs> => {
// When the transaction hash resolves, wait for it to be mined.
return self._web3Wrapper.awaitTransactionSuccessAsync(
await txHashPromise,
pollingIntervalMs,
timeoutMs,
);
})(),
);
},
async estimateGasAsync(
_to: string,
_value: BigNumber,
@@ -506,7 +609,7 @@ export class ZRXTokenContract extends BaseContract {
return contractInstance;
}
constructor(abi: ContractAbi, address: string, supportedProvider: SupportedProvider, txDefaults?: Partial<TxData>) {
super('ZRXToken', abi, address, providerUtils.standardizeOrThrow(supportedProvider), txDefaults);
super('ZRXToken', abi, address, supportedProvider, txDefaults);
classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count

View File

@@ -1,4 +1,13 @@
[
{
"version": "5.1.0",
"changes": [
{
"note": "Export `PromiseWithTransactionHash` type",
"pr": 1797
}
]
},
{
"version": "5.0.5",
"changes": [

View File

@@ -20,6 +20,28 @@ export interface AbiEncoderByFunctionSignature {
[key: string]: AbiEncoder.Method;
}
// tslint:disable: max-classes-per-file
/**
* @dev A promise-compatible type that exposes a `txHash` field.
* Not used by BaseContract, but generated contracts will return it in
* `awaitTransactionSuccessAsync()`.
* Maybe there's a better place for this.
*/
export class PromiseWithTransactionHash<T> implements PromiseLike<T> {
public readonly txHashPromise: Promise<string>;
private readonly _promise: Promise<T>;
constructor(txHashPromise: Promise<string>, promise: Promise<T>) {
this.txHashPromise = txHashPromise;
this._promise = promise;
}
public then<TResult>(
onFulfilled?: (v: T) => TResult | PromiseLike<TResult>,
onRejected?: (reason: any) => PromiseLike<never>,
): PromiseLike<TResult> {
return this._promise.then<TResult>(onFulfilled, onRejected);
}
}
const REVERT_ERROR_SELECTOR = '08c379a0';
const REVERT_ERROR_SELECTOR_OFFSET = 2;
const REVERT_ERROR_SELECTOR_BYTES_LENGTH = 4;