mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-11 11:34:26 +00:00
0ab226ca16
* 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
27 lines
1.1 KiB
TypeScript
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;
|