Skip to main content
@tevm/voltaire
@tevm/voltaire / primitives/BundleHash

primitives/BundleHash

Classes

InvalidBundleHashError

Defined in: src/primitives/BundleHash/errors.js:4 Error thrown when BundleHash operations fail

Extends

  • Error

Constructors

Constructor
new InvalidBundleHashError(message, details?): InvalidBundleHashError
Defined in: src/primitives/BundleHash/errors.js:9
Parameters
message
string Error message
details?
Record<string, unknown> Error details
Returns
InvalidBundleHashError
Overrides
Error.constructor

Properties

details
details: Record<string, unknown> | undefined
Defined in: src/primitives/BundleHash/errors.js:12
name
name: string
Defined in: src/primitives/BundleHash/errors.js:11
Inherited from
Error.name

Type Aliases

BundleHashLike

BundleHashLike = BundleHashType | string | Uint8Array
Defined in: src/primitives/BundleHash/BundleHashType.ts:22 Inputs that can be converted to BundleHash

BundleHashType

BundleHashType = Uint8Array & object
Defined in: src/primitives/BundleHash/BundleHashType.ts:14 BundleHash type Unique identifier for a transaction bundle. Computed as keccak256 of the bundle contents (concatenated transaction hashes). Used to track bundle status through MEV relays and block builders.

Type Declaration

[brand]
readonly [brand]: "BundleHash"
length
readonly length: 32

See

Since

0.0.0

Variables

SIZE

const SIZE: 32 = 32
Defined in: src/primitives/BundleHash/BundleHashType.ts:24

Functions

equals()

equals(a, b): boolean
Defined in: src/primitives/BundleHash/equals.js:17 Checks if two BundleHashes are equal

Parameters

a
BundleHashType First hash
b
BundleHashType Second hash

Returns

boolean True if hashes are equal

Example

import * as BundleHash from './BundleHash/index.js';
const equal = BundleHash.equals(hash1, hash2);

from()

from(value): BundleHashType
Defined in: src/primitives/BundleHash/from.js:21 Creates a BundleHash from various input types

Parameters

value
BundleHashLike BundleHash input (hex string or bytes)

Returns

BundleHashType BundleHash instance

Throws

If input format is invalid

Example

import * as BundleHash from './BundleHash/index.js';
const hash = BundleHash.from("0x1234...");

fromBundle()

fromBundle(bundle, crypto): BundleHashType
Defined in: src/primitives/BundleHash/fromBundle.js:20 Computes BundleHash from a Bundle

Parameters

bundle
BundleType Bundle instance
crypto
Crypto dependencies
keccak256
(data) => Uint8Array Keccak256 function

Returns

BundleHashType Bundle hash

Example

import * as BundleHash from './BundleHash/index.js';
import { keccak256 } from './crypto/keccak256.js';
const hash = BundleHash.fromBundle(bundle, { keccak256 });

fromHex()

fromHex(value): BundleHashType
Defined in: src/primitives/BundleHash/fromHex.js:20 Creates BundleHash from hex string

Parameters

value
string Hex string (with or without 0x prefix)

Returns

BundleHashType BundleHash instance

Throws

If hex format is invalid

Example

import * as BundleHash from './BundleHash/index.js';
const hash = BundleHash.fromHex("0x1234...");

toHex()

toHex(hash): string
Defined in: src/primitives/BundleHash/toHex.js:17 Converts BundleHash to hex string

Parameters

hash
BundleHashType BundleHash instance

Returns

string Hex string with 0x prefix

Example

import * as BundleHash from './BundleHash/index.js';
const hex = BundleHash.toHex(hash);
console.log(hex); // "0x1234..."