1import create from 'zustand';
2import { L2Point, PendingTransaction } from '@urbit/roller-api/build';
4import { HOUR, isL2 } from 'lib/utils/roller';
5import { Invite } from 'types/Invite';
7export interface RollerStore {
10 pendingTransactions: PendingTransaction[];
11 currentPoint: L2Point | null;
14 recentlyCompleted: number;
15 setNextBatchTime: (nextBatchTime: number) => void;
16 setNextRoll: (nextRoll: string) => void;
17 setPendingTransactions: (pendingTransactions: PendingTransaction[]) => void;
18 setCurrentPoint: (currentPoint: L2Point) => void;
19 setInvites: (invites: Invite[]) => void;
22export const useRollerStore = create<RollerStore>(set => ({
23 nextBatchTime: new Date().getTime() + HOUR,
24 nextRoll: '0h 00m 00s',
25 pendingTransactions: [],
30 setNextBatchTime: (nextBatchTime: number) => set(() => ({ nextBatchTime })),
31 setNextRoll: (nextRoll: string) => set(() => ({ nextRoll })),
32 setPendingTransactions: (pendingTransactions: PendingTransaction[]) =>
34 const oldPending = state.pendingTransactions.length;
35 if (oldPending > 0 && pendingTransactions.length === 0) {
39 recentlyCompleted: oldPending,
42 return { ...state, pendingTransactions };
44 setCurrentPoint: (currentPoint: L2Point) =>
47 currentL2: isL2(currentPoint?.dominion),
49 setInvites: (invites: Invite[]) => set(() => ({ invites })),
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list