@lens-protocol/react
Version:
Interacting with the Lens Protocol API using React.
51 lines (50 loc) • 1.6 kB
TypeScript
import { ModuleMetadataResult, UnspecifiedError } from '@lens-protocol/api-bindings';
import { NotFoundError } from "../NotFoundError.js";
import { ReadResult } from "../helpers/reads.js";
import { UseDeferredTask } from "../helpers/tasks.js";
export type { ModuleMetadataResult };
export { decodeData, encodeData } from '@lens-protocol/blockchain-bindings';
export type { ModuleData, ModuleParam } from '@lens-protocol/blockchain-bindings';
/**
* {@link useModuleMetadata} hook arguments
*/
export type UseModuleMetadataArgs = {
/**
* The module address to fetch metadata for.
*/
implementation: string;
};
/**
* Fetch a Lens Module's metadata.
*
* @example
* ```tsx
* const { data, error, loading } = useModuleMetadata();
* ```
*
* @category Modules
* @group Hooks
*/
export declare function useModuleMetadata(args: UseModuleMetadataArgs): ReadResult<ModuleMetadataResult | null>;
export type FetchModuleMetadataArgs = {
/**
* The module address to fetch metadata for.
*/
implementation: string;
};
/**
* `useLazyModuleMetadata` is a lazy version of {@link useModuleMetadata} React Hook.
*
* This hook will not fetch the metadata until the returned function is called.
*
*
* @example
* ```ts
* const { called, data, error, loading, execute } = useLazyModuleMetadata();
* ```
*
* @experimental This hook is experimental and may change in the future.
* @category Modules
* @group Hooks
*/
export declare function useLazyModuleMetadata(): UseDeferredTask<ModuleMetadataResult, NotFoundError | UnspecifiedError, UseModuleMetadataArgs>;