diff --git a/.changeset/plain-eggs-joke.md b/.changeset/plain-eggs-joke.md new file mode 100644 index 00000000..44cf3d9e --- /dev/null +++ b/.changeset/plain-eggs-joke.md @@ -0,0 +1,6 @@ +--- +"@graphprotocol/hypergraph-react": patch +--- + +add privy auth based createSpace hooks + \ No newline at end of file diff --git a/apps/privy-login-example/src/routes/index.tsx b/apps/privy-login-example/src/routes/index.tsx index c504c645..d09c6637 100644 --- a/apps/privy-login-example/src/routes/index.tsx +++ b/apps/privy-login-example/src/routes/index.tsx @@ -1,5 +1,10 @@ import { store } from '@graphprotocol/hypergraph'; -import { useHypergraphApp, useSpaces } from '@graphprotocol/hypergraph-react'; +import { + useHypergraphApp, + _usePrivyAuthCreatePrivateSpace as usePrivyAuthCreatePrivateSpace, + _usePrivyAuthCreatePublicSpace as usePrivyAuthCreatePublicSpace, + useSpaces, +} from '@graphprotocol/hypergraph-react'; import { createFileRoute, Link } from '@tanstack/react-router'; import { useSelector } from '@xstate/store/react'; import { useEffect, useState } from 'react'; @@ -18,17 +23,12 @@ function Index() { const { data: publicSpaces } = useSpaces({ mode: 'public' }); const { data: privateSpaces } = useSpaces({ mode: 'private' }); const [spaceName, setSpaceName] = useState(''); + const { createPrivateSpace, isLoading: isCreatingPrivateSpace } = usePrivyAuthCreatePrivateSpace(); + const { createPublicSpace, isLoading: isCreatingPublicSpace } = usePrivyAuthCreatePublicSpace(); const accountInboxes = useSelector(store, (state) => state.context.accountInboxes); - const { - createSpace, - listInvitations, - invitations, - acceptInvitation, - createAccountInbox, - getOwnAccountInboxes, - isConnecting, - } = useHypergraphApp(); + const { listInvitations, invitations, acceptInvitation, createAccountInbox, getOwnAccountInboxes, isConnecting } = + useHypergraphApp(); useEffect(() => { if (!isConnecting) { @@ -36,6 +36,7 @@ function Index() { getOwnAccountInboxes(); } }, [isConnecting, listInvitations, getOwnAccountInboxes]); + const [spaceType, setSpaceType] = useState<'private' | 'public'>('private'); if (isConnecting) { return
Loading …
; @@ -76,15 +77,23 @@ function Index() {
setSpaceName(e.target.value)} /> +