data

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 10

Documentation

Index

Constants

View Source
const (
	CborTypeByteString uint8 = 0x40
	CborTypeArray      uint8 = 0x80
	CborTypeMap        uint8 = 0xa0
	CborTypeTag        uint8 = 0xc0

	// Only the top 3 bytes are used to specify the type
	CborTypeMask uint8 = 0xe0

	CborIndefFlag uint8 = 0x1f
)

Variables

This section is empty.

Functions

func Encode

func Encode(pd PlutusData) ([]byte, error)

Encode encodes a PlutusData value into CBOR bytes.

Types

type ByteString

type ByteString struct {
	Inner []byte
}

func (ByteString) Clone added in v0.0.13

func (b ByteString) Clone() PlutusData

func (ByteString) Equal added in v0.0.13

func (b ByteString) Equal(pd PlutusData) bool

func (ByteString) String

func (b ByteString) String() string

type Constr

type Constr struct {
	Tag    uint
	Fields []PlutusData
	// contains filtered or unexported fields
}

func (Constr) Clone added in v0.0.13

func (c Constr) Clone() PlutusData

func (Constr) Equal added in v0.0.13

func (c Constr) Equal(pd PlutusData) bool

func (Constr) String

func (c Constr) String() string

type Integer

type Integer struct {
	Inner *big.Int
}

func (Integer) Clone added in v0.0.13

func (i Integer) Clone() PlutusData

func (Integer) Equal added in v0.0.13

func (i Integer) Equal(pd PlutusData) bool

func (Integer) String

func (i Integer) String() string

type List

type List struct {
	Items []PlutusData
	// contains filtered or unexported fields
}

func (List) Clone added in v0.0.13

func (l List) Clone() PlutusData

func (List) Equal added in v0.0.13

func (l List) Equal(pd PlutusData) bool

func (List) String

func (l List) String() string

type Map

type Map struct {
	Pairs [][2]PlutusData // Each pair is [key, value]
	// contains filtered or unexported fields
}

func (Map) Clone added in v0.0.13

func (m Map) Clone() PlutusData

func (Map) Equal added in v0.0.13

func (m Map) Equal(pd PlutusData) bool

func (Map) String

func (m Map) String() string

type PlutusData

type PlutusData interface {
	Clone() PlutusData
	Equal(PlutusData) bool
	fmt.Stringer
	// contains filtered or unexported methods
}

func Decode

func Decode(b []byte) (PlutusData, error)

Decode decodes a CBOR-encoded byte slice into a PlutusData value. It returns an error if the input is invalid or not a valid PlutusData encoding.

func NewByteString

func NewByteString(value []byte) PlutusData

NewByteString creates a new ByteString variant.

func NewConstr

func NewConstr(tag uint, fields ...PlutusData) PlutusData

NewConstr creates a new Constr variant.

func NewConstrDefIndef added in v0.0.8

func NewConstrDefIndef(useIndef bool, tag uint, fields ...PlutusData) PlutusData

NewConstrDefIndef creates a Constr with the ability to specify whether it should use definite- or indefinite-length encoding

func NewInteger

func NewInteger(value *big.Int) PlutusData

NewInteger creates a new Integer variant.

func NewList

func NewList(items ...PlutusData) PlutusData

NewList creates a new List variant.

func NewListDefIndef added in v0.0.8

func NewListDefIndef(useIndef bool, items ...PlutusData) PlutusData

NewListDefIndef creates a list with the ability to specify whether it should use definite- or indefinite-length encoding

func NewMap

func NewMap(pairs [][2]PlutusData) PlutusData

NewMap creates a new Map variant.

func NewMapDefIndef added in v0.0.11

func NewMapDefIndef(useIndef bool, pairs [][2]PlutusData) PlutusData

NewMapDefIndef creates a new Map with the ability to specify whether it should use definite- or indefinite-length encoding

type PlutusDataWrapper

type PlutusDataWrapper struct {
	Data PlutusData
}

func (*PlutusDataWrapper) MarshalCBOR

func (p *PlutusDataWrapper) MarshalCBOR() ([]byte, error)

func (*PlutusDataWrapper) UnmarshalCBOR

func (p *PlutusDataWrapper) UnmarshalCBOR(data []byte) error

type RawMessageStr added in v0.0.6

type RawMessageStr string

RawMessageStr is a hashable variant of cbor.RawMessage

func (RawMessageStr) Bytes added in v0.0.6

func (r RawMessageStr) Bytes() []byte

func (RawMessageStr) MarshalCBOR added in v0.0.6

func (r RawMessageStr) MarshalCBOR() ([]byte, error)

func (*RawMessageStr) UnmarshalCBOR added in v0.0.6

func (r *RawMessageStr) UnmarshalCBOR(data []byte) error

Jump to

Keyboard shortcuts

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