mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-10 18:16:45 +00:00
[FEATURE] Hide scheduling when sending tokens.
This commit is contained in:
parent
6596f70e7b
commit
ac0a398a9a
@ -19,7 +19,11 @@ import translate from 'translations';
|
||||
import { AppState } from 'reducers';
|
||||
import { NonStandardTransaction } from './components';
|
||||
import { getOffline, getNetworkConfig } from 'selectors/config';
|
||||
import { getCurrentSchedulingToggle, ICurrentSchedulingToggle } from 'selectors/transaction';
|
||||
import {
|
||||
getCurrentSchedulingToggle,
|
||||
ICurrentSchedulingToggle,
|
||||
getUnit
|
||||
} from 'selectors/transaction';
|
||||
|
||||
const QueryWarning: React.SFC<{}> = () => (
|
||||
<WhenQueryExists
|
||||
@ -103,7 +107,7 @@ class FieldsClass extends Component<StateProps> {
|
||||
}
|
||||
|
||||
export const Fields = connect((state: AppState) => ({
|
||||
schedulingAvailable: getNetworkConfig(state).name === 'Kovan',
|
||||
schedulingAvailable: getNetworkConfig(state).name === 'Kovan' && getUnit(state) === 'ETH',
|
||||
shouldDisplay: !isAnyOfflineWithWeb3(state),
|
||||
offline: getOffline(state),
|
||||
useScheduling: getCurrentSchedulingToggle(state).value
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { select, call, put, takeEvery } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { SetUnitMetaAction, TypeKeys } from 'actions/transaction';
|
||||
import { SetUnitMetaAction, TypeKeys, setSchedulingToggle } from 'actions/transaction';
|
||||
import {
|
||||
getTokenTo,
|
||||
getTokenValue,
|
||||
@ -84,6 +84,13 @@ export function* handleSetUnitMeta({ payload: currentUnit }: SetUnitMetaAction):
|
||||
};
|
||||
// need to set meta fields for tokenTo and tokenValue
|
||||
if (etherToToken) {
|
||||
yield put(
|
||||
setSchedulingToggle({
|
||||
raw: 'false',
|
||||
value: false
|
||||
})
|
||||
);
|
||||
|
||||
return yield put(
|
||||
swapEtherToToken({
|
||||
...basePayload,
|
||||
|
@ -22,6 +22,7 @@ import { handleSetUnitMeta } from 'sagas/transaction/meta/unitSwap';
|
||||
import { isNetworkUnit } from 'selectors/config';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import BN from 'bn.js';
|
||||
import { setSchedulingToggle } from 'actions/transaction';
|
||||
|
||||
const itShouldBeDone = (gen: SagaIterator) => {
|
||||
it('should be done', () => {
|
||||
@ -207,6 +208,17 @@ describe('handleSetUnitMeta*', () => {
|
||||
|
||||
sharedLogicB(gens.gen, input, raw, value, currentUnit, isValid);
|
||||
|
||||
it('should put setSchedulingToogle', () => {
|
||||
expect(gens.gen.next(to).value).toEqual(
|
||||
put(
|
||||
setSchedulingToggle({
|
||||
raw: 'false',
|
||||
value: false
|
||||
})
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
it('should put swapEtherToToken', () => {
|
||||
const data = encodeTransfer(to.value, value);
|
||||
const payload: any = constructExpectedPayload(
|
||||
|
Loading…
x
Reference in New Issue
Block a user