type(send): export redux types

This commit is contained in:
George Lima 2019-02-14 19:20:54 -03:00
parent e70f03130d
commit 03e3d33dec
1 changed files with 23 additions and 4 deletions

View File

@ -36,7 +36,17 @@ export type SendTransactionInput = {
memo: string,
};
const mapStateToProps = ({ sendStatus, receive }: AppState) => ({
export type MapStateToProps = {|
balance: number,
zecPrice: number,
addresses: string[],
error: string | null,
isSending: boolean,
operationId: string | null,
isToAddressValid: boolean,
|};
const mapStateToProps = ({ sendStatus, receive }: AppState): MapStateToProps => ({
balance: sendStatus.addressBalance,
zecPrice: sendStatus.zecPrice,
addresses: receive.addresses,
@ -46,10 +56,19 @@ const mapStateToProps = ({ sendStatus, receive }: AppState) => ({
isToAddressValid: sendStatus.isToAddressValid,
});
const mapDispatchToProps = (dispatch: Dispatch) => ({
export type MapDispatchToProps = {|
sendTransaction: SendTransactionInput => Promise<void>,
loadAddresses: () => Promise<void>,
resetSendView: () => void,
validateAddress: ({ address: string }) => Promise<void>,
loadZECPrice: () => void,
getAddressBalance: ({ address: string }) => Promise<void>,
|};
const mapDispatchToProps = (dispatch: Dispatch): MapDispatchToProps => ({
sendTransaction: async ({
from, to, amount, fee, memo,
}: SendTransactionInput) => {
}) => {
dispatch(sendTransaction());
// $FlowFixMe
@ -142,7 +161,7 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({
if (zAddressesErr || tAddressesErr) return dispatch(loadAddressesError({ error: 'Something went wrong!' }));
dispatch(
return dispatch(
loadAddressesSuccess({
addresses: [...zAddresses, ...transparentAddresses],
}),