Skip to main content
import { Ssz, Slot } from 'voltaire-effect/primitives'
import * as Schema from 'effect/Schema'

// Schema wraps Uint8Array with branded type
const sszData = Schema.decodeSync(Ssz.Bytes)(new Uint8Array([1, 2, 3]))

// Type guard
Schema.is(Ssz.Bytes)(new Uint8Array([1, 2, 3])) // true
Schema.is(Ssz.Bytes)('not bytes')               // false

// Compose with other schemas
const BeaconDataSchema = Schema.Struct({
  slot: Slot.Number,
  body: Ssz.Bytes,
})
Serialization format for Ethereum consensus layer. Branded type wrapper for type safety.