Metadata

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlonzoMetadata

type AlonzoMetadata struct {
	Metadata      Metadata                    `cbor:"0,keyasint,omitempty"`
	NativeScripts []NativeScript.NativeScript `cbor:"1,keyasint,omitempty"`
	PlutusScripts []uint8                     `cbor:"2,keyasint,omitempty"`
}

type AuxiliaryData

type AuxiliaryData struct {
	// contains filtered or unexported fields
}

func (*AuxiliaryData) Hash

func (ad *AuxiliaryData) Hash() []byte

*

Hash computes computes the has of the AuxiliaryData.

Returns:
	[]byte: The computed hash or nil if all metadata fileds are empty.

func (*AuxiliaryData) MarshalCBOR

func (ad *AuxiliaryData) MarshalCBOR() ([]byte, error)

*

MarshalCBOR serializes the AUxiliaryData to a CBOR byte slice.

Returns:
	[]byte: The CBOR-serialized AuxiliaryData.
	error: An error if serialization fails.

func (*AuxiliaryData) SetAlonzoMetadata

func (ad *AuxiliaryData) SetAlonzoMetadata(value AlonzoMetadata)

*

SetAlonzoMetadata sets the Alonzo metadata for the AuxiliaryData.

func (*AuxiliaryData) SetBasicMetadata

func (ad *AuxiliaryData) SetBasicMetadata(value Metadata)

*

SetBasicMetadata sets the basic metadata for the AuxiliaryData.

func (*AuxiliaryData) SetShelleyMetadata

func (ad *AuxiliaryData) SetShelleyMetadata(value ShelleyMaryMetadata)

*

SetShelleyMetadata sets the Shelley metadata for the AuxiliaryData.

func (*AuxiliaryData) UnmarshalCBOR

func (ad *AuxiliaryData) UnmarshalCBOR(value []byte) error

*

UnmarshalCBOR deserializes the AuxiliaryData from a CBOR-encoded byte slice.

Params:
	value []byte: The CBOR-encoded data to deserialize.

Returns:
	error: An error if deserialization fails.

type JSONSchema added in v1.7.2

type JSONSchema int

JSONSchema selects the Cardano transaction metadata JSON mapping.

const (
	// JSONNoSchema is the cardano-cli no-schema JSON mapping used by
	// --metadata-json-file. JSON objects become metadata maps, strings
	// beginning with a valid lowercase 0x hex prefix become bytes.
	JSONNoSchema JSONSchema = iota

	// JSONDetailedSchema is the tagged mapping with int, bytes, string,
	// list and map fields.
	JSONDetailedSchema
)

type Metadata

type Metadata map[int]any

type MetadatumMap added in v1.7.2

type MetadatumMap []MetadatumMapEntry

MetadatumMap preserves arbitrary metadata map keys, including bytes.

func (MetadatumMap) MarshalCBOR added in v1.7.2

func (m MetadatumMap) MarshalCBOR() ([]byte, error)

MarshalCBOR encodes a Cardano metadata map with deterministic key ordering.

type MetadatumMapEntry added in v1.7.2

type MetadatumMapEntry struct {
	Key   any
	Value any
}

MetadatumMapEntry is one key/value pair in a Cardano metadata map.

type MinimalMetadata

type MinimalMetadata map[string]any

type NegativeInteger added in v1.7.2

type NegativeInteger uint64

NegativeInteger represents a metadata integer below math.MinInt64. Its value is the CBOR major type 1 argument, so it encodes as -1-n.

func (NegativeInteger) MarshalCBOR added in v1.7.2

func (n NegativeInteger) MarshalCBOR() ([]byte, error)

MarshalCBOR encodes a large negative metadata integer.

func (NegativeInteger) String added in v1.7.2

func (n NegativeInteger) String() string

String returns the decimal representation of the negative integer.

type PoliciesMetadata

type PoliciesMetadata map[string]MinimalMetadata

type ShelleyMaryMetadata

type ShelleyMaryMetadata struct {
	Metadata      Metadata                    `cbor:",omitempty"`
	NativeScripts []NativeScript.NativeScript `cbor:",omitempty"`
	// contains filtered or unexported fields
}

func ShelleyMaryMetadataFromJSON added in v1.7.2

func ShelleyMaryMetadataFromJSON(jsonData []byte) (ShelleyMaryMetadata, error)

ShelleyMaryMetadataFromJSON parses cardano-cli-style metadata JSON using the no-schema mapping and returns Shelley Mary metadata.

func ShelleyMaryMetadataFromJSONWithSchema added in v1.7.2

func ShelleyMaryMetadataFromJSONWithSchema(
	jsonData []byte,
	schema JSONSchema,
) (ShelleyMaryMetadata, error)

ShelleyMaryMetadataFromJSONWithSchema parses metadata JSON using the requested Cardano metadata JSON mapping.

func (*ShelleyMaryMetadata) MarshalCBOR

func (smm *ShelleyMaryMetadata) MarshalCBOR() ([]byte, error)

*

MarshalCBOR marshals a ShelleyMaryMetadata instance into CBOR-encoded data.

Returns:
	([]byte, error): The CBOR-encoded data and an error if marshaling fails,
					 nil otherwise.

type TagMetadata

type TagMetadata map[string]any

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL