Skip to main content

useOffers() function

This feature is currently in beta and may change based on feedback that we receive.

Get all the offers for a listing

Example

const { data: offers, isLoading, error } = useOffers(<YourMarketplaceContractInstance>, <listingId>);

Signature:

export declare function useOffers(
contract: RequiredParam<Marketplace>,
listingId: RequiredParam<BigNumberish>,
):
| {
data: Record<string, any>[] | undefined;
error: unknown;
isError: true;
isLoading: false;
isLoadingError: false;
isRefetchError: true;
isSuccess: false;
status: "error";
dataUpdatedAt: number;
errorUpdatedAt: number;
failureCount: number;
failureReason: unknown;
errorUpdateCount: number;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isInitialLoading: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetching: boolean;
isStale: boolean;
refetch: <TPageData>(
options?:
| (import("@tanstack/react-query").RefetchOptions &
import("@tanstack/react-query").RefetchQueryFilters<TPageData>)
| undefined,
) => Promise<
import("@tanstack/react-query").QueryObserverResult<
import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[],
unknown
>
>;
remove: () => void;
fetchStatus: import("@tanstack/react-query").FetchStatus;
}
| {
data: Record<string, any>[] | undefined;
error: null;
isError: false;
isLoading: false;
isLoadingError: false;
isRefetchError: false;
isSuccess: true;
status: "success";
dataUpdatedAt: number;
errorUpdatedAt: number;
failureCount: number;
failureReason: unknown;
errorUpdateCount: number;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isInitialLoading: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetching: boolean;
isStale: boolean;
refetch: <TPageData>(
options?:
| (import("@tanstack/react-query").RefetchOptions &
import("@tanstack/react-query").RefetchQueryFilters<TPageData>)
| undefined,
) => Promise<
import("@tanstack/react-query").QueryObserverResult<
import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[],
unknown
>
>;
remove: () => void;
fetchStatus: import("@tanstack/react-query").FetchStatus;
}
| {
data: Record<string, any>[] | undefined;
error: unknown;
isError: true;
isLoading: false;
isLoadingError: true;
isRefetchError: false;
isSuccess: false;
status: "error";
dataUpdatedAt: number;
errorUpdatedAt: number;
failureCount: number;
failureReason: unknown;
errorUpdateCount: number;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isInitialLoading: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetching: boolean;
isStale: boolean;
refetch: <TPageData>(
options?:
| (import("@tanstack/react-query").RefetchOptions &
import("@tanstack/react-query").RefetchQueryFilters<TPageData>)
| undefined,
) => Promise<
import("@tanstack/react-query").QueryObserverResult<
import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[],
unknown
>
>;
remove: () => void;
fetchStatus: import("@tanstack/react-query").FetchStatus;
}
| {
data: Record<string, any>[] | undefined;
error: null;
isError: false;
isLoading: true;
isLoadingError: false;
isRefetchError: false;
isSuccess: false;
status: "loading";
dataUpdatedAt: number;
errorUpdatedAt: number;
failureCount: number;
failureReason: unknown;
errorUpdateCount: number;
isFetched: boolean;
isFetchedAfterMount: boolean;
isFetching: boolean;
isInitialLoading: boolean;
isPaused: boolean;
isPlaceholderData: boolean;
isPreviousData: boolean;
isRefetching: boolean;
isStale: boolean;
refetch: <TPageData>(
options?:
| (import("@tanstack/react-query").RefetchOptions &
import("@tanstack/react-query").RefetchQueryFilters<TPageData>)
| undefined,
) => Promise<
import("@tanstack/react-query").QueryObserverResult<
import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[],
unknown
>
>;
remove: () => void;
fetchStatus: import("@tanstack/react-query").FetchStatus;
};

Parameters

ParameterTypeDescription
contractRequiredParam<Marketplace>an instance of a Marketplace contract
listingIdRequiredParam<BigNumberish>the id of the listing to fetch offers for

Returns:

{ data: Record<string, any>[] | undefined; error: unknown; isError: true; isLoading: false; isLoadingError: false; isRefetchError: true; isSuccess: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: unknown; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[], unknown>>; remove: () => void; fetchStatus: import("@tanstack/react-query").FetchStatus; } | { data: Record<string, any>[] | undefined; error: null; isError: false; isLoading: false; isLoadingError: false; isRefetchError: false; isSuccess: true; status: "success"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: unknown; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[], unknown>>; remove: () => void; fetchStatus: import("@tanstack/react-query").FetchStatus; } | { data: Record<string, any>[] | undefined; error: unknown; isError: true; isLoading: false; isLoadingError: true; isRefetchError: false; isSuccess: false; status: "error"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: unknown; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[], unknown>>; remove: () => void; fetchStatus: import("@tanstack/react-query").FetchStatus; } | { data: Record<string, any>[] | undefined; error: null; isError: false; isLoading: true; isLoadingError: false; isRefetchError: false; isSuccess: false; status: "loading"; dataUpdatedAt: number; errorUpdatedAt: number; failureCount: number; failureReason: unknown; errorUpdateCount: number; isFetched: boolean; isFetchedAfterMount: boolean; isFetching: boolean; isInitialLoading: boolean; isPaused: boolean; isPlaceholderData: boolean; isPreviousData: boolean; isRefetching: boolean; isStale: boolean; refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<import("@thirdweb-dev/sdk").ContractEvent<Record<string, any>>[], unknown>>; remove: () => void; fetchStatus: import("@tanstack/react-query").FetchStatus; }

Remarks

Fetch all the offers for a specified direct or auction listing.