Documentation ¶
Index ¶
- Variables
- func HashDatum(d cbor.Marshaler) (serialization.DatumHash, error)
- func PlutusDataHash(pd *PlutusData) (serialization.DatumHash, error)
- func PlutusScriptHash(script ScriptHashable) serialization.ScriptHash
- func ToCbor(x interface{}) (string, error)
- type CM
- type CostModels
- type CostView
- type Datum
- type DatumOption
- type DatumType
- type PlutusData
- type PlutusDefArray
- type PlutusIndefArray
- type PlutusList
- type PlutusType
- type PlutusV1Script
- type PlutusV2Script
- type RawPlutusData
- type ScriptHashable
- type ScriptRef
Constants ¶
This section is empty.
Variables ¶
View Source
var COST_MODELSV1 = map[serialization.CustomBytes]cbor.Marshaler{{Value: "00"}: PLUTUSV1COSTMODEL}
View Source
var COST_MODELSV2 = map[int]cbor.Marshaler{1: PLUTUSV2COSTMODEL}
View Source
var PLUTUSV1COSTMODEL = CM{}/* 166 elements not displayed */
View Source
var PLUTUSV2COSTMODEL = CostView{}/* 175 elements not displayed */
Functions ¶
func HashDatum ¶
func HashDatum(d cbor.Marshaler) (serialization.DatumHash, error)
*
HashDatum computes the hash of a CBOR marshaler using the Blake2b algorithm. Params: d (cbor.Marshaler): The CBOR marshaler to be hashed Returns: serialization.DatumHash: The hash of the CBOR marshaler. error: An error if the hash Datum fails.
func PlutusDataHash ¶
func PlutusDataHash(pd *PlutusData) (serialization.DatumHash, error)
*
PlutusDataHash computes the hash of a PlutusData structure using the Blake2b algorithm. Params: pd (*PlutusData): A pointer to the PlutusData structure to be hashed. Returns: serialization.DatumHash: The hash of the PlutusData. error: An error if the PlutusDataHash fails.
func PlutusScriptHash ¶
func PlutusScriptHash(script ScriptHashable) serialization.ScriptHash
*
PlutusScriptHash computes the script hash of a ScriptHashable object. Params: script (ScriptHashable): The ScriptHashable object to be hashed. Returns: serialization.ScriptHash: The script hash of the ScriptHashable object.
func ToCbor ¶
*
ToCbor converts the given interface to a hexadecimal-encoded CBOR string. Params: x (interface{}): The input value to be encoded to CBOR to converted to a hexadecimal string. Returns: string: The hexadecimal-encoded CBOR representation of the input value. error: An error if the convertion fails.
Types ¶
type CM ¶
func (CM) MarshalCBOR ¶
*
MarshalCBOR encodes the CM into a CBOR-encoded byte slice, in which it serializes the map key alphabetically and encodes the respective values. Returns: []byte: The CBOR-encoded byte slice. error: An error if marshaling fails.
type CostModels ¶
type CostModels map[serialization.CustomBytes]CM
type CostView ¶
func (CostView) MarshalCBOR ¶
*
MarshalCBOR encodes the CostView into a CBOR-encoded byte slice, in which it serializes the map key alphabetically and encodes the respective values. Returns: []byte: The CBOR-encoded byte slice. error: An error if marshaling fails.
type Datum ¶
type Datum struct { PlutusDataType PlutusType TagNr uint64 Value any }
func (*Datum) Clone ¶
*
Clone creates a deep copy of the Datum> Returns: Datum: A deep copy of the Datum
func (Datum) MarshalCBOR ¶
*
MarshalCBOR encodes the Datum into a CBOR-encoded byte slice, it applies a CBOR tag, if TagNr is not 0, otherwise it marshals the Value Returns: []uint8: The CBOR-encoded byte slice. error: An error if marshaling fails.
func (*Datum) ToPlutusData ¶
func (pd *Datum) ToPlutusData() PlutusData
*
ToPlutusData converts a datum to PlutusData, encoding the Datum into CBOR format and then decodes it into a PlutusData. Returns: PlutusData: The converted PlutusData.
func (*Datum) UnmarshalCBOR ¶
*
UnmarshalCBOR decodes a CBOR-encoded byte slice into a Datum. It handles different Plutus data types and applies appropriate decoding logic. Returns: error: An error if unmarshaling fails.
type DatumOption ¶ added in v1.0.5
type DatumOption struct { DatumType DatumType Hash []byte Inline *PlutusData // contains filtered or unexported fields }
func DatumOptionHash ¶ added in v1.0.5
func DatumOptionHash(hash []byte) DatumOption
func DatumOptionInline ¶ added in v1.0.5
func DatumOptionInline(pd *PlutusData) DatumOption
func (DatumOption) MarshalCBOR ¶ added in v1.0.5
func (d DatumOption) MarshalCBOR() ([]byte, error)
func (*DatumOption) UnmarshalCBOR ¶ added in v1.0.5
func (d *DatumOption) UnmarshalCBOR(b []byte) error
type PlutusData ¶
type PlutusData struct { PlutusDataType PlutusType TagNr uint64 Value any }
func (*PlutusData) Clone ¶
func (pd *PlutusData) Clone() PlutusData
*
Clone creates a deep copy of a PlutusData object. Returns: PlutusData: A cloned PlutusData object.
func (*PlutusData) Equal ¶ added in v1.0.3
func (pd *PlutusData) Equal(other PlutusData) bool
*
Equal check if two PlutusData values are equal using their CBOR representations. Params: other (PlutusData): The other PlutusData to compare to. Returns: bool: True if the PlutusData are equal, false otherwise.
func (*PlutusData) MarshalCBOR ¶
func (pd *PlutusData) MarshalCBOR() ([]uint8, error)
*
MarshalCBOR encodes the PlutusData into a CBOR byte slice. Returns: []uint8: The CBOR-encoded byte slice. error: An error, if any, during ecoding.
func (*PlutusData) ToDatum ¶
func (pd *PlutusData) ToDatum() Datum
*
ToDatum converts a PlutusData to a Datum, in which it encodes the PlutusData into CBOR format and later into a Datum. Returns: Datum: The converted Datum.
func (*PlutusData) UnmarshalCBOR ¶
func (pd *PlutusData) UnmarshalCBOR(value []uint8) error
*
UnmarshalCBOR unmarshals CBOR-encoded data into a PlutusData object. Params: value ([]uint8): The CBOR-encoded data to unmarshal. Returns: error: An error, if any, during unmarshaling.
func (*PlutusData) UnmarshalJSON ¶ added in v1.0.3
func (pd *PlutusData) UnmarshalJSON(value []byte) error
*
UnmarshalJSON unmarshals JSON-encoded PlutusData into a PlutusData object. Params: value ([]byte): The JSON-encoded data to unmarshal. Returns: error: An error, if any, during unmarshaling.
type PlutusDefArray ¶ added in v1.0.3
type PlutusDefArray []PlutusData
func (PlutusDefArray) Len ¶ added in v1.0.3
func (pia PlutusDefArray) Len() int
*
Len returns the length of the PlutusDefArray. Returns: int: The length of the PlutusDefArray.
type PlutusIndefArray ¶
type PlutusIndefArray []PlutusData
func (*PlutusIndefArray) Clone ¶
func (pia *PlutusIndefArray) Clone() PlutusIndefArray
*
Clone creates a deep copy of the PlutusIndefArray. Returns: PlutusIndefArray: A deep copy of the PlutusIndefArray.
func (PlutusIndefArray) Len ¶ added in v1.0.3
func (pia PlutusIndefArray) Len() int
*
Len returns the length of the PlutusIndefArray. Returns: int: The length of the PlutusIndefArray.
func (PlutusIndefArray) MarshalCBOR ¶
func (pia PlutusIndefArray) MarshalCBOR() ([]uint8, error)
*
MarshalCBOR encodes the PlutusIndefArray into a CBOR-encoded byte slice, in which it serializes the elements in indefinite-length array format. Returns: []uint8: The CBOR-encoded byte slice. error: An error if marshaling fails.
type PlutusList ¶ added in v1.0.3
type PlutusList interface {
Len() int
}
type PlutusType ¶
type PlutusType int
const ( PlutusArray PlutusType = iota PlutusMap PlutusInt PlutusBytes PlutusShortArray )
type PlutusV1Script ¶
type PlutusV1Script []byte
func (PlutusV1Script) Hash ¶
func (ps PlutusV1Script) Hash() (serialization.ScriptHash, error)
*
Hash computes the script hash for a PlutusV1Script. Returns: serialization.ScriptHash: The script hash of the PlutusV1Script. error: An error if the hashing fails.
func (*PlutusV1Script) ToAddress ¶ added in v1.0.3
func (ps *PlutusV1Script) ToAddress(stakingCredential []byte) Address.Address
*
ToAddress converts a PlutusV1Script to an Address with an optional staking credential. Params: stakingCredential ([]byte): The staking credential to include in the address. Returns: Address.Address: The generated address.
type PlutusV2Script ¶
type PlutusV2Script []byte
func (PlutusV2Script) Hash ¶
func (ps PlutusV2Script) Hash() (serialization.ScriptHash, error)
*
Hash computes the script hash for a PlutusV2Script. Returns: serialization.ScriptHash: The script hash of the PlutusV2Script. error: An error if the Hashing fails.
func (*PlutusV2Script) ToAddress ¶ added in v1.0.3
func (ps *PlutusV2Script) ToAddress(stakingCredential []byte) Address.Address
*
ToAddress converts a PlutusV2Script to an Address with an optional staking credential. Params: stakingCredential ([]byte): The staking credential to include in the address. Returns: Address.Address: The generated address.
type RawPlutusData ¶
type RawPlutusData struct { }
type ScriptHashable ¶
type ScriptHashable interface {
Hash() (serialization.ScriptHash, error)
}
Click to show internal directories.
Click to hide internal directories.