React SDK

useBlobMetadata

Query metadata for a specific blob

This query fetches the metadata for a single blob identified by account and blob name. Returns null if the blob is not found.

Example

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

function BlobDetails({ account, name }: { account: string; name: string }) {
  const { data: metadata, isLoading, error } = useBlobMetadata({
    account,
    name,
  });

  if (isLoading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  if (!metadata) return <div>Blob not found</div>;

  return (
    <div>
      <h2>{metadata.name}</h2>
      <p>Size: {metadata.size} bytes</p>
      <p>Created: {new Date(metadata.created_at).toLocaleString()}</p>
      <p>Updated: {new Date(metadata.updated_at).toLocaleString()}</p>
    </div>
  );
}

Parameters

Prop

Type

React Query Options

Prop

Type

Return Value

Prop

Type