React SDK

useAccountObjects

Query the objects an account holds

This query lists the objects under an account, ascending by key, with support for a key prefix and cursor-based paging.

Example

import { useAccountObjects } from "@shelby-protocol/react";

function ObjectList({ owner }: { owner: string }) {
  const { data: objects, isLoading, error } = useAccountObjects({
    owner,
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;

  return (
    <ul>
      {objects?.map((object) => (
        <li key={object.name}>{object.key}</li>
      ))}
    </ul>
  );
}

Parameters

Prop

Type

React Query Options

Prop

Type

Return Value

Prop

Type