From 0832a064a90478dc5fb478a0dba93936c9fdb9f6 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Mon, 5 Dec 2022 11:41:47 -0800 Subject: [PATCH] feat: permit2 flag (#320) * feat: add permit2 flag * test: use permit2 in test fixtures --- src/cosmos/ControlledSwap.fixture.tsx | 1 + src/cosmos/Swap.fixture.tsx | 1 + src/hooks/useSyncFlags.ts | 9 +++++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/cosmos/ControlledSwap.fixture.tsx b/src/cosmos/ControlledSwap.fixture.tsx index a4b5d43fc..2a6660437 100644 --- a/src/cosmos/ControlledSwap.fixture.tsx +++ b/src/cosmos/ControlledSwap.fixture.tsx @@ -57,6 +57,7 @@ function Fixture() { return ( ({}) -export function useInitialFlags({ brandedFooter }: Flags): [[Atom, Flags]] { +export function useInitialFlags({ brandedFooter, permit2 }: Flags): [[Atom, Flags]] { // Only grab the initial flags on mount - ignore exhaustive-deps. // eslint-disable-next-line react-hooks/exhaustive-deps - return useMemo(() => [[flagsAtom, { brandedFooter }]], []) + return useMemo(() => [[flagsAtom, { brandedFooter, permit2 }]], []) } export function useBrandedFooter() { return useAtomValue(flagsAtom).brandedFooter ?? true } + +export function usePermit2() { + return useAtomValue(flagsAtom).permit2 ?? false +}