mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-25 02:20:24 +00:00
aabcd3f7a3
* Set default unit to 'ETH' instead of 'ether' * Use 'isEtherUnit()' everywhere * Set default unit to empty string * Update isEthUnit to isNetworkUnit * Fix unit conversion for non-ethereum networks * Set default network unit properly * Fix tests * fix typos * Update isNetworkUnit selector * Update isNetworkUnit * Fix validationhelpers tests * Add mock state to tests & Move isNetworkUnit to selectors * Fix validation helper spec * fix unit swap spec
23 lines
704 B
TypeScript
23 lines
704 B
TypeScript
import { SagaIterator } from 'redux-saga';
|
|
import { TypeKeys } from 'actions/wallet';
|
|
import { takeEvery, put, select } from 'redux-saga/effects';
|
|
import {
|
|
reset as resetActionCreator,
|
|
setUnitMeta,
|
|
TypeKeys as Constants
|
|
} from 'actions/transaction';
|
|
import { getNetworkUnit } from 'selectors/config';
|
|
|
|
export function* resetTransactionState(): SagaIterator {
|
|
yield put(resetActionCreator());
|
|
}
|
|
|
|
export function* setNetworkUnit(): SagaIterator {
|
|
const networkUnit = yield select(getNetworkUnit);
|
|
yield put(setUnitMeta(networkUnit));
|
|
}
|
|
|
|
export const setDefaultUnit = takeEvery(Constants.RESET, setNetworkUnit);
|
|
|
|
export const reset = [takeEvery([TypeKeys.WALLET_RESET], resetTransactionState)];
|