• Preparing search index...
  • The search index is not available
Lens SDK Reference
  • Lens SDK Reference
  • @lens-protocol/react-native
  • Core
  • useValidateHandle

Function useValidateHandle

  • useValidateHandle(): UseDeferredTask<void, UnspecifiedError | HandleNotAvailableError | InvalidHandleError, ValidateHandleRequest>
  • Experimental

    Validate the proposed new handle, its format and availability.

    This hook will not execute until the returned function is called.

    Returns UseDeferredTask<void, UnspecifiedError | HandleNotAvailableError | InvalidHandleError, ValidateHandleRequest>

    Example

    const { called, error, loading, execute } = useValidateHandle();
    

    Simple example:

    const { called, error, loading, execute } = useValidateHandle();

    const callback = async () => {
    const result = await execute({ localName: 'wagmi' });

    if (result.isFailure()) {
    console.error(result.error.message); // handle not valid or already taken
    return;
    }

    if (result.value === true) {
    // success - handle is available
    }
    }

    This hook is experimental and may change in the future.

    • Defined in packages/react/src/misc/useValidateHandle.ts:71

Settings

Member Visibility

Theme

Lens SDK Reference
  • @lens-protocol/react-web - v2.3.2
  • @lens-protocol/react-native - v2.3.2
  • @lens-protocol/client - v2.3.2