/* @flow */ 'use strict'; import * as React from 'react'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { default as SendFormActions } from '~/js/actions/SendFormActions'; import { default as AbstractAccountActions } from '~/js/actions/AbstractAccountActions'; import SendForm from './SendForm'; import type { MapStateToProps, MapDispatchToProps } from 'react-redux'; import type { State, Dispatch } from '~/flowtype'; import type { StateProps as BaseStateProps, DispatchProps as BaseDispatchProps } from '../AbstractAccount'; type OwnProps = { } export type StateProps = BaseStateProps & { tokens: $ElementType, pending: $ElementType, sendForm: $ElementType, fiat: $ElementType, localStorage: $ElementType, children?: React.Node; } export type DispatchProps = BaseDispatchProps & { sendFormActions: typeof SendFormActions } export type Props = StateProps & DispatchProps; const mapStateToProps: MapStateToProps = (state: State, own: OwnProps): StateProps => { return { abstractAccount: state.abstractAccount, devices: state.connect.devices, accounts: state.accounts, discovery: state.discovery, tokens: state.tokens, pending: state.pending, sendForm: state.sendForm, fiat: state.fiat, localStorage: state.localStorage }; } const mapDispatchToProps: MapDispatchToProps = (dispatch: Dispatch): DispatchProps => { return { abstractAccountActions: bindActionCreators(AbstractAccountActions, dispatch), sendFormActions: bindActionCreators(SendFormActions, dispatch), initAccount: bindActionCreators(SendFormActions.init, dispatch), disposeAccount: bindActionCreators(SendFormActions.dispose, dispatch), }; } export default connect(mapStateToProps, mapDispatchToProps)(SendForm)