From 9b3680780fab26543331524870eba75eea08a426 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 14:41:40 +0100 Subject: Rename expiration to expirationUnixTimestampSec --- packages/website/ts/utils/utils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 7e69b1c5f..794df8dc7 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -7,8 +7,8 @@ import * as moment from 'moment'; import { EtherscanLinkSuffixes, Networks, - Order, ScreenWidths, + SerializedOrder, Side, SideToAssetToken, SignatureData, @@ -71,7 +71,7 @@ export const utils = { signatureData: SignatureData, tokenByAddress: TokenByAddress, orderSalt: BigNumber, - ): Order { + ): SerializedOrder { const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address]; const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address]; const order = { @@ -97,7 +97,7 @@ export const utils = { amount: sideToAssetToken[Side.Receive].amount.toString(), feeAmount: takerFee.toString(), }, - expiration: orderExpiryTimestamp.toString(), + expirationUnixTimestampSec: orderExpiryTimestamp.toString(), feeRecipient, salt: orderSalt.toString(), signature: signatureData, -- cgit From 4d509331893066de7630e76ac19f3795a1ab637b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 14:48:59 +0100 Subject: Rename exchangeContract to exchangeContractAddress --- packages/website/ts/utils/utils.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 794df8dc7..db153d47a 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -60,9 +60,9 @@ export const utils = { }, generateOrder( networkId: number, - exchangeContract: string, + exchangeContractAddress: string, sideToAssetToken: SideToAssetToken, - orderExpiryTimestamp: BigNumber, + expirationUnixTimestampSec: BigNumber, orderTakerAddress: string, orderMakerAddress: string, makerFee: BigNumber, @@ -97,11 +97,11 @@ export const utils = { amount: sideToAssetToken[Side.Receive].amount.toString(), feeAmount: takerFee.toString(), }, - expirationUnixTimestampSec: orderExpiryTimestamp.toString(), + expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), feeRecipient, salt: orderSalt.toString(), signature: signatureData, - exchangeContract, + exchangeContractAddress, networkId, }; return order; -- cgit From 18dc5d17b552f03294c6ea13ae0d2cdcc72ac0fd Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 14:54:37 +0100 Subject: Rename signature to ecSignature --- packages/website/ts/utils/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index db153d47a..7204586c6 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -68,7 +68,7 @@ export const utils = { makerFee: BigNumber, takerFee: BigNumber, feeRecipient: string, - signatureData: SignatureData, + ecSignature: SignatureData, tokenByAddress: TokenByAddress, orderSalt: BigNumber, ): SerializedOrder { @@ -100,7 +100,7 @@ export const utils = { expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), feeRecipient, salt: orderSalt.toString(), - signature: signatureData, + ecSignature, exchangeContractAddress, networkId, }; -- cgit From 1c9428cbba873fe8d5bd18b2cb10522cbdb17a3f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 15:02:41 +0100 Subject: Move .taker.feeAmount to .takerFee and .maker.feeAmount to .makerFee --- packages/website/ts/utils/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 7204586c6..b615ba646 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -75,6 +75,8 @@ export const utils = { const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address]; const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address]; const order = { + makerFee: makerFee.toString(), + takerFee: takerFee.toString(), maker: { address: orderMakerAddress, token: { @@ -84,7 +86,6 @@ export const utils = { address: makerToken.address, }, amount: sideToAssetToken[Side.Deposit].amount.toString(), - feeAmount: makerFee.toString(), }, taker: { address: orderTakerAddress, @@ -95,7 +96,6 @@ export const utils = { address: takerToken.address, }, amount: sideToAssetToken[Side.Receive].amount.toString(), - feeAmount: takerFee.toString(), }, expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), feeRecipient, -- cgit From 223df8006a30a95db544a2af080224a4d9d2d474 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 15:09:06 +0100 Subject: Move .taker.amount to .takerTokenAmount and .maker.amount to .makerTokenAmount --- packages/website/ts/utils/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index b615ba646..cc0689868 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -77,6 +77,8 @@ export const utils = { const order = { makerFee: makerFee.toString(), takerFee: takerFee.toString(), + makerTokenAmount: sideToAssetToken[Side.Deposit].amount.toString(), + takerTokenAmount: sideToAssetToken[Side.Receive].amount.toString(), maker: { address: orderMakerAddress, token: { @@ -85,7 +87,6 @@ export const utils = { decimals: makerToken.decimals, address: makerToken.address, }, - amount: sideToAssetToken[Side.Deposit].amount.toString(), }, taker: { address: orderTakerAddress, @@ -95,7 +96,6 @@ export const utils = { decimals: takerToken.decimals, address: takerToken.address, }, - amount: sideToAssetToken[Side.Receive].amount.toString(), }, expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), feeRecipient, -- cgit From 10fb6061ccf66bd117ba13ea2ed1cfe7373096d0 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 15:26:53 +0100 Subject: Introduce makerToken and takerToken fields for unsigned token metadata --- packages/website/ts/utils/utils.ts | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index cc0689868..447a92fec 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -75,27 +75,23 @@ export const utils = { const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address]; const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address]; const order = { + maker: orderMakerAddress, + taker: orderTakerAddress, makerFee: makerFee.toString(), takerFee: takerFee.toString(), makerTokenAmount: sideToAssetToken[Side.Deposit].amount.toString(), takerTokenAmount: sideToAssetToken[Side.Receive].amount.toString(), - maker: { - address: orderMakerAddress, - token: { - name: makerToken.name, - symbol: makerToken.symbol, - decimals: makerToken.decimals, - address: makerToken.address, - }, + makerTokenAddress: makerToken.address, + takerTokenAddress: takerToken.address, + makerToken: { + name: makerToken.name, + symbol: makerToken.symbol, + decimals: makerToken.decimals, }, - taker: { - address: orderTakerAddress, - token: { - name: takerToken.name, - symbol: takerToken.symbol, - decimals: takerToken.decimals, - address: takerToken.address, - }, + takerToken: { + name: takerToken.name, + symbol: takerToken.symbol, + decimals: takerToken.decimals, }, expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), feeRecipient, -- cgit From 3c7ebe2697f728b6f90d837cc202e5c1ed1a2182 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 16:11:51 +0100 Subject: Remove unused types and take their names --- packages/website/ts/utils/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 447a92fec..2f1b2cce3 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -7,8 +7,8 @@ import * as moment from 'moment'; import { EtherscanLinkSuffixes, Networks, + Order, ScreenWidths, - SerializedOrder, Side, SideToAssetToken, SignatureData, @@ -71,7 +71,7 @@ export const utils = { ecSignature: SignatureData, tokenByAddress: TokenByAddress, orderSalt: BigNumber, - ): SerializedOrder { + ): Order { const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address]; const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address]; const order = { -- cgit From 69f5f5e94627458f4eb41f4150cfa3d140658d09 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 20:26:13 +0100 Subject: Split Order into signedOrder and metadata --- packages/website/ts/utils/utils.ts | 48 +++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 22 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 2f1b2cce3..279b2c1b2 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -75,30 +75,34 @@ export const utils = { const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address]; const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address]; const order = { - 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, - makerToken: { - name: makerToken.name, - symbol: makerToken.symbol, - decimals: makerToken.decimals, + 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, }, - takerToken: { - name: takerToken.name, - symbol: takerToken.symbol, - decimals: takerToken.decimals, + metadata: { + networkId, + makerToken: { + name: makerToken.name, + symbol: makerToken.symbol, + decimals: makerToken.decimals, + }, + takerToken: { + name: takerToken.name, + symbol: takerToken.symbol, + decimals: takerToken.decimals, + }, }, - expirationUnixTimestampSec: expirationUnixTimestampSec.toString(), - feeRecipient, - salt: orderSalt.toString(), - ecSignature, - exchangeContractAddress, - networkId, }; return order; }, -- cgit From e6f2c7a382e2e7e940f430f350240cb2f703bdcd Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 20:38:30 +0100 Subject: Remove networkId from orderJSON --- packages/website/ts/utils/utils.ts | 2 -- 1 file changed, 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index 279b2c1b2..eaff5c658 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -59,7 +59,6 @@ export const utils = { return formattedDate; }, generateOrder( - networkId: number, exchangeContractAddress: string, sideToAssetToken: SideToAssetToken, expirationUnixTimestampSec: BigNumber, @@ -91,7 +90,6 @@ export const utils = { exchangeContractAddress, }, metadata: { - networkId, makerToken: { name: makerToken.name, symbol: makerToken.symbol, -- cgit From 8fba0477a69317c19b3446c76a17cb3adbf447d7 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 7 Feb 2018 20:58:19 +0100 Subject: Remove hash from signatureData --- packages/website/ts/utils/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index eaff5c658..bf6b70f84 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, ZeroExError } from '0x.js'; import { BigNumber } from '@0xproject/utils'; import deepEqual = require('deep-equal'); import isMobile = require('is-mobile'); @@ -67,7 +67,7 @@ export const utils = { makerFee: BigNumber, takerFee: BigNumber, feeRecipient: string, - ecSignature: SignatureData, + ecSignature: ECSignature, tokenByAddress: TokenByAddress, orderSalt: BigNumber, ): Order { -- cgit From 1233c33116a389f34ac90768c5ef43c8bbfbf514 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 8 Feb 2018 16:23:20 +0100 Subject: Address feedback --- packages/website/ts/utils/utils.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages/website/ts/utils/utils.ts') diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts index bf6b70f84..68eb7c813 100644 --- a/packages/website/ts/utils/utils.ts +++ b/packages/website/ts/utils/utils.ts @@ -1,4 +1,4 @@ -import { ECSignature, 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'; -- cgit