lookupBlobObjectId method

Future<String?> lookupBlobObjectId({
  1. required String blobId,
  2. required String owner,
})

Look up the Sui object ID for a blob given its blob ID (base64) and owner address.

Queries all Walrus Blob objects owned by owner and finds the one whose blob_id field matches blobId.

Returns the Sui object ID (0x...), or null if not found.

Example:

final objectId = await client.lookupBlobObjectId(
  blobId: 'PN9q2CUhq0tNBqSrIuZwTbSvZD0Adq3HBzaAm9bGpWE',
  owner: '0x1234...',
);

Implementation

Future<String?> lookupBlobObjectId({
  required String blobId,
  required String owner,
}) async {
  final blobs = await getOwnedBlobs(owner: owner);
  for (final blob in blobs) {
    if (blob['blobId'] == blobId) {
      return blob['objectId'] as String?;
    }
  }
  return null;
}