diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 23:11:51 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-07 23:11:51 +0800 |
commit | 3c7ebe2697f728b6f90d837cc202e5c1ed1a2182 (patch) | |
tree | 2d1656781c3ed7ab29adcc542860b8e2ff6220c0 /packages/website/ts | |
parent | 10fb6061ccf66bd117ba13ea2ed1cfe7373096d0 (diff) | |
download | dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.tar dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.tar.gz dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.tar.bz2 dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.tar.lz dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.tar.xz dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.tar.zst dexon-0x-contracts-3c7ebe2697f728b6f90d837cc202e5c1ed1a2182.zip |
Remove unused types and take their names
Diffstat (limited to 'packages/website/ts')
-rw-r--r-- | packages/website/ts/components/fill_order.tsx | 8 | ||||
-rw-r--r-- | packages/website/ts/components/portal.tsx | 16 | ||||
-rw-r--r-- | packages/website/ts/containers/portal.tsx | 4 | ||||
-rw-r--r-- | packages/website/ts/redux/dispatcher.ts | 4 | ||||
-rw-r--r-- | packages/website/ts/redux/reducer.ts | 4 | ||||
-rw-r--r-- | packages/website/ts/types.ts | 29 | ||||
-rw-r--r-- | packages/website/ts/utils/utils.ts | 4 |
7 files changed, 18 insertions, 51 deletions
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx index 674110b75..ceb06c95a 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, SerializedOrder, Token, TokenByAddress, WebsitePaths } from 'ts/types'; +import { AlertTypes, BlockchainErrs, Order, 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: SerializedOrder; + initialOrder: Order; dispatcher: Dispatcher; lastForceTokenStateRefetch: number; } @@ -45,7 +45,7 @@ interface FillOrderState { globalErrMsg: string; orderJSON: string; orderJSONErrMsg: string; - parsedOrder: SerializedOrder; + parsedOrder: Order; didFillOrderSucceed: boolean; didCancelOrderSucceed: boolean; unavailableTakerAmount: BigNumber; @@ -401,7 +401,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> { } private async _validateFillOrderFireAndForgetAsync(orderJSON: string) { let orderJSONErrMsg = ''; - let parsedOrder: SerializedOrder; + let parsedOrder: Order; try { const order = JSON.parse(orderJSON); const validationResult = this._validator.validate(order, orderSchema); diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx index 6727645fc..92589f75c 100644 --- a/packages/website/ts/components/portal.tsx +++ b/packages/website/ts/components/portal.tsx @@ -23,15 +23,7 @@ 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, - ProviderType, - ScreenWidths, - SerializedOrder, - TokenByAddress, - WebsitePaths, -} from 'ts/types'; +import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, TokenByAddress, WebsitePaths } from 'ts/types'; import { colors } from 'ts/utils/colors'; import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; @@ -56,7 +48,7 @@ export interface PortalAllProps { userEtherBalance: BigNumber; userAddress: string; shouldBlockchainErrDialogBeOpen: boolean; - userSuppliedOrderCache: SerializedOrder; + userSuppliedOrderCache: Order; location: Location; flashMessage?: string | React.ReactNode; lastForceTokenStateRefetch: number; @@ -74,7 +66,7 @@ interface PortalAllState { export class Portal extends React.Component<PortalAllProps, PortalAllState> { private _blockchain: Blockchain; - private _sharedOrderIfExists: SerializedOrder; + private _sharedOrderIfExists: Order; private _throttledScreenWidthUpdate: () => void; public static hasAlreadyDismissedWethNotice() { const didDismissWethNotice = localStorage.getItemIfExists(constants.LOCAL_STORAGE_KEY_DISMISS_WETH_NOTICE); @@ -357,7 +349,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> { isWethNoticeDialogOpen: false, }); } - private _getSharedOrderIfExists(): SerializedOrder | undefined { + private _getSharedOrderIfExists(): Order | 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 4638de2f8..bcca0d70f 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, ProviderType, ScreenWidths, SerializedOrder, Side, TokenByAddress } from 'ts/types'; +import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, 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: SerializedOrder; + userSuppliedOrderCache: Order; flashMessage?: string | React.ReactNode; } diff --git a/packages/website/ts/redux/dispatcher.ts b/packages/website/ts/redux/dispatcher.ts index ba54347b1..87415b285 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: SerializedOrder) { + public updateUserSuppliedOrderCache(order: Order) { this._dispatch({ data: order, type: ActionTypes.UpdateUserSuppliedOrderCache, diff --git a/packages/website/ts/redux/reducer.ts b/packages/website/ts/redux/reducer.ts index 8c640fdb7..7b0b03dae 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: SerializedOrder; + userSuppliedOrderCache: Order; // Docs docsVersion: string; diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts index 42788d0e4..c1fb7111f 100644 --- a/packages/website/ts/types.ts +++ b/packages/website/ts/types.ts @@ -59,40 +59,15 @@ export interface OrderToken { name: string; symbol: string; decimals: number; - address: string; -} - -export interface OrderParty { - address: string; - token: OrderToken; - amount: string; - feeAmount: string; } export interface Order { - maker: OrderParty; - taker: OrderParty; - expiration: string; - feeRecipient: string; - salt: string; - signature: SignatureData; - exchangeContract: string; - networkId: number; -} - -export interface SerializedOrderToken { - name: string; - symbol: string; - decimals: number; -} - -export interface SerializedOrder { maker: string; taker: string; makerTokenAddress: string; takerTokenAddress: string; - makerToken: SerializedOrderToken; - takerToken: SerializedOrderToken; + makerToken: OrderToken; + takerToken: OrderToken; makerFee: string; takerFee: string; makerTokenAmount: string; 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 = { |