aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/containers/selected_asset_instant_heading.ts
blob: a9e853fe1eb501c71e53a1972ea603a6cb84ce5d (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
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import * as React from 'react';
import { connect } from 'react-redux';

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

import { InstantHeading } from '../components/instant_heading';

export interface InstantHeadingProps {}

interface ConnectedState {
    selectedAssetAmount?: BigNumber;
    totalEthBaseAmount?: BigNumber;
    ethUsdPrice?: BigNumber;
}

const mapStateToProps = (state: State, _ownProps: InstantHeadingProps): ConnectedState => ({
    selectedAssetAmount: state.selectedAssetAmount,
    totalEthBaseAmount: _.get(state, 'latestBuyQuote.worstCaseQuoteInfo.totalEthAmount'),
    ethUsdPrice: state.ethUsdPrice,
});

export const SelectedAssetInstantHeading: React.ComponentClass<InstantHeadingProps> = connect(mapStateToProps)(
    InstantHeading,
);