diff options
author | Leonid <logvinov.leon@gmail.com> | 2018-02-09 16:27:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-09 16:27:08 +0800 |
commit | 936f6ac10fe55257d846204ce4e5bd39ca27c78d (patch) | |
tree | f76cca84a55f979103a027282b289693a1f78491 /packages/website/ts/utils | |
parent | 7e04c4f24b789a2ce8f4a5884212cfb1e508b508 (diff) | |
parent | 43cf8d30bdab025cdcda888897d35b25ad455031 (diff) | |
download | dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.tar dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.tar.gz dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.tar.bz2 dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.tar.lz dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.tar.xz dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.tar.zst dexon-sol-tools-936f6ac10fe55257d846204ce4e5bd39ca27c78d.zip |
Merge pull request #379 from 0xProject/portal_json
Make portal order JSON compatible with 0x.js
Diffstat (limited to 'packages/website/ts/utils')
-rw-r--r-- | packages/website/ts/utils/utils.ts | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index a7865d41b..c38f84c92 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -1,4 +1,4 @@ -import { ExchangeContractErrs, ZeroExError } from '0x.js'; +import { ECSignature, ExchangeContractErrs, ZeroEx, ZeroExError } from '0x.js'; import { BigNumber } from '@0xproject/utils'; import deepEqual = require('deep-equal'); import isMobile = require('is-mobile'); @@ -11,7 +11,6 @@ import { ScreenWidths, Side, SideToAssetToken, - SignatureData, Token, TokenByAddress, } from 'ts/types'; @@ -59,50 +58,48 @@ export const utils = { return formattedDate; }, generateOrder( - networkId: number, - exchangeContract: string, + exchangeContractAddress: string, sideToAssetToken: SideToAssetToken, - orderExpiryTimestamp: BigNumber, + expirationUnixTimestampSec: BigNumber, orderTakerAddress: string, orderMakerAddress: string, makerFee: BigNumber, takerFee: BigNumber, feeRecipient: string, - signatureData: SignatureData, + ecSignature: ECSignature, tokenByAddress: TokenByAddress, orderSalt: BigNumber, ): Order { const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address]; const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address]; const order = { - maker: { - address: orderMakerAddress, - token: { + signedOrder: { + maker: orderMakerAddress, + taker: orderTakerAddress, + makerFee: makerFee.toString(), + takerFee: takerFee.toString(), + makerTokenAmount: sideToAssetToken[Side.Deposit].amount.toString(), + takerTokenAmount: sideToAssetToken[Side.Receive].amount.toString(), + makerTokenAddress: makerToken.address, + takerTokenAddress: takerToken.address, + expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), + feeRecipient, + salt: orderSalt.toString(), + ecSignature, + exchangeContractAddress, + }, + metadata: { + makerToken: { name: makerToken.name, symbol: makerToken.symbol, decimals: makerToken.decimals, - address: makerToken.address, }, - amount: sideToAssetToken[Side.Deposit].amount.toString(), - feeAmount: makerFee.toString(), - }, - taker: { - address: orderTakerAddress, - token: { + takerToken: { name: takerToken.name, symbol: takerToken.symbol, decimals: takerToken.decimals, - address: takerToken.address, }, - amount: sideToAssetToken[Side.Receive].amount.toString(), - feeAmount: takerFee.toString(), }, - expiration: orderExpiryTimestamp.toString(), - feeRecipient, - salt: orderSalt.toString(), - signature: signatureData, - exchangeContract, - networkId, }; return order; }, |