sidecarsToVersionedHashes
Transforms a list of sidecars to their versioned hashes.
Import
import { sidecarsToVersionedHashes } from 'viem'
Usage
example.ts
import { toBlobSidecars, sidecarsToVersionedHashes } from 'viem'
import { kzg } from './kzg'
const sidecars = toBlobSidecars({ data: '0x...', kzg })
const versionedHashes = sidecarsToVersionedHashes({ sidecars })
Returns
Hex[] | ByteArray[]
Versioned hashes from the input sidecars.
Parameters
sidecars
- Type:
BlobSidecars<Hex | ByteArray>
Sidecars to transform to versioned hashes.
import { toBlobSidecars, sidecarsToVersionedHashes } from 'viem'
import { kzg } from './kzg'
const sidecars = toBlobSidecars({ data: '0x...', kzg })
const versionedHashes = sidecarsToVersionedHashes({
sidecars,
})
to
- Type:
"bytes" | "hex"
Commitments corresponding to the input blobs.
import { toBlobSidecars, sidecarsToVersionedHashes } from 'viem'
import { kzg } from './kzg'
const sidecars = toBlobSidecars({ data: '0x...', kzg })
const versionedHashes = sidecarsToVersionedHashes({
sidecars,
to: 'bytes',
})
const versionedHashes: readonly ByteArray[]versionedHashes
version
- Type:
number
- Default:
1
Version to tag onto the hashes. Defaults to 1
.
import { toBlobSidecars, sidecarsToVersionedHashes } from 'viem'
import { kzg } from './kzg'
const sidecars = toBlobSidecars({ data: '0x...', kzg })
const versionedHashes = sidecarsToVersionedHashes({
sidecars,
version: 69,
})