fn new_msg_pay_for_blobs(blobs: &[Blob], signer: String) -> anyhow::Result<MsgPayForBlobs> {
    let mut blob_sizes = Vec::with_capacity(blobs.len());
    let mut namespaces = Vec::with_capacity(blobs.len());
    let mut share_commitments = Vec::with_capacity(blobs.len());
    let mut share_versions = Vec::with_capacity(blobs.len());
    for blob in blobs {
        blob_sizes.push(blob.data.len());
        namespaces.push(Bytes::from(blob.namespace.as_bytes().to_vec()));
        share_commitments.push(Bytes::from(blob.commitment.0.to_vec()));
        share_versions.push(u32::from(blob.share_version));
    }

    let blob_sizes = blob_sizes
        .into_iter()
        .map(|blob_size| {
            u32::try_from(blob_size)
                .map_err(|_| anyhow::anyhow!("blob too large, size: {}", blob_size))
        })
        .collect::<anyhow::Result<_, _>>()?;

    Ok(MsgPayForBlobs {
        signer,
        namespaces,
        blob_sizes,
        share_commitments,
        share_versions,
    })
}
Prepares a `MsgPayForBlobs` message for the given blobs.
core/node/da_clients/src/celestia/sdk.rs