Skip to main content

useQuery

Callable

  • useQuery<TChainId, TQuery>(builder: TQuery, options?: ChainComposableOptions<TChainId>): PromiseLikeAsyncState<FlatHead<InferQueryPayload<Exclude<ReturnType<Exclude<UnwrapRef<TQuery>, Falsy>>, Falsy>>>>

  • Composable for querying data from chain, and returning the response.


    Type parameters

    • TChainId: any
    • TQuery: (builder: Query<[], ChainDescriptorOf<TChainId>>) => any

    Parameters

    • builder: TQuery

      The function to create the query

    • optionaloptions: ChainComposableOptions<TChainId>

      Additional options

    Returns PromiseLikeAsyncState<FlatHead<InferQueryPayload<Exclude<ReturnType<Exclude<UnwrapRef<TQuery>, Falsy>>, Falsy>>>>

    The data response