aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-02-07 21:41:40 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-02-07 21:41:40 +0800
commit9b3680780fab26543331524870eba75eea08a426 (patch)
tree8ed51682e7f1a7b86d1ea84c9f53ef468f7ccaf2 /packages
parent12d62e1157168ec9e8cd23749523b2bcda8eefe5 (diff)
downloaddexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.tar
dexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.tar.gz
dexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.tar.bz2
dexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.tar.lz
dexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.tar.xz
dexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.tar.zst
dexon-sol-tools-9b3680780fab26543331524870eba75eea08a426.zip
Rename expiration to expirationUnixTimestampSec
Diffstat (limited to 'packages')
-rw-r--r--packages/website/ts/components/fill_order.tsx16
-rw-r--r--packages/website/ts/components/portal.tsx16
-rw-r--r--packages/website/ts/containers/portal.tsx4
-rw-r--r--packages/website/ts/redux/dispatcher.ts4
-rw-r--r--packages/website/ts/redux/reducer.ts4
-rw-r--r--packages/website/ts/schemas/order_schema.ts13
-rw-r--r--packages/website/ts/types.ts11
-rw-r--r--packages/website/ts/utils/utils.ts6
8 files changed, 51 insertions, 23 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx
index 97f616be2..c0b16f251 100644
--- a/packages/website/ts/components/fill_order.tsx
+++ b/packages/website/ts/components/fill_order.tsx
@@ -20,7 +20,7 @@ import { VisualOrder } from 'ts/components/visual_order';
import { Dispatcher } from 'ts/redux/dispatcher';
import { orderSchema } from 'ts/schemas/order_schema';
import { SchemaValidator } from 'ts/schemas/validator';
-import { AlertTypes, BlockchainErrs, Order, Token, TokenByAddress, WebsitePaths } from 'ts/types';
+import { AlertTypes, BlockchainErrs, SerializedOrder, Token, TokenByAddress, WebsitePaths } from 'ts/types';
import { colors } from 'ts/utils/colors';
import { constants } from 'ts/utils/constants';
import { errorReporter } from 'ts/utils/error_reporter';
@@ -34,7 +34,7 @@ interface FillOrderProps {
networkId: number;
userAddress: string;
tokenByAddress: TokenByAddress;
- initialOrder: Order;
+ initialOrder: SerializedOrder;
dispatcher: Dispatcher;
lastForceTokenStateRefetch: number;
}
@@ -45,7 +45,7 @@ interface FillOrderState {
globalErrMsg: string;
orderJSON: string;
orderJSONErrMsg: string;
- parsedOrder: Order;
+ parsedOrder: SerializedOrder;
didFillOrderSucceed: boolean;
didCancelOrderSucceed: boolean;
unavailableTakerAmount: BigNumber;
@@ -204,7 +204,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
const orderTaker = !_.isEmpty(this.state.parsedOrder.taker.address)
? this.state.parsedOrder.taker.address
: this.props.userAddress;
- const parsedOrderExpiration = new BigNumber(this.state.parsedOrder.expiration);
+ const parsedOrderExpiration = new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec);
const exchangeRate = orderMakerAmount.div(orderTakerAmount);
let orderReceiveAmount = 0;
@@ -402,7 +402,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
}
private async _validateFillOrderFireAndForgetAsync(orderJSON: string) {
let orderJSONErrMsg = '';
- let parsedOrder: Order;
+ let parsedOrder: SerializedOrder;
try {
const order = JSON.parse(orderJSON);
const validationResult = this._validator.validate(order, orderSchema);
@@ -416,7 +416,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
const exchangeContractAddr = this.props.blockchain.getExchangeContractAddressIfExists();
const makerAmount = new BigNumber(parsedOrder.maker.amount);
const takerAmount = new BigNumber(parsedOrder.taker.amount);
- const expiration = new BigNumber(parsedOrder.expiration);
+ const expiration = new BigNumber(parsedOrder.expirationUnixTimestampSec);
const salt = new BigNumber(parsedOrder.salt);
const parsedMakerFee = new BigNumber(parsedOrder.maker.feeAmount);
const parsedTakerFee = new BigNumber(parsedOrder.taker.feeAmount);
@@ -538,7 +538,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
new BigNumber(parsedOrder.taker.amount),
new BigNumber(parsedOrder.maker.feeAmount),
new BigNumber(parsedOrder.taker.feeAmount),
- new BigNumber(this.state.parsedOrder.expiration),
+ new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec),
parsedOrder.feeRecipient,
parsedOrder.signature,
new BigNumber(parsedOrder.salt),
@@ -641,7 +641,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
takerTokenAmount,
new BigNumber(parsedOrder.maker.feeAmount),
new BigNumber(parsedOrder.taker.feeAmount),
- new BigNumber(this.state.parsedOrder.expiration),
+ new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec),
parsedOrder.feeRecipient,
parsedOrder.signature,
new BigNumber(parsedOrder.salt),
diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx
index 92589f75c..6727645fc 100644
--- a/packages/website/ts/components/portal.tsx
+++ b/packages/website/ts/components/portal.tsx
@@ -23,7 +23,15 @@ import { localStorage } from 'ts/local_storage/local_storage';
import { Dispatcher } from 'ts/redux/dispatcher';
import { orderSchema } from 'ts/schemas/order_schema';
import { SchemaValidator } from 'ts/schemas/validator';
-import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, TokenByAddress, WebsitePaths } from 'ts/types';
+import {
+ BlockchainErrs,
+ HashData,
+ ProviderType,
+ ScreenWidths,
+ SerializedOrder,
+ TokenByAddress,
+ WebsitePaths,
+} from 'ts/types';
import { colors } from 'ts/utils/colors';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
@@ -48,7 +56,7 @@ export interface PortalAllProps {
userEtherBalance: BigNumber;
userAddress: string;
shouldBlockchainErrDialogBeOpen: boolean;
- userSuppliedOrderCache: Order;
+ userSuppliedOrderCache: SerializedOrder;
location: Location;
flashMessage?: string | React.ReactNode;
lastForceTokenStateRefetch: number;
@@ -66,7 +74,7 @@ interface PortalAllState {
export class Portal extends React.Component<PortalAllProps, PortalAllState> {
private _blockchain: Blockchain;
- private _sharedOrderIfExists: Order;
+ private _sharedOrderIfExists: SerializedOrder;
private _throttledScreenWidthUpdate: () => void;
public static hasAlreadyDismissedWethNotice() {
const didDismissWethNotice = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE);
@@ -349,7 +357,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> {
isWethNoticeDialogOpen: false,
});
}
- private _getSharedOrderIfExists(): Order | undefined {
+ private _getSharedOrderIfExists(): SerializedOrder | undefined {
const queryString = window.location.search;
if (queryString.length === 0) {
return undefined;
diff --git a/packages/website/ts/containers/portal.tsx b/packages/website/ts/containers/portal.tsx
index bcca0d70f..4638de2f8 100644
--- a/packages/website/ts/containers/portal.tsx
+++ b/packages/website/ts/containers/portal.tsx
@@ -6,7 +6,7 @@ import { Dispatch } from 'redux';
import { Portal as PortalComponent, PortalAllProps as PortalComponentAllProps } from 'ts/components/portal';
import { Dispatcher } from 'ts/redux/dispatcher';
import { State } from 'ts/redux/reducer';
-import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, Side, TokenByAddress } from 'ts/types';
+import { BlockchainErrs, HashData, ProviderType, ScreenWidths, SerializedOrder, Side, TokenByAddress } from 'ts/types';
import { constants } from 'ts/utils/constants';
interface ConnectedState {
@@ -24,7 +24,7 @@ interface ConnectedState {
screenWidth: ScreenWidths;
shouldBlockchainErrDialogBeOpen: boolean;
userAddress: string;
- userSuppliedOrderCache: Order;
+ userSuppliedOrderCache: SerializedOrder;
flashMessage?: string | React.ReactNode;
}
diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts
index 87415b285..ba54347b1 100644
--- a/packages/website/ts/redux/dispatcher.ts
+++ b/packages/website/ts/redux/dispatcher.ts
@@ -5,9 +5,9 @@ import {
ActionTypes,
AssetToken,
BlockchainErrs,
- Order,
ProviderType,
ScreenWidths,
+ SerializedOrder,
Side,
SideToAssetToken,
SignatureData,
@@ -49,7 +49,7 @@ export class Dispatcher {
type: ActionTypes.UpdateOrderSalt,
});
}
- public updateUserSuppliedOrderCache(order: Order) {
+ public updateUserSuppliedOrderCache(order: SerializedOrder) {
this._dispatch({
data: order,
type: ActionTypes.UpdateUserSuppliedOrderCache,
diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts
index 7b0b03dae..8c640fdb7 100644
--- a/packages/website/ts/redux/reducer.ts
+++ b/packages/website/ts/redux/reducer.ts
@@ -6,9 +6,9 @@ import {
Action,
ActionTypes,
BlockchainErrs,
- Order,
ProviderType,
ScreenWidths,
+ SerializedOrder,
Side,
SideToAssetToken,
SignatureData,
@@ -40,7 +40,7 @@ export interface State {
userAddress: string;
userEtherBalance: BigNumber;
// Note: cache of supplied orderJSON in fill order step. Do not use for anything else.
- userSuppliedOrderCache: Order;
+ userSuppliedOrderCache: SerializedOrder;
// Docs
docsVersion: string;
diff --git a/packages/website/ts/schemas/order_schema.ts b/packages/website/ts/schemas/order_schema.ts
index bfbf9eb8b..1d9e96fee 100644
--- a/packages/website/ts/schemas/order_schema.ts
+++ b/packages/website/ts/schemas/order_schema.ts
@@ -5,11 +5,20 @@ export const orderSchema = {
taker: { $ref: '/OrderTaker' },
salt: { type: 'string' },
signature: { $ref: '/SignatureData' },
- expiration: { type: 'string' },
+ expirationUnixTimestampSec: { type: 'string' },
feeRecipient: { type: 'string' },
exchangeContract: { type: 'string' },
networkId: { type: 'number' },
},
- required: ['maker', 'taker', 'salt', 'signature', 'expiration', 'feeRecipient', 'exchangeContract', 'networkId'],
+ required: [
+ 'maker',
+ 'taker',
+ 'salt',
+ 'signature',
+ 'expirationUnixTimestampSec',
+ 'feeRecipient',
+ 'exchangeContract',
+ 'networkId',
+ ],
type: 'object',
};
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index c48c88cae..4ac972783 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -80,6 +80,17 @@ export interface Order {
networkId: number;
}
+export interface SerializedOrder {
+ maker: OrderParty;
+ taker: OrderParty;
+ expirationUnixTimestampSec: string;
+ feeRecipient: string;
+ salt: string;
+ signature: SignatureData;
+ exchangeContract: string;
+ networkId: number;
+}
+
export interface Fill {
logIndex: number;
maker: string;
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,