# Blobs.commitmentsToVersionedHashes

Transform a list of Commitments to Blob Versioned Hashes.

## Imports

:::code-group
```ts [Named]
import { Blobs } from 'ox'
```

```ts [Entrypoint]
import * as Blobs from 'ox/Blobs'
```
:::

## Examples

```ts twoslash
// @noErrors
import { Blobs } from 'ox'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const commitments = Blobs.toCommitments(blobs, { kzg })
const versionedHashes =
  Blobs.commitmentsToVersionedHashes(commitments) // [!code focus]
// @log: ['0x...', '0x...']
```

### Configuring Return Type

It is possible to configure the return type for the Versioned Hashes with the `as` option.

```ts twoslash
// @noErrors
import { Blobs } from 'ox'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const commitments = Blobs.toCommitments(blobs, { kzg })
const versionedHashes = Blobs.commitmentsToVersionedHashes(
  commitments,
  {
    as: 'Bytes' // [!code focus]
  }
)
// @log: [Uint8Array [ ... ], Uint8Array [ ... ]]
```

### Versioning Hashes

It is possible to configure the version for the Versioned Hashes with the `version` option.

```ts twoslash
// @noErrors
import { Blobs } from 'ox'
import { kzg } from './kzg'

const blobs = Blobs.from('0xdeadbeef')
const commitments = Blobs.toCommitments(blobs, { kzg })
const versionedHashes = Blobs.commitmentsToVersionedHashes(
  commitments,
  {
    version: 2 // [!code focus]
  }
)
```

## Definition

```ts
function commitmentsToVersionedHashes<commitments, as>(
  commitments: commitments | readonly Bytes.Bytes[] | readonly Hex.Hex[],
  options?: commitmentsToVersionedHashes.Options<as>,
): commitmentsToVersionedHashes.ReturnType<as>
```

**Source:** [src/core/Blobs.ts](https://github.com/wevm/ox/blob/main/src/core/Blobs.ts#L755)

## Parameters

### commitments

* **Type:** `commitments | readonly Bytes.Bytes[] | readonly Hex.Hex[]`

A list of commitments.

### options

* **Type:** `commitmentsToVersionedHashes.Options<as>`
* **Optional**

Options.

#### options.as

* **Type:** `"Bytes" | "Hex" | as`
* **Optional**

Return type.

#### options.version

* **Type:** `number`
* **Optional**

Version to tag onto the hashes.

## Return Type

A list of Blob Versioned Hashes.

`commitmentsToVersionedHashes.ReturnType<as>`
