Documentation
¶
Index ¶
- Variables
- func CostModelV1(cm CostModel) cbor.Marshaler
- func CostModelV2(cm CostModel) cbor.Marshaler
- func CostModelV3(cm CostModel) cbor.Marshaler
- func HashDatum(d cbor.Marshaler) (serialization.DatumHash, error)
- func PlutusDataHash(pd *PlutusData) (serialization.DatumHash, error)
- func PlutusScriptHash(script ScriptHashable) serialization.ScriptHash
- func ToCbor(x any) (string, error)
- type CM
- type CborMap
- type CostModel
- type CostModelArray
- type CostModelV1Encoding
- type CostModels
- type CostView
- type Datum
- type DatumOption
- type DatumType
- type PlutusData
- func (pd *PlutusData) Clone() PlutusData
- func (pd *PlutusData) Equal(other PlutusData) bool
- func (pd *PlutusData) MarshalCBOR() ([]uint8, error)
- func (pd *PlutusData) String() string
- func (pd *PlutusData) ToDatum() Datum
- func (pd *PlutusData) UnmarshalCBOR(value []uint8) error
- func (pd *PlutusData) UnmarshalJSON(value []byte) error
- type PlutusDataKey
- type PlutusDefArray
- type PlutusIndefArray
- type PlutusList
- type PlutusMapPair
- type PlutusMapPairs
- type PlutusType
- type PlutusV1Script
- type PlutusV2Script
- type PlutusV3Script
- type RawPlutusData
- type ScriptHashable
- type ScriptRef
Constants ¶
This section is empty.
Variables ¶
var COST_MODELSV1 = map[serialization.CustomBytes]cbor.Marshaler{ {Value: "00"}: PLUTUSV1COSTMODEL, }
var COST_MODELSV2 = map[int]cbor.Marshaler{ 1: PLUTUSV2COSTMODEL, }
var PLUTUSV1COSTMODEL = CM{}/* 166 elements not displayed */
var PLUTUSV2COSTMODEL = CostView{}/* 175 elements not displayed */
var PLUTUSV3COSTMODEL = CostModelArray( []int32{ 100788, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32, 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 1, 1000, 42921, 4, 2, 24548, 29498, 38, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 541, 1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 549, 57, 85848, 0, 1, 955506, 213312, 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10, 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18, 2780678, 6, 442008, 1, 52538055, 3756, 18, 267929, 18, 76433006, 8868, 18, 52948122, 18, 1995836, 36, 3227919, 12, 901022, 1, 166917843, 4307, 36, 284546, 36, 158221314, 26549, 36, 74698472, 36, 333849714, 1, 254006273, 72, 2174038, 72, 2261318, 64571, 4, 207616, 8310, 4, 1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 1, 100181, 726, 719, 0, 1, 100181, 726, 719, 0, 1, 100181, 726, 719, 0, 1, 107878, 680, 0, 1, 95336, 1, 281145, 18848, 0, 1, 180194, 159, 1, 1, 158519, 8942, 0, 1, 159378, 8813, 0, 1, 107490, 3298, 1, 106057, 655, 1, 1964219, 24520, 3, }, )
var V1COSTMODELKEYS = []string{}/* 166 elements not displayed */
var V2COSTMODELKEYS = []string{}/* 175 elements not displayed */
var V3COSTMODELKEYS = []string{}/* 297 elements not displayed */
Functions ¶
func CostModelV1 ¶ added in v1.7.0
func CostModelV2 ¶ added in v1.7.0
func CostModelV3 ¶ added in v1.7.0
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 conversion 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 CborMap ¶ added in v1.7.0
type CborMap struct {
Contents *map[serialization.CustomBytes]PlutusData
}
func (*CborMap) MarshalCBOR ¶ added in v1.7.0
func (*CborMap) UnmarshalCBOR ¶ added in v1.7.0
type CostModel ¶ added in v1.7.0
type CostModel []int
CostModel is an ordered slice of integer cost parameters matching the on-chain CBOR encoding for a given Plutus language version.
func (CostModel) MarshalCBOR ¶ added in v1.7.0
MarshalCBOR encodes the CostModel as a CBOR array of integers, preserving the existing slice order.
type CostModelArray ¶ added in v1.3.0
type CostModelArray []int32
func (CostModelArray) MarshalCBOR ¶ added in v1.3.0
func (cma CostModelArray) MarshalCBOR() ([]byte, error)
type CostModelV1Encoding ¶ added in v1.7.2
type CostModelV1Encoding CostModel
CostModelV1Encoding produces the CIP-35 Alonzo V1 language-view encoding: a CBOR bytestring wrapping an indefinite-length array of the cost model integers in canonical parameter order.
func (CostModelV1Encoding) MarshalCBOR ¶ added in v1.7.2
func (cm CostModelV1Encoding) MarshalCBOR() ([]byte, error)
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) String ¶ added in v1.0.12
func (pd *PlutusData) String() string
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 PlutusDataKey ¶ added in v1.0.12
type PlutusDataKey struct {
CborHexValue string
}
func (*PlutusDataKey) MarshalCBOR ¶ added in v1.0.12
func (pdk *PlutusDataKey) MarshalCBOR() ([]uint8, error)
func (*PlutusDataKey) String ¶ added in v1.0.12
func (pdk *PlutusDataKey) String() string
func (*PlutusDataKey) UnmarshalCBOR ¶ added in v1.0.12
func (pdk *PlutusDataKey) UnmarshalCBOR(value []uint8) error
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 PlutusMapPair ¶ added in v1.6.0
type PlutusMapPair struct {
Key PlutusData
Value PlutusData
}
PlutusMapPair represents a key-value pair in a Plutus data map where both key and value can be any PlutusData type. This is needed for maps where keys are constructor-tagged values.
type PlutusMapPairs ¶ added in v1.6.0
type PlutusMapPairs []PlutusMapPair
PlutusMapPairs represents a Plutus data map as a slice of key-value pairs. This representation is used instead of a Go map when keys are complex types like constructor-tagged values.
type PlutusType ¶
type PlutusType int
const ( PlutusArray PlutusType = iota PlutusMap PlutusIntMap PlutusInt PlutusBigInt PlutusBytes PlutusShortArray PlutusGenericMap // For maps with complex keys (like constructor-tagged values) )
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, network constants.Network, ) 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 PlutusV3Script ¶ added in v1.3.0
type PlutusV3Script []byte
func (PlutusV3Script) Hash ¶ added in v1.3.0
func (ps3 PlutusV3Script) Hash() (serialization.ScriptHash, error)
type RawPlutusData ¶
type RawPlutusData struct {
}
type ScriptHashable ¶
type ScriptHashable interface {
Hash() (serialization.ScriptHash, error)
}
type ScriptRef ¶
type ScriptRef []byte
func NewV1ScriptRef ¶ added in v1.6.0
func NewV1ScriptRef(script PlutusV1Script) (ScriptRef, error)
NewV1ScriptRef creates a ScriptRef for a Plutus V1 script. The inner CBOR encoding is [1, script_bytes] per the Cardano CDDL.
func NewV2ScriptRef ¶ added in v1.6.0
func NewV2ScriptRef(script PlutusV2Script) (ScriptRef, error)
NewV2ScriptRef creates a ScriptRef for a Plutus V2 script. The inner CBOR encoding is [2, script_bytes] per the Cardano CDDL.
func NewV3ScriptRef ¶ added in v1.6.0
func NewV3ScriptRef(script PlutusV3Script) (ScriptRef, error)
NewV3ScriptRef creates a ScriptRef for a Plutus V3 script. The inner CBOR encoding is [3, script_bytes] per the Cardano CDDL.
func (ScriptRef) MarshalCBOR ¶ added in v1.6.0
MarshalCBOR encodes ScriptRef as CBOR tag 24 wrapping a byte string, per the Cardano CDDL: script_ref = #6.24(bytes .cbor script)
func (*ScriptRef) UnmarshalCBOR ¶ added in v1.6.0
UnmarshalCBOR decodes ScriptRef from CBOR tag 24 wrapping a byte string.