React SDK

useCommitBlobs

Upload blob data to the Shelby RPCs

This mutation uploads multiple blobs data to the RPC endpoint with configurable concurrency control.

Example

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

function CommitBlobs() {
  const commitBlobs = useCommitBlobs({
    onSuccess: () => {
      console.log("Blobs committed successfully");
    },
  });

  const handleCommit = () => {
    commitBlobs.mutate({
      account: "0x123...",
      blobs: [
        { blobName: "file1.txt", blobData: new Uint8Array([/* ... */]) },
        { blobName: "file2.txt", blobData: new Uint8Array([/* ... */]) },
      ],
    });
  };

  return (
    <button onClick={handleCommit} disabled={commitBlobs.isPending}>
      {commitBlobs.isPending ? "Committing..." : "Commit Blobs"}
    </button>
  );
}

Parameters

Prop

Type

React Query Options

Prop

Type

Mutation Variables

Prop

Type

Return Value

Prop

Type