Skip to main content

Type Alias: Bytes32

type Bytes32 = Hex & object;

Defined in: packages/overcast-core/src/types/index.ts:115

A 32-byte value as a 0x-prefixed, lower-case hex string: the protocol's canonical, cross-chain representation of everything it identifies — assets, accounts, settlement layers, salts, digests, and the content-addresses of offers and options.

One type for all of them because on the wire and in the hash they are all the same thing: a 32-byte slot. The Solidity and Rust sides both work in exactly these terms (see serialization.ts), so holding chain-formatted strings in core and converting back at hash time was a detour through an encoding core has no business knowing. Two consequences worth internalizing:

  • Core needs no chain knowledge. getId(offer) and op.digest() take no codec, no utils, no layer — the bytes are already there. There is nothing to mismatch, so the class of bug where a correct-looking id matches no contract cannot arise.
  • An address is 32 bytes here even where the chain is narrower. An EVM address occupies the low 20 bytes of its slot, left-padded with zeros. The widening is the layer's business, in OvercastUtils.toBytes32.

Build one with bytesToHex32, randomBytes32, parseBytes32 (which throws on anything that is not 32 well-formed hex bytes) or the layer's OvercastUtils.toBytes32 — never with a cast. Values are normalized to lower case, so two encodings of the same bytes are === and key a Map identically.

Type Declaration

__width

readonly __width: 32;