Created tests for batchMatchOrders
This commit is contained in:
committed by
Amir Bandeali
parent
f289b3112b
commit
6cf11554de
@@ -5,7 +5,7 @@ import { BigNumber } from '@0x/utils';
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { constants } from './constants';
|
||||
import { CancelOrder, MatchOrder } from './types';
|
||||
import { BatchMatchOrder, CancelOrder, MatchOrder } from './types';
|
||||
|
||||
export const orderUtils = {
|
||||
getPartialAmountFloor(numerator: BigNumber, denominator: BigNumber, target: BigNumber): BigNumber {
|
||||
@@ -33,6 +33,19 @@ export const orderUtils = {
|
||||
getOrderWithoutDomain(signedOrder: SignedOrder): OrderWithoutDomain {
|
||||
return _.omit(signedOrder, ['signature', 'domain']) as OrderWithoutDomain;
|
||||
},
|
||||
createBatchMatchOrders(signedOrdersLeft: SignedOrder[], signedOrdersRight: SignedOrder[]): BatchMatchOrder {
|
||||
return {
|
||||
leftOrders: signedOrdersLeft.map(order => orderUtils.getOrderWithoutDomain(order)),
|
||||
rightOrders: signedOrdersRight.map(order => {
|
||||
const right = orderUtils.getOrderWithoutDomain(order);
|
||||
right.makerAssetData = constants.NULL_BYTES;
|
||||
right.takerAssetData = constants.NULL_BYTES;
|
||||
return right;
|
||||
}),
|
||||
leftSignatures: signedOrdersLeft.map(order => order.signature),
|
||||
rightSignatures: signedOrdersRight.map(order => order.signature),
|
||||
};
|
||||
},
|
||||
createMatchOrders(signedOrderLeft: SignedOrder, signedOrderRight: SignedOrder): MatchOrder {
|
||||
const fill = {
|
||||
left: orderUtils.getOrderWithoutDomain(signedOrderLeft),
|
||||
|
Reference in New Issue
Block a user