Query helpers
TanStack Query helpers for data fetching and mutations
TanStack Query helper functions for fetching API data, managing mutations, and configuring the query client. These utilities streamline integration with the MDK Gateway API.
Package
@tetherto/mdk-ui-foundation
Query helpers
@tetherto/mdk-ui-foundation
Import the public APIs on this page from @tetherto/mdk-ui-foundation.
createMdkQueryClient
Build the TanStack QueryClient an MDK app talks to its Gateway with.
(options: CreateMdkQueryClientOptions = {}) => QueryClientgetApiBaseUrl
Read the configured base URL back from a QueryClient. Falls back to the default when the client was not produced by createMdkQueryClient.
(client: QueryClient) => stringgetFetcher
Read the client's auth-aware fetcher, or undefined for a client MDK did not build. Use it to call your Gateway routes with the session's token.
(client: QueryClient) => Fetcher | undefinedgetMdkRuntime
Read the whole runtime at once. baseUrl is always resolved.
(client: QueryClient) => MdkRuntimemdkFetch
Module-level singleton bearer fetcher reading from the global authStore. Used as the default by the mining query factories (tailLogQuery, etc.).
FetcherresolveApiBaseUrl
Resolves the API base URL:
(override?: string) => string