Skip to content

Commit 1192664

Browse files
refactor(web): reuse the shared address formatter in the round hook (#258)
1 parent 90d2a52 commit 1192664

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

apps/web/src/hooks/useRoundSession.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { DEMO_TRACE } from "../demo/trace";
3737
import { formatCountdown, useDrandCountdown } from "./useDrandCountdown";
3838
import { useToast } from "../ui/Toast";
3939
import { useTime } from "../lib/time";
40+
import { shortAddr } from "../lib/format";
4041

4142
export type ActionStatus = "idle" | "working" | "ok" | "error";
4243

@@ -469,8 +470,3 @@ export function useRoundSession(active: UseCase) {
469470
refresh,
470471
};
471472
}
472-
473-
function shortAddr(addr: string, len = 6) {
474-
if (addr.length <= len * 2 + 3) return addr;
475-
return `${addr.slice(0, len)}${addr.slice(-len)}`;
476-
}

0 commit comments

Comments
 (0)