diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 19:22:22 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 19:22:22 +0800 |
commit | fd004032cb23998184a78ac4a0a486ef1bd04c25 (patch) | |
tree | 90f7e64996ccc0fee1e5428b2ced9b2c2b1c3d4a /packages/contracts/util/formatters.ts | |
parent | 4b6324050da4862f4d8bdb7d6dbd66107929a2b5 (diff) | |
download | dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.tar dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.tar.gz dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.tar.bz2 dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.tar.lz dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.tar.xz dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.tar.zst dexon-0x-contracts-fd004032cb23998184a78ac4a0a486ef1bd04c25.zip |
Introduce SignedOrder class and remove type assertions
Diffstat (limited to 'packages/contracts/util/formatters.ts')
-rw-r--r-- | packages/contracts/util/formatters.ts | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/contracts/util/formatters.ts b/packages/contracts/util/formatters.ts index e16fe8d45..6c225268e 100644 --- a/packages/contracts/util/formatters.ts +++ b/packages/contracts/util/formatters.ts @@ -1,12 +1,12 @@ import { BigNumber } from '@0xproject/utils'; import * as _ from 'lodash'; -import { Order } from './order'; +import { SignedOrder } from './signed_order'; import { BatchCancelOrders, BatchFillOrders, FillOrdersUpTo } from './types'; export const formatters = { createBatchFill( - orders: Order[], + orders: SignedOrder[], shouldThrowOnInsufficientBalanceOrAllowance: boolean, fillTakerTokenAmounts: BigNumber[] = [], ) { @@ -35,9 +35,9 @@ export const formatters = { order.params.expirationTimestampInSec, order.params.salt, ]); - batchFill.v.push(order.params.v as number); - batchFill.r.push(order.params.r as string); - batchFill.s.push(order.params.s as string); + batchFill.v.push(order.params.v); + batchFill.r.push(order.params.r); + batchFill.s.push(order.params.s); if (fillTakerTokenAmounts.length < orders.length) { batchFill.fillTakerTokenAmounts.push(order.params.takerTokenAmount); } @@ -45,7 +45,7 @@ export const formatters = { return batchFill; }, createFillUpTo( - orders: Order[], + orders: SignedOrder[], shouldThrowOnInsufficientBalanceOrAllowance: boolean, fillTakerTokenAmount: BigNumber, ) { @@ -74,13 +74,13 @@ export const formatters = { order.params.expirationTimestampInSec, order.params.salt, ]); - fillUpTo.v.push(order.params.v as number); - fillUpTo.r.push(order.params.r as string); - fillUpTo.s.push(order.params.s as string); + fillUpTo.v.push(order.params.v); + fillUpTo.r.push(order.params.r); + fillUpTo.s.push(order.params.s); }); return fillUpTo; }, - createBatchCancel(orders: Order[], cancelTakerTokenAmounts: BigNumber[] = []) { + createBatchCancel(orders: SignedOrder[], cancelTakerTokenAmounts: BigNumber[] = []) { const batchCancel: BatchCancelOrders = { orderAddresses: [], orderValues: [], |