Rename expiration to expirationUnixTimestampSec
This commit is contained in:
@@ -20,7 +20,7 @@ import { VisualOrder } from 'ts/components/visual_order';
|
|||||||
import { Dispatcher } from 'ts/redux/dispatcher';
|
import { Dispatcher } from 'ts/redux/dispatcher';
|
||||||
import { orderSchema } from 'ts/schemas/order_schema';
|
import { orderSchema } from 'ts/schemas/order_schema';
|
||||||
import { SchemaValidator } from 'ts/schemas/validator';
|
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 { colors } from 'ts/utils/colors';
|
||||||
import { constants } from 'ts/utils/constants';
|
import { constants } from 'ts/utils/constants';
|
||||||
import { errorReporter } from 'ts/utils/error_reporter';
|
import { errorReporter } from 'ts/utils/error_reporter';
|
||||||
@@ -34,7 +34,7 @@ interface FillOrderProps {
|
|||||||
networkId: number;
|
networkId: number;
|
||||||
userAddress: string;
|
userAddress: string;
|
||||||
tokenByAddress: TokenByAddress;
|
tokenByAddress: TokenByAddress;
|
||||||
initialOrder: Order;
|
initialOrder: SerializedOrder;
|
||||||
dispatcher: Dispatcher;
|
dispatcher: Dispatcher;
|
||||||
lastForceTokenStateRefetch: number;
|
lastForceTokenStateRefetch: number;
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ interface FillOrderState {
|
|||||||
globalErrMsg: string;
|
globalErrMsg: string;
|
||||||
orderJSON: string;
|
orderJSON: string;
|
||||||
orderJSONErrMsg: string;
|
orderJSONErrMsg: string;
|
||||||
parsedOrder: Order;
|
parsedOrder: SerializedOrder;
|
||||||
didFillOrderSucceed: boolean;
|
didFillOrderSucceed: boolean;
|
||||||
didCancelOrderSucceed: boolean;
|
didCancelOrderSucceed: boolean;
|
||||||
unavailableTakerAmount: BigNumber;
|
unavailableTakerAmount: BigNumber;
|
||||||
@@ -204,7 +204,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
|||||||
const orderTaker = !_.isEmpty(this.state.parsedOrder.taker.address)
|
const orderTaker = !_.isEmpty(this.state.parsedOrder.taker.address)
|
||||||
? this.state.parsedOrder.taker.address
|
? this.state.parsedOrder.taker.address
|
||||||
: this.props.userAddress;
|
: this.props.userAddress;
|
||||||
const parsedOrderExpiration = new BigNumber(this.state.parsedOrder.expiration);
|
const parsedOrderExpiration = new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec);
|
||||||
const exchangeRate = orderMakerAmount.div(orderTakerAmount);
|
const exchangeRate = orderMakerAmount.div(orderTakerAmount);
|
||||||
|
|
||||||
let orderReceiveAmount = 0;
|
let orderReceiveAmount = 0;
|
||||||
@@ -402,7 +402,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
|||||||
}
|
}
|
||||||
private async _validateFillOrderFireAndForgetAsync(orderJSON: string) {
|
private async _validateFillOrderFireAndForgetAsync(orderJSON: string) {
|
||||||
let orderJSONErrMsg = '';
|
let orderJSONErrMsg = '';
|
||||||
let parsedOrder: Order;
|
let parsedOrder: SerializedOrder;
|
||||||
try {
|
try {
|
||||||
const order = JSON.parse(orderJSON);
|
const order = JSON.parse(orderJSON);
|
||||||
const validationResult = this._validator.validate(order, orderSchema);
|
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 exchangeContractAddr = this.props.blockchain.getExchangeContractAddressIfExists();
|
||||||
const makerAmount = new BigNumber(parsedOrder.maker.amount);
|
const makerAmount = new BigNumber(parsedOrder.maker.amount);
|
||||||
const takerAmount = new BigNumber(parsedOrder.taker.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 salt = new BigNumber(parsedOrder.salt);
|
||||||
const parsedMakerFee = new BigNumber(parsedOrder.maker.feeAmount);
|
const parsedMakerFee = new BigNumber(parsedOrder.maker.feeAmount);
|
||||||
const parsedTakerFee = new BigNumber(parsedOrder.taker.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.taker.amount),
|
||||||
new BigNumber(parsedOrder.maker.feeAmount),
|
new BigNumber(parsedOrder.maker.feeAmount),
|
||||||
new BigNumber(parsedOrder.taker.feeAmount),
|
new BigNumber(parsedOrder.taker.feeAmount),
|
||||||
new BigNumber(this.state.parsedOrder.expiration),
|
new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec),
|
||||||
parsedOrder.feeRecipient,
|
parsedOrder.feeRecipient,
|
||||||
parsedOrder.signature,
|
parsedOrder.signature,
|
||||||
new BigNumber(parsedOrder.salt),
|
new BigNumber(parsedOrder.salt),
|
||||||
@@ -641,7 +641,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
|
|||||||
takerTokenAmount,
|
takerTokenAmount,
|
||||||
new BigNumber(parsedOrder.maker.feeAmount),
|
new BigNumber(parsedOrder.maker.feeAmount),
|
||||||
new BigNumber(parsedOrder.taker.feeAmount),
|
new BigNumber(parsedOrder.taker.feeAmount),
|
||||||
new BigNumber(this.state.parsedOrder.expiration),
|
new BigNumber(this.state.parsedOrder.expirationUnixTimestampSec),
|
||||||
parsedOrder.feeRecipient,
|
parsedOrder.feeRecipient,
|
||||||
parsedOrder.signature,
|
parsedOrder.signature,
|
||||||
new BigNumber(parsedOrder.salt),
|
new BigNumber(parsedOrder.salt),
|
||||||
|
|||||||
@@ -23,7 +23,15 @@ import { localStorage } from 'ts/local_storage/local_storage';
|
|||||||
import { Dispatcher } from 'ts/redux/dispatcher';
|
import { Dispatcher } from 'ts/redux/dispatcher';
|
||||||
import { orderSchema } from 'ts/schemas/order_schema';
|
import { orderSchema } from 'ts/schemas/order_schema';
|
||||||
import { SchemaValidator } from 'ts/schemas/validator';
|
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 { colors } from 'ts/utils/colors';
|
||||||
import { configs } from 'ts/utils/configs';
|
import { configs } from 'ts/utils/configs';
|
||||||
import { constants } from 'ts/utils/constants';
|
import { constants } from 'ts/utils/constants';
|
||||||
@@ -48,7 +56,7 @@ export interface PortalAllProps {
|
|||||||
userEtherBalance: BigNumber;
|
userEtherBalance: BigNumber;
|
||||||
userAddress: string;
|
userAddress: string;
|
||||||
shouldBlockchainErrDialogBeOpen: boolean;
|
shouldBlockchainErrDialogBeOpen: boolean;
|
||||||
userSuppliedOrderCache: Order;
|
userSuppliedOrderCache: SerializedOrder;
|
||||||
location: Location;
|
location: Location;
|
||||||
flashMessage?: string | React.ReactNode;
|
flashMessage?: string | React.ReactNode;
|
||||||
lastForceTokenStateRefetch: number;
|
lastForceTokenStateRefetch: number;
|
||||||
@@ -66,7 +74,7 @@ interface PortalAllState {
|
|||||||
|
|
||||||
export class Portal extends React.Component<PortalAllProps, PortalAllState> {
|
export class Portal extends React.Component<PortalAllProps, PortalAllState> {
|
||||||
private _blockchain: Blockchain;
|
private _blockchain: Blockchain;
|
||||||
private _sharedOrderIfExists: Order;
|
private _sharedOrderIfExists: SerializedOrder;
|
||||||
private _throttledScreenWidthUpdate: () => void;
|
private _throttledScreenWidthUpdate: () => void;
|
||||||
public static hasAlreadyDismissedWethNotice() {
|
public static hasAlreadyDismissedWethNotice() {
|
||||||
const didDismissWethNotice = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE);
|
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,
|
isWethNoticeDialogOpen: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
private _getSharedOrderIfExists(): Order | undefined {
|
private _getSharedOrderIfExists(): SerializedOrder | undefined {
|
||||||
const queryString = window.location.search;
|
const queryString = window.location.search;
|
||||||
if (queryString.length === 0) {
|
if (queryString.length === 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Dispatch } from 'redux';
|
|||||||
import { Portal as PortalComponent, PortalAllProps as PortalComponentAllProps } from 'ts/components/portal';
|
import { Portal as PortalComponent, PortalAllProps as PortalComponentAllProps } from 'ts/components/portal';
|
||||||
import { Dispatcher } from 'ts/redux/dispatcher';
|
import { Dispatcher } from 'ts/redux/dispatcher';
|
||||||
import { State } from 'ts/redux/reducer';
|
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';
|
import { constants } from 'ts/utils/constants';
|
||||||
|
|
||||||
interface ConnectedState {
|
interface ConnectedState {
|
||||||
@@ -24,7 +24,7 @@ interface ConnectedState {
|
|||||||
screenWidth: ScreenWidths;
|
screenWidth: ScreenWidths;
|
||||||
shouldBlockchainErrDialogBeOpen: boolean;
|
shouldBlockchainErrDialogBeOpen: boolean;
|
||||||
userAddress: string;
|
userAddress: string;
|
||||||
userSuppliedOrderCache: Order;
|
userSuppliedOrderCache: SerializedOrder;
|
||||||
flashMessage?: string | React.ReactNode;
|
flashMessage?: string | React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,9 +5,9 @@ import {
|
|||||||
ActionTypes,
|
ActionTypes,
|
||||||
AssetToken,
|
AssetToken,
|
||||||
BlockchainErrs,
|
BlockchainErrs,
|
||||||
Order,
|
|
||||||
ProviderType,
|
ProviderType,
|
||||||
ScreenWidths,
|
ScreenWidths,
|
||||||
|
SerializedOrder,
|
||||||
Side,
|
Side,
|
||||||
SideToAssetToken,
|
SideToAssetToken,
|
||||||
SignatureData,
|
SignatureData,
|
||||||
@@ -49,7 +49,7 @@ export class Dispatcher {
|
|||||||
type: ActionTypes.UpdateOrderSalt,
|
type: ActionTypes.UpdateOrderSalt,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public updateUserSuppliedOrderCache(order: Order) {
|
public updateUserSuppliedOrderCache(order: SerializedOrder) {
|
||||||
this._dispatch({
|
this._dispatch({
|
||||||
data: order,
|
data: order,
|
||||||
type: ActionTypes.UpdateUserSuppliedOrderCache,
|
type: ActionTypes.UpdateUserSuppliedOrderCache,
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import {
|
|||||||
Action,
|
Action,
|
||||||
ActionTypes,
|
ActionTypes,
|
||||||
BlockchainErrs,
|
BlockchainErrs,
|
||||||
Order,
|
|
||||||
ProviderType,
|
ProviderType,
|
||||||
ScreenWidths,
|
ScreenWidths,
|
||||||
|
SerializedOrder,
|
||||||
Side,
|
Side,
|
||||||
SideToAssetToken,
|
SideToAssetToken,
|
||||||
SignatureData,
|
SignatureData,
|
||||||
@@ -40,7 +40,7 @@ export interface State {
|
|||||||
userAddress: string;
|
userAddress: string;
|
||||||
userEtherBalance: BigNumber;
|
userEtherBalance: BigNumber;
|
||||||
// Note: cache of supplied orderJSON in fill order step. Do not use for anything else.
|
// Note: cache of supplied orderJSON in fill order step. Do not use for anything else.
|
||||||
userSuppliedOrderCache: Order;
|
userSuppliedOrderCache: SerializedOrder;
|
||||||
|
|
||||||
// Docs
|
// Docs
|
||||||
docsVersion: string;
|
docsVersion: string;
|
||||||
|
|||||||
@@ -5,11 +5,20 @@ export const orderSchema = {
|
|||||||
taker: { $ref: '/OrderTaker' },
|
taker: { $ref: '/OrderTaker' },
|
||||||
salt: { type: 'string' },
|
salt: { type: 'string' },
|
||||||
signature: { $ref: '/SignatureData' },
|
signature: { $ref: '/SignatureData' },
|
||||||
expiration: { type: 'string' },
|
expirationUnixTimestampSec: { type: 'string' },
|
||||||
feeRecipient: { type: 'string' },
|
feeRecipient: { type: 'string' },
|
||||||
exchangeContract: { type: 'string' },
|
exchangeContract: { type: 'string' },
|
||||||
networkId: { type: 'number' },
|
networkId: { type: 'number' },
|
||||||
},
|
},
|
||||||
required: ['maker', 'taker', 'salt', 'signature', 'expiration', 'feeRecipient', 'exchangeContract', 'networkId'],
|
required: [
|
||||||
|
'maker',
|
||||||
|
'taker',
|
||||||
|
'salt',
|
||||||
|
'signature',
|
||||||
|
'expirationUnixTimestampSec',
|
||||||
|
'feeRecipient',
|
||||||
|
'exchangeContract',
|
||||||
|
'networkId',
|
||||||
|
],
|
||||||
type: 'object',
|
type: 'object',
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -80,6 +80,17 @@ export interface Order {
|
|||||||
networkId: number;
|
networkId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface SerializedOrder {
|
||||||
|
maker: OrderParty;
|
||||||
|
taker: OrderParty;
|
||||||
|
expirationUnixTimestampSec: string;
|
||||||
|
feeRecipient: string;
|
||||||
|
salt: string;
|
||||||
|
signature: SignatureData;
|
||||||
|
exchangeContract: string;
|
||||||
|
networkId: number;
|
||||||
|
}
|
||||||
|
|
||||||
export interface Fill {
|
export interface Fill {
|
||||||
logIndex: number;
|
logIndex: number;
|
||||||
maker: string;
|
maker: string;
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import * as moment from 'moment';
|
|||||||
import {
|
import {
|
||||||
EtherscanLinkSuffixes,
|
EtherscanLinkSuffixes,
|
||||||
Networks,
|
Networks,
|
||||||
Order,
|
|
||||||
ScreenWidths,
|
ScreenWidths,
|
||||||
|
SerializedOrder,
|
||||||
Side,
|
Side,
|
||||||
SideToAssetToken,
|
SideToAssetToken,
|
||||||
SignatureData,
|
SignatureData,
|
||||||
@@ -71,7 +71,7 @@ export const utils = {
|
|||||||
signatureData: SignatureData,
|
signatureData: SignatureData,
|
||||||
tokenByAddress: TokenByAddress,
|
tokenByAddress: TokenByAddress,
|
||||||
orderSalt: BigNumber,
|
orderSalt: BigNumber,
|
||||||
): Order {
|
): SerializedOrder {
|
||||||
const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address];
|
const makerToken = tokenByAddress[sideToAssetToken[Side.Deposit].address];
|
||||||
const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address];
|
const takerToken = tokenByAddress[sideToAssetToken[Side.Receive].address];
|
||||||
const order = {
|
const order = {
|
||||||
@@ -97,7 +97,7 @@ export const utils = {
|
|||||||
amount: sideToAssetToken[Side.Receive].amount.toString(),
|
amount: sideToAssetToken[Side.Receive].amount.toString(),
|
||||||
feeAmount: takerFee.toString(),
|
feeAmount: takerFee.toString(),
|
||||||
},
|
},
|
||||||
expiration: orderExpiryTimestamp.toString(),
|
expirationUnixTimestampSec: orderExpiryTimestamp.toString(),
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
salt: orderSalt.toString(),
|
salt: orderSalt.toString(),
|
||||||
signature: signatureData,
|
signature: signatureData,
|
||||||
|
|||||||
Reference in New Issue
Block a user