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 { 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),
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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',
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user