Update abi-gen-wrappers
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -34,6 +36,16 @@ export class CoordinatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signature', signature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getSignerAddress(bytes32,bytes)', [hash,
|
||||
signature
|
||||
@@ -56,6 +68,80 @@ export class CoordinatorContract extends BaseContract {
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public getTransactionHash = {
|
||||
async callAsync(
|
||||
transaction: {salt: BigNumber;signerAddress: string;data: string},
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTransactionHash((uint256,address,bytes))', [transaction
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public getCoordinatorApprovalHash = {
|
||||
async callAsync(
|
||||
approval: {txOrigin: string;transactionHash: string;transactionSignature: string;approvalExpirationTimeSeconds: BigNumber},
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))', [approval
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public executeTransaction = {
|
||||
async sendTransactionAsync(
|
||||
transaction: {salt: BigNumber;signerAddress: string;data: string},
|
||||
@@ -63,8 +149,13 @@ export class CoordinatorContract extends BaseContract {
|
||||
transactionSignature: string,
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin,
|
||||
@@ -72,10 +163,11 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -97,17 +189,15 @@ export class CoordinatorContract extends BaseContract {
|
||||
transactionSignature: string,
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const txHashPromise = self.executeTransaction.sendTransactionAsync(transaction,
|
||||
txOrigin,
|
||||
@@ -133,8 +223,13 @@ export class CoordinatorContract extends BaseContract {
|
||||
transactionSignature: string,
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin,
|
||||
@@ -142,10 +237,11 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -160,6 +256,11 @@ export class CoordinatorContract extends BaseContract {
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
): string {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
const self = this as any as CoordinatorContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin,
|
||||
@@ -179,6 +280,19 @@ export class CoordinatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin,
|
||||
@@ -204,6 +318,40 @@ export class CoordinatorContract extends BaseContract {
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public EIP712_EXCHANGE_DOMAIN_HASH = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('EIP712_EXCHANGE_DOMAIN_HASH()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public assertValidCoordinatorApprovals = {
|
||||
async callAsync(
|
||||
transaction: {salt: BigNumber;signerAddress: string;data: string},
|
||||
@@ -215,6 +363,19 @@ export class CoordinatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
|
||||
assert.isString('txOrigin', txOrigin);
|
||||
assert.isString('transactionSignature', transactionSignature);
|
||||
assert.isArray('approvalExpirationTimeSeconds', approvalExpirationTimeSeconds);
|
||||
assert.isArray('approvalSignatures', approvalSignatures);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', [transaction,
|
||||
txOrigin,
|
||||
@@ -240,51 +401,24 @@ export class CoordinatorContract extends BaseContract {
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public EIP712_DOMAIN_HASH = {
|
||||
public decodeOrdersFromFillData = {
|
||||
async callAsync(
|
||||
data: string,
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
): Promise<Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>
|
||||
> {
|
||||
assert.isString('data', data);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public assertValidTransactionOrdersApproval = {
|
||||
async callAsync(
|
||||
transaction: {salt: BigNumber;signerAddress: string;data: string},
|
||||
orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
|
||||
txOrigin: string,
|
||||
transactionSignature: string,
|
||||
approvalExpirationTimeSeconds: BigNumber[],
|
||||
approvalSignatures: string[],
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('assertValidTransactionOrdersApproval((uint256,address,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address,bytes,uint256[],bytes[])', [transaction,
|
||||
orders,
|
||||
txOrigin,
|
||||
transactionSignature,
|
||||
approvalExpirationTimeSeconds,
|
||||
approvalSignatures
|
||||
const encodedData = self._strictEncodeArguments('decodeOrdersFromFillData(bytes)', [data
|
||||
]);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
@@ -296,9 +430,43 @@ export class CoordinatorContract extends BaseContract {
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('assertValidTransactionOrdersApproval((uint256,address,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address,bytes,uint256[],bytes[])');
|
||||
const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<void
|
||||
const result = abiEncoder.strictDecodeReturnValue<Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
},
|
||||
};
|
||||
public EIP712_COORDINATOR_DOMAIN_HASH = {
|
||||
async callAsync(
|
||||
callData: Partial<CallData> = {},
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorContract;
|
||||
const encodedData = self._strictEncodeArguments('EIP712_COORDINATOR_DOMAIN_HASH()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...callData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
);
|
||||
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
|
||||
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
|
||||
const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()');
|
||||
// tslint:disable boolean-naming
|
||||
const result = abiEncoder.strictDecodeReturnValue<string
|
||||
>(rawCallResult);
|
||||
// tslint:enable boolean-naming
|
||||
return result;
|
||||
@@ -310,6 +478,11 @@ export class CoordinatorContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -326,6 +499,12 @@ export class CoordinatorContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<CoordinatorContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -41,15 +43,17 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
public setCoordinatorEndpoint = {
|
||||
async sendTransactionAsync(
|
||||
coordinatorEndpoint: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -63,17 +67,11 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
coordinatorEndpoint: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const txHashPromise = self.setCoordinatorEndpoint.sendTransactionAsync(coordinatorEndpoint
|
||||
, txData);
|
||||
@@ -91,15 +89,17 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
coordinatorEndpoint: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -110,6 +110,7 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
coordinatorEndpoint: string,
|
||||
): string {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
@@ -121,6 +122,15 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('coordinatorEndpoint', coordinatorEndpoint);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('setCoordinatorEndpoint(string)', [coordinatorEndpoint
|
||||
]);
|
||||
@@ -149,6 +159,15 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('coordinatorOperator', coordinatorOperator);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as CoordinatorRegistryContract;
|
||||
const encodedData = self._strictEncodeArguments('getCoordinatorEndpoint(address)', [coordinatorOperator
|
||||
]);
|
||||
@@ -175,6 +194,11 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -189,6 +213,12 @@ export class CoordinatorRegistryContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<CoordinatorRegistryContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -53,6 +55,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('name()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -77,16 +87,19 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -102,17 +115,12 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender,
|
||||
_value
|
||||
@@ -132,16 +140,19 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -153,6 +164,8 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
@@ -166,6 +179,16 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
@@ -194,6 +217,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -219,17 +250,21 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -247,17 +282,13 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -279,17 +310,21 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -302,6 +337,9 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -317,6 +355,17 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -346,6 +395,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('decimals()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -373,6 +430,15 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner
|
||||
]);
|
||||
@@ -400,6 +466,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -426,6 +500,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('symbol()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -449,15 +531,17 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
public mint = {
|
||||
async sendTransactionAsync(
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('mint(uint256)', [_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -471,17 +555,11 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const txHashPromise = self.mint.sendTransactionAsync(_value
|
||||
, txData);
|
||||
@@ -499,15 +577,17 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('mint(uint256)', [_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -518,6 +598,7 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value
|
||||
]);
|
||||
@@ -529,6 +610,15 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('mint(uint256)', [_value
|
||||
]);
|
||||
@@ -554,16 +644,19 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -579,17 +672,12 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to,
|
||||
_value
|
||||
@@ -609,16 +697,19 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -630,6 +721,8 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
@@ -643,6 +736,16 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
@@ -673,6 +776,16 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
|
||||
_spender
|
||||
@@ -699,16 +812,19 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_target: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_target', _target);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -724,17 +840,12 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_target: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_target', _target);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const txHashPromise = self.setBalance.sendTransactionAsync(_target,
|
||||
_value
|
||||
@@ -754,16 +865,19 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_target: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_target', _target);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -775,6 +889,8 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_target: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_target', _target);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
|
||||
_value
|
||||
@@ -788,6 +904,16 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_target', _target);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_target,
|
||||
_value
|
||||
@@ -813,15 +939,17 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -835,17 +963,11 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -863,15 +985,17 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -882,6 +1006,7 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -893,6 +1018,15 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -920,6 +1054,14 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('MAX_MINT_AMOUNT()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -949,6 +1091,11 @@ export class DummyERC20TokenContract extends BaseContract {
|
||||
_decimals: BigNumber,
|
||||
_totalSupply: BigNumber,
|
||||
): Promise<DummyERC20TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -971,6 +1118,12 @@ _totalSupply
|
||||
_decimals: BigNumber,
|
||||
_totalSupply: BigNumber,
|
||||
): Promise<DummyERC20TokenContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_name,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -61,6 +63,14 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('name()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -88,6 +98,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId
|
||||
]);
|
||||
@@ -113,16 +132,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -138,17 +160,12 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_approved,
|
||||
_tokenId
|
||||
@@ -168,16 +185,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -189,6 +209,8 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
@@ -202,6 +224,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
@@ -229,17 +261,21 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -257,17 +293,13 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -289,17 +321,21 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -312,6 +348,9 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -327,6 +366,17 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -354,16 +404,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -379,17 +432,12 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.mint.sendTransactionAsync(_to,
|
||||
_tokenId
|
||||
@@ -409,16 +457,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -430,6 +481,8 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_to,
|
||||
_tokenId
|
||||
@@ -443,6 +496,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_to,
|
||||
_tokenId
|
||||
@@ -470,17 +533,21 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -498,17 +565,13 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -530,17 +593,21 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -553,6 +620,9 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -568,6 +638,17 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -598,6 +679,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId
|
||||
]);
|
||||
@@ -626,6 +716,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner
|
||||
]);
|
||||
@@ -653,6 +752,14 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -679,6 +786,14 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('symbol()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -703,16 +818,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_owner: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -728,17 +846,12 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_owner: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.burn.sendTransactionAsync(_owner,
|
||||
_tokenId
|
||||
@@ -758,16 +871,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_owner: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -779,6 +895,8 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_owner: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
|
||||
_tokenId
|
||||
@@ -792,6 +910,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_owner,
|
||||
_tokenId
|
||||
@@ -818,16 +946,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -843,17 +974,12 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator,
|
||||
_approved
|
||||
@@ -873,16 +999,19 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -894,6 +1023,8 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
): string {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
@@ -907,6 +1038,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
@@ -935,18 +1076,23 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -966,17 +1112,14 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -1000,18 +1143,23 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -1025,6 +1173,10 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
@@ -1042,6 +1194,18 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
@@ -1074,6 +1238,16 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_operator', _operator);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner,
|
||||
_operator
|
||||
@@ -1099,15 +1273,17 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -1121,17 +1297,11 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -1149,15 +1319,17 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -1168,6 +1340,7 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -1179,6 +1352,15 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DummyERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -1207,6 +1389,11 @@ export class DummyERC721TokenContract extends BaseContract {
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
): Promise<DummyERC721TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -1225,6 +1412,12 @@ _symbol
|
||||
_name: string,
|
||||
_symbol: string,
|
||||
): Promise<DummyERC721TokenContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_name,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -29,15 +31,17 @@ export class DutchAuctionContract extends BaseContract {
|
||||
public getAuctionDetails = {
|
||||
async sendTransactionAsync(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -51,17 +55,11 @@ export class DutchAuctionContract extends BaseContract {
|
||||
},
|
||||
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,
|
||||
txData?: Partial<TxData>,
|
||||
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);
|
||||
@@ -79,15 +77,17 @@ export class DutchAuctionContract extends BaseContract {
|
||||
},
|
||||
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> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -98,6 +98,7 @@ export class DutchAuctionContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
|
||||
): string {
|
||||
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
@@ -109,6 +110,15 @@ export class DutchAuctionContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
|
||||
> {
|
||||
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order
|
||||
]);
|
||||
@@ -136,18 +146,23 @@ export class DutchAuctionContract extends BaseContract {
|
||||
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> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -167,17 +182,14 @@ export class DutchAuctionContract extends BaseContract {
|
||||
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,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const txHashPromise = self.matchOrders.sendTransactionAsync(buyOrder,
|
||||
sellOrder,
|
||||
@@ -201,18 +213,23 @@ export class DutchAuctionContract extends BaseContract {
|
||||
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> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
buySignature,
|
||||
sellSignature
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -226,6 +243,10 @@ export class DutchAuctionContract extends BaseContract {
|
||||
buySignature: string,
|
||||
sellSignature: string,
|
||||
): string {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
@@ -243,6 +264,18 @@ export class DutchAuctionContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
|
||||
> {
|
||||
|
||||
|
||||
assert.isString('buySignature', buySignature);
|
||||
assert.isString('sellSignature', sellSignature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as DutchAuctionContract;
|
||||
const encodedData = self._strictEncodeArguments('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', [buyOrder,
|
||||
sellOrder,
|
||||
@@ -273,6 +306,11 @@ export class DutchAuctionContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -289,6 +327,12 @@ export class DutchAuctionContract extends BaseContract {
|
||||
txDefaults: Partial<TxData>,
|
||||
_exchange: string,
|
||||
): Promise<DutchAuctionContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -48,15 +50,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -70,17 +74,11 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -98,15 +96,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -117,6 +117,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -128,6 +129,15 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -156,6 +166,15 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
@@ -180,15 +199,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -202,17 +223,11 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -230,15 +245,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -249,6 +266,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -260,6 +278,15 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -287,6 +314,14 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -311,16 +346,19 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -336,17 +374,12 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
|
||||
index
|
||||
@@ -366,16 +399,19 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -387,6 +423,8 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -400,6 +438,16 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -428,6 +476,14 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -455,6 +511,15 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0
|
||||
]);
|
||||
@@ -482,6 +547,14 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -505,15 +578,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -527,17 +602,11 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -555,15 +624,17 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -574,6 +645,7 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -585,6 +657,15 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -611,6 +692,11 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -625,6 +711,12 @@ export class ERC20ProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20ProxyContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -51,16 +53,19 @@ export class ERC20TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -76,17 +81,12 @@ export class ERC20TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender,
|
||||
_value
|
||||
@@ -106,16 +106,19 @@ export class ERC20TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -127,6 +130,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
@@ -140,6 +145,16 @@ export class ERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
@@ -168,6 +183,14 @@ export class ERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -193,17 +216,21 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -221,17 +248,13 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -253,17 +276,21 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -276,6 +303,9 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -291,6 +321,17 @@ export class ERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -321,6 +362,15 @@ export class ERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner
|
||||
]);
|
||||
@@ -346,16 +396,19 @@ export class ERC20TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -371,17 +424,12 @@ export class ERC20TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to,
|
||||
_value
|
||||
@@ -401,16 +449,19 @@ export class ERC20TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -422,6 +473,8 @@ export class ERC20TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
@@ -435,6 +488,16 @@ export class ERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
@@ -465,6 +528,16 @@ export class ERC20TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC20TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
|
||||
_spender
|
||||
@@ -492,6 +565,11 @@ export class ERC20TokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -506,6 +584,12 @@ export class ERC20TokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC20TokenContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -48,15 +50,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -70,17 +74,11 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -98,15 +96,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -117,6 +117,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -128,6 +129,15 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -156,6 +166,15 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
@@ -180,15 +199,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -202,17 +223,11 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -230,15 +245,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -249,6 +266,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -260,6 +278,15 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -287,6 +314,14 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -311,16 +346,19 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -336,17 +374,12 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
|
||||
index
|
||||
@@ -366,16 +399,19 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -387,6 +423,8 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -400,6 +438,16 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -428,6 +476,14 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -455,6 +511,15 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0
|
||||
]);
|
||||
@@ -482,6 +547,14 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -505,15 +578,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -527,17 +602,11 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -555,15 +624,17 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -574,6 +645,7 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -585,6 +657,15 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721ProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -611,6 +692,11 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -625,6 +711,12 @@ export class ERC721ProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721ProxyContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -62,6 +64,15 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_tokenId
|
||||
]);
|
||||
@@ -87,16 +98,19 @@ export class ERC721TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -112,17 +126,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_approved,
|
||||
_tokenId
|
||||
@@ -142,16 +151,19 @@ export class ERC721TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -163,6 +175,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_approved: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
@@ -176,6 +190,16 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_approved', _approved);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_approved,
|
||||
_tokenId
|
||||
@@ -203,17 +227,21 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -231,17 +259,13 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -263,17 +287,21 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -286,6 +314,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -301,6 +332,17 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -329,17 +371,21 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -357,17 +403,13 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom1.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -389,17 +431,21 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_tokenId
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -412,6 +458,9 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -427,6 +476,17 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -457,6 +517,15 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_tokenId
|
||||
]);
|
||||
@@ -485,6 +554,15 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner
|
||||
]);
|
||||
@@ -510,16 +588,19 @@ export class ERC721TokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -535,17 +616,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.setApprovalForAll.sendTransactionAsync(_operator,
|
||||
_approved
|
||||
@@ -565,16 +641,19 @@ export class ERC721TokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -586,6 +665,8 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_operator: string,
|
||||
_approved: boolean,
|
||||
): string {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
@@ -599,6 +680,16 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_operator', _operator);
|
||||
assert.isBoolean('_approved', _approved);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_operator,
|
||||
_approved
|
||||
@@ -627,18 +718,23 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -658,17 +754,14 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const txHashPromise = self.safeTransferFrom2.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -692,18 +785,23 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
_tokenId,
|
||||
_data
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -717,6 +815,10 @@ export class ERC721TokenContract extends BaseContract {
|
||||
_tokenId: BigNumber,
|
||||
_data: string,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
@@ -734,6 +836,18 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_tokenId', _tokenId);
|
||||
assert.isString('_data', _data);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_from,
|
||||
_to,
|
||||
@@ -766,6 +880,16 @@ export class ERC721TokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_operator', _operator);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ERC721TokenContract;
|
||||
const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_owner,
|
||||
_operator
|
||||
@@ -793,6 +917,11 @@ export class ERC721TokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721TokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -807,6 +936,12 @@ export class ERC721TokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ERC721TokenContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -35,8 +37,15 @@ export class ForwarderContract extends BaseContract {
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
makerAssetFillAmount,
|
||||
@@ -46,10 +55,11 @@ export class ForwarderContract extends BaseContract {
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -75,17 +85,17 @@ export class ForwarderContract extends BaseContract {
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData?: Partial<TxDataPayable> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isArray('orders', orders);
|
||||
assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const txHashPromise = self.marketBuyOrdersWithEth.sendTransactionAsync(orders,
|
||||
makerAssetFillAmount,
|
||||
@@ -115,8 +125,15 @@ export class ForwarderContract extends BaseContract {
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
makerAssetFillAmount,
|
||||
@@ -126,10 +143,11 @@ export class ForwarderContract extends BaseContract {
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -146,6 +164,13 @@ export class ForwarderContract extends BaseContract {
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
): string {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
makerAssetFillAmount,
|
||||
@@ -169,6 +194,21 @@ export class ForwarderContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
|
||||
> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isBigNumber('makerAssetFillAmount', makerAssetFillAmount);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
makerAssetFillAmount,
|
||||
@@ -200,16 +240,19 @@ export class ForwarderContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
|
||||
amount
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -225,17 +268,12 @@ export class ForwarderContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as ForwarderContract;
|
||||
const txHashPromise = self.withdrawAsset.sendTransactionAsync(assetData,
|
||||
amount
|
||||
@@ -255,16 +293,19 @@ export class ForwarderContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
|
||||
amount
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -276,6 +317,8 @@ export class ForwarderContract extends BaseContract {
|
||||
assetData: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as ForwarderContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
|
||||
amount
|
||||
@@ -289,6 +332,16 @@ export class ForwarderContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isBigNumber('amount', amount);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [assetData,
|
||||
amount
|
||||
@@ -317,6 +370,14 @@ export class ForwarderContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -345,8 +406,14 @@ export class ForwarderContract extends BaseContract {
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
signatures,
|
||||
@@ -355,10 +422,11 @@ export class ForwarderContract extends BaseContract {
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -382,17 +450,16 @@ export class ForwarderContract extends BaseContract {
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData?: Partial<TxDataPayable> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const txHashPromise = self.marketSellOrdersWithEth.sendTransactionAsync(orders,
|
||||
signatures,
|
||||
@@ -420,8 +487,14 @@ export class ForwarderContract extends BaseContract {
|
||||
feeSignatures: string[],
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
signatures,
|
||||
@@ -430,10 +503,11 @@ export class ForwarderContract extends BaseContract {
|
||||
feePercentage,
|
||||
feeRecipient
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -449,6 +523,12 @@ export class ForwarderContract extends BaseContract {
|
||||
feePercentage: BigNumber,
|
||||
feeRecipient: string,
|
||||
): string {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
const self = this as any as ForwarderContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
signatures,
|
||||
@@ -470,6 +550,20 @@ export class ForwarderContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
|
||||
> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('signatures', signatures);
|
||||
assert.isArray('feeOrders', feeOrders);
|
||||
assert.isArray('feeSignatures', feeSignatures);
|
||||
assert.isBigNumber('feePercentage', feePercentage);
|
||||
assert.isString('feeRecipient', feeRecipient);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [orders,
|
||||
signatures,
|
||||
@@ -499,15 +593,17 @@ export class ForwarderContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -521,17 +617,11 @@ export class ForwarderContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ForwarderContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -549,15 +639,17 @@ export class ForwarderContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -568,6 +660,7 @@ export class ForwarderContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as ForwarderContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -579,6 +672,15 @@ export class ForwarderContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ForwarderContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -608,6 +710,11 @@ export class ForwarderContract extends BaseContract {
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -628,6 +735,12 @@ _wethAssetData
|
||||
_zrxAssetData: string,
|
||||
_wethAssetData: string,
|
||||
): Promise<ForwarderContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -29,15 +31,17 @@ export class IAssetProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -51,17 +55,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -79,15 +77,17 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -98,6 +98,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -109,6 +110,15 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -133,15 +143,17 @@ export class IAssetProxyContract extends BaseContract {
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -155,17 +167,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -183,15 +189,17 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -202,6 +210,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -213,6 +222,15 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -238,16 +256,19 @@ export class IAssetProxyContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -263,17 +284,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
|
||||
index
|
||||
@@ -293,16 +309,19 @@ export class IAssetProxyContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -314,6 +333,8 @@ export class IAssetProxyContract extends BaseContract {
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -327,6 +348,16 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -355,18 +386,23 @@ export class IAssetProxyContract extends BaseContract {
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -386,17 +422,14 @@ export class IAssetProxyContract extends BaseContract {
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(assetData,
|
||||
from,
|
||||
@@ -420,18 +453,23 @@ export class IAssetProxyContract extends BaseContract {
|
||||
from: string,
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
to,
|
||||
amount
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -445,6 +483,10 @@ export class IAssetProxyContract extends BaseContract {
|
||||
to: string,
|
||||
amount: BigNumber,
|
||||
): string {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
@@ -462,6 +504,18 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('assetData', assetData);
|
||||
assert.isString('from', from);
|
||||
assert.isString('to', to);
|
||||
assert.isBigNumber('amount', amount);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(bytes,address,address,uint256)', [assetData,
|
||||
from,
|
||||
@@ -492,6 +546,14 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -518,6 +580,14 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -541,15 +611,17 @@ export class IAssetProxyContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -563,17 +635,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -591,15 +657,17 @@ export class IAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -610,6 +678,7 @@ export class IAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -621,6 +690,15 @@ export class IAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -647,6 +725,11 @@ export class IAssetProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IAssetProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -661,6 +744,12 @@ export class IAssetProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IAssetProxyContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -35,6 +37,17 @@ export class IValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signerAddress', signerAddress);
|
||||
assert.isString('signature', signature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [hash,
|
||||
signerAddress,
|
||||
@@ -63,6 +76,11 @@ export class IValidatorContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IValidatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -77,6 +95,12 @@ export class IValidatorContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IValidatorContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -34,6 +36,16 @@ export class IWalletContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('hash', hash);
|
||||
assert.isString('signature', signature);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as IWalletContract;
|
||||
const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [hash,
|
||||
signature
|
||||
@@ -61,6 +73,11 @@ export class IWalletContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IWalletContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -75,6 +92,12 @@ export class IWalletContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<IWalletContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -59,6 +61,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [index_0
|
||||
]);
|
||||
@@ -83,15 +94,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
public addAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -105,17 +118,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const txHashPromise = self.addAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -133,15 +140,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -152,6 +161,7 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -163,6 +173,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -191,6 +210,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isBigNumber('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorities(uint256)', [index_0
|
||||
]);
|
||||
@@ -219,6 +247,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('assetProxyId', assetProxyId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [assetProxyId
|
||||
]);
|
||||
@@ -243,15 +280,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
public removeAuthorizedAddress = {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -265,17 +304,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddress.sendTransactionAsync(target
|
||||
, txData);
|
||||
@@ -293,15 +326,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -312,6 +347,7 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
target: string,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -323,6 +359,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target
|
||||
]);
|
||||
@@ -350,6 +395,14 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('owner()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -374,16 +427,19 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -399,17 +455,12 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const txHashPromise = self.removeAuthorizedAddressAtIndex.sendTransactionAsync(target,
|
||||
index
|
||||
@@ -429,16 +480,19 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -450,6 +504,8 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
target: string,
|
||||
index: BigNumber,
|
||||
): string {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -463,6 +519,16 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isBigNumber('index', index);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target,
|
||||
index
|
||||
@@ -491,6 +557,14 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getProxyId()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -518,6 +592,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('authorized(address)', [index_0
|
||||
]);
|
||||
@@ -542,15 +625,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
public registerAssetProxy = {
|
||||
async sendTransactionAsync(
|
||||
assetProxy: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('assetProxy', assetProxy);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -564,17 +649,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
assetProxy: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('assetProxy', assetProxy);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const txHashPromise = self.registerAssetProxy.sendTransactionAsync(assetProxy
|
||||
, txData);
|
||||
@@ -592,15 +671,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
assetProxy: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('assetProxy', assetProxy);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -611,6 +692,7 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
assetProxy: string,
|
||||
): string {
|
||||
assert.isString('assetProxy', assetProxy);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
|
||||
]);
|
||||
@@ -622,6 +704,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('assetProxy', assetProxy);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy
|
||||
]);
|
||||
@@ -649,6 +740,14 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string[]
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -672,15 +771,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
public transferOwnership = {
|
||||
async sendTransactionAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -694,17 +795,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
newOwner: string,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const txHashPromise = self.transferOwnership.sendTransactionAsync(newOwner
|
||||
, txData);
|
||||
@@ -722,15 +817,17 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
newOwner: string,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -741,6 +838,7 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
newOwner: string,
|
||||
): string {
|
||||
assert.isString('newOwner', newOwner);
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -752,6 +850,15 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isString('newOwner', newOwner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as MultiAssetProxyContract;
|
||||
const encodedData = self._strictEncodeArguments('transferOwnership(address)', [newOwner
|
||||
]);
|
||||
@@ -778,6 +885,11 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<MultiAssetProxyContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -792,6 +904,12 @@ export class MultiAssetProxyContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<MultiAssetProxyContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -34,6 +36,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}]
|
||||
> {
|
||||
|
||||
assert.isString('takerAddress', takerAddress);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
|
||||
takerAddress
|
||||
@@ -64,6 +76,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber, BigNumber]
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isString('assetData', assetData);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [target,
|
||||
assetData
|
||||
@@ -94,6 +116,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
|
||||
> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('takerAddresses', takerAddresses);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
|
||||
takerAddresses
|
||||
@@ -124,6 +156,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
|
||||
> {
|
||||
assert.isArray('orders', orders);
|
||||
assert.isArray('takerAddresses', takerAddresses);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [orders,
|
||||
takerAddresses
|
||||
@@ -154,6 +196,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.isString('token', token);
|
||||
assert.isBigNumber('tokenId', tokenId);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [token,
|
||||
tokenId
|
||||
@@ -184,6 +236,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<[BigNumber[], BigNumber[]]
|
||||
> {
|
||||
assert.isString('target', target);
|
||||
assert.isArray('assetData', assetData);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [target,
|
||||
assetData
|
||||
@@ -214,6 +276,16 @@ export class OrderValidatorContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
|
||||
> {
|
||||
|
||||
assert.isString('takerAddress', takerAddress);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as OrderValidatorContract;
|
||||
const encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [order,
|
||||
takerAddress
|
||||
@@ -243,6 +315,11 @@ export class OrderValidatorContract extends BaseContract {
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -261,6 +338,12 @@ _zrxAssetData
|
||||
_exchange: string,
|
||||
_zrxAssetData: string,
|
||||
): Promise<OrderValidatorContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[_exchange,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -67,6 +69,14 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('name()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -91,16 +101,19 @@ export class WETH9Contract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('guy', guy);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy,
|
||||
wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -116,17 +129,12 @@ export class WETH9Contract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('guy', guy);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(guy,
|
||||
wad
|
||||
@@ -146,16 +154,19 @@ export class WETH9Contract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('guy', guy);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy,
|
||||
wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -167,6 +178,8 @@ export class WETH9Contract extends BaseContract {
|
||||
guy: string,
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
assert.isString('guy', guy);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [guy,
|
||||
wad
|
||||
@@ -180,6 +193,16 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('guy', guy);
|
||||
assert.isBigNumber('wad', wad);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [guy,
|
||||
wad
|
||||
@@ -208,6 +231,14 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -233,17 +264,21 @@ export class WETH9Contract extends BaseContract {
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('src', src);
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -261,17 +296,13 @@ export class WETH9Contract extends BaseContract {
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('src', src);
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(src,
|
||||
dst,
|
||||
@@ -293,17 +324,21 @@ export class WETH9Contract extends BaseContract {
|
||||
src: string,
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('src', src);
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
|
||||
dst,
|
||||
wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -316,6 +351,9 @@ export class WETH9Contract extends BaseContract {
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
assert.isString('src', src);
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
|
||||
dst,
|
||||
@@ -331,6 +369,17 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('src', src);
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [src,
|
||||
dst,
|
||||
@@ -357,15 +406,17 @@ export class WETH9Contract extends BaseContract {
|
||||
public withdraw = {
|
||||
async sendTransactionAsync(
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -379,17 +430,11 @@ export class WETH9Contract extends BaseContract {
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
wad: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const txHashPromise = self.withdraw.sendTransactionAsync(wad
|
||||
, txData);
|
||||
@@ -407,15 +452,17 @@ export class WETH9Contract extends BaseContract {
|
||||
},
|
||||
async estimateGasAsync(
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -426,6 +473,7 @@ export class WETH9Contract extends BaseContract {
|
||||
getABIEncodedTransactionData(
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad
|
||||
]);
|
||||
@@ -437,6 +485,15 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.isBigNumber('wad', wad);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('withdraw(uint256)', [wad
|
||||
]);
|
||||
@@ -464,6 +521,14 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<number
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('decimals()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -491,6 +556,15 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [index_0
|
||||
]);
|
||||
@@ -518,6 +592,14 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('symbol()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -542,16 +624,19 @@ export class WETH9Contract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
|
||||
wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -567,17 +652,12 @@ export class WETH9Contract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(dst,
|
||||
wad
|
||||
@@ -597,16 +677,19 @@ export class WETH9Contract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
|
||||
wad
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -618,6 +701,8 @@ export class WETH9Contract extends BaseContract {
|
||||
dst: string,
|
||||
wad: BigNumber,
|
||||
): string {
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
const self = this as any as WETH9Contract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
|
||||
wad
|
||||
@@ -631,6 +716,16 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('dst', dst);
|
||||
assert.isBigNumber('wad', wad);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [dst,
|
||||
wad
|
||||
@@ -655,14 +750,15 @@ export class WETH9Contract extends BaseContract {
|
||||
};
|
||||
public deposit = {
|
||||
async sendTransactionAsync(
|
||||
txData: Partial<TxDataPayable> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('deposit()', []);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -674,17 +770,10 @@ export class WETH9Contract extends BaseContract {
|
||||
return txHash;
|
||||
},
|
||||
awaitTransactionSuccessAsync(
|
||||
txData?: Partial<TxDataPayable> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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>(
|
||||
@@ -700,14 +789,15 @@ export class WETH9Contract extends BaseContract {
|
||||
);
|
||||
},
|
||||
async estimateGasAsync(
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('deposit()', []);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -726,6 +816,14 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<void
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('deposit()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -754,6 +852,16 @@ export class WETH9Contract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('index_0', index_0);
|
||||
assert.isString('index_1', index_1);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as WETH9Contract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [index_0,
|
||||
index_1
|
||||
@@ -781,6 +889,11 @@ export class WETH9Contract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<WETH9Contract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -795,6 +908,12 @@ export class WETH9Contract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<WETH9Contract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// tslint:disable:no-unused-variable
|
||||
// tslint:disable:no-unbound-method
|
||||
import { BaseContract, PromiseWithTransactionHash } from '@0x/base-contract';
|
||||
import { schemas } from '@0x/json-schemas';
|
||||
import {
|
||||
BlockParam,
|
||||
BlockParamLiteral,
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
import { BigNumber, classUtils, logUtils, providerUtils } from '@0x/utils';
|
||||
import { SimpleContractArtifact } from '@0x/types';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { assert } from '@0x/assert';
|
||||
import * as ethers from 'ethers';
|
||||
// tslint:enable:no-unused-variable
|
||||
|
||||
@@ -53,6 +55,14 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('name()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -77,16 +87,19 @@ export class ZRXTokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -102,17 +115,12 @@ export class ZRXTokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const txHashPromise = self.approve.sendTransactionAsync(_spender,
|
||||
_value
|
||||
@@ -132,16 +140,19 @@ export class ZRXTokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -153,6 +164,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_spender: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
@@ -166,6 +179,16 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_spender', _spender);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_spender,
|
||||
_value
|
||||
@@ -194,6 +217,14 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('totalSupply()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -219,17 +250,21 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -247,17 +282,13 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const txHashPromise = self.transferFrom.sendTransactionAsync(_from,
|
||||
_to,
|
||||
@@ -279,17 +310,21 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_from: string,
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -302,6 +337,9 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -317,6 +355,17 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_from', _from);
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_from,
|
||||
_to,
|
||||
@@ -346,6 +395,14 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<number
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('decimals()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -373,6 +430,15 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('balanceOf(address)', [_owner
|
||||
]);
|
||||
@@ -400,6 +466,14 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<string
|
||||
> {
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('symbol()', []);
|
||||
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
@@ -424,16 +498,19 @@ export class ZRXTokenContract extends BaseContract {
|
||||
async sendTransactionAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<string> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -449,17 +526,12 @@ export class ZRXTokenContract extends BaseContract {
|
||||
awaitTransactionSuccessAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData?: Partial<TxData> | number,
|
||||
txData?: Partial<TxData>,
|
||||
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 = {};
|
||||
}
|
||||
//
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const txHashPromise = self.transfer.sendTransactionAsync(_to,
|
||||
_value
|
||||
@@ -479,16 +551,19 @@ export class ZRXTokenContract extends BaseContract {
|
||||
async estimateGasAsync(
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
txData: Partial<TxData> = {},
|
||||
txData?: Partial<TxData> | undefined,
|
||||
): Promise<number> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
]);
|
||||
const passedInTxData = txData === undefined ? {} : txData;
|
||||
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
|
||||
{
|
||||
to: self.address,
|
||||
...txData,
|
||||
...passedInTxData,
|
||||
data: encodedData,
|
||||
},
|
||||
self._web3Wrapper.getContractDefaults(),
|
||||
@@ -500,6 +575,8 @@ export class ZRXTokenContract extends BaseContract {
|
||||
_to: string,
|
||||
_value: BigNumber,
|
||||
): string {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
@@ -513,6 +590,16 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<boolean
|
||||
> {
|
||||
assert.isString('_to', _to);
|
||||
assert.isBigNumber('_value', _value);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_to,
|
||||
_value
|
||||
@@ -543,6 +630,16 @@ export class ZRXTokenContract extends BaseContract {
|
||||
defaultBlock?: BlockParam,
|
||||
): Promise<BigNumber
|
||||
> {
|
||||
assert.isString('_owner', _owner);
|
||||
assert.isString('_spender', _spender);
|
||||
assert.doesConformToSchema('callData', callData, schemas.callDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (defaultBlock !== undefined) {
|
||||
assert.isBlockParam('defaultBlock', defaultBlock);
|
||||
}
|
||||
const self = this as any as ZRXTokenContract;
|
||||
const encodedData = self._strictEncodeArguments('allowance(address,address)', [_owner,
|
||||
_spender
|
||||
@@ -570,6 +667,11 @@ export class ZRXTokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ZRXTokenContract> {
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
if (artifact.compilerOutput === undefined) {
|
||||
throw new Error('Compiler output not found in the artifact file');
|
||||
}
|
||||
@@ -584,6 +686,12 @@ export class ZRXTokenContract extends BaseContract {
|
||||
supportedProvider: SupportedProvider,
|
||||
txDefaults: Partial<TxData>,
|
||||
): Promise<ZRXTokenContract> {
|
||||
assert.isString('bytecode', bytecode);
|
||||
assert.doesConformToSchema('txDefaults', txDefaults, schemas.txDataSchema, [
|
||||
schemas.addressSchema,
|
||||
schemas.numberSchema,
|
||||
schemas.jsNumber,
|
||||
]);
|
||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
|
||||
[] = BaseContract._formatABIDataItemList(
|
||||
|
||||
Reference in New Issue
Block a user