[FEATURE] Add Redux state for scheduling
This commit is contained in:
parent
97b14f0120
commit
3e10970f83
|
@ -1,6 +1,6 @@
|
|||
export * from './timeBounty';
|
||||
export * from './windowSize';
|
||||
export * from './windowStart';
|
||||
export * from './scheduleTimestamp';
|
||||
export * from './scheduleType';
|
||||
export * from './schedulingToggle';
|
||||
export * from './timeBounty';
|
||||
export * from './windowSize';
|
||||
export * from './windowStart';
|
|
@ -1,8 +1,8 @@
|
|||
import { TypeKeys } from 'actions/schedule';
|
||||
import {
|
||||
SetCurrentScheduleTimestampAction,
|
||||
SetCurrentScheduleTimezoneAction
|
||||
} from '../actionTypes/scheduleTimestamp';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
} from '../../actionTypes/scheduleTimestamp';
|
||||
|
||||
export type TSetCurrentScheduleTimestamp = typeof setCurrentScheduleTimestamp;
|
||||
export const setCurrentScheduleTimestamp = (
|
|
@ -1,5 +1,5 @@
|
|||
import { SetCurrentScheduleTypeAction } from '../actionTypes/scheduleType';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
import { SetCurrentScheduleTypeAction } from '../../actionTypes/scheduleType';
|
||||
|
||||
export type TSetCurrentScheduleType = typeof setCurrentScheduleType;
|
||||
export const setCurrentScheduleType = (
|
|
@ -1,5 +1,5 @@
|
|||
import { SetCurrentSchedulingToggleAction } from '../actionTypes/schedulingToggle';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
import { SetCurrentSchedulingToggleAction } from '../../actionTypes/schedulingToggle';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentSchedulingToggle = typeof setCurrentSchedulingToggle;
|
||||
const setCurrentSchedulingToggle = (
|
|
@ -1,5 +1,5 @@
|
|||
import { SetCurrentTimeBountyAction } from '../actionTypes/timeBounty';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
import { SetCurrentTimeBountyAction } from '../../actionTypes/timeBounty';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentTimeBounty = typeof setCurrentTimeBounty;
|
||||
const setCurrentTimeBounty = (
|
|
@ -1,5 +1,5 @@
|
|||
import { SetCurrentWindowSizeAction } from '../actionTypes/windowSize';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
import { SetCurrentWindowSizeAction } from '../../actionTypes/windowSize';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentWindowSize = typeof setCurrentWindowSize;
|
||||
const setCurrentWindowSize = (
|
|
@ -1,5 +1,5 @@
|
|||
import { SetCurrentWindowStartAction } from '../actionTypes/windowStart';
|
||||
import { TypeKeys } from 'actions/transaction';
|
||||
import { SetCurrentWindowStartAction } from '../../actionTypes/windowStart';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
type TSetCurrentWindowStart = typeof setCurrentWindowStart;
|
||||
const setCurrentWindowStart = (
|
|
@ -0,0 +1,117 @@
|
|||
import {
|
||||
SetTimeBountyFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleParamsValidityAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
|
||||
type TSetTimeBountyField = typeof setTimeBountyField;
|
||||
const setTimeBountyField = (
|
||||
payload: SetTimeBountyFieldAction['payload']
|
||||
): SetTimeBountyFieldAction => ({
|
||||
type: TypeKeys.TIME_BOUNTY_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetWindowSizeField = typeof setWindowSizeField;
|
||||
const setWindowSizeField = (
|
||||
payload: SetWindowSizeFieldAction['payload']
|
||||
): SetWindowSizeFieldAction => ({
|
||||
type: TypeKeys.WINDOW_SIZE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetWindowStartField = typeof setWindowStartField;
|
||||
const setWindowStartField = (
|
||||
payload: SetWindowStartFieldAction['payload']
|
||||
): SetWindowStartFieldAction => ({
|
||||
type: TypeKeys.WINDOW_START_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleTimestampField = typeof setScheduleTimestampField;
|
||||
const setScheduleTimestampField = (
|
||||
payload: SetScheduleTimestampFieldAction['payload']
|
||||
): SetScheduleTimestampFieldAction => ({
|
||||
type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleType = typeof setScheduleType;
|
||||
const setScheduleType = (payload: SetScheduleTypeAction['payload']): SetScheduleTypeAction => ({
|
||||
type: TypeKeys.SCHEDULE_TYPE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetSchedulingToggle = typeof setSchedulingToggle;
|
||||
const setSchedulingToggle = (
|
||||
payload: SetSchedulingToggleAction['payload']
|
||||
): SetSchedulingToggleAction => ({
|
||||
type: TypeKeys.SCHEDULING_TOGGLE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleTimezone = typeof setScheduleTimezone;
|
||||
const setScheduleTimezone = (
|
||||
payload: SetScheduleTimezoneAction['payload']
|
||||
): SetScheduleTimezoneAction => ({
|
||||
type: TypeKeys.SCHEDULE_TIMEZONE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleGasPriceField = typeof setScheduleGasPriceField;
|
||||
const setScheduleGasPriceField = (payload: SetScheduleGasPriceFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleGasLimitField = typeof setScheduleGasLimitField;
|
||||
const setScheduleGasLimitField = (payload: SetScheduleGasLimitFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleDepositField = typeof setScheduleDepositField;
|
||||
const setScheduleDepositField = (payload: SetScheduleDepositFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleParamsValidity = typeof setScheduleParamsValidity;
|
||||
const setScheduleParamsValidity = (payload: SetScheduleParamsValidityAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
export {
|
||||
TSetWindowSizeField,
|
||||
TSetWindowStartField,
|
||||
TSetTimeBountyField,
|
||||
TSetScheduleTimestampField,
|
||||
TSetScheduleType,
|
||||
TSetSchedulingToggle,
|
||||
TSetScheduleTimezone,
|
||||
TSetScheduleGasPriceField,
|
||||
TSetScheduleGasLimitField,
|
||||
TSetScheduleDepositField,
|
||||
TSetScheduleParamsValidity,
|
||||
setTimeBountyField,
|
||||
setWindowSizeField,
|
||||
setWindowStartField,
|
||||
setScheduleTimestampField,
|
||||
setScheduleType,
|
||||
setSchedulingToggle,
|
||||
setScheduleTimezone,
|
||||
setScheduleGasPriceField,
|
||||
setScheduleGasLimitField,
|
||||
setScheduleDepositField,
|
||||
setScheduleParamsValidity
|
||||
};
|
|
@ -0,0 +1,2 @@
|
|||
export * from './fields';
|
||||
export * from './current';
|
|
@ -0,0 +1,5 @@
|
|||
import { ScheduleFieldAction } from './fields';
|
||||
|
||||
export * from './fields';
|
||||
|
||||
export type ScheduleAction = ScheduleFieldAction;
|
|
@ -0,0 +1,117 @@
|
|||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { Wei } from 'libs/units';
|
||||
|
||||
interface SetTimeBountyFieldAction {
|
||||
type: TypeKeys.TIME_BOUNTY_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetWindowSizeFieldAction {
|
||||
type: TypeKeys.WINDOW_SIZE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetWindowStartFieldAction {
|
||||
type: TypeKeys.WINDOW_START_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: number | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTimestampFieldAction {
|
||||
type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Date | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTypeAction {
|
||||
type: TypeKeys.SCHEDULE_TYPE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetSchedulingToggleAction {
|
||||
type: TypeKeys.SCHEDULING_TOGGLE_SET;
|
||||
payload: {
|
||||
value: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTimezoneAction {
|
||||
type: TypeKeys.SCHEDULE_TIMEZONE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleGasPriceFieldAction {
|
||||
type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleGasLimitFieldAction {
|
||||
type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleDepositFieldAction {
|
||||
type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleParamsValidityAction {
|
||||
type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET;
|
||||
payload: {
|
||||
raw: boolean;
|
||||
value: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
type ScheduleFieldAction =
|
||||
| SetTimeBountyFieldAction
|
||||
| SetWindowSizeFieldAction
|
||||
| SetWindowStartFieldAction
|
||||
| SetScheduleTimestampFieldAction
|
||||
| SetScheduleTypeAction
|
||||
| SetSchedulingToggleAction
|
||||
| SetScheduleGasPriceFieldAction
|
||||
| SetScheduleGasLimitFieldAction
|
||||
| SetScheduleDepositFieldAction
|
||||
| SetScheduleTimezoneAction
|
||||
| SetScheduleParamsValidityAction;
|
||||
|
||||
export {
|
||||
ScheduleFieldAction,
|
||||
SetTimeBountyFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleParamsValidityAction
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
export * from './actionTypes';
|
|
@ -1,4 +1,4 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
import { TypeKeys } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule';
|
||||
|
||||
/* user input */
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
export enum TypeKeys {
|
||||
CURRENT_TIME_BOUNTY_SET = 'CURRENT_TIME_BOUNTY_SET',
|
||||
CURRENT_WINDOW_SIZE_SET = 'CURRENT_WINDOW_SIZE_SET',
|
||||
CURRENT_WINDOW_START_SET = 'CURRENT_WINDOW_START_SET',
|
||||
CURRENT_SCHEDULE_TIMESTAMP_SET = 'CURRENT_SCHEDULE_TIMESTAMP_SET',
|
||||
CURRENT_SCHEDULE_TIMEZONE_SET = 'CURRENT_SCHEDULE_TIMEZONE_SET',
|
||||
CURRENT_SCHEDULE_TYPE = 'CURRENT_SCHEDULE_TYPE',
|
||||
CURRENT_SCHEDULING_TOGGLE = 'CURRENT_SCHEDULING_TOGGLE',
|
||||
|
||||
TIME_BOUNTY_FIELD_SET = 'TIME_BOUNTY_FIELD_SET',
|
||||
WINDOW_SIZE_FIELD_SET = 'WINDOW_SIZE_FIELD_SET',
|
||||
WINDOW_START_FIELD_SET = 'WINDOW_START_FIELD_SET',
|
||||
SCHEDULE_GAS_PRICE_FIELD_SET = 'SCHEDULE_GAS_PRICE_SET',
|
||||
SCHEDULE_GAS_LIMIT_FIELD_SET = 'SCHEDULE_GAS_LIMIT_SET',
|
||||
SCHEDULE_TIMESTAMP_FIELD_SET = 'SCHEDULE_TIMESTAMP_FIELD_SET',
|
||||
SCHEDULE_TIMEZONE_SET = 'SCHEDULE_TIMEZONE_SET',
|
||||
SCHEDULE_TYPE_SET = 'SCHEDULE_TYPE_SET',
|
||||
SCHEDULING_TOGGLE_SET = 'SCHEDULING_TOGGLE_SET',
|
||||
SCHEDULE_DEPOSIT_FIELD_SET = 'SCHEDULE_DEPOSIT_FIELD_SET',
|
||||
SCHEDULE_PARAMS_VALIDITY_SET = 'SCHEDULE_PARAMS_VALIDITY_SET'
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
export * from './actionCreators';
|
||||
export * from './constants';
|
||||
export * from './actionTypes';
|
|
@ -10,18 +10,7 @@ import {
|
|||
InputDataAction,
|
||||
InputNonceAction,
|
||||
ResetAction,
|
||||
SetGasPriceFieldAction,
|
||||
SetTimeBountyFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleParamsValidityAction
|
||||
SetGasPriceFieldAction
|
||||
} from '../actionTypes';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
|
||||
|
@ -43,14 +32,6 @@ const inputGasPriceIntent = (payload: InputGasPriceIntentAction['payload']) => (
|
|||
payload
|
||||
});
|
||||
|
||||
type TSetTimeBountyField = typeof setTimeBountyField;
|
||||
const setTimeBountyField = (
|
||||
payload: SetTimeBountyFieldAction['payload']
|
||||
): SetTimeBountyFieldAction => ({
|
||||
type: TypeKeys.TIME_BOUNTY_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TInputNonce = typeof inputNonce;
|
||||
const inputNonce = (payload: InputNonceAction['payload']) => ({
|
||||
type: TypeKeys.NONCE_INPUT,
|
||||
|
@ -99,76 +80,6 @@ const setGasPriceField = (payload: SetGasPriceFieldAction['payload']): SetGasPri
|
|||
payload
|
||||
});
|
||||
|
||||
type TSetWindowSizeField = typeof setWindowSizeField;
|
||||
const setWindowSizeField = (
|
||||
payload: SetWindowSizeFieldAction['payload']
|
||||
): SetWindowSizeFieldAction => ({
|
||||
type: TypeKeys.WINDOW_SIZE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetWindowStartField = typeof setWindowStartField;
|
||||
const setWindowStartField = (
|
||||
payload: SetWindowStartFieldAction['payload']
|
||||
): SetWindowStartFieldAction => ({
|
||||
type: TypeKeys.WINDOW_START_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleTimestampField = typeof setScheduleTimestampField;
|
||||
const setScheduleTimestampField = (
|
||||
payload: SetScheduleTimestampFieldAction['payload']
|
||||
): SetScheduleTimestampFieldAction => ({
|
||||
type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleType = typeof setScheduleType;
|
||||
const setScheduleType = (payload: SetScheduleTypeAction['payload']): SetScheduleTypeAction => ({
|
||||
type: TypeKeys.SCHEDULE_TYPE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetSchedulingToggle = typeof setSchedulingToggle;
|
||||
const setSchedulingToggle = (
|
||||
payload: SetSchedulingToggleAction['payload']
|
||||
): SetSchedulingToggleAction => ({
|
||||
type: TypeKeys.SCHEDULING_TOGGLE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleTimezone = typeof setScheduleTimezone;
|
||||
const setScheduleTimezone = (
|
||||
payload: SetScheduleTimezoneAction['payload']
|
||||
): SetScheduleTimezoneAction => ({
|
||||
type: TypeKeys.SCHEDULE_TIMEZONE_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleGasPriceField = typeof setScheduleGasPriceField;
|
||||
const setScheduleGasPriceField = (payload: SetScheduleGasPriceFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleGasLimitField = typeof setScheduleGasLimitField;
|
||||
const setScheduleGasLimitField = (payload: SetScheduleGasLimitFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleDepositField = typeof setScheduleDepositField;
|
||||
const setScheduleDepositField = (payload: SetScheduleDepositFieldAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TSetScheduleParamsValidity = typeof setScheduleParamsValidity;
|
||||
const setScheduleParamsValidity = (payload: SetScheduleParamsValidityAction['payload']) => ({
|
||||
type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET,
|
||||
payload
|
||||
});
|
||||
|
||||
type TReset = typeof reset;
|
||||
const reset = (payload: ResetAction['payload'] = { include: {}, exclude: {} }): ResetAction => ({
|
||||
type: TypeKeys.RESET,
|
||||
|
@ -187,22 +98,10 @@ export {
|
|||
TSetNonceField,
|
||||
TSetValueField,
|
||||
TSetGasPriceField,
|
||||
TSetWindowSizeField,
|
||||
TSetWindowStartField,
|
||||
TSetTimeBountyField,
|
||||
TSetScheduleTimestampField,
|
||||
TSetScheduleType,
|
||||
TSetSchedulingToggle,
|
||||
TSetScheduleTimezone,
|
||||
TSetScheduleGasPriceField,
|
||||
TSetScheduleGasLimitField,
|
||||
TSetScheduleDepositField,
|
||||
TSetScheduleParamsValidity,
|
||||
TReset,
|
||||
inputGasLimit,
|
||||
inputGasPrice,
|
||||
inputGasPriceIntent,
|
||||
setTimeBountyField,
|
||||
inputNonce,
|
||||
inputData,
|
||||
setGasLimitField,
|
||||
|
@ -211,15 +110,5 @@ export {
|
|||
setNonceField,
|
||||
setValueField,
|
||||
setGasPriceField,
|
||||
setWindowSizeField,
|
||||
setWindowStartField,
|
||||
setScheduleTimestampField,
|
||||
setScheduleType,
|
||||
setSchedulingToggle,
|
||||
setScheduleTimezone,
|
||||
setScheduleGasPriceField,
|
||||
setScheduleGasLimitField,
|
||||
setScheduleDepositField,
|
||||
setScheduleParamsValidity,
|
||||
reset
|
||||
};
|
||||
|
|
|
@ -5,4 +5,3 @@ export * from './sign';
|
|||
export * from './broadcast';
|
||||
export * from './current';
|
||||
export * from './sendEverything';
|
||||
export * from '../../../containers/Tabs/ScheduleTransaction/actions/transaction/actionCreators';
|
||||
|
|
|
@ -51,14 +51,6 @@ interface SetGasPriceFieldAction {
|
|||
};
|
||||
}
|
||||
|
||||
interface SetTimeBountyFieldAction {
|
||||
type: TypeKeys.TIME_BOUNTY_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetDataFieldAction {
|
||||
type: TypeKeys.DATA_FIELD_SET;
|
||||
payload: {
|
||||
|
@ -91,86 +83,6 @@ interface SetValueFieldAction {
|
|||
};
|
||||
}
|
||||
|
||||
interface SetWindowSizeFieldAction {
|
||||
type: TypeKeys.WINDOW_SIZE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetWindowStartFieldAction {
|
||||
type: TypeKeys.WINDOW_START_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: number | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTimestampFieldAction {
|
||||
type: TypeKeys.SCHEDULE_TIMESTAMP_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Date | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTypeAction {
|
||||
type: TypeKeys.SCHEDULE_TYPE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: string | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetSchedulingToggleAction {
|
||||
type: TypeKeys.SCHEDULING_TOGGLE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleTimezoneAction {
|
||||
type: TypeKeys.SCHEDULE_TIMEZONE_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: string;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleGasPriceFieldAction {
|
||||
type: TypeKeys.SCHEDULE_GAS_PRICE_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleGasLimitFieldAction {
|
||||
type: TypeKeys.SCHEDULE_GAS_LIMIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleDepositFieldAction {
|
||||
type: TypeKeys.SCHEDULE_DEPOSIT_FIELD_SET;
|
||||
payload: {
|
||||
raw: string;
|
||||
value: Wei | null;
|
||||
};
|
||||
}
|
||||
|
||||
interface SetScheduleParamsValidityAction {
|
||||
type: TypeKeys.SCHEDULE_PARAMS_VALIDITY_SET;
|
||||
payload: {
|
||||
raw: boolean;
|
||||
value: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
type InputFieldAction = InputNonceAction | InputGasLimitAction | InputDataAction;
|
||||
|
||||
type FieldAction =
|
||||
|
@ -179,18 +91,7 @@ type FieldAction =
|
|||
| SetToFieldAction
|
||||
| SetNonceFieldAction
|
||||
| SetValueFieldAction
|
||||
| SetGasPriceFieldAction
|
||||
| SetTimeBountyFieldAction
|
||||
| SetWindowSizeFieldAction
|
||||
| SetWindowStartFieldAction
|
||||
| SetScheduleTimestampFieldAction
|
||||
| SetScheduleTypeAction
|
||||
| SetSchedulingToggleAction
|
||||
| SetScheduleGasPriceFieldAction
|
||||
| SetScheduleGasLimitFieldAction
|
||||
| SetScheduleDepositFieldAction
|
||||
| SetScheduleTimezoneAction
|
||||
| SetScheduleParamsValidityAction;
|
||||
| SetGasPriceFieldAction;
|
||||
|
||||
export {
|
||||
InputGasLimitAction,
|
||||
|
@ -207,16 +108,5 @@ export {
|
|||
SetValueFieldAction,
|
||||
FieldAction,
|
||||
InputFieldAction,
|
||||
SetGasPriceFieldAction,
|
||||
SetTimeBountyFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleParamsValidityAction
|
||||
SetGasPriceFieldAction
|
||||
};
|
||||
|
|
|
@ -25,13 +25,6 @@ export enum TypeKeys {
|
|||
|
||||
CURRENT_VALUE_SET = 'CURRENT_VALUE_SET',
|
||||
CURRENT_TO_SET = 'CURRENT_TO_SET',
|
||||
CURRENT_TIME_BOUNTY_SET = 'CURRENT_TIME_BOUNTY_SET',
|
||||
CURRENT_WINDOW_SIZE_SET = 'CURRENT_WINDOW_SIZE_SET',
|
||||
CURRENT_WINDOW_START_SET = 'CURRENT_WINDOW_START_SET',
|
||||
CURRENT_SCHEDULE_TIMESTAMP_SET = 'CURRENT_SCHEDULE_TIMESTAMP_SET',
|
||||
CURRENT_SCHEDULE_TIMEZONE_SET = 'CURRENT_SCHEDULE_TIMEZONE_SET',
|
||||
CURRENT_SCHEDULE_TYPE = 'CURRENT_SCHEDULE_TYPE',
|
||||
CURRENT_SCHEDULING_TOGGLE = 'CURRENT_SCHEDULING_TOGGLE',
|
||||
|
||||
DATA_FIELD_INPUT = 'DATA_FIELD_INPUT',
|
||||
GAS_LIMIT_INPUT = 'GAS_LIMIT_INPUT',
|
||||
|
@ -47,17 +40,6 @@ export enum TypeKeys {
|
|||
VALUE_FIELD_SET = 'VALUE_FIELD_SET',
|
||||
NONCE_FIELD_SET = 'NONCE_FIELD_SET',
|
||||
GAS_PRICE_FIELD_SET = 'GAS_PRICE_FIELD_SET',
|
||||
TIME_BOUNTY_FIELD_SET = 'TIME_BOUNTY_FIELD_SET',
|
||||
WINDOW_SIZE_FIELD_SET = 'WINDOW_SIZE_FIELD_SET',
|
||||
WINDOW_START_FIELD_SET = 'WINDOW_START_FIELD_SET',
|
||||
SCHEDULE_GAS_PRICE_FIELD_SET = 'SCHEDULE_GAS_PRICE_SET',
|
||||
SCHEDULE_GAS_LIMIT_FIELD_SET = 'SCHEDULE_GAS_LIMIT_SET',
|
||||
SCHEDULE_TIMESTAMP_FIELD_SET = 'SCHEDULE_TIMESTAMP_FIELD_SET',
|
||||
SCHEDULE_TIMEZONE_SET = 'SCHEDULE_TIMEZONE_SET',
|
||||
SCHEDULE_TYPE_SET = 'SCHEDULE_TYPE_SET',
|
||||
SCHEDULING_TOGGLE_SET = 'SCHEDULING_TOGGLE_SET',
|
||||
SCHEDULE_DEPOSIT_FIELD_SET = 'SCHEDULE_DEPOSIT_FIELD_SET',
|
||||
SCHEDULE_PARAMS_VALIDITY_SET = 'SCHEDULE_PARAMS_VALIDITY_SET',
|
||||
|
||||
TOKEN_TO_META_SET = 'TOKEN_TO_META_SET',
|
||||
UNIT_META_SET = 'UNIT_META_SET',
|
||||
|
|
|
@ -5,7 +5,7 @@ import { inputGasLimit, TInputGasLimit } from 'actions/transaction';
|
|||
import { connect } from 'react-redux';
|
||||
import { AppState } from 'reducers';
|
||||
import { sanitizeNumericalInput } from 'libs/values';
|
||||
import { getSchedulingToggle } from 'selectors/transaction';
|
||||
import { getSchedulingToggle } from 'selectors/schedule/fields';
|
||||
|
||||
const defaultGasLimit = '21000';
|
||||
|
||||
|
|
|
@ -8,11 +8,12 @@ import { TInputGasPrice } from 'actions/transaction';
|
|||
import { NonceField, GasLimitField, DataField } from 'components';
|
||||
import { connect } from 'react-redux';
|
||||
import { getAutoGasLimitEnabled } from 'selectors/config';
|
||||
import { isValidGasPrice, getTimeBounty, getScheduleGasPrice } from 'selectors/transaction';
|
||||
import { isValidGasPrice } from 'selectors/transaction';
|
||||
import { sanitizeNumericalInput } from 'libs/values';
|
||||
import { Input, UnitDisplay } from 'components/ui';
|
||||
import SchedulingFeeSummary from './SchedulingFeeSummary';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import { getScheduleGasPrice, getTimeBounty } from 'selectors/schedule';
|
||||
|
||||
export interface AdvancedOptions {
|
||||
gasPriceField?: boolean;
|
||||
|
@ -27,8 +28,8 @@ interface OwnProps {
|
|||
gasPrice: AppState['transaction']['fields']['gasPrice'];
|
||||
options?: AdvancedOptions;
|
||||
scheduling?: boolean;
|
||||
scheduleGasPrice: AppState['transaction']['fields']['scheduleGasPrice'];
|
||||
timeBounty: AppState['transaction']['fields']['timeBounty'];
|
||||
scheduleGasPrice: AppState['schedule']['scheduleGasPrice'];
|
||||
timeBounty: AppState['schedule']['timeBounty'];
|
||||
}
|
||||
|
||||
interface StateProps {
|
||||
|
@ -152,7 +153,7 @@ class AdvancedGas extends React.Component<Props, State> {
|
|||
* {EAC_SCHEDULING_CONFIG.SCHEDULING_GAS_LIMIT.toString()} +{' '}
|
||||
{scheduleGasPrice && scheduleGasPrice.value && scheduleGasPrice.value.toString()}{' '}
|
||||
* ({EAC_SCHEDULING_CONFIG.FUTURE_EXECUTION_COST.toString()} + {scheduleGasLimit})
|
||||
= {fee} {usd && <span>~= ${usd} USD</span>}
|
||||
= {fee} {usd && <span>~= {usd} USD</span>}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
|
@ -167,7 +168,7 @@ class AdvancedGas extends React.Component<Props, State> {
|
|||
gasPrice={gasPrice}
|
||||
render={({ gasPriceWei, gasLimit, fee, usd }) => (
|
||||
<span>
|
||||
{gasPriceWei} * {gasLimit} = {fee} {usd && <span>~= ${usd} USD</span>}
|
||||
{gasPriceWei} * {gasLimit} = {fee} {usd && <span>~= {usd} USD</span>}
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
|
|
|
@ -4,7 +4,7 @@ import { connect } from 'react-redux';
|
|||
import { AppState } from 'reducers';
|
||||
import { getNetworkConfig, getOffline } from 'selectors/config';
|
||||
import { getIsEstimating } from 'selectors/gas';
|
||||
import { getTimeBounty, getScheduleGasLimit } from 'selectors/transaction';
|
||||
import { getTimeBounty, getScheduleGasLimit } from 'selectors/schedule';
|
||||
import { UnitDisplay, Spinner } from 'components/ui';
|
||||
import { NetworkConfig } from 'types/network';
|
||||
import './FeeSummary.scss';
|
||||
|
@ -20,17 +20,17 @@ interface RenderData {
|
|||
}
|
||||
|
||||
interface ReduxStateProps {
|
||||
scheduleGasLimit: AppState['transaction']['fields']['scheduleGasLimit'];
|
||||
scheduleGasLimit: AppState['schedule']['scheduleGasLimit'];
|
||||
rates: AppState['rates']['rates'];
|
||||
network: NetworkConfig;
|
||||
isOffline: AppState['config']['meta']['offline'];
|
||||
isGasEstimating: AppState['gas']['isEstimating'];
|
||||
timeBounty: AppState['transaction']['fields']['timeBounty'];
|
||||
timeBounty: AppState['schedule']['timeBounty'];
|
||||
}
|
||||
|
||||
interface OwnProps {
|
||||
gasPrice: AppState['transaction']['fields']['gasPrice'];
|
||||
scheduleGasPrice: AppState['transaction']['fields']['scheduleGasPrice'];
|
||||
scheduleGasPrice: AppState['schedule']['scheduleGasPrice'];
|
||||
|
||||
render(data: RenderData): React.ReactElement<string> | string;
|
||||
}
|
||||
|
|
|
@ -6,8 +6,7 @@ import { AppState } from 'reducers';
|
|||
import {
|
||||
getGasLimitEstimationTimedOut,
|
||||
getGasEstimationPending,
|
||||
nonceRequestPending,
|
||||
getScheduleGasPrice
|
||||
nonceRequestPending
|
||||
} from 'selectors/transaction';
|
||||
import { connect } from 'react-redux';
|
||||
import { fetchGasEstimates, TFetchGasEstimates } from 'actions/gas';
|
||||
|
@ -19,6 +18,7 @@ import { InlineSpinner } from 'components/ui/InlineSpinner';
|
|||
import { TInputGasPrice } from 'actions/transaction';
|
||||
import FeeSummary from './FeeSummary';
|
||||
import SchedulingFeeSummary from './SchedulingFeeSummary';
|
||||
import { getScheduleGasPrice } from 'selectors/schedule';
|
||||
|
||||
const SliderWithTooltip = createSliderWithTooltip(Slider);
|
||||
|
||||
|
@ -37,7 +37,7 @@ interface StateProps {
|
|||
gasLimitPending: boolean;
|
||||
isWeb3Node: boolean;
|
||||
gasLimitEstimationTimedOut: boolean;
|
||||
scheduleGasPrice: AppState['transaction']['fields']['scheduleGasPrice'];
|
||||
scheduleGasPrice: AppState['schedule']['scheduleGasPrice'];
|
||||
}
|
||||
|
||||
interface ActionProps {
|
||||
|
@ -134,7 +134,7 @@ class SimpleGas extends React.Component<Props> {
|
|||
scheduleGasPrice={scheduleGasPrice}
|
||||
render={({ fee, usd }) => (
|
||||
<span>
|
||||
{fee} {usd && <span>/ ${usd}</span>}
|
||||
{fee} {usd && <span>/ {usd}</span>}
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
|
@ -146,7 +146,7 @@ class SimpleGas extends React.Component<Props> {
|
|||
gasPrice={gasPrice}
|
||||
render={({ fee, usd }) => (
|
||||
<span>
|
||||
{fee} {usd && <span>/ ${usd}</span>}
|
||||
{fee} {usd && <span>/ {usd}</span>}
|
||||
</span>
|
||||
)}
|
||||
/>
|
||||
|
|
|
@ -70,7 +70,7 @@ const UnitDisplay: React.SFC<EthProps | TokenProps> = params => {
|
|||
element = (
|
||||
<span>
|
||||
{formattedValue}
|
||||
<span>{symbol ? <> ${symbol}</> : ''}</span>
|
||||
<span>{symbol ? <> {symbol}</> : ''}</span>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import { connect } from 'react-redux';
|
||||
import React, { Component } from 'react';
|
||||
import { AppState } from 'reducers';
|
||||
import { setScheduleDepositField, TSetScheduleDepositField } from 'actions/transaction';
|
||||
import { setScheduleDepositField, TSetScheduleDepositField } from 'actions/schedule';
|
||||
import { translateRaw } from 'translations';
|
||||
import { Input } from 'components/ui';
|
||||
import { getScheduleDeposit, isValidScheduleDeposit, getDecimal } from 'selectors/transaction';
|
||||
import { getDecimal } from 'selectors/transaction';
|
||||
import { getScheduleDeposit, isValidScheduleDeposit } from 'selectors/schedule/fields';
|
||||
import { toWei } from 'libs/units';
|
||||
import Help from 'components/ui/Help';
|
||||
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
import { connect } from 'react-redux';
|
||||
import React from 'react';
|
||||
import { AppState } from 'reducers';
|
||||
import { setScheduleGasLimitField, TSetScheduleGasLimitField } from 'actions/transaction';
|
||||
import { setScheduleGasLimitField, TSetScheduleGasLimitField } from 'actions/schedule';
|
||||
import { translateRaw } from 'translations';
|
||||
import { Input, InlineSpinner } from 'components/ui';
|
||||
import {
|
||||
getScheduleGasLimit,
|
||||
isValidScheduleGasLimit,
|
||||
getGasEstimationPending
|
||||
} from 'selectors/transaction';
|
||||
import { getGasEstimationPending } from 'selectors/transaction';
|
||||
import { Wei } from 'libs/units';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import { getScheduleGasLimit, isValidScheduleGasLimit } from 'selectors/schedule/fields';
|
||||
|
||||
interface OwnProps {
|
||||
gasEstimationPending: boolean;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { connect } from 'react-redux';
|
||||
import React from 'react';
|
||||
import { AppState } from 'reducers';
|
||||
import { setScheduleGasPriceField, TSetScheduleGasPriceField } from 'actions/transaction';
|
||||
import { setScheduleGasPriceField, TSetScheduleGasPriceField } from 'actions/schedule';
|
||||
import { translateRaw } from 'translations';
|
||||
import { Input } from 'components/ui';
|
||||
import { getScheduleGasPrice, isValidScheduleGasPrice } from 'selectors/transaction';
|
||||
import { getScheduleGasPrice, isValidScheduleGasPrice } from 'selectors/schedule/fields';
|
||||
import { gasPriceToBase } from 'libs/units';
|
||||
|
||||
interface OwnProps {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Query } from 'components/renderCbs';
|
||||
import { setCurrentScheduleTimestamp, TSetCurrentScheduleTimestamp } from 'actions/transaction';
|
||||
import { setCurrentScheduleTimestamp, TSetCurrentScheduleTimestamp } from 'actions/schedule';
|
||||
import { ScheduleTimestampInputFactory } from './ScheduleTimestampInputFactory';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { ICurrentScheduleTimestamp } from 'selectors/transaction';
|
||||
import { ICurrentScheduleTimestamp } from 'selectors/schedule';
|
||||
import moment from 'moment';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import {
|
|||
isValidCurrentScheduleTimestamp,
|
||||
ICurrentScheduleTimestamp,
|
||||
fiveMinFromNow
|
||||
} from 'selectors/transaction';
|
||||
} from 'selectors/schedule';
|
||||
import { connect } from 'react-redux';
|
||||
import { AppState } from 'reducers';
|
||||
import { CallbackProps } from './ScheduleTimestampFieldFactory';
|
||||
|
@ -14,7 +14,7 @@ import Pikaday from 'pikaday-time';
|
|||
import moment from 'moment';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
|
||||
import { setCurrentScheduleTimestamp, TSetCurrentScheduleTimestamp } from 'actions/transaction';
|
||||
import { setCurrentScheduleTimestamp, TSetCurrentScheduleTimestamp } from 'actions/schedule';
|
||||
|
||||
interface DispatchProps {
|
||||
setCurrentScheduleTimestamp: TSetCurrentScheduleTimestamp;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React, { Component } from 'react';
|
||||
import { setScheduleTimezone, TSetScheduleTimezone } from 'actions/transaction';
|
||||
import { getCurrentScheduleTimezone, ICurrentScheduleTimezone } from 'selectors/transaction';
|
||||
import { setScheduleTimezone, TSetScheduleTimezone } from 'actions/schedule';
|
||||
import { getCurrentScheduleTimezone, ICurrentScheduleTimezone } from 'selectors/schedule';
|
||||
import { AppState } from 'reducers';
|
||||
import { Query } from 'components/renderCbs';
|
||||
import { connect } from 'react-redux';
|
||||
|
@ -47,10 +47,15 @@ class ScheduleTimezoneDropDownClass extends Component<Props> {
|
|||
);
|
||||
}
|
||||
|
||||
private handleOnChange = (timezone: Option<string>) => {
|
||||
private handleOnChange = (timezone: Option<string> | null) => {
|
||||
if (!timezone) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!timezone.value) {
|
||||
throw Error('No timezone value found');
|
||||
}
|
||||
|
||||
this.props.setScheduleTimezone({
|
||||
value: timezone.value,
|
||||
raw: timezone.value
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React, { Component } from 'react';
|
||||
import { setScheduleType, TSetScheduleType } from 'actions/transaction';
|
||||
import { setScheduleType, TSetScheduleType } from 'actions/schedule';
|
||||
import { connect } from 'react-redux';
|
||||
import translate from 'translations';
|
||||
import { getCurrentScheduleType, ICurrentScheduleType } from 'selectors/transaction';
|
||||
import { getCurrentScheduleType, ICurrentScheduleType } from 'selectors/schedule';
|
||||
import { AppState } from 'reducers';
|
||||
|
||||
interface DispatchProps {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import React, { Component } from 'react';
|
||||
import { setSchedulingToggle, TSetSchedulingToggle } from 'actions/transaction';
|
||||
import { setSchedulingToggle, TSetSchedulingToggle } from 'actions/schedule';
|
||||
import { connect } from 'react-redux';
|
||||
import translate from 'translations';
|
||||
import { getCurrentSchedulingToggle, ICurrentSchedulingToggle } from 'selectors/transaction';
|
||||
import { getCurrentSchedulingToggle, ICurrentSchedulingToggle } from 'selectors/schedule/fields';
|
||||
import { AppState } from 'reducers';
|
||||
|
||||
interface DispatchProps {
|
||||
|
@ -36,7 +36,7 @@ class SchedulingToggleClass extends Component<Props> {
|
|||
|
||||
private handleOnChange = (ev: React.ChangeEvent<HTMLInputElement>) => {
|
||||
const checked = ev.currentTarget.checked;
|
||||
this.props.setSchedulingToggle({ raw: checked.toString(), value: checked });
|
||||
this.props.setSchedulingToggle({ value: checked });
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Query } from 'components/renderCbs';
|
||||
import { setCurrentTimeBounty, TSetCurrentTimeBounty } from 'actions/transaction';
|
||||
import { setCurrentTimeBounty, TSetCurrentTimeBounty } from 'actions/schedule';
|
||||
import { TimeBountyInputFactory } from './TimeBountyInputFactory';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { ICurrentTimeBounty } from 'selectors/transaction';
|
||||
import { ICurrentTimeBounty } from 'selectors/schedule';
|
||||
|
||||
interface DispatchProps {
|
||||
setCurrentTimeBounty: TSetCurrentTimeBounty;
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
getCurrentTimeBounty,
|
||||
ICurrentTimeBounty,
|
||||
isValidCurrentTimeBounty
|
||||
} from 'selectors/transaction';
|
||||
} from 'selectors/schedule';
|
||||
import { connect } from 'react-redux';
|
||||
import { AppState } from 'reducers';
|
||||
import { CallbackProps } from 'containers/Tabs/ScheduleTransaction/components/Fields/TimeBounty/TimeBountyFieldFactory';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Query } from 'components/renderCbs';
|
||||
import { setCurrentWindowSize, TSetCurrentWindowSize } from 'actions/transaction';
|
||||
import { setCurrentWindowSize, TSetCurrentWindowSize } from 'actions/schedule';
|
||||
import { WindowSizeInputFactory } from './WindowSizeInputFactory';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
|
@ -7,7 +7,7 @@ import {
|
|||
ICurrentWindowSize,
|
||||
ICurrentScheduleType,
|
||||
getCurrentScheduleType
|
||||
} from 'selectors/transaction';
|
||||
} from 'selectors/schedule';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import { AppState } from 'reducers';
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
isValidCurrentWindowSize,
|
||||
getCurrentScheduleType,
|
||||
ICurrentScheduleType
|
||||
} from 'selectors/transaction';
|
||||
} from 'selectors/schedule';
|
||||
import { connect } from 'react-redux';
|
||||
import { AppState } from 'reducers';
|
||||
import { getResolvingDomain } from 'selectors/ens';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { Query } from 'components/renderCbs';
|
||||
import { setCurrentWindowStart, TSetCurrentWindowStart } from 'actions/transaction';
|
||||
import { setCurrentWindowStart, TSetCurrentWindowStart } from 'actions/schedule';
|
||||
import { WindowStartInputFactory } from './WindowStartInputFactory';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { ICurrentWindowStart } from 'selectors/transaction';
|
||||
import { ICurrentWindowStart } from 'selectors/schedule';
|
||||
import { getLatestBlock } from 'selectors/config';
|
||||
import { AppState } from 'reducers';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import {
|
|||
getCurrentWindowStart,
|
||||
ICurrentWindowStart,
|
||||
isValidCurrentWindowStart
|
||||
} from 'selectors/transaction';
|
||||
} from 'selectors/schedule';
|
||||
import { connect } from 'react-redux';
|
||||
import { AppState } from 'reducers';
|
||||
import { getResolvingDomain } from 'selectors/ens';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
@import 'common/sass/variables';
|
||||
|
||||
.scheduled-tx-settings {
|
||||
.ScheduleFields {
|
||||
padding: 0 20px 20px 20px;
|
||||
border: 1px solid #e5ecf3;
|
||||
|
||||
&_title {
|
||||
&-title {
|
||||
margin-top: -10px;
|
||||
background: white;
|
||||
padding: 0 15px;
|
||||
|
@ -12,7 +12,7 @@
|
|||
width: 250px;
|
||||
}
|
||||
|
||||
&_logo {
|
||||
&-logo {
|
||||
float: right;
|
||||
max-width: 160px;
|
||||
width: 100%;
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
&_description {
|
||||
&-description {
|
||||
font-weight: 300;
|
||||
font-size: 16px;
|
||||
padding: 20px 0 30px;
|
||||
|
@ -40,4 +40,4 @@
|
|||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { connect } from 'react-redux';
|
||||
import React from 'react';
|
||||
import { AppState } from 'reducers';
|
||||
import { getCurrentScheduleType, ICurrentScheduleType } from 'selectors/transaction';
|
||||
import { getCurrentScheduleType, ICurrentScheduleType } from 'selectors/schedule/fields';
|
||||
import {
|
||||
WindowSizeField,
|
||||
TimeBountyField,
|
||||
|
@ -23,12 +23,10 @@ class ScheduleFieldsClass extends React.Component<Props> {
|
|||
const { schedulingType } = this.props;
|
||||
|
||||
return (
|
||||
<div className="scheduled-tx-settings">
|
||||
<div className="scheduled-tx-settings_title">{translate('SCHEDULING_TITLE')}</div>
|
||||
<div className="ScheduleFields">
|
||||
<div className="ScheduleFields-title">{translate('SCHEDULING_TITLE')}</div>
|
||||
|
||||
<div className="scheduled-tx-settings_description">
|
||||
{translate('SCHEDULING_DESCRIPTION')}
|
||||
</div>
|
||||
<div className="ScheduleFields-description">{translate('SCHEDULING_DESCRIPTION')}</div>
|
||||
|
||||
<div className="row form-group vcenter-sm">
|
||||
<div className="col-lg-3 col-lg-push-9">
|
||||
|
@ -84,7 +82,7 @@ class ScheduleFieldsClass extends React.Component<Props> {
|
|||
href="https://blog.chronologic.network/announcing-the-ethereum-alarm-clock-chronologic-partnership-b3d7545bea3b"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="scheduled-tx-settings_logo"
|
||||
className="ScheduleFields-logo"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
} from 'selectors/transaction';
|
||||
import { getWalletType } from 'selectors/wallet';
|
||||
import { GenerateTransactionFactoryClass } from 'components/GenerateTransactionFactory';
|
||||
import { getSchedulingTransaction } from '../selectors/transaction';
|
||||
import { getSchedulingTransaction } from 'selectors/schedule/transaction';
|
||||
|
||||
export const ScheduleTransactionFactory = connect((state: AppState) => ({
|
||||
...getSchedulingTransaction(state),
|
||||
|
|
|
@ -5,7 +5,7 @@ import { SigningStatus } from 'components';
|
|||
import { SendScheduleTransactionButtonFactory } from 'containers/Tabs/ScheduleTransaction/components/SendScheduleTransactionButtonFactory';
|
||||
import { connect } from 'react-redux';
|
||||
import { AppState } from 'reducers';
|
||||
import { getScheduleParamsValidity } from 'selectors/transaction';
|
||||
import { getScheduleParamsValidity } from 'selectors/schedule/fields';
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
|
|
|
@ -10,7 +10,7 @@ import {
|
|||
getWeb3Tx
|
||||
} from 'selectors/transaction';
|
||||
import { SendButtonFactoryClass } from 'components/SendButtonFactory';
|
||||
import { getSchedulingTransaction } from '../selectors/transaction';
|
||||
import { getSchedulingTransaction } from 'selectors/schedule/transaction';
|
||||
|
||||
const mapStateToProps = (state: AppState) => {
|
||||
return {
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
import { currentWindowSize } from './currentWindowSize';
|
||||
import { currentWindowStart } from './currentWindowStart';
|
||||
import { currentScheduleTimestamp } from './currentScheduleTimestamp';
|
||||
import { currentTimeBounty } from './currentTimeBounty';
|
||||
import { currentSchedulingToggle } from './currentSchedulingToggle';
|
||||
|
||||
export const schedulingCurrentSagas = [
|
||||
currentWindowSize,
|
||||
currentWindowStart,
|
||||
currentScheduleTimestamp,
|
||||
currentTimeBounty,
|
||||
currentSchedulingToggle
|
||||
];
|
|
@ -1,3 +0,0 @@
|
|||
import { schedulingParamsValidity } from './paramsValidity';
|
||||
|
||||
export const schedulingTransactionNetworkSagas = [schedulingParamsValidity];
|
|
@ -1,41 +0,0 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getFields } from 'selectors/transaction';
|
||||
|
||||
const getTimeBounty = (state: AppState) => getFields(state).timeBounty;
|
||||
const getWindowSize = (state: AppState) => getFields(state).windowSize;
|
||||
const getWindowStart = (state: AppState) => getFields(state).windowStart;
|
||||
const getScheduleTimestamp = (state: AppState) => getFields(state).scheduleTimestamp;
|
||||
const getScheduleType = (state: AppState) => getFields(state).scheduleType;
|
||||
const getScheduleTimezone = (state: AppState) => getFields(state).scheduleTimezone;
|
||||
const getSchedulingToggle = (state: AppState) => getFields(state).schedulingToggle;
|
||||
const getScheduleGasLimit = (state: AppState) => getFields(state).scheduleGasLimit;
|
||||
const getScheduleGasPrice = (state: AppState) => getFields(state).scheduleGasPrice;
|
||||
const getScheduleDeposit = (state: AppState) => getFields(state).scheduleDeposit;
|
||||
const getScheduleParamsValidity = (state: AppState) => getFields(state).scheduleParamsValidity;
|
||||
|
||||
const schedulingFields = [
|
||||
'windowStart',
|
||||
'windowSize',
|
||||
'scheduleTimestamp',
|
||||
'scheduleTimezone',
|
||||
'schedulingToggle',
|
||||
'scheduleDeposit',
|
||||
'scheduleGasLimit',
|
||||
'scheduleGasPrice',
|
||||
'scheduleParamsValidity'
|
||||
];
|
||||
|
||||
export {
|
||||
getTimeBounty,
|
||||
getWindowSize,
|
||||
getWindowStart,
|
||||
getScheduleTimestamp,
|
||||
getScheduleType,
|
||||
getScheduleTimezone,
|
||||
getSchedulingToggle,
|
||||
getScheduleGasLimit,
|
||||
getScheduleGasPrice,
|
||||
getScheduleDeposit,
|
||||
schedulingFields,
|
||||
getScheduleParamsValidity
|
||||
};
|
|
@ -1,8 +0,0 @@
|
|||
export * from './transaction';
|
||||
export * from './windowSize';
|
||||
export * from './windowStart';
|
||||
export * from './timeBounty';
|
||||
export * from './scheduleTimestamp';
|
||||
export * from './scheduleType';
|
||||
export * from './scheduleTimezone';
|
||||
export * from './schedulingToggle';
|
|
@ -19,11 +19,8 @@ import translate from 'translations';
|
|||
import { AppState } from 'reducers';
|
||||
import { NonStandardTransaction } from './components';
|
||||
import { getOffline, getNetworkConfig } from 'selectors/config';
|
||||
import {
|
||||
getCurrentSchedulingToggle,
|
||||
ICurrentSchedulingToggle,
|
||||
getUnit
|
||||
} from 'selectors/transaction';
|
||||
import { getCurrentSchedulingToggle, ICurrentSchedulingToggle } from 'selectors/schedule/fields';
|
||||
import { getUnit } from 'selectors/transaction';
|
||||
|
||||
const QueryWarning: React.SFC<{}> = () => (
|
||||
<WhenQueryExists
|
||||
|
|
|
@ -12,9 +12,9 @@ import {
|
|||
RequestPayment,
|
||||
RecentTransactions,
|
||||
Fields,
|
||||
UnavailableWallets
|
||||
} from 'containers/Tabs/SendTransaction/components';
|
||||
import { SideBar } from './components';
|
||||
UnavailableWallets,
|
||||
SideBar
|
||||
} from './components';
|
||||
import SubTabs, { Tab } from 'components/SubTabs';
|
||||
import { RouteNotFound } from 'components/RouteNotFound';
|
||||
import { isNetworkUnit } from 'selectors/config/wallet';
|
||||
|
|
|
@ -12,6 +12,7 @@ import { State as TransactionState, transaction } from './transaction';
|
|||
import { State as GasState, gas } from './gas';
|
||||
import { onboardStatus, State as OnboardStatusState } from './onboardStatus';
|
||||
import { State as TransactionsState, transactions } from './transactions';
|
||||
import { schedule, State as ScheduleState } from './schedule';
|
||||
|
||||
export interface AppState {
|
||||
// Custom reducers
|
||||
|
@ -27,6 +28,7 @@ export interface AppState {
|
|||
transaction: TransactionState;
|
||||
transactions: TransactionsState;
|
||||
gas: GasState;
|
||||
schedule: ScheduleState;
|
||||
// Third party reducers (TODO: Fill these out)
|
||||
routing: any;
|
||||
}
|
||||
|
@ -44,5 +46,6 @@ export default combineReducers<AppState>({
|
|||
transaction,
|
||||
transactions,
|
||||
gas,
|
||||
schedule,
|
||||
routing: routerReducer
|
||||
});
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
export * from './schedule';
|
|
@ -0,0 +1,75 @@
|
|||
import { ScheduleFieldAction, TypeKeys as TK } from 'actions/schedule';
|
||||
import { Reducer, combineReducers } from 'redux';
|
||||
import { State } from './typings';
|
||||
import { gasPriceToBase, fromWei } from 'libs/units';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
const INITIAL_STATE: State = {
|
||||
schedulingToggle: { value: false },
|
||||
windowSize: { raw: '', value: null },
|
||||
windowStart: { raw: '', value: null },
|
||||
scheduleTimestamp: { raw: '', value: null },
|
||||
scheduleTimezone: { raw: moment.tz.guess(), value: moment.tz.guess() },
|
||||
timeBounty: {
|
||||
raw: fromWei(EAC_SCHEDULING_CONFIG.TIME_BOUNTY_DEFAULT, 'ether'),
|
||||
value: EAC_SCHEDULING_CONFIG.TIME_BOUNTY_DEFAULT
|
||||
},
|
||||
scheduleType: {
|
||||
raw: EAC_SCHEDULING_CONFIG.DEFAULT_SCHEDULING_METHOD,
|
||||
value: EAC_SCHEDULING_CONFIG.DEFAULT_SCHEDULING_METHOD
|
||||
},
|
||||
scheduleGasLimit: {
|
||||
raw: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_LIMIT_FALLBACK.toString(),
|
||||
value: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_LIMIT_FALLBACK
|
||||
},
|
||||
scheduleGasPrice: {
|
||||
raw: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_PRICE_FALLBACK.toString(),
|
||||
value: gasPriceToBase(EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_PRICE_FALLBACK)
|
||||
},
|
||||
scheduleDeposit: { raw: '', value: null },
|
||||
scheduleParamsValidity: { raw: true, value: true }
|
||||
};
|
||||
|
||||
const updateScheduleField = (key: keyof State): Reducer<State> => (
|
||||
state: State,
|
||||
action: ScheduleFieldAction
|
||||
) => ({
|
||||
...state,
|
||||
[key]: { ...state[key], ...action.payload }
|
||||
});
|
||||
|
||||
export const schedule = (state: State = INITIAL_STATE, action: ScheduleFieldAction) => {
|
||||
switch (action.type) {
|
||||
case TK.TIME_BOUNTY_FIELD_SET:
|
||||
return updateScheduleField('timeBounty')(state, action);
|
||||
case TK.WINDOW_SIZE_FIELD_SET:
|
||||
return updateScheduleField('windowSize')(state, action);
|
||||
case TK.WINDOW_START_FIELD_SET:
|
||||
return updateScheduleField('windowStart')(state, action);
|
||||
case TK.SCHEDULE_TIMESTAMP_FIELD_SET:
|
||||
return updateScheduleField('scheduleTimestamp')(state, action);
|
||||
case TK.SCHEDULE_TIMEZONE_SET:
|
||||
return updateScheduleField('scheduleTimezone')(state, action);
|
||||
case TK.SCHEDULE_TYPE_SET:
|
||||
return updateScheduleField('scheduleType')(state, action);
|
||||
case TK.SCHEDULING_TOGGLE_SET:
|
||||
return updateScheduleField('schedulingToggle')(state, action);
|
||||
case TK.SCHEDULE_GAS_LIMIT_FIELD_SET:
|
||||
return updateScheduleField('scheduleGasLimit')(state, action);
|
||||
case TK.SCHEDULE_GAS_PRICE_FIELD_SET:
|
||||
return updateScheduleField('scheduleGasPrice')(state, action);
|
||||
case TK.SCHEDULE_DEPOSIT_FIELD_SET:
|
||||
return updateScheduleField('scheduleDeposit')(state, action);
|
||||
case TK.SCHEDULE_PARAMS_VALIDITY_SET:
|
||||
return updateScheduleField('scheduleParamsValidity')(state, action);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export { State };
|
||||
|
||||
export default combineReducers({
|
||||
schedule
|
||||
});
|
|
@ -0,0 +1,27 @@
|
|||
import {
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleParamsValidityAction
|
||||
} from 'actions/schedule';
|
||||
import { Wei } from 'libs/units';
|
||||
|
||||
export interface State {
|
||||
schedulingToggle: SetSchedulingToggleAction['payload'];
|
||||
timeBounty: { raw: string; value: Wei };
|
||||
windowSize: SetWindowSizeFieldAction['payload'];
|
||||
windowStart: SetWindowStartFieldAction['payload'];
|
||||
scheduleTimestamp: SetScheduleTimestampFieldAction['payload'];
|
||||
scheduleTimezone: SetScheduleTimezoneAction['payload'];
|
||||
scheduleType: SetScheduleTypeAction['payload'];
|
||||
scheduleGasLimit: SetScheduleGasLimitFieldAction['payload'];
|
||||
scheduleGasPrice: SetScheduleGasPriceFieldAction['payload'];
|
||||
scheduleDeposit: SetScheduleDepositFieldAction['payload'];
|
||||
scheduleParamsValidity: SetScheduleParamsValidityAction['payload'];
|
||||
}
|
|
@ -10,41 +10,16 @@ import {
|
|||
} from 'actions/transaction';
|
||||
import { Reducer } from 'redux';
|
||||
import { State } from './typings';
|
||||
import { gasPriceToBase, fromWei } from 'libs/units';
|
||||
import { gasPriceToBase } from 'libs/units';
|
||||
import { resetHOF } from 'reducers/transaction/shared';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
const INITIAL_STATE: State = {
|
||||
to: { raw: '', value: null },
|
||||
data: { raw: '', value: null },
|
||||
nonce: { raw: '', value: null },
|
||||
value: { raw: '', value: null },
|
||||
schedulingToggle: { raw: 'false', value: false },
|
||||
windowSize: { raw: '', value: null },
|
||||
windowStart: { raw: '', value: null },
|
||||
scheduleTimestamp: { raw: '', value: null },
|
||||
scheduleTimezone: { raw: moment.tz.guess(), value: moment.tz.guess() },
|
||||
gasLimit: { raw: '21000', value: new BN(21000) },
|
||||
gasPrice: { raw: '20', value: gasPriceToBase(20) },
|
||||
timeBounty: {
|
||||
raw: fromWei(EAC_SCHEDULING_CONFIG.TIME_BOUNTY_DEFAULT, 'ether'),
|
||||
value: EAC_SCHEDULING_CONFIG.TIME_BOUNTY_DEFAULT
|
||||
},
|
||||
scheduleType: {
|
||||
raw: EAC_SCHEDULING_CONFIG.DEFAULT_SCHEDULING_METHOD,
|
||||
value: EAC_SCHEDULING_CONFIG.DEFAULT_SCHEDULING_METHOD
|
||||
},
|
||||
scheduleGasLimit: {
|
||||
raw: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_LIMIT_FALLBACK.toString(),
|
||||
value: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_LIMIT_FALLBACK
|
||||
},
|
||||
scheduleGasPrice: {
|
||||
raw: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_PRICE_FALLBACK.toString(),
|
||||
value: gasPriceToBase(EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_PRICE_FALLBACK)
|
||||
},
|
||||
scheduleDeposit: { raw: '', value: null },
|
||||
scheduleParamsValidity: { raw: true, value: true }
|
||||
gasPrice: { raw: '20', value: gasPriceToBase(20) }
|
||||
};
|
||||
|
||||
const updateField = (key: keyof State): Reducer<State> => (state: State, action: FieldAction) => ({
|
||||
|
@ -94,28 +69,6 @@ export const fields = (
|
|||
return updateField('nonce')(state, action);
|
||||
case TK.GAS_PRICE_FIELD_SET:
|
||||
return updateField('gasPrice')(state, action);
|
||||
case TK.TIME_BOUNTY_FIELD_SET:
|
||||
return updateField('timeBounty')(state, action);
|
||||
case TK.WINDOW_SIZE_FIELD_SET:
|
||||
return updateField('windowSize')(state, action);
|
||||
case TK.WINDOW_START_FIELD_SET:
|
||||
return updateField('windowStart')(state, action);
|
||||
case TK.SCHEDULE_TIMESTAMP_FIELD_SET:
|
||||
return updateField('scheduleTimestamp')(state, action);
|
||||
case TK.SCHEDULE_TIMEZONE_SET:
|
||||
return updateField('scheduleTimezone')(state, action);
|
||||
case TK.SCHEDULE_TYPE_SET:
|
||||
return updateField('scheduleType')(state, action);
|
||||
case TK.SCHEDULING_TOGGLE_SET:
|
||||
return updateField('schedulingToggle')(state, action);
|
||||
case TK.SCHEDULE_GAS_LIMIT_FIELD_SET:
|
||||
return updateField('scheduleGasLimit')(state, action);
|
||||
case TK.SCHEDULE_GAS_PRICE_FIELD_SET:
|
||||
return updateField('scheduleGasPrice')(state, action);
|
||||
case TK.SCHEDULE_DEPOSIT_FIELD_SET:
|
||||
return updateField('scheduleDeposit')(state, action);
|
||||
case TK.SCHEDULE_PARAMS_VALIDITY_SET:
|
||||
return updateField('scheduleParamsValidity')(state, action);
|
||||
case TK.TOKEN_TO_ETHER_SWAP:
|
||||
return tokenToEther(state, action);
|
||||
case TK.ETHER_TO_TOKEN_SWAP:
|
||||
|
|
|
@ -2,17 +2,7 @@ import {
|
|||
SetToFieldAction,
|
||||
SetDataFieldAction,
|
||||
SetNonceFieldAction,
|
||||
SetGasLimitFieldAction,
|
||||
SetWindowSizeFieldAction,
|
||||
SetWindowStartFieldAction,
|
||||
SetScheduleTimestampFieldAction,
|
||||
SetScheduleTypeAction,
|
||||
SetSchedulingToggleAction,
|
||||
SetScheduleGasPriceFieldAction,
|
||||
SetScheduleGasLimitFieldAction,
|
||||
SetScheduleDepositFieldAction,
|
||||
SetScheduleTimezoneAction,
|
||||
SetScheduleParamsValidityAction
|
||||
SetGasLimitFieldAction
|
||||
} from 'actions/transaction';
|
||||
import { Wei } from 'libs/units';
|
||||
|
||||
|
@ -23,15 +13,4 @@ export interface State {
|
|||
value: { raw: string; value: Wei | null }; // TODO: fix this workaround since some of the payload is optional
|
||||
gasLimit: SetGasLimitFieldAction['payload'];
|
||||
gasPrice: { raw: string; value: Wei };
|
||||
schedulingToggle: SetSchedulingToggleAction['payload'];
|
||||
timeBounty: { raw: string; value: Wei };
|
||||
windowSize: SetWindowSizeFieldAction['payload'];
|
||||
windowStart: SetWindowStartFieldAction['payload'];
|
||||
scheduleTimestamp: SetScheduleTimestampFieldAction['payload'];
|
||||
scheduleTimezone: SetScheduleTimezoneAction['payload'];
|
||||
scheduleType: SetScheduleTypeAction['payload'];
|
||||
scheduleGasLimit: SetScheduleGasLimitFieldAction['payload'];
|
||||
scheduleGasPrice: SetScheduleGasPriceFieldAction['payload'];
|
||||
scheduleDeposit: SetScheduleDepositFieldAction['payload'];
|
||||
scheduleParamsValidity: SetScheduleParamsValidityAction['payload'];
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import { ens } from './ens';
|
|||
import { transaction } from './transaction';
|
||||
import transactions from './transactions';
|
||||
import gas from './gas';
|
||||
import { schedule } from './schedule';
|
||||
|
||||
export default {
|
||||
ens,
|
||||
|
@ -23,5 +24,6 @@ export default {
|
|||
deterministicWallets,
|
||||
rates,
|
||||
transactions,
|
||||
gas
|
||||
gas,
|
||||
schedule
|
||||
};
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import { setScheduleTimestampField } from 'actions/transaction/actionCreators/fields';
|
||||
import { call, put, takeLatest } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { SetScheduleTimestampFieldAction } from 'actions/transaction';
|
||||
import { SetCurrentScheduleTimestampAction } from '../../../actions/transaction/actionTypes/scheduleTimestamp';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { SetScheduleTimestampFieldAction, setScheduleTimestampField } from 'actions/schedule';
|
||||
import { SetCurrentScheduleTimestampAction } from 'actions/schedule/actionTypes/scheduleTimestamp';
|
||||
|
||||
export function* setCurrentScheduleTimestamp({
|
||||
payload: raw
|
|
@ -1,9 +1,8 @@
|
|||
import { setScheduleTimezone } from 'actions/transaction/actionCreators/fields';
|
||||
import { call, put, takeLatest } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { SetScheduleTimezoneAction } from 'actions/transaction';
|
||||
import { SetCurrentScheduleTimezoneAction } from '../../../actions/transaction/actionTypes/scheduleTimestamp';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { SetScheduleTimezoneAction, setScheduleTimezone } from 'actions/schedule';
|
||||
import { SetCurrentScheduleTimezoneAction } from 'actions/schedule/actionTypes/scheduleTimestamp';
|
||||
|
||||
export function* setCurrentScheduleTimezone({
|
||||
payload: raw
|
|
@ -1,10 +1,11 @@
|
|||
import { setGasLimitField } from 'actions/transaction/actionCreators/fields';
|
||||
import { call, put, takeLatest } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { SetGasLimitFieldAction, SetSchedulingToggleAction } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { SetGasLimitFieldAction } from 'actions/transaction';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import BN from 'bn.js';
|
||||
import { SetSchedulingToggleAction } from 'actions/schedule/actionTypes';
|
||||
|
||||
export function* setGasLimitForScheduling({
|
||||
payload: { value: useScheduling }
|
|
@ -1,14 +1,13 @@
|
|||
import { setTimeBountyField } from 'actions/transaction/actionCreators/fields';
|
||||
import { call, put, takeLatest, select } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { SetTimeBountyFieldAction } from 'actions/transaction';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { getDecimal, getUnit } from 'selectors/transaction';
|
||||
import { validDecimal, validNumber } from 'libs/validators';
|
||||
import { toTokenBase } from 'libs/units';
|
||||
import { validateInput } from 'sagas/transaction/validationHelpers';
|
||||
import BN from 'bn.js';
|
||||
import { SetCurrentTimeBountyAction } from '../../../actions/transaction/actionTypes/timeBounty';
|
||||
import { SetCurrentTimeBountyAction } from 'actions/schedule/actionTypes/timeBounty';
|
||||
import { SetTimeBountyFieldAction, setTimeBountyField } from 'actions/schedule';
|
||||
|
||||
export function* setCurrentTimeBounty({ payload: raw }: SetCurrentTimeBountyAction): SagaIterator {
|
||||
const decimal: number = yield select(getDecimal);
|
|
@ -1,11 +1,10 @@
|
|||
import { setWindowSizeField } from 'actions/transaction/actionCreators/fields';
|
||||
import { call, put, takeLatest } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { SetWindowSizeFieldAction } from 'actions/transaction';
|
||||
import { SetCurrentWindowSizeAction } from '../../../actions/transaction/actionTypes/windowSize';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { validNumber } from 'libs/validators';
|
||||
import BN from 'bn.js';
|
||||
import { SetCurrentWindowSizeAction } from 'actions/schedule/actionTypes/windowSize';
|
||||
import { SetWindowSizeFieldAction, setWindowSizeField } from 'actions/schedule';
|
||||
|
||||
export function* setCurrentWindowSize({ payload: raw }: SetCurrentWindowSizeAction): SagaIterator {
|
||||
let value: BN | null = null;
|
|
@ -1,9 +1,8 @@
|
|||
import { setWindowStartField } from 'actions/transaction/actionCreators/fields';
|
||||
import { call, put, takeLatest } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { SetWindowStartFieldAction } from 'actions/transaction';
|
||||
import { SetCurrentWindowStartAction } from '../../../actions/transaction/actionTypes/windowStart';
|
||||
import { TypeKeys } from 'actions/schedule/constants';
|
||||
import { SetCurrentWindowStartAction } from 'actions/schedule/actionTypes/windowStart';
|
||||
import { SetWindowStartFieldAction, setWindowStartField } from 'actions/schedule';
|
||||
|
||||
export function* setCurrentWindowStart({
|
||||
payload: raw
|
|
@ -0,0 +1,21 @@
|
|||
import { SagaIterator } from 'redux-saga';
|
||||
import { all } from 'redux-saga/effects';
|
||||
import { schedulingParamsValidity } from './paramsValidity';
|
||||
import { currentWindowSize } from './currentWindowSize';
|
||||
import { currentWindowStart } from './currentWindowStart';
|
||||
import { currentScheduleTimestamp } from './currentScheduleTimestamp';
|
||||
import { currentTimeBounty } from './currentTimeBounty';
|
||||
import { currentSchedulingToggle } from './currentSchedulingToggle';
|
||||
import { currentScheduleTimezone } from './currentScheduleTimezone';
|
||||
|
||||
export function* schedule(): SagaIterator {
|
||||
yield all([
|
||||
currentWindowSize,
|
||||
currentWindowStart,
|
||||
currentScheduleTimestamp,
|
||||
currentTimeBounty,
|
||||
currentSchedulingToggle,
|
||||
currentScheduleTimezone,
|
||||
schedulingParamsValidity
|
||||
]);
|
||||
}
|
|
@ -8,22 +8,10 @@ import {
|
|||
ICurrentScheduleType,
|
||||
ICurrentScheduleTimezone,
|
||||
ICurrentScheduleTimestamp,
|
||||
ICurrentTimeBounty
|
||||
} from 'containers/Tabs/ScheduleTransaction/selectors';
|
||||
import {
|
||||
ICurrentTimeBounty,
|
||||
getSchedulingToggle,
|
||||
getScheduleTimestamp,
|
||||
getScheduleTimezone
|
||||
} from '../../../selectors/fields';
|
||||
import {
|
||||
TypeKeys,
|
||||
SetScheduleParamsValidityAction,
|
||||
setScheduleParamsValidity
|
||||
} from 'actions/transaction';
|
||||
import {
|
||||
getCurrentTo,
|
||||
getCurrentValue,
|
||||
getData,
|
||||
getScheduleTimezone,
|
||||
getScheduleType,
|
||||
getWindowStart,
|
||||
getWindowSize,
|
||||
|
@ -31,7 +19,14 @@ import {
|
|||
getScheduleGasPrice,
|
||||
getScheduleGasLimit,
|
||||
getScheduleDeposit
|
||||
} from 'selectors/transaction';
|
||||
} from 'selectors/schedule/fields';
|
||||
import {
|
||||
TypeKeys,
|
||||
SetScheduleParamsValidityAction,
|
||||
setScheduleParamsValidity
|
||||
} from 'actions/schedule';
|
||||
import { TypeKeys as TransactionTypeKeys } from 'actions/transaction';
|
||||
import { getData } from 'selectors/transaction/fields';
|
||||
import { getWalletInst } from 'selectors/wallet';
|
||||
import {
|
||||
EAC_SCHEDULING_CONFIG,
|
||||
|
@ -44,13 +39,14 @@ import { gasPriceToBase } from 'libs/units';
|
|||
import BN from 'bn.js';
|
||||
import { bufferToHex } from 'ethereumjs-util';
|
||||
import RequestFactory from 'libs/scheduling/contracts/RequestFactory';
|
||||
import { windowSizeBlockToMin, calculateWindowStart } from 'selectors/transaction/helpers';
|
||||
import { windowSizeBlockToMin, calculateWindowStart } from 'selectors/schedule/helpers';
|
||||
import { getCurrentTo, getCurrentValue } from 'selectors/transaction/current';
|
||||
|
||||
export function* shouldValidateParams(): SagaIterator {
|
||||
while (true) {
|
||||
yield take([
|
||||
TypeKeys.TO_FIELD_SET,
|
||||
TypeKeys.DATA_FIELD_SET,
|
||||
TransactionTypeKeys.TO_FIELD_SET,
|
||||
TransactionTypeKeys.DATA_FIELD_SET,
|
||||
TypeKeys.CURRENT_TIME_BOUNTY_SET,
|
||||
TypeKeys.WINDOW_SIZE_FIELD_SET,
|
||||
TypeKeys.WINDOW_START_FIELD_SET,
|
|
@ -1,11 +1,5 @@
|
|||
import { SagaIterator } from 'redux-saga';
|
||||
import {
|
||||
getWeb3Tx,
|
||||
getSignedTx,
|
||||
getTransactionStatus,
|
||||
getSchedulingToggle,
|
||||
ICurrentSchedulingToggle
|
||||
} from 'selectors/transaction';
|
||||
import { getWeb3Tx, getSignedTx, getTransactionStatus } from 'selectors/transaction';
|
||||
import { select, call, put } from 'redux-saga/effects';
|
||||
import {
|
||||
broadcastTransactionFailed,
|
||||
|
@ -27,6 +21,7 @@ import { getNetworkConfig } from 'selectors/config';
|
|||
import TransactionSucceeded from 'components/ExtendedNotifications/TransactionSucceeded';
|
||||
import { computeIndexingHash } from 'libs/transaction';
|
||||
import { NetworkConfig } from 'types/network';
|
||||
import { ICurrentSchedulingToggle, getSchedulingToggle } from 'selectors/schedule';
|
||||
|
||||
export const broadcastTransactionWrapper = (func: (serializedTx: string) => SagaIterator) =>
|
||||
function* handleBroadcastTransaction(action: BroadcastRequestedAction) {
|
||||
|
@ -60,7 +55,6 @@ export const broadcastTransactionWrapper = (func: (serializedTx: string) => Saga
|
|||
const network: NetworkConfig = yield select(getNetworkConfig);
|
||||
|
||||
const scheduling = Boolean(schedulingToggle && schedulingToggle.value);
|
||||
|
||||
yield put(
|
||||
showNotification(
|
||||
'success',
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { currentTo } from './currentTo';
|
||||
import { currentValue } from './currentValue';
|
||||
import { schedulingCurrentSagas } from 'containers/Tabs/ScheduleTransaction/sagas/transaction/current';
|
||||
|
||||
export const current = [currentTo, ...currentValue, ...schedulingCurrentSagas];
|
||||
export const current = [currentTo, ...currentValue];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { select, call, put, takeEvery } from 'redux-saga/effects';
|
||||
import { SagaIterator } from 'redux-saga';
|
||||
import { SetUnitMetaAction, TypeKeys, setSchedulingToggle } from 'actions/transaction';
|
||||
import { SetUnitMetaAction, TypeKeys } from 'actions/transaction';
|
||||
import {
|
||||
getTokenTo,
|
||||
getTokenValue,
|
||||
|
@ -21,6 +21,7 @@ import { encodeTransfer } from 'libs/transaction';
|
|||
import { AppState } from 'reducers';
|
||||
import { bufferToHex } from 'ethereumjs-util';
|
||||
import { validateInput, rebaseUserInput, IInput } from 'sagas/transaction/validationHelpers';
|
||||
import { setSchedulingToggle } from 'actions/schedule';
|
||||
|
||||
export function* handleSetUnitMeta({ payload: currentUnit }: SetUnitMetaAction): SagaIterator {
|
||||
const previousUnit: string = yield select(getPreviousUnit);
|
||||
|
@ -86,7 +87,6 @@ export function* handleSetUnitMeta({ payload: currentUnit }: SetUnitMetaAction):
|
|||
if (etherToToken) {
|
||||
yield put(
|
||||
setSchedulingToggle({
|
||||
raw: 'false',
|
||||
value: false
|
||||
})
|
||||
);
|
||||
|
|
|
@ -15,7 +15,6 @@ import { INode } from 'libs/nodes/INode';
|
|||
import { getNodeLib, getOffline, getAutoGasLimitEnabled } from 'selectors/config';
|
||||
import { getWalletInst } from 'selectors/wallet';
|
||||
import { getTransaction, IGetTransaction, getCurrentToAddressMessage } from 'selectors/transaction';
|
||||
import { getSchedulingToggle } from 'containers/Tabs/ScheduleTransaction/selectors/fields';
|
||||
import {
|
||||
EstimateGasRequestedAction,
|
||||
setGasLimitField,
|
||||
|
@ -28,14 +27,14 @@ import {
|
|||
SwapEtherToTokenAction,
|
||||
SwapTokenToTokenAction,
|
||||
SwapTokenToEtherAction,
|
||||
SetSchedulingToggleAction,
|
||||
setScheduleGasLimitField,
|
||||
estimateGasFailed
|
||||
} from 'actions/transaction';
|
||||
import { TypeKeys as ConfigTypeKeys, ToggleAutoGasLimitAction } from 'actions/config';
|
||||
import { IWallet } from 'libs/wallet';
|
||||
import { makeTransaction, getTransactionFields, IHexStrTransaction } from 'libs/transaction';
|
||||
import { AddressMessage } from 'config';
|
||||
import { getSchedulingToggle } from 'selectors/schedule';
|
||||
import { setScheduleGasLimitField, SetSchedulingToggleAction } from 'actions/schedule';
|
||||
|
||||
export function* shouldEstimateGas(): SagaIterator {
|
||||
while (true) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { from } from './from';
|
||||
import { gas } from './gas';
|
||||
import { nonce } from './nonce';
|
||||
import { schedulingTransactionNetworkSagas } from '../../../containers/Tabs/ScheduleTransaction/sagas/transaction/network';
|
||||
|
||||
export const network = [from, ...gas, nonce, ...schedulingTransactionNetworkSagas];
|
||||
export const network = [from, ...gas, nonce];
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getScheduleTimestamp } from './fields';
|
||||
import moment from 'moment';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import { getScheduleTimestamp } from 'selectors/schedule';
|
||||
|
||||
const fiveMinFromNow = moment()
|
||||
.add(5, 'm')
|
|
@ -1,5 +1,5 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getScheduleTimezone } from './fields';
|
||||
import { getScheduleTimezone } from '../fields';
|
||||
|
||||
interface ICurrentScheduleTimezone {
|
||||
raw: string;
|
|
@ -1,5 +1,5 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getScheduleType } from './fields';
|
||||
import { getScheduleType } from '../fields';
|
||||
|
||||
interface ICurrentScheduleType {
|
||||
raw: string;
|
|
@ -1,8 +1,7 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getSchedulingToggle } from './fields';
|
||||
import { getSchedulingToggle } from '../fields';
|
||||
|
||||
interface ICurrentSchedulingToggle {
|
||||
raw: string;
|
||||
value: boolean;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getTimeBounty } from './fields';
|
||||
import { getTimeBounty } from '../fields';
|
||||
import BN from 'bn.js';
|
||||
import { timeBountyValidator } from 'libs/validators';
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getWindowSize } from './fields';
|
||||
import BN from 'bn.js';
|
||||
import { getWindowSize } from 'selectors/schedule';
|
||||
|
||||
interface ICurrentWindowSize {
|
||||
raw: string;
|
||||
|
@ -20,4 +20,10 @@ const isValidCurrentWindowSize = (state: AppState) => {
|
|||
|
||||
const getCurrentWindowSize = (state: AppState): ICurrentWindowSize => getWindowSize(state);
|
||||
|
||||
export { getCurrentWindowSize, ICurrentWindowSize, isValidCurrentWindowSize };
|
||||
const isWindowSizeValid = (state: AppState): boolean => {
|
||||
const windowSize = getWindowSize(state);
|
||||
|
||||
return Boolean(windowSize && windowSize.value && windowSize.value.bitLength() <= 256);
|
||||
};
|
||||
|
||||
export { getCurrentWindowSize, ICurrentWindowSize, isWindowSizeValid, isValidCurrentWindowSize };
|
|
@ -1,6 +1,6 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { getLatestBlock } from 'selectors/config';
|
||||
import { getWindowStart } from './fields';
|
||||
import { getWindowStart } from '../fields';
|
||||
|
||||
interface ICurrentWindowStart {
|
||||
raw: string;
|
|
@ -0,0 +1,73 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { gasPriceValidator, gasLimitValidator } from 'libs/validators';
|
||||
import BN from 'bn.js';
|
||||
|
||||
const getScheduleState = (state: AppState) => state.schedule;
|
||||
|
||||
const getTimeBounty = (state: AppState) => getScheduleState(state).timeBounty;
|
||||
const getWindowSize = (state: AppState) => getScheduleState(state).windowSize;
|
||||
const getWindowStart = (state: AppState) => getScheduleState(state).windowStart;
|
||||
const getScheduleTimestamp = (state: AppState) => getScheduleState(state).scheduleTimestamp;
|
||||
const getScheduleType = (state: AppState) => getScheduleState(state).scheduleType;
|
||||
const getScheduleTimezone = (state: AppState) => getScheduleState(state).scheduleTimezone;
|
||||
const getSchedulingToggle = (state: AppState) => getScheduleState(state).schedulingToggle;
|
||||
const getScheduleGasLimit = (state: AppState) => getScheduleState(state).scheduleGasLimit;
|
||||
const getScheduleGasPrice = (state: AppState) => getScheduleState(state).scheduleGasPrice;
|
||||
const getScheduleDeposit = (state: AppState) => getScheduleState(state).scheduleDeposit;
|
||||
const getScheduleParamsValidity = (state: AppState) =>
|
||||
getScheduleState(state).scheduleParamsValidity;
|
||||
|
||||
const schedulingFields = [
|
||||
'windowStart',
|
||||
'windowSize',
|
||||
'scheduleTimestamp',
|
||||
'scheduleTimezone',
|
||||
'schedulingToggle',
|
||||
'scheduleDeposit',
|
||||
'scheduleGasLimit',
|
||||
'scheduleGasPrice',
|
||||
'scheduleParamsValidity'
|
||||
];
|
||||
|
||||
const isValidScheduleGasPrice = (state: AppState): boolean =>
|
||||
gasPriceValidator(getScheduleGasPrice(state).raw);
|
||||
|
||||
const isValidScheduleGasLimit = (state: AppState): boolean =>
|
||||
gasLimitValidator(getScheduleGasLimit(state).raw);
|
||||
|
||||
const isValidScheduleDeposit = (state: AppState): boolean => {
|
||||
const depositValue = getScheduleDeposit(state).value;
|
||||
|
||||
if (!depositValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return depositValue.gte(new BN('0')) && depositValue.bitLength() <= 256;
|
||||
};
|
||||
|
||||
export {
|
||||
getScheduleState,
|
||||
getTimeBounty,
|
||||
getWindowSize,
|
||||
getWindowStart,
|
||||
getScheduleTimestamp,
|
||||
getScheduleType,
|
||||
getScheduleTimezone,
|
||||
getSchedulingToggle,
|
||||
getScheduleGasLimit,
|
||||
getScheduleGasPrice,
|
||||
getScheduleDeposit,
|
||||
schedulingFields,
|
||||
getScheduleParamsValidity,
|
||||
isValidScheduleDeposit,
|
||||
isValidScheduleGasLimit,
|
||||
isValidScheduleGasPrice
|
||||
};
|
||||
|
||||
export * from './current/windowSize';
|
||||
export * from './current/windowStart';
|
||||
export * from './current/timeBounty';
|
||||
export * from './current/scheduleTimestamp';
|
||||
export * from './current/scheduleType';
|
||||
export * from './current/scheduleTimezone';
|
||||
export * from './current/schedulingToggle';
|
|
@ -5,7 +5,7 @@ import { ICurrentScheduleTimestamp } from '.';
|
|||
import BN from 'bn.js';
|
||||
|
||||
export const isWindowStartValid = (
|
||||
transactionFields: AppState['transaction']['fields'],
|
||||
transactionFields: AppState['schedule'],
|
||||
latestBlock: string
|
||||
) => {
|
||||
const { windowStart } = transactionFields;
|
||||
|
@ -13,7 +13,7 @@ export const isWindowStartValid = (
|
|||
return Boolean(windowStart && windowStart.value && windowStart.value > parseInt(latestBlock, 10));
|
||||
};
|
||||
|
||||
export const isScheduleTimestampValid = (transactionFields: AppState['transaction']['fields']) => {
|
||||
export const isScheduleTimestampValid = (transactionFields: AppState['schedule']) => {
|
||||
const { scheduleTimestamp } = transactionFields;
|
||||
const now = new Date();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
export * from './transaction';
|
||||
export * from './fields';
|
|
@ -2,27 +2,28 @@ import { AppState } from 'reducers';
|
|||
import {
|
||||
getCurrentTo,
|
||||
getCurrentValue,
|
||||
getFields,
|
||||
getData,
|
||||
getScheduleType,
|
||||
getWindowStart,
|
||||
getNonce,
|
||||
getGasPrice,
|
||||
IGetTransaction,
|
||||
getTransaction
|
||||
} from 'selectors/transaction';
|
||||
import {
|
||||
getScheduleType,
|
||||
getWindowStart,
|
||||
getTimeBounty,
|
||||
getWindowSize,
|
||||
getScheduleGasPrice,
|
||||
isValidScheduleGasPrice,
|
||||
getScheduleGasLimit,
|
||||
isValidScheduleGasLimit,
|
||||
isValidScheduleDeposit,
|
||||
getScheduleDeposit,
|
||||
getScheduleTimestamp,
|
||||
getScheduleTimezone,
|
||||
IGetTransaction,
|
||||
getTransaction,
|
||||
isValidCurrentTimeBounty,
|
||||
isWindowSizeValid
|
||||
} from 'selectors/transaction';
|
||||
isWindowSizeValid,
|
||||
isValidScheduleGasPrice,
|
||||
isValidScheduleGasLimit,
|
||||
isValidScheduleDeposit
|
||||
} from 'selectors/schedule';
|
||||
import {
|
||||
EAC_SCHEDULING_CONFIG,
|
||||
getScheduleData,
|
||||
|
@ -31,14 +32,15 @@ import {
|
|||
} from 'libs/scheduling';
|
||||
import BN from 'bn.js';
|
||||
import { makeTransaction } from 'libs/transaction';
|
||||
import {
|
||||
isWindowStartValid,
|
||||
isScheduleTimestampValid,
|
||||
windowSizeBlockToMin,
|
||||
calculateWindowStart
|
||||
} from 'selectors/transaction/helpers';
|
||||
import EthTx from 'ethereumjs-tx';
|
||||
import { getLatestBlock } from 'selectors/config';
|
||||
import {
|
||||
windowSizeBlockToMin,
|
||||
calculateWindowStart,
|
||||
isWindowStartValid,
|
||||
isScheduleTimestampValid
|
||||
} from 'selectors/schedule/helpers';
|
||||
import { getScheduleState } from 'selectors/schedule/fields';
|
||||
|
||||
export const getSchedulingTransaction = (state: AppState): IGetTransaction => {
|
||||
const { isFullTransaction } = getTransaction(state);
|
||||
|
@ -111,10 +113,10 @@ export const getSchedulingTransaction = (state: AppState): IGetTransaction => {
|
|||
};
|
||||
|
||||
const isSchedulingTransactionValid = (state: AppState): boolean => {
|
||||
const transactionFields = getFields(state);
|
||||
const schedulingState = getScheduleState(state);
|
||||
const windowSizeValid = isWindowSizeValid(state);
|
||||
const windowStartValid = isWindowStartValid(transactionFields, getLatestBlock(state));
|
||||
const scheduleTimestampValid = isScheduleTimestampValid(transactionFields);
|
||||
const windowStartValid = isWindowStartValid(schedulingState, getLatestBlock(state));
|
||||
const scheduleTimestampValid = isScheduleTimestampValid(schedulingState);
|
||||
const scheduleGasPriceValid = isValidScheduleGasPrice(state);
|
||||
const scheduleGasLimitValid = isValidScheduleGasLimit(state);
|
||||
const depositValid = isValidScheduleDeposit(state);
|
|
@ -1,18 +1,11 @@
|
|||
import { getTo, getValue, getScheduleGasPrice, getWindowSize } from './fields';
|
||||
import { getTo, getValue } from './fields';
|
||||
import { getUnit, getTokenTo, getTokenValue } from './meta';
|
||||
import { AppState } from 'reducers';
|
||||
import { TokenValue, Wei, Address } from 'libs/units';
|
||||
import { gasPriceValidator, gasLimitValidator } from 'libs/validators';
|
||||
import {
|
||||
getDataExists,
|
||||
getGasPrice,
|
||||
getGasLimit,
|
||||
getScheduleGasLimit,
|
||||
getScheduleDeposit
|
||||
} from 'selectors/transaction';
|
||||
import { getDataExists, getGasPrice, getGasLimit } from 'selectors/transaction';
|
||||
import { isNetworkUnit } from 'selectors/config';
|
||||
import { getAddressMessage, AddressMessage } from 'config';
|
||||
import BN from 'bn.js';
|
||||
|
||||
interface ICurrentValue {
|
||||
raw: string;
|
||||
|
@ -51,28 +44,6 @@ const isValidGasPrice = (state: AppState): boolean => gasPriceValidator(getGasPr
|
|||
|
||||
const isValidGasLimit = (state: AppState): boolean => gasLimitValidator(getGasLimit(state).raw);
|
||||
|
||||
const isValidScheduleGasPrice = (state: AppState): boolean =>
|
||||
gasPriceValidator(getScheduleGasPrice(state).raw);
|
||||
|
||||
const isValidScheduleGasLimit = (state: AppState): boolean =>
|
||||
gasLimitValidator(getScheduleGasLimit(state).raw);
|
||||
|
||||
const isValidScheduleDeposit = (state: AppState): boolean => {
|
||||
const depositValue = getScheduleDeposit(state).value;
|
||||
|
||||
if (!depositValue) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return depositValue.gte(new BN('0')) && depositValue.bitLength() <= 256;
|
||||
};
|
||||
|
||||
const isWindowSizeValid = (state: AppState): boolean => {
|
||||
const windowSize = getWindowSize(state);
|
||||
|
||||
return Boolean(windowSize && windowSize.value && windowSize.value.bitLength() <= 256);
|
||||
};
|
||||
|
||||
function getCurrentToAddressMessage(state: AppState): AddressMessage | undefined {
|
||||
const to = getCurrentTo(state);
|
||||
return getAddressMessage(to.raw);
|
||||
|
@ -87,9 +58,5 @@ export {
|
|||
isValidCurrentTo,
|
||||
isValidGasPrice,
|
||||
isValidGasLimit,
|
||||
isValidScheduleGasLimit,
|
||||
isValidScheduleGasPrice,
|
||||
isValidScheduleDeposit,
|
||||
isWindowSizeValid,
|
||||
getCurrentToAddressMessage
|
||||
};
|
||||
|
|
|
@ -37,5 +37,3 @@ export {
|
|||
getDataExists,
|
||||
getValidGasCost
|
||||
};
|
||||
|
||||
export * from '../../containers/Tabs/ScheduleTransaction/selectors/fields';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { AppState } from 'reducers';
|
||||
import { ICurrentTo, ICurrentValue, schedulingFields } from 'selectors/transaction';
|
||||
import { ICurrentTo, ICurrentValue } from 'selectors/transaction';
|
||||
import { isNetworkUnit } from 'selectors/config';
|
||||
import { schedulingFields } from 'selectors/schedule/fields';
|
||||
|
||||
type TransactionFields = AppState['transaction']['fields'];
|
||||
|
||||
|
@ -61,5 +62,3 @@ export const isFullTx = (
|
|||
);
|
||||
}
|
||||
};
|
||||
|
||||
export * from '../../containers/Tabs/ScheduleTransaction/selectors/helpers';
|
||||
|
|
|
@ -5,4 +5,3 @@ export * from './meta';
|
|||
export * from './sign';
|
||||
export * from './current';
|
||||
export * from './network';
|
||||
export * from '../../containers/Tabs/ScheduleTransaction/selectors';
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { TypeKeys } from 'actions/transaction/constants';
|
||||
import { gasPriceToBase, fromWei } from 'libs/units';
|
||||
import { gasPriceToBase } from 'libs/units';
|
||||
import { fields, State } from 'reducers/transaction/fields';
|
||||
import * as txActions from 'actions/transaction';
|
||||
import BN from 'bn.js';
|
||||
import { EAC_SCHEDULING_CONFIG } from 'libs/scheduling';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
describe('fields reducer', () => {
|
||||
const INITIAL_STATE: State = {
|
||||
|
@ -13,27 +11,7 @@ describe('fields reducer', () => {
|
|||
nonce: { raw: '', value: null },
|
||||
value: { raw: '', value: null },
|
||||
gasLimit: { raw: '21000', value: new BN(21000) },
|
||||
gasPrice: { raw: '20', value: gasPriceToBase(20) },
|
||||
schedulingToggle: { raw: 'false', value: false },
|
||||
timeBounty: {
|
||||
raw: fromWei(EAC_SCHEDULING_CONFIG.TIME_BOUNTY_DEFAULT, 'ether'),
|
||||
value: EAC_SCHEDULING_CONFIG.TIME_BOUNTY_DEFAULT
|
||||
},
|
||||
windowSize: { raw: '', value: null },
|
||||
windowStart: { raw: '', value: null },
|
||||
scheduleTimestamp: { raw: '', value: null },
|
||||
scheduleTimezone: { raw: moment.tz.guess(), value: moment.tz.guess() },
|
||||
scheduleType: {
|
||||
raw: EAC_SCHEDULING_CONFIG.DEFAULT_SCHEDULING_METHOD,
|
||||
value: EAC_SCHEDULING_CONFIG.DEFAULT_SCHEDULING_METHOD
|
||||
},
|
||||
scheduleGasPrice: {
|
||||
raw: EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_PRICE_FALLBACK.toString(),
|
||||
value: gasPriceToBase(EAC_SCHEDULING_CONFIG.SCHEDULE_GAS_PRICE_FALLBACK)
|
||||
},
|
||||
scheduleGasLimit: { raw: '21000', value: new BN(21000) },
|
||||
scheduleDeposit: { raw: '', value: null },
|
||||
scheduleParamsValidity: { raw: true, value: true }
|
||||
gasPrice: { raw: '20', value: gasPriceToBase(20) }
|
||||
};
|
||||
const testPayload = { raw: 'test', value: null };
|
||||
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
import {
|
||||
getWeb3Tx,
|
||||
getSignedTx,
|
||||
getTransactionStatus,
|
||||
getSchedulingToggle
|
||||
} from 'selectors/transaction';
|
||||
import { getWeb3Tx, getSignedTx, getTransactionStatus } from 'selectors/transaction';
|
||||
import { select, call, put } from 'redux-saga/effects';
|
||||
import {
|
||||
broadcastTransactionFailed,
|
||||
|
@ -30,6 +25,7 @@ import {
|
|||
getSerializedTxAndIndexingHash,
|
||||
shouldBroadcastTransaction
|
||||
} from 'sagas/transaction/broadcast/helpers';
|
||||
import { getSchedulingToggle } from 'selectors/schedule';
|
||||
|
||||
describe('broadcastTransactionWrapper*', () => {
|
||||
const indexingHash = 'indexingHash';
|
||||
|
|
|
@ -22,7 +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';
|
||||
import { setSchedulingToggle } from 'actions/schedule';
|
||||
|
||||
const itShouldBeDone = (gen: SagaIterator) => {
|
||||
it('should be done', () => {
|
||||
|
@ -212,7 +212,6 @@ describe('handleSetUnitMeta*', () => {
|
|||
expect(gens.gen.next(to).value).toEqual(
|
||||
put(
|
||||
setSchedulingToggle({
|
||||
raw: 'false',
|
||||
value: false
|
||||
})
|
||||
)
|
||||
|
|
|
@ -4,15 +4,13 @@ import BN from 'bn.js';
|
|||
import { getNodeLib, getOffline, getAutoGasLimitEnabled } from 'selectors/config';
|
||||
import { getWalletInst } from 'selectors/wallet';
|
||||
import { getTransaction, getCurrentToAddressMessage } from 'selectors/transaction';
|
||||
import { getSchedulingToggle } from 'containers/Tabs/ScheduleTransaction/selectors/fields';
|
||||
import {
|
||||
setGasLimitField,
|
||||
estimateGasFailed,
|
||||
estimateGasSucceeded,
|
||||
TypeKeys,
|
||||
estimateGasRequested,
|
||||
estimateGasTimedout,
|
||||
setScheduleGasLimitField
|
||||
estimateGasTimedout
|
||||
} from 'actions/transaction';
|
||||
import { makeTransaction, getTransactionFields } from 'libs/transaction';
|
||||
import {
|
||||
|
@ -24,6 +22,8 @@ import {
|
|||
import { cloneableGenerator, SagaIteratorClone } from 'redux-saga/utils';
|
||||
import { Wei } from 'libs/units';
|
||||
import { TypeKeys as ConfigTypeKeys } from 'actions/config';
|
||||
import { getSchedulingToggle } from 'selectors/schedule/fields';
|
||||
import { setScheduleGasLimitField } from 'actions/schedule';
|
||||
|
||||
describe('shouldEstimateGas*', () => {
|
||||
const offline = false;
|
||||
|
|
|
@ -12,7 +12,6 @@ import {
|
|||
getValidGasCost
|
||||
} from 'selectors/transaction';
|
||||
import { getInitialState } from '../helpers';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
describe('fields selector', () => {
|
||||
const state = getInitialState();
|
||||
|
@ -40,50 +39,6 @@ describe('fields selector', () => {
|
|||
gasPrice: {
|
||||
raw: '1500',
|
||||
value: Wei('1500')
|
||||
},
|
||||
schedulingToggle: {
|
||||
raw: 'false',
|
||||
value: false
|
||||
},
|
||||
timeBounty: {
|
||||
raw: '1500',
|
||||
value: Wei('1500')
|
||||
},
|
||||
windowSize: {
|
||||
raw: '',
|
||||
value: null
|
||||
},
|
||||
windowStart: {
|
||||
raw: '',
|
||||
value: null
|
||||
},
|
||||
scheduleTimestamp: {
|
||||
raw: '',
|
||||
value: null
|
||||
},
|
||||
scheduleTimezone: {
|
||||
raw: moment.tz.guess(),
|
||||
value: moment.tz.guess()
|
||||
},
|
||||
scheduleType: {
|
||||
raw: 'time',
|
||||
value: 'time'
|
||||
},
|
||||
scheduleGasPrice: {
|
||||
raw: '1500',
|
||||
value: Wei('1500')
|
||||
},
|
||||
scheduleGasLimit: {
|
||||
raw: '21000',
|
||||
value: Wei('21000')
|
||||
},
|
||||
scheduleDeposit: {
|
||||
raw: '1000000000',
|
||||
value: Wei('1000000000')
|
||||
},
|
||||
scheduleParamsValidity: {
|
||||
raw: false,
|
||||
value: false
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import {
|
|||
getValidGasCost
|
||||
} from 'selectors/transaction';
|
||||
import { getInitialState } from '../helpers';
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
describe('helpers selector', () => {
|
||||
const state = getInitialState();
|
||||
|
@ -44,50 +43,6 @@ describe('helpers selector', () => {
|
|||
gasPrice: {
|
||||
raw: '1500',
|
||||
value: Wei('1500')
|
||||
},
|
||||
schedulingToggle: {
|
||||
raw: 'false',
|
||||
value: false
|
||||
},
|
||||
timeBounty: {
|
||||
raw: '1500',
|
||||
value: Wei('1500')
|
||||
},
|
||||
windowSize: {
|
||||
raw: '',
|
||||
value: null
|
||||
},
|
||||
windowStart: {
|
||||
raw: '',
|
||||
value: null
|
||||
},
|
||||
scheduleTimestamp: {
|
||||
raw: '',
|
||||
value: null
|
||||
},
|
||||
scheduleTimezone: {
|
||||
raw: moment.tz.guess(),
|
||||
value: moment.tz.guess()
|
||||
},
|
||||
scheduleType: {
|
||||
raw: 'time',
|
||||
value: 'time'
|
||||
},
|
||||
scheduleGasPrice: {
|
||||
raw: '1500',
|
||||
value: Wei('1500')
|
||||
},
|
||||
scheduleGasLimit: {
|
||||
raw: '21000',
|
||||
value: Wei('21000')
|
||||
},
|
||||
scheduleDeposit: {
|
||||
raw: '1000000000',
|
||||
value: Wei('1000000000')
|
||||
},
|
||||
scheduleParamsValidity: {
|
||||
raw: false,
|
||||
value: false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -99,18 +54,7 @@ describe('helpers selector', () => {
|
|||
gasPrice: Wei('1500'),
|
||||
nonce: new BN('0'),
|
||||
to: new Buffer([0, 1, 2, 3]),
|
||||
value: Wei('1000000000'),
|
||||
schedulingToggle: false,
|
||||
timeBounty: Wei('1500'),
|
||||
windowSize: null,
|
||||
windowStart: null,
|
||||
scheduleTimestamp: null,
|
||||
scheduleType: 'time',
|
||||
scheduleTimezone: moment.tz.guess(),
|
||||
scheduleGasPrice: Wei('1500'),
|
||||
scheduleGasLimit: Wei('21000'),
|
||||
scheduleDeposit: Wei('1000000000'),
|
||||
scheduleParamsValidity: false
|
||||
value: Wei('1000000000')
|
||||
};
|
||||
expect(reduceToValues(state.transaction.fields)).toEqual(values);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue