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