diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 23 | ||||
-rw-r--r-- | src/index.ts | 1 | ||||
-rw-r--r-- | src/types.ts | 7 |
3 files changed, 12 insertions, 19 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 9e4936de6..e7b4a437f 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -11,7 +11,6 @@ import { OrderValues, OrderAddresses, Order, - OrderFillOrKillRequest, SignedOrder, ContractEvent, ExchangeEvents, @@ -452,26 +451,26 @@ export class ExchangeWrapper extends ContractWrapper { /** * Batch version of fillOrKill. Allows a taker to specify a batch of orders that will either be atomically * filled (each to the specified fillAmount) or aborted. - * @param orderFillOrKillRequests An array of objects that conform to the OrderFillOrKillRequest interface. + * @param orderFillRequests An array of objects that conform to the OrderFillRequest interface. * @param takerAddress The user Ethereum address who would like to fill there orders. * Must be available via the supplied Web3.Provider passed to 0x.js. * @param orderTransactionOpts Optional arguments this method accepts. * @return Transaction hash. */ @decorators.contractCallErrorHandler - public async batchFillOrKillAsync(orderFillOrKillRequests: OrderFillOrKillRequest[], + public async batchFillOrKillAsync(orderFillRequests: OrderFillRequest[], takerAddress: string, orderTransactionOpts?: OrderTransactionOpts): Promise<string> { - assert.doesConformToSchema('orderFillOrKillRequests', orderFillOrKillRequests, - schemas.orderFillOrKillRequestsSchema); + assert.doesConformToSchema('orderFillRequests', orderFillRequests, + schemas.orderFillRequestsSchema); const exchangeContractAddresses = _.map( - orderFillOrKillRequests, - orderFillOrKillRequest => orderFillOrKillRequest.signedOrder.exchangeContractAddress, + orderFillRequests, + orderFillRequest => orderFillRequest.signedOrder.exchangeContractAddress, ); assert.hasAtMostOneUniqueValue(exchangeContractAddresses, ExchangeContractErrs.BatchOrdersMustHaveSameExchangeAddress); await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper); - if (_.isEmpty(orderFillOrKillRequests)) { + if (_.isEmpty(orderFillRequests)) { throw new Error(ExchangeContractErrs.BatchOrdersMustHaveAtLeastOneItem); } const exchangeInstance = await this._getExchangeContractAsync(); @@ -482,18 +481,18 @@ export class ExchangeWrapper extends ContractWrapper { if (shouldValidate) { const zrxTokenAddress = await this.getZRXTokenAddressAsync(); const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper); - for (const orderFillOrKillRequest of orderFillOrKillRequests) { + for (const orderFillRequest of orderFillRequests) { await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync( - exchangeTradeEmulator, orderFillOrKillRequest.signedOrder, orderFillOrKillRequest.fillTakerAmount, + exchangeTradeEmulator, orderFillRequest.signedOrder, orderFillRequest.takerTokenFillAmount, takerAddress, zrxTokenAddress, ); } } - const orderAddressesValuesAndTakerTokenFillAmounts = _.map(orderFillOrKillRequests, request => { + const orderAddressesValuesAndTakerTokenFillAmounts = _.map(orderFillRequests, request => { return [ ...ExchangeWrapper._getOrderAddressesAndValues(request.signedOrder), - request.fillTakerAmount, + request.takerTokenFillAmount, request.signedOrder.ecSignature.v, request.signedOrder.ecSignature.r, request.signedOrder.ecSignature.s, diff --git a/src/index.ts b/src/index.ts index 97ab084b7..b9f50b0d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -16,7 +16,6 @@ export { IndexedFilterValues, SubscriptionOpts, BlockParam, - OrderFillOrKillRequest, OrderCancellationRequest, OrderFillRequest, LogErrorContractEventArgs, diff --git a/src/types.ts b/src/types.ts index 8c0bc1cf9..4d0b477dd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -57,7 +57,7 @@ export interface ExchangeContract extends Web3.ContractInstance { callAsync: (orderHash: string, defaultBlock?: Web3.BlockParam) => Promise<BigNumber.BigNumber>; }; isRoundingError: { - callAsync: (fillTakerAmount: BigNumber.BigNumber, takerTokenAmount: BigNumber.BigNumber, + callAsync: (takerTokenFillAmount: BigNumber.BigNumber, takerTokenAmount: BigNumber.BigNumber, makerTokenAmount: BigNumber.BigNumber, txOpts?: TxOpts) => Promise<boolean>; }; fillOrder: { @@ -360,11 +360,6 @@ export interface SubscriptionOpts { export type DoneCallback = (err?: Error) => void; -export interface OrderFillOrKillRequest { - signedOrder: SignedOrder; - fillTakerAmount: BigNumber.BigNumber; -} - export interface OrderCancellationRequest { order: Order|SignedOrder; takerTokenCancelAmount: BigNumber.BigNumber; |