aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers/latest_buy_quote_order_details.ts
blob: b354c78fa57564c0f7d035ecb8f11ec21c6122c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { BuyQuoteInfo } from '@0xproject/asset-buyer';
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { connect } from 'react-redux';
import { oc } from 'ts-optchain';

import { State } from '../redux/reducer';

import { OrderDetails } from '../components/order_details';

export interface LatestBuyQuoteOrderDetailsProps {}

interface ConnectedState {
    buyQuoteInfo?: BuyQuoteInfo;
    ethUsdPrice?: BigNumber;
}

const mapStateToProps = (state: State, _ownProps: LatestBuyQuoteOrderDetailsProps): ConnectedState => ({
    // use the worst case quote info
    buyQuoteInfo: oc(state).latestBuyQuote.worstCaseQuoteInfo(),
    ethUsdPrice: state.ethUsdPrice,
});

export const LatestBuyQuoteOrderDetails: React.ComponentClass<LatestBuyQuoteOrderDetailsProps> = connect(
    mapStateToProps,
)(OrderDetails);