Skip to content

Commit

Permalink
chore(query-keys): Export SIWEProviders' two query keys, allowing pac…
Browse files Browse the repository at this point in the history
…kage consumers to invalidate queries
  • Loading branch information
jeffrey-computers committed Mar 27, 2024
1 parent e16376a commit 9df55d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/connectkit/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ export { default as getDefaultConnectors } from './defaultConnectors';
export { wallets } from './wallets';

export { useModal } from './hooks/useModal';
export { SIWEProvider, useSIWE } from './siwe';
export {
SIWEProvider,
useSIWE,
SIWE_NONCE_QUERY_KEY,
SIWE_SESSION_QUERY_KEY,
} from './siwe';
export type { SIWESession, SIWEConfig } from './siwe';

export { ConnectKitProvider, Context } from './components/ConnectKit';
Expand Down
7 changes: 5 additions & 2 deletions packages/connectkit/src/siwe/SIWEProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type Props = SIWEConfig & {
onSignOut?: () => void;
};

export const SIWE_NONCE_QUERY_KEY = 'ckSiweNonce';
export const SIWE_SESSION_QUERY_KEY = 'ckSiweSession';

export const SIWEProvider = ({
children,
enabled = true,
Expand Down Expand Up @@ -46,13 +49,13 @@ export const SIWEProvider = ({
}

const nonce = useQuery({
queryKey: ['ckSiweNonce'],
queryKey: [SIWE_NONCE_QUERY_KEY],
queryFn: () => siweConfig.getNonce(),
refetchInterval: nonceRefetchInterval,
});

const session = useQuery({
queryKey: ['ckSiweSession'],
queryKey: [SIWE_SESSION_QUERY_KEY],
queryFn: () => siweConfig.getSession(),
refetchInterval: sessionRefetchInterval,
});
Expand Down
6 changes: 5 additions & 1 deletion packages/connectkit/src/siwe/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export { useSIWE } from './useSIWE';
export { SIWEProvider } from './SIWEProvider';
export {
SIWEProvider,
SIWE_SESSION_QUERY_KEY,
SIWE_NONCE_QUERY_KEY,
} from './SIWEProvider';
export { SIWEContext, SIWEConfig, SIWESession } from './SIWEContext';

0 comments on commit 9df55d6

Please sign in to comment.