on master help sign in
state: useRoller sets nextBatch in timerStore
51bb890tomholford
src/lib/useRoller.ts+2−1
@@ -41,6 +41,7 @@ import { useWalletConnect } from './useWalletConnect';
41import { PendingL1Txn } from './types/PendingL1Transaction';
41import { PendingL1Txn } from './types/PendingL1Transaction';
42import { TRANSACTION_PROGRESS } from './reticket';
42import { TRANSACTION_PROGRESS } from './reticket';
43import { useRollerOptions } from './useRollerOptions';
43import { useRollerOptions } from './useRollerOptions';
44+import { useTimerStore } from 'store/timerStore';
44
45
45interface UpdateParams {
46interface UpdateParams {
46 point: number;
47 point: number;
@@ -69,7 +70,6 @@ export default function useRoller() {
69 point,
70 point,
70 points,
71 points,
71 nextQuotaTime,
72 nextQuotaTime,
72− setNextBatchTime,
73 setNextQuotaTime,
73 setNextQuotaTime,
74 setPendingTransactions,
74 setPendingTransactions,
75 setModalText,
75 setModalText,
@@ -78,6 +78,7 @@ export default function useRoller() {
78 storePendingL1Txn,
78 storePendingL1Txn,
79 deletePendingL1Txn,
79 deletePendingL1Txn,
80 } = useRollerStore();
80 } = useRollerStore();
81+ const { setNextBatchTime } = useTimerStore();
81 const [config, setConfig] = useState<Config | null>(null);
82 const [config, setConfig] = useState<Config | null>(null);
82
83
83 const { options } = useRollerOptions();
84 const { options } = useRollerOptions();
src/store/rollerStore.ts−4
@@ -22,7 +22,6 @@ export const EMPTY_POINT = new Point({
22
22
23export interface RollerStore {
23export interface RollerStore {
24 loading: boolean;
24 loading: boolean;
25− nextBatchTime: number;
26 nextQuotaTime: number;
25 nextQuotaTime: number;
27 pendingTransactions: PendingTransaction[];
26 pendingTransactions: PendingTransaction[];
28 point: Point;
27 point: Point;
@@ -34,7 +33,6 @@ export interface RollerStore {
34 ethBalance: BN;
33 ethBalance: BN;
35 setLoading: (loading: boolean) => void;
34 setLoading: (loading: boolean) => void;
36 setModalText: (modalText: string) => void;
35 setModalText: (modalText: string) => void;
37− setNextBatchTime: (nextBatchTime: number) => void;
38 setNextQuotaTime: (nextQuotaTime: number) => void;
36 setNextQuotaTime: (nextQuotaTime: number) => void;
39 setPendingTransactions: (pendingTransactions: PendingTransaction[]) => void;
37 setPendingTransactions: (pendingTransactions: PendingTransaction[]) => void;
40 setPoint: (point: number) => void;
38 setPoint: (point: number) => void;
@@ -47,7 +45,6 @@ export interface RollerStore {
47
45
48export const useRollerStore = create<RollerStore>(set => ({
46export const useRollerStore = create<RollerStore>(set => ({
49 loading: false,
47 loading: false,
50− nextBatchTime: new Date().getTime() + HOUR,
51 nextQuotaTime: new Date().getTime() + 24 * HOUR,
48 nextQuotaTime: new Date().getTime() + 24 * HOUR,
52 pendingTransactions: [],
49 pendingTransactions: [],
53 point: EMPTY_POINT,
50 point: EMPTY_POINT,
@@ -57,7 +54,6 @@ export const useRollerStore = create<RollerStore>(set => ({
57 recentlyCompleted: 0,
54 recentlyCompleted: 0,
58 ethBalance: toBN(0),
55 ethBalance: toBN(0),
59 setLoading: (loading: boolean) => set(() => ({ loading })),
56 setLoading: (loading: boolean) => set(() => ({ loading })),
60− setNextBatchTime: (nextBatchTime: number) => set(() => ({ nextBatchTime })),
61 setNextQuotaTime: (nextQuotaTime: number) => set(() => ({ nextQuotaTime })),
57 setNextQuotaTime: (nextQuotaTime: number) => set(() => ({ nextQuotaTime })),
62 setPendingTransactions: (pendingTransactions: PendingTransaction[]) =>
58 setPendingTransactions: (pendingTransactions: PendingTransaction[]) =>
63 set(state => {
59 set(state => {