@@ -20,7 +20,7 @@ export const EMPTY_POINT = new Point({
20 address: '',
20 address: '',
23−export interface RollerStore {
23+export interface RollerState {
24 loading: boolean;
24 loading: boolean;
25 nextQuotaTime: number;
25 nextQuotaTime: number;
26 pendingTransactions: PendingTransaction[];
26 pendingTransactions: PendingTransaction[];
@@ -31,6 +31,9 @@ export interface RollerStore {
31 modalText?: string;
31 modalText?: string;
32 recentlyCompleted: number;
32 recentlyCompleted: number;
33 ethBalance: BN;
33 ethBalance: BN;
36+export interface RollerActions {
34 setLoading: (loading: boolean) => void;
37 setLoading: (loading: boolean) => void;
35 setModalText: (modalText: string) => void;
38 setModalText: (modalText: string) => void;
36 setNextQuotaTime: (nextQuotaTime: number) => void;
39 setNextQuotaTime: (nextQuotaTime: number) => void;
@@ -41,9 +44,10 @@ export interface RollerStore {
41 storePendingL1Txn: (txn: PendingL1Txn) => void;
44 storePendingL1Txn: (txn: PendingL1Txn) => void;
42 deletePendingL1Txn: (txn: PendingL1Txn) => void;
45 deletePendingL1Txn: (txn: PendingL1Txn) => void;
43 setEthBalance: (ethBalance: BN) => void;
46 setEthBalance: (ethBalance: BN) => void;
47+ resetStore: () => void;
46−export const useRollerStore = create<RollerStore>(set => ({
50+const initialRollerState: RollerState = {
47 loading: false,
51 loading: false,
48 nextQuotaTime: new Date().getTime() + 24 * HOUR,
52 nextQuotaTime: new Date().getTime() + 24 * HOUR,
49 pendingTransactions: [],
53 pendingTransactions: [],
@@ -53,6 +57,10 @@ export const useRollerStore = create<RollerStore>(set => ({
53 pendingL1ByPoint: {},
57 pendingL1ByPoint: {},
54 recentlyCompleted: 0,
58 recentlyCompleted: 0,
55 ethBalance: toBN(0),
59 ethBalance: toBN(0),
62+export const useRollerStore = create<RollerState & RollerActions>(set => ({
63+ ...initialRollerState,
56 setLoading: (loading: boolean) => set(() => ({ loading })),
64 setLoading: (loading: boolean) => set(() => ({ loading })),
57 setNextQuotaTime: (nextQuotaTime: number) => set(() => ({ nextQuotaTime })),
65 setNextQuotaTime: (nextQuotaTime: number) => set(() => ({ nextQuotaTime })),
58 setPendingTransactions: (pendingTransactions: PendingTransaction[]) =>
66 setPendingTransactions: (pendingTransactions: PendingTransaction[]) =>
@@ -92,4 +100,7 @@ export const useRollerStore = create<RollerStore>(set => ({
92 return { pendingL1ByPoint: newPending };
100 return { pendingL1ByPoint: newPending };
94 setEthBalance: (ethBalance: BN) => set(() => ({ ethBalance })),
102 setEthBalance: (ethBalance: BN) => set(() => ({ ethBalance })),
104+ set(initialRollerState);