Documentation
¶
Index ¶
Constants ¶
const ( // CborTagSet is used for sets in Cardano CDDL: set<a> = #6.258([* a]) CborTagSet = 258 // CBOR major type 5 (map) encoding constants // Maps with 0-23 entries use 0xa0 + length directly CborMapBase = 0xa0 // Base byte for maps with length 0-23 CborMap1ByteLen = 0xb8 // Map with 1-byte length following (24-255 entries) CborMap2ByteLen = 0xb9 // Map with 2-byte length following (256-65535 entries) CborMap4ByteLen = 0xba // Map with 4-byte length following (up to ~4 billion) CborMap8ByteLen = 0xbb // Map with 8-byte length following (up to ~18 quintillion) )
CBOR constants used in Cardano
Variables ¶
This section is empty.
Functions ¶
func DecodeMapToRaw ¶
func DecodeMapToRaw(data []byte) (map[uint64]RawMessage, error)
DecodeMapToRaw decodes a CBOR map into a map of uint64 keys to raw CBOR bytes. This allows preserving the original CBOR encoding for each field value, which is critical for data containing CBOR tags that may not decode correctly when re-encoded through Go interfaces.
func UnwrapSetTag ¶
UnwrapSetTag checks if the data is wrapped in a CBOR tag 258 (Set). If it is, it returns the unwrapped content. Otherwise, it returns the original data. The second return value indicates whether the data was wrapped in a Set tag.
Types ¶
type MapPair ¶
type MapPair struct {
KeyRaw RawMessage
ValueRaw RawMessage
}
MapPair represents a key-value pair in a CBOR map where both key and value are preserved as raw CBOR bytes. This is useful for maps that may have complex keys (like CBOR tags) that can't be used as Go map keys.
func DecodeMapPairs ¶
DecodeMapPairs decodes a CBOR map into a slice of key-value pairs, preserving raw bytes for both keys and values. This is essential for handling Plutus data maps where keys can be constructor-tagged values (cbor.Tag) which cannot be used as Go map keys.