diff options
author | Leonid <logvinov.leon@gmail.com> | 2017-12-06 03:39:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-06 03:39:36 +0800 |
commit | 1153fa093b5a20863a2a7c1237a39ffdf7aaec49 (patch) | |
tree | b6d9bdad0c339d02336698f326f00352992be6d4 /packages/0x.js/src/contract_wrappers/generated/ether_token.ts | |
parent | c0015c2c118c0fd563fa8d2ee672c28dca7ef809 (diff) | |
parent | c64ec92fb23fd130d0c54a4d42147bb468e434d9 (diff) | |
download | dexon-sol-tools-1153fa093b5a20863a2a7c1237a39ffdf7aaec49.tar.gz dexon-sol-tools-1153fa093b5a20863a2a7c1237a39ffdf7aaec49.tar.zst dexon-sol-tools-1153fa093b5a20863a2a7c1237a39ffdf7aaec49.zip |
Merge pull request #249 from 0xProject/feature/typed-contracts
ABI to TS generator
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/generated/ether_token.ts')
-rw-r--r-- | packages/0x.js/src/contract_wrappers/generated/ether_token.ts | 363 |
1 files changed, 363 insertions, 0 deletions
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..eed5e4686 --- /dev/null +++ b/packages/0x.js/src/contract_wrappers/generated/ether_token.ts @@ -0,0 +1,363 @@ +/** + * 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. + */ +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 |