diff options
Diffstat (limited to 'packages/contracts/src/contract_wrappers/generated/token.ts')
-rw-r--r-- | packages/contracts/src/contract_wrappers/generated/token.ts | 215 |
1 files changed, 215 insertions, 0 deletions
diff --git a/packages/contracts/src/contract_wrappers/generated/token.ts b/packages/contracts/src/contract_wrappers/generated/token.ts new file mode 100644 index 000000000..5ad96da1e --- /dev/null +++ b/packages/contracts/src/contract_wrappers/generated/token.ts @@ -0,0 +1,215 @@ +/** + * This file is auto-generated using abi-gen. Don't edit directly. + * Templates can be found at https://github.com/0xProject/0x.js/tree/development/packages/abi-gen-templates. + */ +// tslint:disable-next-line:no-unused-variable +import { TxData, TxDataPayable } from '@0xproject/types'; +import { BigNumber, classUtils, promisify } from '@0xproject/utils'; +import * as Web3 from 'web3'; + +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 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 |