UNPKG

@towns-protocol/react-sdk

Version:

React Hooks for Towns Protocol SDK

26 lines (22 loc) 788 B
'use client' import type { Spaces } from '@towns-protocol/sdk' import { type ActionConfig, useAction } from './internals/useAction' import { useSyncAgent } from './useSyncAgent' /** * Hook to create a space. * @param config - Configuration options for the action. * @returns The `createSpace` action and its loading state. */ export const useCreateSpace = (config: ActionConfig<Spaces['createSpace']> = {}) => { const sync = useSyncAgent() const { action: createSpace, ...rest } = useAction(sync.spaces, 'createSpace', config) return { /** * Action to create a space. * @param opts - Options for the create space action. * @param signer - The signer used to create the space. */ createSpace, ...rest, } }