diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-08 19:56:10 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-08 19:56:10 +0800 |
commit | 1d64b542d8eecb4d6c63a5faa04150d3110d2fd5 (patch) | |
tree | f13b6c8aa85217b6cddba3d57b2e5307d9c89b63 | |
parent | e60153a4fbb732a6f11cb216743764060c579cdd (diff) | |
download | dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.tar dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.tar.gz dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.tar.bz2 dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.tar.lz dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.tar.xz dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.tar.zst dexon-sol-tools-1d64b542d8eecb4d6c63a5faa04150d3110d2fd5.zip |
Rename CallOpts to MethodOpts
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 21 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 20 | ||||
-rw-r--r-- | src/index.ts | 1 | ||||
-rw-r--r-- | src/types.ts | 2 |
4 files changed, 23 insertions, 21 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 9d73a4ede..c6632175c 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -27,7 +27,7 @@ import { LogFillContractEventArgs, LogCancelContractEventArgs, LogWithDecodedArgs, - CallOpts, + MethodOpts, } from '../types'; import {assert} from '../utils/assert'; import {utils} from '../utils/utils'; @@ -86,14 +86,15 @@ export class ExchangeWrapper extends ContractWrapper { * subtracting the unavailable amount from the total order takerAmount. * @param orderHash The hex encoded orderHash for which you would like to retrieve the * unavailable takerAmount. - * @param callOpts ${FABIOS_COMMENT} + * @param methodOpts ${FABIOS_COMMENT} * @return The amount of the order (in taker tokens) that has either been filled or canceled. */ - public async getUnavailableTakerAmountAsync(orderHash: string, callOpts?: CallOpts): Promise<BigNumber.BigNumber> { + public async getUnavailableTakerAmountAsync(orderHash: string, + methodOpts?: MethodOpts): Promise<BigNumber.BigNumber> { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); - const defaultBlock = _.isUndefined(callOpts) ? undefined : callOpts.defaultBlock; + const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock; let unavailableTakerTokenAmount = await exchangeContract.getUnavailableTakerTokenAmount.callAsync( orderHash, defaultBlock, ); @@ -104,14 +105,14 @@ export class ExchangeWrapper extends ContractWrapper { /** * Retrieve the takerAmount of an order that has already been filled. * @param orderHash The hex encoded orderHash for which you would like to retrieve the filled takerAmount. - * @param callOpts ${FABIOS_COMMENT} + * @param methodOpts ${FABIOS_COMMENT} * @return The amount of the order (in taker tokens) that has already been filled. */ - public async getFilledTakerAmountAsync(orderHash: string, callOpts?: CallOpts): Promise<BigNumber.BigNumber> { + public async getFilledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber.BigNumber> { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); - const defaultBlock = _.isUndefined(callOpts) ? undefined : callOpts.defaultBlock; + const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock; let fillAmountInBaseUnits = await exchangeContract.filled.callAsync(orderHash, defaultBlock); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber fillAmountInBaseUnits = new BigNumber(fillAmountInBaseUnits); @@ -121,14 +122,14 @@ export class ExchangeWrapper extends ContractWrapper { * Retrieve the takerAmount of an order that has been cancelled. * @param orderHash The hex encoded orderHash for which you would like to retrieve the * cancelled takerAmount. - * @param callOpts ${FABIOS_COMMENT} + * @param methodOpts ${FABIOS_COMMENT} * @return The amount of the order (in taker tokens) that has been cancelled. */ - public async getCanceledTakerAmountAsync(orderHash: string, callOpts?: CallOpts): Promise<BigNumber.BigNumber> { + public async getCanceledTakerAmountAsync(orderHash: string, methodOpts?: MethodOpts): Promise<BigNumber.BigNumber> { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); - const defaultBlock = _.isUndefined(callOpts) ? undefined : callOpts.defaultBlock; + const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock; let cancelledAmountInBaseUnits = await exchangeContract.cancelled.callAsync(orderHash, defaultBlock); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber cancelledAmountInBaseUnits = new BigNumber(cancelledAmountInBaseUnits); diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 96dc10b88..218427517 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -17,7 +17,7 @@ import { CreateContractEvent, ContractEventEmitter, ContractEventObj, - CallOpts, + MethodOpts, } from '../types'; const ALLOWANCE_TO_ZERO_GAS_AMOUNT = 47155; @@ -40,16 +40,16 @@ export class TokenWrapper extends ContractWrapper { * Retrieves an owner's ERC20 token balance. * @param tokenAddress The hex encoded contract Ethereum address where the ERC20 token is deployed. * @param ownerAddress The hex encoded user Ethereum address whose balance you would like to check. - * @param callOpts ${FABIOS_COMMENT} + * @param methodOpts ${FABIOS_COMMENT} * @return The owner's ERC20 token balance in base units. */ public async getBalanceAsync(tokenAddress: string, ownerAddress: string, - callOpts?: CallOpts): Promise<BigNumber.BigNumber> { + methodOpts?: MethodOpts): Promise<BigNumber.BigNumber> { assert.isETHAddressHex('ownerAddress', ownerAddress); assert.isETHAddressHex('tokenAddress', tokenAddress); const tokenContract = await this._getTokenContractAsync(tokenAddress); - const defaultBlock = _.isUndefined(callOpts) ? undefined : callOpts.defaultBlock; + const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock; let balance = await tokenContract.balanceOf.callAsync(ownerAddress, defaultBlock); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber balance = new BigNumber(balance); @@ -108,15 +108,15 @@ export class TokenWrapper extends ContractWrapper { * @param ownerAddress The hex encoded user Ethereum address whose allowance to spenderAddress * you would like to retrieve. * @param spenderAddress The hex encoded user Ethereum address who can spend the allowance you are fetching. - * @param callOpts ${FABIOS_COMMENT} + * @param methodOpts ${FABIOS_COMMENT} */ public async getAllowanceAsync(tokenAddress: string, ownerAddress: string, - spenderAddress: string, callOpts?: CallOpts): Promise<BigNumber.BigNumber> { + spenderAddress: string, methodOpts?: MethodOpts): Promise<BigNumber.BigNumber> { assert.isETHAddressHex('ownerAddress', ownerAddress); assert.isETHAddressHex('tokenAddress', tokenAddress); const tokenContract = await this._getTokenContractAsync(tokenAddress); - const defaultBlock = _.isUndefined(callOpts) ? undefined : callOpts.defaultBlock; + const defaultBlock = _.isUndefined(methodOpts) ? undefined : methodOpts.defaultBlock; let allowanceInBaseUnits = await tokenContract.allowance.callAsync(ownerAddress, spenderAddress, defaultBlock); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber allowanceInBaseUnits = new BigNumber(allowanceInBaseUnits); @@ -126,15 +126,15 @@ export class TokenWrapper extends ContractWrapper { * Retrieves the owner's allowance in baseUnits set to the 0x proxy contract. * @param tokenAddress The hex encoded contract Ethereum address where the ERC20 token is deployed. * @param ownerAddress The hex encoded user Ethereum address whose proxy contract allowance we are retrieving. - * @param callOpts ${FABIOS_COMMENT} + * @param methodOpts ${FABIOS_COMMENT} */ public async getProxyAllowanceAsync(tokenAddress: string, ownerAddress: string, - callOpts?: CallOpts): Promise<BigNumber.BigNumber> { + methodOpts?: MethodOpts): Promise<BigNumber.BigNumber> { assert.isETHAddressHex('ownerAddress', ownerAddress); assert.isETHAddressHex('tokenAddress', tokenAddress); const proxyAddress = await this._getProxyAddressAsync(); - const allowanceInBaseUnits = await this.getAllowanceAsync(tokenAddress, ownerAddress, proxyAddress, callOpts); + const allowanceInBaseUnits = await this.getAllowanceAsync(tokenAddress, ownerAddress, proxyAddress, methodOpts); return allowanceInBaseUnits; } /** diff --git a/src/index.ts b/src/index.ts index 00d4730da..a59904210 100644 --- a/src/index.ts +++ b/src/index.ts @@ -33,4 +33,5 @@ export { TransactionReceiptWithDecodedLogs, LogWithDecodedArgs, DecodedLogArgs, + MethodOpts, } from './types'; diff --git a/src/types.ts b/src/types.ts index a8d4f078e..d62edd231 100644 --- a/src/types.ts +++ b/src/types.ts @@ -421,6 +421,6 @@ export interface Artifact { }}; } -export interface CallOpts { +export interface MethodOpts { defaultBlock?: Web3.BlockParam; } |