UNPKG

@towns-protocol/react-sdk

Version:

React Hooks for Towns Protocol SDK

24 lines 865 B
'use client'; import { useMemo } from 'react'; import { useAction } from './internals/useAction'; import { useSyncAgent } from './useSyncAgent'; /** * Hook to create a channel. * @param config - Configuration options for the action. * @returns The `createChannel` action and its loading state. */ export const useCreateChannel = (spaceId, config) => { const sync = useSyncAgent(); const space = useMemo(() => sync.spaces.getSpace(spaceId), [spaceId, sync.spaces]); const { action: createChannel, ...rest } = useAction(space, 'createChannel', config); return { /** * Action to create a channel. * @param name - The name of the channel to create. * @param signer - The signer to use to create the channel. */ createChannel, ...rest, }; }; //# sourceMappingURL=useCreateChannel.js.map