Files
Hanzo AI b9e41288cb initial commit: extract ZAP-native codec from luxfi/codec
Wave 2G-Archive extracted github.com/luxfi/codec/zapcodec into its
own top-level module so consumers (proto/zap_codec at the canonical
wallet codec construction site) can depend on it without pulling in
the soon-to-be-archived luxfi/codec module.

Self-contained design:
  - own sentinel errors (errors.go)
  - embedded struct-fielder (struct_fielder.go, lifted from codec/reflectcodec)
  - own packer (packer.go, local little-endian implementation)
  - external dependency only on luxfi/utils/wrappers for the cross-module Packer type

Wire format is byte-identical to codec/zapcodec — extraction is a
code-level move, not a wire-format change.

Migrated callers:
  - github.com/luxfi/proto/zap_codec (v1.3.0+)
  - github.com/luxfi/genesis/builder (post v1.13.12)
2026-06-06 05:46:22 -07:00

22 lines
1.1 KiB
Go

// Copyright (C) 2025-2026, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package zapcodec
import "errors"
// Sentinel errors — same surface as the historical luxfi/codec
// sentinels so consumers asserting via errors.Is on the post-rename
// values get equivalent behaviour after the module move.
var (
ErrUnsupportedType = errors.New("zapcodec: unsupported type")
ErrMaxSliceLenExceeded = errors.New("zapcodec: max slice length exceeded")
ErrDoesNotImplementInterface = errors.New("zapcodec: does not implement interface")
ErrUnexportedField = errors.New("zapcodec: unexported field")
ErrMarshalZeroLength = errors.New("zapcodec: can't marshal zero length value")
ErrUnmarshalZeroLength = errors.New("zapcodec: can't unmarshal zero length value")
ErrMarshalNil = errors.New("zapcodec: can't marshal nil pointer")
ErrUnmarshalNil = errors.New("zapcodec: can't unmarshal into nil")
ErrDuplicateType = errors.New("zapcodec: duplicate type registration")
)