aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-12-02 12:43:45 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-12-02 13:31:11 +0800
commit0fc356740aa59cdef0ec193a83468ef0f261ca6b (patch)
treed0981bba8986295fe5f76f7fb3dea75abd53b711 /packages/0x.js
parentf285a46d05c8d30e516459b243106659c7351f6f (diff)
downloaddexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.tar
dexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.tar.gz
dexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.tar.bz2
dexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.tar.lz
dexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.tar.xz
dexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.tar.zst
dexon-sol-tools-0fc356740aa59cdef0ec193a83468ef0f261ca6b.zip
Add generated contract wrappers
Diffstat (limited to 'packages/0x.js')
-rw-r--r--packages/0x.js/src/contract_wrappers/generated/base_contract.ts36
-rw-r--r--packages/0x.js/src/contract_wrappers/generated/ether_token.ts359
-rw-r--r--packages/0x.js/src/contract_wrappers/generated/exchange.ts726
-rw-r--r--packages/0x.js/src/contract_wrappers/generated/token.ts228
-rw-r--r--packages/0x.js/src/contract_wrappers/generated/token_registry.ts546
-rw-r--r--packages/0x.js/src/contract_wrappers/generated/token_transfer_proxy.ts281
6 files changed, 2176 insertions, 0 deletions
diff --git a/packages/0x.js/src/contract_wrappers/generated/base_contract.ts b/packages/0x.js/src/contract_wrappers/generated/base_contract.ts
new file mode 100644
index 000000000..e5f536448
--- /dev/null
+++ b/packages/0x.js/src/contract_wrappers/generated/base_contract.ts
@@ -0,0 +1,36 @@
+import * as _ from 'lodash';
+import * as Web3 from 'web3';
+
+import {TxData, TxDataPayable} from '../../types';
+
+// TODO: Gas Margin
+// TODO: Abi check
+export class BaseContract {
+ protected web3ContractInstance: Web3.ContractInstance;
+ protected defaults: Partial<TxData>;
+ protected async applyDefaultsToTxDataAsync<T extends TxData|TxDataPayable>(
+ txData: T,
+ estimateGasAsync?: (txData: T) => Promise<number>,
+ ): Promise<TxData> {
+ // Gas amount sourced with the following priorities:
+ // 1. Optional param passed in to public method call
+ // 2. Global config passed in at library instantiation
+ // 3. Gas estimate calculation + safety margin
+ const removeUndefinedProperties = _.pickBy;
+ const txDataWithDefaults = {
+ ...removeUndefinedProperties(this.defaults),
+ ...removeUndefinedProperties(txData as any),
+ // HACK: TS can't prove that T is speadable.
+ // Awaiting https://github.com/Microsoft/TypeScript/pull/13288 to be merged
+ };
+ if (_.isUndefined(txDataWithDefaults.gas) && !_.isUndefined(estimateGasAsync)) {
+ const estimatedGas = await estimateGasAsync(txData);
+ txDataWithDefaults.gas = estimatedGas;
+ }
+ return txDataWithDefaults;
+ }
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
+ this.web3ContractInstance = web3ContractInstance;
+ this.defaults = defaults;
+ }
+}
diff --git a/packages/0x.js/src/contract_wrappers/generated/ether_token.ts b/packages/0x.js/src/contract_wrappers/generated/ether_token.ts
new file mode 100644
index 000000000..e613f453f
--- /dev/null
+++ b/packages/0x.js/src/contract_wrappers/generated/ether_token.ts
@@ -0,0 +1,359 @@
+import {BigNumber} from 'bignumber.js';
+import * as Web3 from 'web3';
+
+import {TxData, TxDataPayable} from '../../types';
+import {classUtils} from '../../utils/class_utils';
+import {promisify} from '../../utils/promisify';
+
+import {BaseContract} from './base_contract';
+
+export class EtherTokenContract extends BaseContract {
+ public name = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as EtherTokenContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.name.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public approve = {
+ async sendTransactionAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.approve.estimateGasAsync.bind(
+ self,
+ _spender,
+ _value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.approve, self.web3ContractInstance,
+ )(
+ _spender,
+ _value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.approve.estimateGas, self.web3ContractInstance,
+ )(
+ _spender,
+ _value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _spender: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as EtherTokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.approve.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public totalSupply = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as EtherTokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.totalSupply.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transferFrom, self.web3ContractInstance,
+ )(
+ _from,
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transferFrom.estimateGas, self.web3ContractInstance,
+ )(
+ _from,
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as EtherTokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transferFrom.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public withdraw = {
+ async sendTransactionAsync(
+ amount: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.withdraw.estimateGasAsync.bind(
+ self,
+ amount,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.withdraw, self.web3ContractInstance,
+ )(
+ amount,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ amount: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.withdraw.estimateGas, self.web3ContractInstance,
+ )(
+ amount,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ amount: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as EtherTokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.withdraw.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public decimals = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as EtherTokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.decimals.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as EtherTokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.balanceOf.call,
+ self.web3ContractInstance,
+ )(
+ _owner,
+ );
+ return result;
+ },
+ };
+ public symbol = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as EtherTokenContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.symbol.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public transfer = {
+ async sendTransactionAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transfer.estimateGasAsync.bind(
+ self,
+ _to,
+ _value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transfer, self.web3ContractInstance,
+ )(
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transfer.estimateGas, self.web3ContractInstance,
+ )(
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as EtherTokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transfer.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public deposit = {
+ async sendTransactionAsync(
+ txData: TxDataPayable = {},
+ ): Promise<string> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.deposit.estimateGasAsync.bind(
+ self,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.deposit, self.web3ContractInstance,
+ )(
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as EtherTokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.deposit.estimateGas, self.web3ContractInstance,
+ )(
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ txData: TxData = {},
+ ): string {
+ const self = this as EtherTokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.deposit.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public allowance = {
+ async callAsync(
+ _owner: string,
+ _spender: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as EtherTokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.allowance.call,
+ self.web3ContractInstance,
+ )(
+ _owner,
+ _spender,
+ );
+ return result;
+ },
+ };
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
+ super(web3ContractInstance, defaults);
+ classUtils.bindAll(this, ['web3ContractInstance', 'defaults']);
+ }
+} // tslint:disable:max-file-line-count
diff --git a/packages/0x.js/src/contract_wrappers/generated/exchange.ts b/packages/0x.js/src/contract_wrappers/generated/exchange.ts
new file mode 100644
index 000000000..8bb2a24a3
--- /dev/null
+++ b/packages/0x.js/src/contract_wrappers/generated/exchange.ts
@@ -0,0 +1,726 @@
+import {BigNumber} from 'bignumber.js';
+import * as Web3 from 'web3';
+
+import {TxData, TxDataPayable} from '../../types';
+import {classUtils} from '../../utils/class_utils';
+import {promisify} from '../../utils/promisify';
+
+import {BaseContract} from './base_contract';
+
+export class ExchangeContract extends BaseContract {
+ public isRoundingError = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<boolean
+ >(
+ self.web3ContractInstance.isRoundingError.call,
+ self.web3ContractInstance,
+ )(
+ numerator,
+ denominator,
+ target,
+ );
+ return result;
+ },
+ };
+ public filled = {
+ async callAsync(
+ index: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.filled.call,
+ self.web3ContractInstance,
+ )(
+ index,
+ );
+ return result;
+ },
+ };
+ public cancelled = {
+ async callAsync(
+ index: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.cancelled.call,
+ self.web3ContractInstance,
+ )(
+ index,
+ );
+ return result;
+ },
+ };
+ public fillOrdersUpTo = {
+ async sendTransactionAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmount: BigNumber,
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.fillOrdersUpTo.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.fillOrdersUpTo, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmount: BigNumber,
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.fillOrdersUpTo.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmount: BigNumber,
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.fillOrdersUpTo.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public cancelOrder = {
+ async sendTransactionAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ cancelTakerTokenAmount: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.cancelOrder.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ cancelTakerTokenAmount,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.cancelOrder, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ cancelTakerTokenAmount,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ cancelTakerTokenAmount: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.cancelOrder.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ cancelTakerTokenAmount,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ cancelTakerTokenAmount: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.cancelOrder.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public ZRX_TOKEN_CONTRACT = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.ZRX_TOKEN_CONTRACT.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public batchFillOrKillOrders = {
+ async sendTransactionAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmounts: BigNumber[],
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.batchFillOrKillOrders.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmounts,
+ v,
+ r,
+ s,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.batchFillOrKillOrders, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmounts,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmounts: BigNumber[],
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.batchFillOrKillOrders.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmounts,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmounts: BigNumber[],
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.batchFillOrKillOrders.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public fillOrKillOrder = {
+ async sendTransactionAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ fillTakerTokenAmount: BigNumber,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.fillOrKillOrder.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ v,
+ r,
+ s,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.fillOrKillOrder, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ fillTakerTokenAmount: BigNumber,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.fillOrKillOrder.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ fillTakerTokenAmount: BigNumber,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.fillOrKillOrder.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public getUnavailableTakerTokenAmount = {
+ async callAsync(
+ orderHash: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.getUnavailableTakerTokenAmount.call,
+ self.web3ContractInstance,
+ )(
+ orderHash,
+ );
+ return result;
+ },
+ };
+ public isValidSignature = {
+ async callAsync(
+ signer: string,
+ hash: string,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<boolean
+ >(
+ self.web3ContractInstance.isValidSignature.call,
+ self.web3ContractInstance,
+ )(
+ signer,
+ hash,
+ v,
+ r,
+ s,
+ );
+ return result;
+ },
+ };
+ public getPartialAmount = {
+ async callAsync(
+ numerator: BigNumber,
+ denominator: BigNumber,
+ target: BigNumber,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.getPartialAmount.call,
+ self.web3ContractInstance,
+ )(
+ numerator,
+ denominator,
+ target,
+ );
+ return result;
+ },
+ };
+ public TOKEN_TRANSFER_PROXY_CONTRACT = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.TOKEN_TRANSFER_PROXY_CONTRACT.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public batchFillOrders = {
+ async sendTransactionAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmounts: BigNumber[],
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.batchFillOrders.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmounts,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.batchFillOrders, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmounts,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmounts: BigNumber[],
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.batchFillOrders.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmounts,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ fillTakerTokenAmounts: BigNumber[],
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber[],
+ r: string[],
+ s: string[],
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.batchFillOrders.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public batchCancelOrders = {
+ async sendTransactionAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ cancelTakerTokenAmounts: BigNumber[],
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.batchCancelOrders.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ cancelTakerTokenAmounts,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.batchCancelOrders, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ cancelTakerTokenAmounts,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ cancelTakerTokenAmounts: BigNumber[],
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.batchCancelOrders.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ cancelTakerTokenAmounts,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[][],
+ orderValues: BigNumber[][],
+ cancelTakerTokenAmounts: BigNumber[],
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.batchCancelOrders.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public fillOrder = {
+ async sendTransactionAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ fillTakerTokenAmount: BigNumber,
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.fillOrder.estimateGasAsync.bind(
+ self,
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.fillOrder, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ fillTakerTokenAmount: BigNumber,
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as ExchangeContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.fillOrder.estimateGas, self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ fillTakerTokenAmount,
+ shouldThrowOnInsufficientBalanceOrAllowance,
+ v,
+ r,
+ s,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ fillTakerTokenAmount: BigNumber,
+ shouldThrowOnInsufficientBalanceOrAllowance: boolean,
+ v: number|BigNumber,
+ r: string,
+ s: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as ExchangeContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.fillOrder.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public getOrderHash = {
+ async callAsync(
+ orderAddresses: string[],
+ orderValues: BigNumber[],
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.getOrderHash.call,
+ self.web3ContractInstance,
+ )(
+ orderAddresses,
+ orderValues,
+ );
+ return result;
+ },
+ };
+ public EXTERNAL_QUERY_GAS_LIMIT = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.EXTERNAL_QUERY_GAS_LIMIT.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public VERSION = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as ExchangeContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.VERSION.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
+ super(web3ContractInstance, defaults);
+ classUtils.bindAll(this, ['web3ContractInstance', 'defaults']);
+ }
+} // tslint:disable:max-file-line-count
diff --git a/packages/0x.js/src/contract_wrappers/generated/token.ts b/packages/0x.js/src/contract_wrappers/generated/token.ts
new file mode 100644
index 000000000..1248f53a3
--- /dev/null
+++ b/packages/0x.js/src/contract_wrappers/generated/token.ts
@@ -0,0 +1,228 @@
+import {BigNumber} from 'bignumber.js';
+import * as Web3 from 'web3';
+
+import {TxData, TxDataPayable} from '../../types';
+import {classUtils} from '../../utils/class_utils';
+import {promisify} from '../../utils/promisify';
+
+import {BaseContract} from './base_contract';
+
+export class TokenContract extends BaseContract {
+ public approve = {
+ async sendTransactionAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.approve.estimateGasAsync.bind(
+ self,
+ _spender,
+ _value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.approve, self.web3ContractInstance,
+ )(
+ _spender,
+ _value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _spender: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.approve.estimateGas, self.web3ContractInstance,
+ )(
+ _spender,
+ _value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _spender: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.approve.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public totalSupply = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as TokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.totalSupply.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public transferFrom = {
+ async sendTransactionAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ _from,
+ _to,
+ _value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transferFrom, self.web3ContractInstance,
+ )(
+ _from,
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transferFrom.estimateGas, self.web3ContractInstance,
+ )(
+ _from,
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _from: string,
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transferFrom.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public balanceOf = {
+ async callAsync(
+ _owner: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as TokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.balanceOf.call,
+ self.web3ContractInstance,
+ )(
+ _owner,
+ );
+ return result;
+ },
+ };
+ public transfer = {
+ async sendTransactionAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transfer.estimateGasAsync.bind(
+ self,
+ _to,
+ _value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transfer, self.web3ContractInstance,
+ )(
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transfer.estimateGas, self.web3ContractInstance,
+ )(
+ _to,
+ _value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _to: string,
+ _value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transfer.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public allowance = {
+ async callAsync(
+ _owner: string,
+ _spender: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<BigNumber
+ > {
+ const self = this as TokenContract;
+ const result = await promisify<BigNumber
+ >(
+ self.web3ContractInstance.allowance.call,
+ self.web3ContractInstance,
+ )(
+ _owner,
+ _spender,
+ );
+ return result;
+ },
+ };
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
+ super(web3ContractInstance, defaults);
+ classUtils.bindAll(this, ['web3ContractInstance', 'defaults']);
+ }
+} // tslint:disable:max-file-line-count
diff --git a/packages/0x.js/src/contract_wrappers/generated/token_registry.ts b/packages/0x.js/src/contract_wrappers/generated/token_registry.ts
new file mode 100644
index 000000000..ec2158bb8
--- /dev/null
+++ b/packages/0x.js/src/contract_wrappers/generated/token_registry.ts
@@ -0,0 +1,546 @@
+import {BigNumber} from 'bignumber.js';
+import * as Web3 from 'web3';
+
+import {TxData, TxDataPayable} from '../../types';
+import {classUtils} from '../../utils/class_utils';
+import {promisify} from '../../utils/promisify';
+
+import {BaseContract} from './base_contract';
+
+export class TokenRegistryContract extends BaseContract {
+ public removeToken = {
+ async sendTransactionAsync(
+ _token: string,
+ _index: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.removeToken.estimateGasAsync.bind(
+ self,
+ _token,
+ _index,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.removeToken, self.web3ContractInstance,
+ )(
+ _token,
+ _index,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _token: string,
+ _index: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.removeToken.estimateGas, self.web3ContractInstance,
+ )(
+ _token,
+ _index,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _token: string,
+ _index: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.removeToken.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public getTokenAddressByName = {
+ async callAsync(
+ _name: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.getTokenAddressByName.call,
+ self.web3ContractInstance,
+ )(
+ _name,
+ );
+ return result;
+ },
+ };
+ public getTokenAddressBySymbol = {
+ async callAsync(
+ _symbol: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.getTokenAddressBySymbol.call,
+ self.web3ContractInstance,
+ )(
+ _symbol,
+ );
+ return result;
+ },
+ };
+ public setTokenSwarmHash = {
+ async sendTransactionAsync(
+ _token: string,
+ _swarmHash: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.setTokenSwarmHash.estimateGasAsync.bind(
+ self,
+ _token,
+ _swarmHash,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.setTokenSwarmHash, self.web3ContractInstance,
+ )(
+ _token,
+ _swarmHash,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _token: string,
+ _swarmHash: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.setTokenSwarmHash.estimateGas, self.web3ContractInstance,
+ )(
+ _token,
+ _swarmHash,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _token: string,
+ _swarmHash: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.setTokenSwarmHash.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public getTokenMetaData = {
+ async callAsync(
+ _token: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<[string, string, string, BigNumber, string, string]
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<[string, string, string, BigNumber, string, string]
+ >(
+ self.web3ContractInstance.getTokenMetaData.call,
+ self.web3ContractInstance,
+ )(
+ _token,
+ );
+ return result;
+ },
+ };
+ public owner = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.owner.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public addToken = {
+ async sendTransactionAsync(
+ _token: string,
+ _name: string,
+ _symbol: string,
+ _decimals: number|BigNumber,
+ _ipfsHash: string,
+ _swarmHash: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.addToken.estimateGasAsync.bind(
+ self,
+ _token,
+ _name,
+ _symbol,
+ _decimals,
+ _ipfsHash,
+ _swarmHash,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.addToken, self.web3ContractInstance,
+ )(
+ _token,
+ _name,
+ _symbol,
+ _decimals,
+ _ipfsHash,
+ _swarmHash,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _token: string,
+ _name: string,
+ _symbol: string,
+ _decimals: number|BigNumber,
+ _ipfsHash: string,
+ _swarmHash: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.addToken.estimateGas, self.web3ContractInstance,
+ )(
+ _token,
+ _name,
+ _symbol,
+ _decimals,
+ _ipfsHash,
+ _swarmHash,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _token: string,
+ _name: string,
+ _symbol: string,
+ _decimals: number|BigNumber,
+ _ipfsHash: string,
+ _swarmHash: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.addToken.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public setTokenName = {
+ async sendTransactionAsync(
+ _token: string,
+ _name: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.setTokenName.estimateGasAsync.bind(
+ self,
+ _token,
+ _name,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.setTokenName, self.web3ContractInstance,
+ )(
+ _token,
+ _name,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _token: string,
+ _name: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.setTokenName.estimateGas, self.web3ContractInstance,
+ )(
+ _token,
+ _name,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _token: string,
+ _name: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.setTokenName.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public tokens = {
+ async callAsync(
+ index: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<[string, string, string, BigNumber, string, string]
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<[string, string, string, BigNumber, string, string]
+ >(
+ self.web3ContractInstance.tokens.call,
+ self.web3ContractInstance,
+ )(
+ index,
+ );
+ return result;
+ },
+ };
+ public tokenAddresses = {
+ async callAsync(
+ index: BigNumber,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.tokenAddresses.call,
+ self.web3ContractInstance,
+ )(
+ index,
+ );
+ return result;
+ },
+ };
+ public getTokenByName = {
+ async callAsync(
+ _name: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<[string, string, string, BigNumber, string, string]
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<[string, string, string, BigNumber, string, string]
+ >(
+ self.web3ContractInstance.getTokenByName.call,
+ self.web3ContractInstance,
+ )(
+ _name,
+ );
+ return result;
+ },
+ };
+ public getTokenAddresses = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<string[]
+ >(
+ self.web3ContractInstance.getTokenAddresses.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public setTokenIpfsHash = {
+ async sendTransactionAsync(
+ _token: string,
+ _ipfsHash: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.setTokenIpfsHash.estimateGasAsync.bind(
+ self,
+ _token,
+ _ipfsHash,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.setTokenIpfsHash, self.web3ContractInstance,
+ )(
+ _token,
+ _ipfsHash,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _token: string,
+ _ipfsHash: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.setTokenIpfsHash.estimateGas, self.web3ContractInstance,
+ )(
+ _token,
+ _ipfsHash,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _token: string,
+ _ipfsHash: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.setTokenIpfsHash.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public getTokenBySymbol = {
+ async callAsync(
+ _symbol: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<[string, string, string, BigNumber, string, string]
+ > {
+ const self = this as TokenRegistryContract;
+ const result = await promisify<[string, string, string, BigNumber, string, string]
+ >(
+ self.web3ContractInstance.getTokenBySymbol.call,
+ self.web3ContractInstance,
+ )(
+ _symbol,
+ );
+ return result;
+ },
+ };
+ public setTokenSymbol = {
+ async sendTransactionAsync(
+ _token: string,
+ _symbol: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.setTokenSymbol.estimateGasAsync.bind(
+ self,
+ _token,
+ _symbol,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.setTokenSymbol, self.web3ContractInstance,
+ )(
+ _token,
+ _symbol,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ _token: string,
+ _symbol: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.setTokenSymbol.estimateGas, self.web3ContractInstance,
+ )(
+ _token,
+ _symbol,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ _token: string,
+ _symbol: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.setTokenSymbol.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transferOwnership, self.web3ContractInstance,
+ )(
+ newOwner,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenRegistryContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transferOwnership.estimateGas, self.web3ContractInstance,
+ )(
+ newOwner,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenRegistryContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transferOwnership.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
+ super(web3ContractInstance, defaults);
+ classUtils.bindAll(this, ['web3ContractInstance', 'defaults']);
+ }
+} // tslint:disable:max-file-line-count
diff --git a/packages/0x.js/src/contract_wrappers/generated/token_transfer_proxy.ts b/packages/0x.js/src/contract_wrappers/generated/token_transfer_proxy.ts
new file mode 100644
index 000000000..2e0c294ab
--- /dev/null
+++ b/packages/0x.js/src/contract_wrappers/generated/token_transfer_proxy.ts
@@ -0,0 +1,281 @@
+import {BigNumber} from 'bignumber.js';
+import * as Web3 from 'web3';
+
+import {TxData, TxDataPayable} from '../../types';
+import {classUtils} from '../../utils/class_utils';
+import {promisify} from '../../utils/promisify';
+
+import {BaseContract} from './base_contract';
+
+export class TokenTransferProxyContract extends BaseContract {
+ public transferFrom = {
+ async sendTransactionAsync(
+ token: string,
+ from: string,
+ to: string,
+ value: BigNumber,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transferFrom.estimateGasAsync.bind(
+ self,
+ token,
+ from,
+ to,
+ value,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transferFrom, self.web3ContractInstance,
+ )(
+ token,
+ from,
+ to,
+ value,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ token: string,
+ from: string,
+ to: string,
+ value: BigNumber,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transferFrom.estimateGas, self.web3ContractInstance,
+ )(
+ token,
+ from,
+ to,
+ value,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ token: string,
+ from: string,
+ to: string,
+ value: BigNumber,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenTransferProxyContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transferFrom.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public addAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.addAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.addAuthorizedAddress, self.web3ContractInstance,
+ )(
+ target,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.addAuthorizedAddress.estimateGas, self.web3ContractInstance,
+ )(
+ target,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenTransferProxyContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.addAuthorizedAddress.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public authorities = {
+ async callAsync(
+ index: BigNumber,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as TokenTransferProxyContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.authorities.call,
+ self.web3ContractInstance,
+ )(
+ index,
+ );
+ return result;
+ },
+ };
+ public removeAuthorizedAddress = {
+ async sendTransactionAsync(
+ target: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.removeAuthorizedAddress.estimateGasAsync.bind(
+ self,
+ target,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.removeAuthorizedAddress, self.web3ContractInstance,
+ )(
+ target,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ target: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.removeAuthorizedAddress.estimateGas, self.web3ContractInstance,
+ )(
+ target,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ target: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenTransferProxyContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.removeAuthorizedAddress.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ public owner = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string
+ > {
+ const self = this as TokenTransferProxyContract;
+ const result = await promisify<string
+ >(
+ self.web3ContractInstance.owner.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public authorized = {
+ async callAsync(
+ index: string,
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<boolean
+ > {
+ const self = this as TokenTransferProxyContract;
+ const result = await promisify<boolean
+ >(
+ self.web3ContractInstance.authorized.call,
+ self.web3ContractInstance,
+ )(
+ index,
+ );
+ return result;
+ },
+ };
+ public getAuthorizedAddresses = {
+ async callAsync(
+ defaultBlock?: Web3.BlockParam,
+ ): Promise<string[]
+ > {
+ const self = this as TokenTransferProxyContract;
+ const result = await promisify<string[]
+ >(
+ self.web3ContractInstance.getAuthorizedAddresses.call,
+ self.web3ContractInstance,
+ )(
+ );
+ return result;
+ },
+ };
+ public transferOwnership = {
+ async sendTransactionAsync(
+ newOwner: string,
+ txData: TxData = {},
+ ): Promise<string> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ self.transferOwnership.estimateGasAsync.bind(
+ self,
+ newOwner,
+ ),
+ );
+ const txHash = await promisify<string>(
+ self.web3ContractInstance.transferOwnership, self.web3ContractInstance,
+ )(
+ newOwner,
+ txDataWithDefaults,
+ );
+ return txHash;
+ },
+ async estimateGasAsync(
+ newOwner: string,
+ txData: TxData = {},
+ ): Promise<number> {
+ const self = this as TokenTransferProxyContract;
+ const txDataWithDefaults = await self.applyDefaultsToTxDataAsync(
+ txData,
+ );
+ const gas = await promisify<number>(
+ self.web3ContractInstance.transferOwnership.estimateGas, self.web3ContractInstance,
+ )(
+ newOwner,
+ txDataWithDefaults,
+ );
+ return gas;
+ },
+ getABIEncodedTransactionData(
+ newOwner: string,
+ txData: TxData = {},
+ ): string {
+ const self = this as TokenTransferProxyContract;
+ const abiEncodedTransactionData = self.web3ContractInstance.transferOwnership.getData();
+ return abiEncodedTransactionData;
+ },
+ };
+ constructor(web3ContractInstance: Web3.ContractInstance, defaults: Partial<TxData>) {
+ super(web3ContractInstance, defaults);
+ classUtils.bindAll(this, ['web3ContractInstance', 'defaults']);
+ }
+} // tslint:disable:max-file-line-count