You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-wallet/src/js/components/wallet/account/send/index.js

56 lines
2.0 KiB

/* @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<State, 'tokens'>,
pending: $ElementType<State, 'pending'>,
sendForm: $ElementType<State, 'sendForm'>,
fiat: $ElementType<State, 'fiat'>,
localStorage: $ElementType<State, 'localStorage'>,
children?: React.Node;
}
export type DispatchProps = BaseDispatchProps & {
sendFormActions: typeof SendFormActions
}
export type Props = StateProps & DispatchProps;
const mapStateToProps: MapStateToProps<State, OwnProps, StateProps> = (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, OwnProps, DispatchProps> = (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)