import * as statusActions from './status.actions' ; import { ConnectionStatus , providerType , networkType } from '../../web3.service' ; export interface StatusState { status : ConnectionStatus | undefined ; network : { id : number ; name : networkType ; } ; provider : providerType ; } const initialState = { status : undefined , network : { id : undefined , name : undefined } , provider : undefined , } ; export function statusReducer ( state = initialState , action ) { switch ( action . type ) { case statusActions . SET_STATUS : { return { ... state , status : action . payload , } ; } case statusActions . SET_NETWORK : { return { ... state , network : action . payload , } ; } case statusActions . SET_PROVIDER : { return { ... state , provider : action . payload , } ; } default : return state ; } } export const getStatus = ( state ) => state . status ; export const getNetwork = ( state ) => state . network ; export const getNetworkId = ( state ) => state . network . id ; export const getNetworkName = ( state ) => state . network . name ; export const getProvider = ( state ) => state . provider ;