James Prado 0ab226ca16 Add nonce loading indicator & refresh button (#1021)
* Add InlineSpinner component

* Add 'what-input' module

* Add input style overrides

* Add new refresh icon

* Update footer styles

* Add nonce refresh button & loading indicator

* Center InlineSpinner

* Add types

* Lock version

* prettify package.json

* prettify package.json
2018-02-08 11:51:15 -06:00

27 lines
1.1 KiB
TypeScript

import { AppState } from 'reducers';
import { getTransactionState } from 'selectors/transaction';
import { RequestStatus } from 'reducers/transaction/network';
export const getNetworkStatus = (state: AppState) => getTransactionState(state).network;
export const nonceRequestPending = (state: AppState) =>
getNetworkStatus(state).getNonceStatus === RequestStatus.REQUESTED;
export const nonceRequestFailed = (state: AppState) =>
getNetworkStatus(state).getNonceStatus === RequestStatus.FAILED;
export const isNetworkRequestPending = (state: AppState) => {
const network = getNetworkStatus(state);
const states: RequestStatus[] = Object.values(network);
return states.reduce(
(anyPending, currRequestState) => anyPending || currRequestState === RequestStatus.REQUESTED,
false
);
};
export const getGasEstimationPending = (state: AppState) =>
getNetworkStatus(state).gasEstimationStatus === RequestStatus.REQUESTED;
export const getGasLimitEstimationTimedOut = (state: AppState) =>
getNetworkStatus(state).gasEstimationStatus === RequestStatus.TIMEDOUT;