diff options
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/blockchain_lifecycle.ts | 2 | ||||
-rw-r--r-- | test/utils/order.ts | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/test/utils/blockchain_lifecycle.ts b/test/utils/blockchain_lifecycle.ts index 68e169ac0..50eb57b95 100644 --- a/test/utils/blockchain_lifecycle.ts +++ b/test/utils/blockchain_lifecycle.ts @@ -17,4 +17,4 @@ export class BlockchainLifecycle { throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`); } } -}; +} diff --git a/test/utils/order.ts b/test/utils/order.ts new file mode 100644 index 000000000..dc0be670c --- /dev/null +++ b/test/utils/order.ts @@ -0,0 +1,21 @@ +import {SignedOrder} from '../../lib/src/types'; +import * as BigNumber from 'bignumber.js'; +import * as _ from 'lodash'; + +export function signedOrderFromJSON(signedOrderJSON: any): SignedOrder { + const signedOrder = { + maker: signedOrderJSON.maker.address, + taker: _.isEmpty(signedOrderJSON.taker.address) ? undefined : signedOrderJSON.taker.address, + makerTokenAddress: signedOrderJSON.maker.token.address, + takerTokenAddress: signedOrderJSON.taker.token.address, + makerTokenAmount: new BigNumber(signedOrderJSON.maker.amount), + takerTokenAmount: new BigNumber(signedOrderJSON.taker.amount), + makerFee: new BigNumber(signedOrderJSON.maker.feeAmount), + takerFee: new BigNumber(signedOrderJSON.taker.feeAmount), + expirationUnixTimestampSec: new BigNumber(signedOrderJSON.expiration), + feeRecipient: signedOrderJSON.feeRecipient, + ecSignature: signedOrderJSON.signature, + salt: new BigNumber(signedOrderJSON.salt), + }; + return signedOrder; +} |