diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 19:43:46 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-05 19:43:46 +0800 |
commit | 9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2 (patch) | |
tree | 1bcb6a3c80c15ea7bfe6755a97ac9fb8760da953 | |
parent | e05dfab1fca9eb108848c98da9dbf671a59d17f3 (diff) | |
download | dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.gz dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.bz2 dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.lz dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.xz dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.tar.zst dexon-sol-tools-9f12ef61b0cc8bb295b4a2bbfdf24b41c1584da2.zip |
Rename x.call -> x.callAsync x() -> x.sendTransactionAsync() x.estimateGas() -> x.estimateGasAsync()
-rw-r--r-- | src/contract.ts | 14 | ||||
-rw-r--r-- | src/contract_wrappers/ether_token_wrapper.ts | 4 | ||||
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 42 | ||||
-rw-r--r-- | src/contract_wrappers/token_registry_wrapper.ts | 12 | ||||
-rw-r--r-- | src/contract_wrappers/token_transfer_proxy_wrapper.ts | 4 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 17 | ||||
-rw-r--r-- | src/types.ts | 149 |
7 files changed, 132 insertions, 110 deletions
diff --git a/src/contract.ts b/src/contract.ts index ebda31e65..9dfb04446 100644 --- a/src/contract.ts +++ b/src/contract.ts @@ -21,16 +21,18 @@ export class Contract implements Web3.ContractInstance { private populateFunctions(): void { const functionsAbi = _.filter(this.abi, abiPart => abiPart.type === 'function'); _.forEach(functionsAbi, (functionAbi: Web3.MethodAbi) => { - const cbStyleFunction = this.contract[functionAbi.name]; if (functionAbi.constant) { - this[functionAbi.name] = promisify(cbStyleFunction, this.contract); const cbStyleCallFunction = this.contract[functionAbi.name].call; - this[functionAbi.name].call = promisify(cbStyleCallFunction, this.contract); + this[functionAbi.name] = { + callAsync: promisify(cbStyleCallFunction, this.contract), + }; } else { - this[functionAbi.name] = this.promisifyWithDefaultParams(cbStyleFunction); + const cbStyleFunction = this.contract[functionAbi.name]; const cbStyleEstimateGasFunction = this.contract[functionAbi.name].estimateGas; - this[functionAbi.name].estimateGas = - promisify(cbStyleEstimateGasFunction, this.contract); + this[functionAbi.name] = { + estimateGasAsync: promisify(cbStyleEstimateGasFunction, this.contract), + sendTransactionAsync: this.promisifyWithDefaultParams(cbStyleFunction), + }; } }); } diff --git a/src/contract_wrappers/ether_token_wrapper.ts b/src/contract_wrappers/ether_token_wrapper.ts index 4c19b3caa..d31069b22 100644 --- a/src/contract_wrappers/ether_token_wrapper.ts +++ b/src/contract_wrappers/ether_token_wrapper.ts @@ -33,7 +33,7 @@ export class EtherTokenWrapper extends ContractWrapper { assert.assert(ethBalanceInWei.gte(amountInWei), ZeroExError.InsufficientEthBalanceForDeposit); const wethContract = await this._getEtherTokenContractAsync(); - const txHash = await wethContract.deposit({ + const txHash = await wethContract.deposit.sendTransactionAsync({ from: depositor, value: amountInWei, }); @@ -55,7 +55,7 @@ export class EtherTokenWrapper extends ContractWrapper { assert.assert(WETHBalanceInBaseUnits.gte(amountInWei), ZeroExError.InsufficientWEthBalanceForWithdrawal); const wethContract = await this._getEtherTokenContractAsync(); - const txHash = await wethContract.withdraw(amountInWei, { + const txHash = await wethContract.withdraw.sendTransactionAsync(amountInWei, { from: withdrawer, }); return txHash; diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 324c92062..fbb2c710f 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -90,7 +90,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); - let unavailableTakerTokenAmount = await exchangeContract.getUnavailableTakerTokenAmount.call(orderHash); + let unavailableTakerTokenAmount = await exchangeContract.getUnavailableTakerTokenAmount.callAsync(orderHash); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber unavailableTakerTokenAmount = new BigNumber(unavailableTakerTokenAmount); return unavailableTakerTokenAmount; @@ -104,7 +104,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); - let fillAmountInBaseUnits = await exchangeContract.filled.call(orderHash); + let fillAmountInBaseUnits = await exchangeContract.filled.callAsync(orderHash); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber fillAmountInBaseUnits = new BigNumber(fillAmountInBaseUnits); return fillAmountInBaseUnits; @@ -119,7 +119,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.doesConformToSchema('orderHash', orderHash, schemas.orderHashSchema); const exchangeContract = await this._getExchangeContractAsync(); - let cancelledAmountInBaseUnits = await exchangeContract.cancelled.call(orderHash); + let cancelledAmountInBaseUnits = await exchangeContract.cancelled.callAsync(orderHash); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber cancelledAmountInBaseUnits = new BigNumber(cancelledAmountInBaseUnits); return cancelledAmountInBaseUnits; @@ -156,7 +156,7 @@ export class ExchangeWrapper extends ContractWrapper { const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder); - const gas = await exchangeInstance.fillOrder.estimateGas( + const gas = await exchangeInstance.fillOrder.estimateGasAsync( orderAddresses, orderValues, fillTakerTokenAmount, @@ -168,7 +168,7 @@ export class ExchangeWrapper extends ContractWrapper { from: takerAddress, }, ); - const txHash: string = await exchangeInstance.fillOrder( + const txHash: string = await exchangeInstance.fillOrder.sendTransactionAsync( orderAddresses, orderValues, fillTakerTokenAmount, @@ -235,7 +235,7 @@ export class ExchangeWrapper extends ContractWrapper { ); const exchangeInstance = await this._getExchangeContractAsync(); - const gas = await exchangeInstance.fillOrdersUpTo.estimateGas( + const gas = await exchangeInstance.fillOrdersUpTo.estimateGasAsync( orderAddressesArray, orderValuesArray, fillTakerTokenAmount, @@ -247,7 +247,7 @@ export class ExchangeWrapper extends ContractWrapper { from: takerAddress, }, ); - const txHash = await exchangeInstance.fillOrdersUpTo( + const txHash = await exchangeInstance.fillOrdersUpTo.sendTransactionAsync( orderAddressesArray, orderValuesArray, fillTakerTokenAmount, @@ -316,7 +316,7 @@ export class ExchangeWrapper extends ContractWrapper { ); const exchangeInstance = await this._getExchangeContractAsync(); - const gas = await exchangeInstance.batchFillOrders.estimateGas( + const gas = await exchangeInstance.batchFillOrders.estimateGasAsync( orderAddressesArray, orderValuesArray, fillTakerTokenAmounts, @@ -328,7 +328,7 @@ export class ExchangeWrapper extends ContractWrapper { from: takerAddress, }, ); - const txHash = await exchangeInstance.batchFillOrders( + const txHash = await exchangeInstance.batchFillOrders.sendTransactionAsync( orderAddressesArray, orderValuesArray, fillTakerTokenAmounts, @@ -366,7 +366,7 @@ export class ExchangeWrapper extends ContractWrapper { const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(signedOrder); - const gas = await exchangeInstance.fillOrKillOrder.estimateGas( + const gas = await exchangeInstance.fillOrKillOrder.estimateGasAsync( orderAddresses, orderValues, fillTakerTokenAmount, @@ -377,7 +377,7 @@ export class ExchangeWrapper extends ContractWrapper { from: takerAddress, }, ); - const txHash = await exchangeInstance.fillOrKillOrder( + const txHash = await exchangeInstance.fillOrKillOrder.sendTransactionAsync( orderAddresses, orderValues, fillTakerTokenAmount, @@ -434,7 +434,7 @@ export class ExchangeWrapper extends ContractWrapper { const [orderAddresses, orderValues, fillTakerTokenAmounts, vParams, rParams, sParams] = _.unzip<any>(orderAddressesValuesAndTakerTokenFillAmounts); - const gas = await exchangeInstance.batchFillOrKillOrders.estimateGas( + const gas = await exchangeInstance.batchFillOrKillOrders.estimateGasAsync( orderAddresses, orderValues, fillTakerTokenAmounts, @@ -445,7 +445,7 @@ export class ExchangeWrapper extends ContractWrapper { from: takerAddress, }, ); - const txHash = await exchangeInstance.batchFillOrKillOrders( + const txHash = await exchangeInstance.batchFillOrKillOrders.sendTransactionAsync( orderAddresses, orderValues, fillTakerTokenAmounts, @@ -477,7 +477,7 @@ export class ExchangeWrapper extends ContractWrapper { await this.validateCancelOrderThrowIfInvalidAsync(order, cancelTakerTokenAmount); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); - const gas = await exchangeInstance.cancelOrder.estimateGas( + const gas = await exchangeInstance.cancelOrder.estimateGasAsync( orderAddresses, orderValues, cancelTakerTokenAmount, @@ -485,7 +485,7 @@ export class ExchangeWrapper extends ContractWrapper { from: order.maker, }, ); - const txHash = await exchangeInstance.cancelOrder( + const txHash = await exchangeInstance.cancelOrder.sendTransactionAsync( orderAddresses, orderValues, cancelTakerTokenAmount, @@ -535,7 +535,7 @@ export class ExchangeWrapper extends ContractWrapper { // We use _.unzip<any> because _.unzip doesn't type check if values have different types :'( const [orderAddresses, orderValues, cancelTakerTokenAmounts] = _.unzip<any>(orderAddressesValuesAndTakerTokenCancelAmounts); - const gas = await exchangeInstance.batchCancelOrders.estimateGas( + const gas = await exchangeInstance.batchCancelOrders.estimateGasAsync( orderAddresses, orderValues, cancelTakerTokenAmounts, @@ -543,7 +543,7 @@ export class ExchangeWrapper extends ContractWrapper { from: maker, }, ); - const txHash = await exchangeInstance.batchCancelOrders( + const txHash = await exchangeInstance.batchCancelOrders.sendTransactionAsync( orderAddresses, orderValues, cancelTakerTokenAmounts, @@ -677,7 +677,7 @@ export class ExchangeWrapper extends ContractWrapper { assert.isBigNumber('takerTokenAmount', takerTokenAmount); assert.isBigNumber('makerTokenAmount', makerTokenAmount); const exchangeInstance = await this._getExchangeContractAsync(); - const isRoundingError = await exchangeInstance.isRoundingError.call( + const isRoundingError = await exchangeInstance.isRoundingError.callAsync( fillTakerTokenAmount, takerTokenAmount, makerTokenAmount, ); return isRoundingError; @@ -694,7 +694,7 @@ export class ExchangeWrapper extends ContractWrapper { const exchangeInstance = await this._getExchangeContractAsync(); - const isValidSignature = await exchangeInstance.isValidSignature.call( + const isValidSignature = await exchangeInstance.isValidSignature.callAsync( signerAddressHex, dataHex, ecSignature.v, @@ -706,7 +706,7 @@ export class ExchangeWrapper extends ContractWrapper { private async _getOrderHashHexUsingContractCallAsync(order: Order|SignedOrder): Promise<string> { const exchangeInstance = await this._getExchangeContractAsync(); const [orderAddresses, orderValues] = ExchangeWrapper._getOrderAddressesAndValues(order); - const orderHashHex = await exchangeInstance.getOrderHash.call(orderAddresses, orderValues); + const orderHashHex = await exchangeInstance.getOrderHash.callAsync(orderAddresses, orderValues); return orderHashHex; } private _throwErrorLogsAsErrors(logs: ContractEvent[]): void { @@ -729,7 +729,7 @@ export class ExchangeWrapper extends ContractWrapper { } private async _getZRXTokenAddressAsync(): Promise<string> { const exchangeInstance = await this._getExchangeContractAsync(); - const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.call(); + const ZRXtokenAddress = await exchangeInstance.ZRX_TOKEN_CONTRACT.callAsync(); return ZRXtokenAddress; } } diff --git a/src/contract_wrappers/token_registry_wrapper.ts b/src/contract_wrappers/token_registry_wrapper.ts index 57c9ca93d..79eb516fe 100644 --- a/src/contract_wrappers/token_registry_wrapper.ts +++ b/src/contract_wrappers/token_registry_wrapper.ts @@ -35,7 +35,7 @@ export class TokenRegistryWrapper extends ContractWrapper { */ public async getTokenAddressesAsync(): Promise<string[]> { const tokenRegistryContract = await this._getTokenRegistryContractAsync(); - const addresses = await tokenRegistryContract.getTokenAddresses.call(); + const addresses = await tokenRegistryContract.getTokenAddresses.callAsync(); return addresses; } /** @@ -46,14 +46,14 @@ export class TokenRegistryWrapper extends ContractWrapper { assert.isETHAddressHex('address', address); const tokenRegistryContract = await this._getTokenRegistryContractAsync(); - const metadata = await tokenRegistryContract.getTokenMetaData.call(address); + const metadata = await tokenRegistryContract.getTokenMetaData.callAsync(address); const token = this._createTokenFromMetadata(metadata); return token; } public async getTokenAddressBySymbolIfExistsAsync(symbol: string): Promise<string|undefined> { assert.isString('symbol', symbol); const tokenRegistryContract = await this._getTokenRegistryContractAsync(); - const addressIfExists = await tokenRegistryContract.getTokenAddressBySymbol.call(symbol); + const addressIfExists = await tokenRegistryContract.getTokenAddressBySymbol.callAsync(symbol); if (addressIfExists === constants.NULL_ADDRESS) { return undefined; } @@ -62,7 +62,7 @@ export class TokenRegistryWrapper extends ContractWrapper { public async getTokenAddressByNameIfExistsAsync(name: string): Promise<string|undefined> { assert.isString('name', name); const tokenRegistryContract = await this._getTokenRegistryContractAsync(); - const addressIfExists = await tokenRegistryContract.getTokenAddressByName.call(name); + const addressIfExists = await tokenRegistryContract.getTokenAddressByName.callAsync(name); if (addressIfExists === constants.NULL_ADDRESS) { return undefined; } @@ -71,14 +71,14 @@ export class TokenRegistryWrapper extends ContractWrapper { public async getTokenBySymbolIfExistsAsync(symbol: string): Promise<Token|undefined> { assert.isString('symbol', symbol); const tokenRegistryContract = await this._getTokenRegistryContractAsync(); - const metadata = await tokenRegistryContract.getTokenBySymbol.call(symbol); + const metadata = await tokenRegistryContract.getTokenBySymbol.callAsync(symbol); const token = this._createTokenFromMetadata(metadata); return token; } public async getTokenByNameIfExistsAsync(name: string): Promise<Token|undefined> { assert.isString('name', name); const tokenRegistryContract = await this._getTokenRegistryContractAsync(); - const metadata = await tokenRegistryContract.getTokenByName.call(name); + const metadata = await tokenRegistryContract.getTokenByName.callAsync(name); const token = this._createTokenFromMetadata(metadata); return token; } diff --git a/src/contract_wrappers/token_transfer_proxy_wrapper.ts b/src/contract_wrappers/token_transfer_proxy_wrapper.ts index 2b4b32961..2ed198be6 100644 --- a/src/contract_wrappers/token_transfer_proxy_wrapper.ts +++ b/src/contract_wrappers/token_transfer_proxy_wrapper.ts @@ -15,7 +15,7 @@ export class TokenTransferProxyWrapper extends ContractWrapper { */ public async isAuthorizedAsync(exchangeContractAddress: string): Promise<boolean> { const tokenTransferProxyContractInstance = await this._getTokenTransferProxyContractAsync(); - const isAuthorized = await tokenTransferProxyContractInstance.authorized.call(exchangeContractAddress); + const isAuthorized = await tokenTransferProxyContractInstance.authorized.callAsync(exchangeContractAddress); return isAuthorized; } /** @@ -24,7 +24,7 @@ export class TokenTransferProxyWrapper extends ContractWrapper { */ public async getAuthorizedAddressesAsync(): Promise<string[]> { const tokenTransferProxyContractInstance = await this._getTokenTransferProxyContractAsync(); - const authorizedAddresses = await tokenTransferProxyContractInstance.getAuthorizedAddresses.call(); + const authorizedAddresses = await tokenTransferProxyContractInstance.getAuthorizedAddresses.callAsync(); return authorizedAddresses; } /** diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 944f0fb42..db1ce22b2 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -47,7 +47,7 @@ export class TokenWrapper extends ContractWrapper { assert.isETHAddressHex('tokenAddress', tokenAddress); const tokenContract = await this._getTokenContractAsync(tokenAddress); - let balance = await tokenContract.balanceOf.call(ownerAddress); + let balance = await tokenContract.balanceOf.callAsync(ownerAddress); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber balance = new BigNumber(balance); return balance; @@ -75,7 +75,7 @@ export class TokenWrapper extends ContractWrapper { // TODO: Debug issue in testrpc and submit a PR, then remove this hack const networkIdIfExists = await this._web3Wrapper.getNetworkIdIfExistsAsync(); const gas = networkIdIfExists === constants.TESTRPC_NETWORK_ID ? ALLOWANCE_TO_ZERO_GAS_AMOUNT : undefined; - const txHash = await tokenContract.approve(spenderAddress, amountInBaseUnits, { + const txHash = await tokenContract.approve.sendTransactionAsync(spenderAddress, amountInBaseUnits, { from: ownerAddress, gas, }); @@ -112,7 +112,7 @@ export class TokenWrapper extends ContractWrapper { assert.isETHAddressHex('tokenAddress', tokenAddress); const tokenContract = await this._getTokenContractAsync(tokenAddress); - let allowanceInBaseUnits = await tokenContract.allowance.call(ownerAddress, spenderAddress); + let allowanceInBaseUnits = await tokenContract.allowance.callAsync(ownerAddress, spenderAddress); // Wrap BigNumbers returned from web3 with our own (later) version of BigNumber allowanceInBaseUnits = new BigNumber(allowanceInBaseUnits); return allowanceInBaseUnits; @@ -187,7 +187,7 @@ export class TokenWrapper extends ContractWrapper { throw new Error(ZeroExError.InsufficientBalanceForTransfer); } - const txHash = await tokenContract.transfer(toAddress, amountInBaseUnits, { + const txHash = await tokenContract.transfer.sendTransactionAsync(toAddress, amountInBaseUnits, { from: fromAddress, }); return txHash; @@ -226,9 +226,12 @@ export class TokenWrapper extends ContractWrapper { throw new Error(ZeroExError.InsufficientBalanceForTransfer); } - const txHash = await tokenContract.transferFrom(fromAddress, toAddress, amountInBaseUnits, { - from: senderAddress, - }); + const txHash = await tokenContract.transferFrom.sendTransactionAsync( + fromAddress, toAddress, amountInBaseUnits, + { + from: senderAddress, + }, + ); return txHash; } /** diff --git a/src/types.ts b/src/types.ts index b65ffda73..e47f57e5e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -42,85 +42,90 @@ export type CreateContractEvent = (indexFilterValues: IndexedFilterValues, subscriptionOpts: SubscriptionOpts) => ContractEventObj; export interface ExchangeContract extends Web3.ContractInstance { isValidSignature: { - call: (signerAddressHex: string, dataHex: string, v: number, r: string, s: string, - txOpts?: TxOpts) => Promise<boolean>; + callAsync: (signerAddressHex: string, dataHex: string, v: number, r: string, s: string, + txOpts?: TxOpts) => Promise<boolean>; }; LogFill: CreateContractEvent; LogCancel: CreateContractEvent; LogError: CreateContractEvent; ZRX_TOKEN_CONTRACT: { - call: () => Promise<string>; + callAsync: () => Promise<string>; }; getUnavailableTakerTokenAmount: { - call: (orderHash: string) => Promise<BigNumber.BigNumber>; + callAsync: (orderHash: string) => Promise<BigNumber.BigNumber>; }; isRoundingError: { - call: (fillTakerAmount: BigNumber.BigNumber, takerTokenAmount: BigNumber.BigNumber, - makerTokenAmount: BigNumber.BigNumber, txOpts?: TxOpts) => Promise<boolean>; + callAsync: (fillTakerAmount: BigNumber.BigNumber, takerTokenAmount: BigNumber.BigNumber, + makerTokenAmount: BigNumber.BigNumber, txOpts?: TxOpts) => Promise<boolean>; }; fillOrder: { - (orderAddresses: OrderAddresses, orderValues: OrderValues, fillTakerTokenAmount: BigNumber.BigNumber, - shouldThrowOnInsufficientBalanceOrAllowance: boolean, - v: number, r: string, s: string, txOpts?: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues, - fillTakerTokenAmount: BigNumber.BigNumber, - shouldThrowOnInsufficientBalanceOrAllowance: boolean, - v: number, r: string, s: string, txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues, + fillTakerTokenAmount: BigNumber.BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number, r: string, s: string, txOpts?: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues, + fillTakerTokenAmount: BigNumber.BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number, r: string, s: string, txOpts?: TxOpts) => Promise<number>; }; batchFillOrders: { - (orderAddresses: OrderAddresses[], orderValues: OrderValues[], fillTakerTokenAmounts: BigNumber.BigNumber[], - shouldThrowOnInsufficientBalanceOrAllowance: boolean, - v: number[], r: string[], s: string[], txOpts?: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], - fillTakerTokenAmounts: BigNumber.BigNumber[], - shouldThrowOnInsufficientBalanceOrAllowance: boolean, - v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + fillTakerTokenAmounts: BigNumber.BigNumber[], + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + fillTakerTokenAmounts: BigNumber.BigNumber[], + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<number>; }; fillOrdersUpTo: { - (orderAddresses: OrderAddresses[], orderValues: OrderValues[], fillTakerTokenAmount: BigNumber.BigNumber, - shouldThrowOnInsufficientBalanceOrAllowance: boolean, - v: number[], r: string[], s: string[], txOpts?: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], - fillTakerTokenAmount: BigNumber.BigNumber, - shouldThrowOnInsufficientBalanceOrAllowance: boolean, - v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + fillTakerTokenAmount: BigNumber.BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + fillTakerTokenAmount: BigNumber.BigNumber, + shouldThrowOnInsufficientBalanceOrAllowance: boolean, + v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<number>; }; cancelOrder: { - (orderAddresses: OrderAddresses, orderValues: OrderValues, cancelTakerTokenAmount: BigNumber.BigNumber, - txOpts?: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues, - cancelTakerTokenAmount: BigNumber.BigNumber, - txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues, + cancelTakerTokenAmount: BigNumber.BigNumber, txOpts?: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues, + cancelTakerTokenAmount: BigNumber.BigNumber, + txOpts?: TxOpts) => Promise<number>; }; batchCancelOrders: { - (orderAddresses: OrderAddresses[], orderValues: OrderValues[], cancelTakerTokenAmounts: BigNumber.BigNumber[], - txOpts?: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], - cancelTakerTokenAmounts: BigNumber.BigNumber[], - txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + cancelTakerTokenAmounts: BigNumber.BigNumber[], txOpts?: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + cancelTakerTokenAmounts: BigNumber.BigNumber[], + txOpts?: TxOpts) => Promise<number>; }; fillOrKillOrder: { - (orderAddresses: OrderAddresses, orderValues: OrderValues, fillTakerTokenAmount: BigNumber.BigNumber, - v: number, r: string, s: string, txOpts?: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses, orderValues: OrderValues, - fillTakerTokenAmount: BigNumber.BigNumber, - v: number, r: string, s: string, txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues, + fillTakerTokenAmount: BigNumber.BigNumber, + v: number, r: string, s: string, txOpts?: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues, + fillTakerTokenAmount: BigNumber.BigNumber, + v: number, r: string, s: string, txOpts?: TxOpts) => Promise<number>; }; batchFillOrKillOrders: { - (orderAddresses: OrderAddresses[], orderValues: OrderValues[], fillTakerTokenAmounts: BigNumber.BigNumber[], - v: number[], r: string[], s: string[], txOpts: TxOpts): Promise<string>; - estimateGas: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], - fillTakerTokenAmounts: BigNumber.BigNumber[], - v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<number>; + sendTransactionAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + fillTakerTokenAmounts: BigNumber.BigNumber[], + v: number[], r: string[], s: string[], txOpts: TxOpts) => Promise<string>; + estimateGasAsync: (orderAddresses: OrderAddresses[], orderValues: OrderValues[], + fillTakerTokenAmounts: BigNumber.BigNumber[], + v: number[], r: string[], s: string[], txOpts?: TxOpts) => Promise<number>; }; filled: { - call: (orderHash: string) => Promise<BigNumber.BigNumber>; + callAsync: (orderHash: string) => Promise<BigNumber.BigNumber>; }; cancelled: { - call: (orderHash: string) => Promise<BigNumber.BigNumber>; + callAsync: (orderHash: string) => Promise<BigNumber.BigNumber>; }; getOrderHash: { - call: (orderAddresses: OrderAddresses, orderValues: OrderValues) => Promise<string>; + callAsync: (orderAddresses: OrderAddresses, orderValues: OrderValues) => Promise<string>; }; } @@ -128,49 +133,61 @@ export interface TokenContract extends Web3.ContractInstance { Transfer: CreateContractEvent; Approval: CreateContractEvent; balanceOf: { - call: (address: string) => Promise<BigNumber.BigNumber>; + callAsync: (address: string) => Promise<BigNumber.BigNumber>; }; allowance: { - call: (ownerAddress: string, allowedAddress: string) => Promise<BigNumber.BigNumber>; + callAsync: (ownerAddress: string, allowedAddress: string) => Promise<BigNumber.BigNumber>; + }; + transfer: { + sendTransactionAsync: (toAddress: string, amountInBaseUnits: BigNumber.BigNumber, + txOpts?: TxOpts) => Promise<string>; + }; + transferFrom: { + sendTransactionAsync: (fromAddress: string, toAddress: string, amountInBaseUnits: BigNumber.BigNumber, + txOpts?: TxOpts) => Promise<string>; + }; + approve: { + sendTransactionAsync: (proxyAddress: string, amountInBaseUnits: BigNumber.BigNumber, + txOpts?: TxOpts) => Promise<string>; }; - transfer: (toAddress: string, amountInBaseUnits: BigNumber.BigNumber, txOpts?: TxOpts) => Promise<string>; - transferFrom: (fromAddress: string, toAddress: string, amountInBaseUnits: BigNumber.BigNumber, - txOpts?: TxOpts) => Promise<string>; - approve: (proxyAddress: string, amountInBaseUnits: BigNumber.BigNumber, txOpts?: TxOpts) => Promise<string>; } export interface TokenRegistryContract extends Web3.ContractInstance { getTokenMetaData: { - call: (address: string) => Promise<TokenMetadata>; + callAsync: (address: string) => Promise<TokenMetadata>; }; getTokenAddresses: { - call: () => Promise<string[]>; + callAsync: () => Promise<string[]>; }; getTokenAddressBySymbol: { - call: (symbol: string) => Promise<string>; + callAsync: (symbol: string) => Promise<string>; }; getTokenAddressByName: { - call: (name: string) => Promise<string>; + callAsync: (name: string) => Promise<string>; }; getTokenBySymbol: { - call: (symbol: string) => Promise<TokenMetadata>; + callAsync: (symbol: string) => Promise<TokenMetadata>; }; getTokenByName: { - call: (name: string) => Promise<TokenMetadata>; + callAsync: (name: string) => Promise<TokenMetadata>; }; } export interface EtherTokenContract extends Web3.ContractInstance { - deposit: (txOpts: TxOpts) => Promise<string>; - withdraw: (amount: BigNumber.BigNumber, txOpts: TxOpts) => Promise<string>; + deposit: { + sendTransactionAsync: (txOpts: TxOpts) => Promise<string>; + }; + withdraw: { + sendTransactionAsync: (amount: BigNumber.BigNumber, txOpts: TxOpts) => Promise<string>; + }; } export interface TokenTransferProxyContract extends Web3.ContractInstance { getAuthorizedAddresses: { - call: () => Promise<string[]>; + callAsync: () => Promise<string[]>; }; authorized: { - call: (address: string) => Promise<boolean>; + callAsync: (address: string) => Promise<boolean>; }; } |