types.ts
1 import { Wei } from 'libs/units'; 2 3 export interface ScheduleState { 4 schedulingToggle: SetSchedulingToggleAction['payload']; 5 timeBounty: SetTimeBountyFieldAction['payload']; 6 windowSize: SetWindowSizeFieldAction['payload']; 7 windowStart: SetWindowStartFieldAction['payload']; 8 scheduleTimestamp: SetScheduleTimestampFieldAction['payload']; 9 scheduleTimezone: SetScheduleTimezoneAction['payload']; 10 scheduleType: SetScheduleTypeAction['payload']; 11 scheduleGasLimit: SetScheduleGasLimitFieldAction['payload']; 12 scheduleGasPrice: SetScheduleGasPriceFieldAction['payload']; 13 scheduleDeposit: SetScheduleDepositFieldAction['payload']; 14 scheduleParamsValidity: SetScheduleParamsValidityAction['payload']; 15 } 16 17 export enum ScheduleActions { 18 CURRENT_TIME_BOUNTY_SET = 'SCHEDULE_CURRENT_TIME_BOUNTY_SET', 19 CURRENT_WINDOW_SIZE_SET = 'SCHEDULE_CURRENT_WINDOW_SIZE_SET', 20 CURRENT_WINDOW_START_SET = 'SCHEDULE_CURRENT_WINDOW_START_SET', 21 CURRENT_SCHEDULE_TIMESTAMP_SET = 'SCHEDULE_CURRENT_SCHEDULE_TIMESTAMP_SET', 22 CURRENT_SCHEDULE_TIMEZONE_SET = 'SCHEDULE_CURRENT_SCHEDULE_TIMEZONE_SET', 23 CURRENT_SCHEDULE_TYPE = 'SCHEDULE_CURRENT_SCHEDULE_TYPE', 24 CURRENT_SCHEDULING_TOGGLE = 'SCHEDULE_CURRENT_SCHEDULING_TOGGLE', 25 TIME_BOUNTY_FIELD_SET = 'SCHEDULE_TIME_BOUNTY_FIELD_SET', 26 WINDOW_SIZE_FIELD_SET = 'SCHEDULE_WINDOW_SIZE_FIELD_SET', 27 WINDOW_START_FIELD_SET = 'SCHEDULE_WINDOW_START_FIELD_SET', 28 GAS_PRICE_FIELD_SET = 'SCHEDULE_GAS_PRICE_SET', 29 GAS_LIMIT_FIELD_SET = 'SCHEDULE_GAS_LIMIT_SET', 30 TIMESTAMP_FIELD_SET = 'SCHEDULE_TIMESTAMP_FIELD_SET', 31 TIMEZONE_SET = 'SCHEDULE_TIMEZONE_SET', 32 TYPE_SET = 'SCHEDULE_TYPE_SET', 33 TOGGLE_SET = 'SCHEDULING_TOGGLE_SET', 34 DEPOSIT_FIELD_SET = 'SCHEDULE_DEPOSIT_FIELD_SET', 35 PARAMS_VALIDITY_SET = 'SCHEDULE_PARAMS_VALIDITY_SET' 36 } 37 38 //#region Fields 39 export interface SetTimeBountyFieldAction { 40 type: ScheduleActions.TIME_BOUNTY_FIELD_SET; 41 payload: { 42 raw: string; 43 value: Wei | null; 44 }; 45 } 46 47 export interface SetWindowSizeFieldAction { 48 type: ScheduleActions.WINDOW_SIZE_FIELD_SET; 49 payload: { 50 raw: string; 51 value: Wei | null; 52 }; 53 } 54 55 export interface SetWindowStartFieldAction { 56 type: ScheduleActions.WINDOW_START_FIELD_SET; 57 payload: { 58 raw: string; 59 value: number | null; 60 }; 61 } 62 63 export interface SetScheduleTimestampFieldAction { 64 type: ScheduleActions.TIMESTAMP_FIELD_SET; 65 payload: { 66 raw: string; 67 value: Date; 68 }; 69 } 70 71 export interface SetScheduleTypeAction { 72 type: ScheduleActions.TYPE_SET; 73 payload: { 74 raw: string; 75 value: string | null; 76 }; 77 } 78 79 export interface SetSchedulingToggleAction { 80 type: ScheduleActions.TOGGLE_SET; 81 payload: { 82 value: boolean; 83 }; 84 } 85 86 export interface SetScheduleTimezoneAction { 87 type: ScheduleActions.TIMEZONE_SET; 88 payload: { 89 raw: string; 90 value: string; 91 }; 92 } 93 94 export interface SetScheduleGasPriceFieldAction { 95 type: ScheduleActions.GAS_PRICE_FIELD_SET; 96 payload: { 97 raw: string; 98 value: Wei | null; 99 }; 100 } 101 102 export interface SetScheduleGasLimitFieldAction { 103 type: ScheduleActions.GAS_LIMIT_FIELD_SET; 104 payload: { 105 raw: string; 106 value: Wei | null; 107 }; 108 } 109 110 export interface SetScheduleDepositFieldAction { 111 type: ScheduleActions.DEPOSIT_FIELD_SET; 112 payload: { 113 raw: string; 114 value: Wei | null; 115 }; 116 } 117 118 export interface SetScheduleParamsValidityAction { 119 type: ScheduleActions.PARAMS_VALIDITY_SET; 120 payload: { 121 value: boolean; 122 }; 123 } 124 125 export type ScheduleFieldAction = 126 | SetTimeBountyFieldAction 127 | SetWindowSizeFieldAction 128 | SetWindowStartFieldAction 129 | SetScheduleTimestampFieldAction 130 | SetScheduleTypeAction 131 | SetSchedulingToggleAction 132 | SetScheduleGasPriceFieldAction 133 | SetScheduleGasLimitFieldAction 134 | SetScheduleDepositFieldAction 135 | SetScheduleTimezoneAction 136 | SetScheduleParamsValidityAction; 137 //#endregion Fields 138 139 //#region Schedule Timestamp 140 export interface SetCurrentScheduleTimestampAction { 141 type: ScheduleActions.CURRENT_SCHEDULE_TIMESTAMP_SET; 142 payload: string; 143 } 144 145 export type ScheduleTimestampCurrentAction = SetCurrentScheduleTimestampAction; 146 147 export interface SetCurrentScheduleTimezoneAction { 148 type: ScheduleActions.CURRENT_SCHEDULE_TIMEZONE_SET; 149 payload: string; 150 } 151 //#endregion Schedule Timestamp 152 153 //#region Schedule Type 154 export interface SetCurrentScheduleTypeAction { 155 type: ScheduleActions.CURRENT_SCHEDULE_TYPE; 156 payload: string; 157 } 158 159 export type ScheduleTypeCurrentAction = SetCurrentScheduleTypeAction; 160 //#endregion Schedule Type 161 162 //#region Schedule Toggle 163 export interface SetCurrentSchedulingToggleAction { 164 type: ScheduleActions.CURRENT_SCHEDULING_TOGGLE; 165 payload: string; 166 } 167 168 export type SchedulingToggleCurrentAction = SetCurrentSchedulingToggleAction; 169 //#endregion Schedule Toggle 170 171 //#region Time Bounty 172 export interface SetCurrentTimeBountyAction { 173 type: ScheduleActions.CURRENT_TIME_BOUNTY_SET; 174 payload: string; 175 } 176 177 export type TimeBountyCurrentAction = SetCurrentTimeBountyAction; 178 //#endregion Time Bounty 179 180 //#region Window Size 181 export interface SetCurrentWindowSizeAction { 182 type: ScheduleActions.CURRENT_WINDOW_SIZE_SET; 183 payload: string; 184 } 185 186 export type WindowSizeCurrentAction = SetCurrentWindowSizeAction; 187 //#endregion Window Size 188 189 //#region Window Size 190 export interface SetCurrentWindowStartAction { 191 type: ScheduleActions.CURRENT_WINDOW_START_SET; 192 payload: string; 193 } 194 195 export type WindowStartCurrentAction = SetCurrentWindowStartAction; 196 //#endregion Window Size 197 198 export type ScheduleAction = ScheduleFieldAction;