common

package
v0.143.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 25 Imported by: 20

Documentation

Index

Constants

View Source
const (
	AddressHeaderTypeMask    = 0xF0
	AddressHeaderNetworkMask = 0x0F
	AddressHashSize          = 28

	AddressNetworkTestnet = 0
	AddressNetworkMainnet = 1

	AddressTypeKeyKey        = 0b0000
	AddressTypeScriptKey     = 0b0001
	AddressTypeKeyScript     = 0b0010
	AddressTypeScriptScript  = 0b0011
	AddressTypeKeyPointer    = 0b0100
	AddressTypeScriptPointer = 0b0101
	AddressTypeKeyNone       = 0b0110
	AddressTypeScriptNone    = 0b0111
	AddressTypeByron         = 0b1000
	AddressTypeNoneKey       = 0b1110
	AddressTypeNoneScript    = 0b1111

	ByronAddressTypePubkey = 0
	ByronAddressTypeScript = 1
	ByronAddressTypeRedeem = 2
)
View Source
const (
	DrepTypeAddrKeyHash  = 0
	DrepTypeScriptHash   = 1
	DrepTypeAbstain      = 2
	DrepTypeNoConfidence = 3
)
View Source
const (
	PoolRelayTypeSingleHostAddress = 0
	PoolRelayTypeSingleHostName    = 1
	PoolRelayTypeMultiHostName     = 2
)
View Source
const (
	Blake2b256Size = 32
	Blake2b224Size = 28
	Blake2b160Size = 20
)
View Source
const (
	CredentialTypeAddrKeyHash = 0
	CredentialTypeScriptHash  = 1
)
View Source
const (
	VoterTypeConstitutionalCommitteeHotKeyHash    uint8 = 0
	VoterTypeConstitutionalCommitteeHotScriptHash uint8 = 1
	VoterTypeDRepKeyHash                          uint8 = 2
	VoterTypeDRepScriptHash                       uint8 = 3
	VoterTypeStakingPoolKeyHash                   uint8 = 4
)
View Source
const (
	GovVoteNo      uint8 = 0
	GovVoteYes     uint8 = 1
	GovVoteAbstain uint8 = 2
)
View Source
const (
	GovActionTypeParameterChange    = 0
	GovActionTypeHardForkInitiation = 1
	GovActionTypeTreasuryWithdrawal = 2
	GovActionTypeNoConfidence       = 3
	GovActionTypeUpdateCommittee    = 4
	GovActionTypeNewConstitution    = 5
	GovActionTypeInfo               = 6
)
View Source
const (
	NonceTypeNeutral = 0
	NonceTypeNonce   = 1
)
View Source
const (
	ScriptRefTypeNativeScript = 0
	ScriptRefTypePlutusV1     = 1
	ScriptRefTypePlutusV2     = 2
	ScriptRefTypePlutusV3     = 3
)

Variables

View Source
var EraInvalid = Era{
	Id:   0,
	Name: "invalid",
}

Functions

func CalculateMinFee added in v0.142.0

func CalculateMinFee(bodySize int, minFeeA uint, minFeeB uint) uint64

CalculateMinFee computes the minimum fee for a transaction body given its CBOR-encoded size and the protocol parameters MinFeeA and MinFeeB

func CalculateOptimalPoolCount added in v0.141.0

func CalculateOptimalPoolCount(_ uint64, k uint64) uint64

CalculateOptimalPoolCount calculates the optimal number of stake pools totalActiveStake is unused as current implementation is simplified and only uses k parameter. TODO: implement real optimal pool count formula when requirements are finalized.

func CalculatePoolSaturation added in v0.141.0

func CalculatePoolSaturation(
	poolStake uint64,
	totalActiveStake uint64,
	saturationPoint uint64,
) float64

CalculatePoolSaturation calculates the saturation level of a pool Returns 1.0 (fully saturated) when saturationPointStake == 0 to handle edge cases like very small totalActiveStake or misconfigured saturationPoint parameters.

func ConvertToUtxorpcCardanoCostModels added in v0.102.0

func ConvertToUtxorpcCardanoCostModels(
	models map[uint][]int64,
) *cardano.CostModels

ConvertToUtxorpcCardanoCostModels converts a map of cost models for Plutus scripts into cardano.CostModels Only PlutusV(keys 1, 2, and 3) are supported.

func RegisterEra

func RegisterEra(era Era)

func ToUtxorpcBigInt added in v0.139.0

func ToUtxorpcBigInt(v uint64) *utxorpc.BigInt

ToUtxorpcBigInt converts a uint64 into a *utxorpc.BigInt pointer

func TransactionBodyToUtxorpc added in v0.117.0

func TransactionBodyToUtxorpc(tx TransactionBody) (*utxorpc.Tx, error)

TransactionBodyToUtxorpc is a common helper for converting TransactionBody to utxorpc.Tx

func ValidateBlockBodyHash added in v0.143.0

func ValidateBlockBodyHash(
	data []byte,
	expectedBodyHash Blake2b256,
	eraName string,
	minRawLength int,
) error

ValidateBlockBodyHash validates the block body hash during parsing. It takes the raw CBOR data, expected body hash, and era-specific parameters.

func ValidatePoolPledge added in v0.141.0

func ValidatePoolPledge(
	_ PoolKeyHash,
	poolParams *PoolRegistrationCertificate,
	ownerStake map[AddrKeyHash]uint64,
) bool

ValidatePoolPledge validates that a pool meets its pledge requirement poolID is unused as validation only depends on pool parameters and owner stake amounts

func VerifyTransaction added in v0.143.0

func VerifyTransaction(
	tx Transaction,
	slot uint64,
	ledgerState LedgerState,
	protocolParams ProtocolParameters,
	validationRules []UtxoValidationRuleFunc,
) error

VerifyTransaction validates a transaction against the given validation rules. It runs all provided UtxoValidationRuleFunc functions and returns the first error encountered, or nil if all validations pass.

Types

type AdaPots added in v0.141.0

type AdaPots struct {
	Reserves uint64 // The reserves pot
	Treasury uint64 // The treasury pot
	Rewards  uint64 // The rewards pot
}

AdaPots represents the three main ADA pots in Cardano

func CalculateAdaPots added in v0.141.0

func CalculateAdaPots(
	currentPots AdaPots,
	params RewardParameters,
	epochFees uint64,
	totalBlocksInEpoch uint32,
) AdaPots

CalculateAdaPots calculates the ADA pots for the next epoch

type AddrKeyHash

type AddrKeyHash = Blake2b224

type Address

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

func NewAddress

func NewAddress(addr string) (Address, error)

NewAddress returns an Address based on the provided bech32/base58 address string It detects if the string has mixed case assumes it is a base58 encoded address otherwise, it assumes it is bech32 encoded

func NewAddressFromBytes added in v0.125.0

func NewAddressFromBytes(addrBytes []byte) (Address, error)

NewAddressFromBytes returns an Address based on the raw bytes provided

func NewAddressFromParts

func NewAddressFromParts(
	addrType uint8,
	networkId uint8,
	paymentAddr []byte,
	stakingAddr []byte,
) (Address, error)

NewAddressFromParts returns an Address based on the individual parts of the address that are provided

func NewByronAddressFromParts added in v0.107.0

func NewByronAddressFromParts(
	byronAddrType uint64,
	paymentAddr []byte,
	attr ByronAddressAttributes,
) (Address, error)

func NewByronAddressRedeem added in v0.107.0

func NewByronAddressRedeem(
	pubkey []byte,
	attr ByronAddressAttributes,
) (Address, error)

func (*Address) ByronAttr added in v0.109.0

func (a *Address) ByronAttr() ByronAddressAttributes

func (Address) ByronType added in v0.109.0

func (a Address) ByronType() uint64

func (Address) Bytes

func (a Address) Bytes() ([]byte, error)

Bytes returns the underlying bytes for the address

func (*Address) MarshalCBOR

func (a *Address) MarshalCBOR() ([]byte, error)

func (Address) MarshalJSON

func (a Address) MarshalJSON() ([]byte, error)

func (Address) NetworkId added in v0.109.0

func (a Address) NetworkId() uint

func (*Address) PayloadPayload added in v0.134.0

func (a *Address) PayloadPayload() AddressPayload

PaymentPayload returns the payment payload

func (Address) PaymentAddress

func (a Address) PaymentAddress() *Address

PaymentAddress returns a new Address with only the payment address portion. This will return nil for anything other than payment and script addresses

func (*Address) PaymentKeyHash

func (a *Address) PaymentKeyHash() Blake2b224

PaymentKeyHash returns a new Blake2b224 hash of the payment key

func (Address) StakeAddress

func (a Address) StakeAddress() *Address

StakeAddress returns a new Address with only the stake key portion. This will return nil if the address is not a payment/staking key pair

func (*Address) StakeKeyHash

func (a *Address) StakeKeyHash() Blake2b224

StakeKeyHash returns a new Blake2b224 hash of the stake key

func (*Address) StakingPayload added in v0.134.0

func (a *Address) StakingPayload() AddressPayload

StakingPayload returns the staking payload

func (Address) String

func (a Address) String() string

String returns the bech32-encoded version of the address

func (*Address) ToPlutusData added in v0.129.0

func (a *Address) ToPlutusData() data.PlutusData

func (Address) Type added in v0.109.0

func (a Address) Type() uint8

func (*Address) UnmarshalCBOR

func (a *Address) UnmarshalCBOR(data []byte) error

type AddressPayload added in v0.134.0

type AddressPayload interface {
	// contains filtered or unexported methods
}

type AddressPayloadKeyHash added in v0.134.0

type AddressPayloadKeyHash struct {
	Hash AddrKeyHash
}

type AddressPayloadPointer added in v0.134.0

type AddressPayloadPointer struct {
	Slot      uint64
	TxIndex   uint64
	CertIndex uint64
}

type AddressPayloadScriptHash added in v0.134.0

type AddressPayloadScriptHash struct {
	Hash ScriptHash
}

type AssetFingerprint

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

func NewAssetFingerprint

func NewAssetFingerprint(policyId []byte, assetName []byte) AssetFingerprint

func (AssetFingerprint) Hash

func (a AssetFingerprint) Hash() Blake2b160

func (AssetFingerprint) String

func (a AssetFingerprint) String() string

type AuthCommitteeHotCertificate

type AuthCommitteeHotCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType       uint
	ColdCredential Credential
	HotCredential  Credential
}

func (*AuthCommitteeHotCertificate) Type added in v0.116.0

func (*AuthCommitteeHotCertificate) UnmarshalCBOR

func (c *AuthCommitteeHotCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*AuthCommitteeHotCertificate) Utxorpc

type Blake2b160

type Blake2b160 [Blake2b160Size]byte

func Blake2b160Hash

func Blake2b160Hash(data []byte) Blake2b160

Blake2b160Hash generates a Blake2b-160 hash from the provided data

func NewBlake2b160

func NewBlake2b160(data []byte) Blake2b160

func (Blake2b160) Bytes

func (b Blake2b160) Bytes() []byte

func (Blake2b160) MarshalCBOR added in v0.139.0

func (b Blake2b160) MarshalCBOR() ([]byte, error)

func (Blake2b160) MarshalJSON added in v0.139.0

func (b Blake2b160) MarshalJSON() ([]byte, error)

func (Blake2b160) String

func (b Blake2b160) String() string

func (Blake2b160) ToPlutusData added in v0.129.0

func (b Blake2b160) ToPlutusData() data.PlutusData

type Blake2b224

type Blake2b224 [Blake2b224Size]byte

func Blake2b224Hash

func Blake2b224Hash(data []byte) Blake2b224

Blake2b224Hash generates a Blake2b-224 hash from the provided data

func NewBlake2b224

func NewBlake2b224(data []byte) Blake2b224

func (Blake2b224) Bech32 added in v0.141.0

func (b Blake2b224) Bech32(prefix string) string

func (Blake2b224) Bytes

func (b Blake2b224) Bytes() []byte

func (Blake2b224) MarshalCBOR added in v0.139.0

func (b Blake2b224) MarshalCBOR() ([]byte, error)

func (Blake2b224) MarshalJSON added in v0.100.0

func (b Blake2b224) MarshalJSON() ([]byte, error)

func (Blake2b224) String

func (b Blake2b224) String() string

func (Blake2b224) ToPlutusData added in v0.129.0

func (b Blake2b224) ToPlutusData() data.PlutusData

type Blake2b256

type Blake2b256 [Blake2b256Size]byte

func Blake2b256Hash

func Blake2b256Hash(data []byte) Blake2b256

Blake2b256Hash generates a Blake2b-256 hash from the provided data

func CalculateEpochNonce added in v0.108.0

func CalculateEpochNonce(
	stableBlockNonce []byte,
	prevEpochFirstBlockHash []byte,
	extraEntropy []byte,
) (Blake2b256, error)

CalculateEpochNonce calculates an epoch nonce from the rolling nonce (eta_v) value of the block immediately before the stability window and the block hash of the first block from the previous epoch.

func CalculateRollingNonce added in v0.108.0

func CalculateRollingNonce(
	prevBlockNonce []byte,
	blockVrf []byte,
) (Blake2b256, error)

CalculateRollingNonce calculates a rolling nonce (eta_v) value from the previous block's eta_v value and the current block's VRF result

func NewBlake2b256

func NewBlake2b256(data []byte) Blake2b256

func (Blake2b256) Bytes

func (b Blake2b256) Bytes() []byte

func (Blake2b256) MarshalCBOR added in v0.139.0

func (b Blake2b256) MarshalCBOR() ([]byte, error)

func (Blake2b256) MarshalJSON added in v0.139.0

func (b Blake2b256) MarshalJSON() ([]byte, error)

func (Blake2b256) String

func (b Blake2b256) String() string

func (Blake2b256) ToPlutusData added in v0.129.0

func (b Blake2b256) ToPlutusData() data.PlutusData

type Block added in v0.105.0

type Block interface {
	BlockHeader
	Header() BlockHeader
	Type() int
	Transactions() []Transaction
	Utxorpc() (*utxorpc.Block, error)
}

type BlockHeader added in v0.105.0

type BlockHeader interface {
	Hash() Blake2b256
	PrevHash() Blake2b256
	BlockNumber() uint64
	SlotNumber() uint64
	IssuerVkey() IssuerVkey
	BlockBodySize() uint64
	Era() Era
	Cbor() []byte
	BlockBodyHash() Blake2b256
}

type BootstrapWitness added in v0.110.0

type BootstrapWitness struct {
	cbor.StructAsArray
	PublicKey  []byte
	Signature  []byte
	ChainCode  []byte
	Attributes []byte
}

type ByronAddressAttributes added in v0.107.0

type ByronAddressAttributes struct {
	Payload []byte
	Network *uint32
}

func (*ByronAddressAttributes) MarshalCBOR added in v0.107.0

func (a *ByronAddressAttributes) MarshalCBOR() ([]byte, error)

func (*ByronAddressAttributes) UnmarshalCBOR added in v0.107.0

func (a *ByronAddressAttributes) UnmarshalCBOR(data []byte) error

type CertState added in v0.109.0

type CertState interface {
	StakeRegistration([]byte) ([]StakeRegistrationCertificate, error)
}

CertState defines the interface for querying the certificate state

type Certificate

type Certificate interface {
	Cbor() []byte
	Utxorpc() (*utxorpc.Certificate, error)
	Type() uint
	// contains filtered or unexported methods
}

type CertificateType added in v0.140.0

type CertificateType uint
const (
	CertificateTypeStakeRegistration               CertificateType = 0
	CertificateTypeStakeDeregistration             CertificateType = 1
	CertificateTypeStakeDelegation                 CertificateType = 2
	CertificateTypePoolRegistration                CertificateType = 3
	CertificateTypePoolRetirement                  CertificateType = 4
	CertificateTypeGenesisKeyDelegation            CertificateType = 5
	CertificateTypeMoveInstantaneousRewards        CertificateType = 6
	CertificateTypeRegistration                    CertificateType = 7
	CertificateTypeDeregistration                  CertificateType = 8
	CertificateTypeVoteDelegation                  CertificateType = 9
	CertificateTypeStakeVoteDelegation             CertificateType = 10
	CertificateTypeStakeRegistrationDelegation     CertificateType = 11
	CertificateTypeVoteRegistrationDelegation      CertificateType = 12
	CertificateTypeStakeVoteRegistrationDelegation CertificateType = 13
	CertificateTypeAuthCommitteeHot                CertificateType = 14
	CertificateTypeResignCommitteeCold             CertificateType = 15
	CertificateTypeRegistrationDrep                CertificateType = 16
	CertificateTypeDeregistrationDrep              CertificateType = 17
	CertificateTypeUpdateDrep                      CertificateType = 18
	CertificateTypeLeiosEb                         CertificateType = 19
)

type CertificateWrapper

type CertificateWrapper struct {
	Type        uint
	Certificate Certificate
}

func (*CertificateWrapper) MarshalCBOR

func (c *CertificateWrapper) MarshalCBOR() ([]byte, error)

func (*CertificateWrapper) UnmarshalCBOR

func (c *CertificateWrapper) UnmarshalCBOR(data []byte) error

type Credential added in v0.115.0

type Credential struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CredType   uint
	Credential CredentialHash
}

func (*Credential) Hash added in v0.115.0

func (c *Credential) Hash() Blake2b224

func (*Credential) ToPlutusData added in v0.129.0

func (c *Credential) ToPlutusData() data.PlutusData

func (*Credential) UnmarshalCBOR added in v0.115.0

func (c *Credential) UnmarshalCBOR(cborData []byte) error

func (*Credential) Utxorpc added in v0.115.0

func (c *Credential) Utxorpc() (*utxorpc.StakeCredential, error)

type CredentialHash added in v0.115.0

type CredentialHash = Blake2b224

type Datum added in v0.132.0

type Datum struct {
	cbor.DecodeStoreCbor
	Data data.PlutusData `json:"data"`
}

Datum represents a Plutus datum

func (*Datum) Hash added in v0.132.0

func (d *Datum) Hash() DatumHash

func (*Datum) MarshalCBOR added in v0.132.0

func (d *Datum) MarshalCBOR() ([]byte, error)

func (*Datum) UnmarshalCBOR added in v0.132.0

func (d *Datum) UnmarshalCBOR(cborData []byte) error

type DatumHash added in v0.132.0

type DatumHash = Blake2b256

type DeregistrationCertificate

type DeregistrationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	Amount          int64
}

func (*DeregistrationCertificate) Type added in v0.116.0

func (c *DeregistrationCertificate) Type() uint

func (*DeregistrationCertificate) UnmarshalCBOR

func (c *DeregistrationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*DeregistrationCertificate) Utxorpc

type DeregistrationDrepCertificate

type DeregistrationDrepCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType       uint
	DrepCredential Credential
	Amount         int64
}

func (*DeregistrationDrepCertificate) Type added in v0.116.0

func (*DeregistrationDrepCertificate) UnmarshalCBOR

func (c *DeregistrationDrepCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*DeregistrationDrepCertificate) Utxorpc

type Drep

type Drep struct {
	Type       int
	Credential []byte
}

func (*Drep) ToPlutusData added in v0.134.0

func (d *Drep) ToPlutusData() data.PlutusData

func (*Drep) UnmarshalCBOR

func (d *Drep) UnmarshalCBOR(data []byte) error

func (*Drep) Utxorpc added in v0.121.0

func (d *Drep) Utxorpc() (*utxorpc.DRep, error)

type Era

type Era struct {
	Id   uint8
	Name string
}

func EraById

func EraById(eraId uint8) Era

type ExUnitPrice added in v0.99.0

type ExUnitPrice struct {
	cbor.StructAsArray
	MemPrice  *cbor.Rat
	StepPrice *cbor.Rat
}

type ExUnits added in v0.111.0

type ExUnits struct {
	cbor.StructAsArray
	Memory int64
	Steps  int64
}

ExUnits represents the steps and memory usage for script execution

type GenesisHash added in v0.137.1

type GenesisHash = Blake2b224

GenesisHash is a type alias for the Blake2b-224 hash used for genesis keys

type GenesisKeyDelegationCertificate

type GenesisKeyDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType            uint
	GenesisHash         []byte
	GenesisDelegateHash []byte
	VrfKeyHash          VrfKeyHash
}

func (*GenesisKeyDelegationCertificate) Type added in v0.116.0

func (*GenesisKeyDelegationCertificate) UnmarshalCBOR

func (c *GenesisKeyDelegationCertificate) UnmarshalCBOR(cborData []byte) error

func (*GenesisKeyDelegationCertificate) Utxorpc

type GenesisRat added in v0.99.0

type GenesisRat = cbor.Rat

GenesisRat is a convenience type for cbor.Rat

type GovAction

type GovAction interface {
	ToPlutusData() data.PlutusData
	// contains filtered or unexported methods
}

type GovActionBase added in v0.134.0

type GovActionBase struct{}

type GovActionId

type GovActionId struct {
	cbor.StructAsArray
	TransactionId [32]byte
	GovActionIdx  uint32
}

func (*GovActionId) ToPlutusData added in v0.130.0

func (id *GovActionId) ToPlutusData() data.PlutusData

type GovAnchor

type GovAnchor struct {
	cbor.StructAsArray
	Url      string
	DataHash [32]byte
}

func (*GovAnchor) ToPlutusData added in v0.130.0

func (a *GovAnchor) ToPlutusData() data.PlutusData

type HardForkInitiationGovAction

type HardForkInitiationGovAction struct {
	cbor.StructAsArray
	Type            uint
	ActionId        *GovActionId
	ProtocolVersion struct {
		cbor.StructAsArray
		Major uint
		Minor uint
	}
}

func (*HardForkInitiationGovAction) ToPlutusData added in v0.130.0

func (a *HardForkInitiationGovAction) ToPlutusData() data.PlutusData

type InfoGovAction

type InfoGovAction struct {
	cbor.StructAsArray
	Type uint
}

func (*InfoGovAction) ToPlutusData added in v0.130.0

func (a *InfoGovAction) ToPlutusData() data.PlutusData

type IssuerVkey

type IssuerVkey [32]byte

IssuerVkey represents the verification key for the stake pool that minted a block

func (IssuerVkey) Hash

func (i IssuerVkey) Hash() Blake2b224

func (IssuerVkey) PoolId

func (i IssuerVkey) PoolId() string

type LedgerState added in v0.109.0

type LedgerState interface {
	UtxoState
	CertState
	SlotState
	PoolState
	RewardState
	NetworkId() uint
}

LedgerState defines the interface for querying the ledger

type LeiosEbCertificate added in v0.136.0

type LeiosEbCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	ElectionId          Blake2b256
	EndorserBlockHash   Blake2b256
	PersistentVoters    []uint
	NonpersistentVoters map[Blake2b256][]byte
	AggregateEligSig    *[]byte
	AggregateVoteSig    []byte
}

func (*LeiosEbCertificate) GetAggregateEligSig added in v0.140.0

func (c *LeiosEbCertificate) GetAggregateEligSig() []byte

GetAggregateEligSig returns the aggregate eligibility signature as a byte slice

func (*LeiosEbCertificate) GetAggregateVoteSig added in v0.140.0

func (c *LeiosEbCertificate) GetAggregateVoteSig() []byte

GetAggregateVoteSig returns the aggregate vote signature as a byte slice

func (*LeiosEbCertificate) SetAggregateEligSig added in v0.140.0

func (c *LeiosEbCertificate) SetAggregateEligSig(sig []byte)

SetAggregateEligSig sets the aggregate eligibility signature from a byte slice

func (*LeiosEbCertificate) SetAggregateVoteSig added in v0.140.0

func (c *LeiosEbCertificate) SetAggregateVoteSig(sig []byte)

SetAggregateVoteSig sets the aggregate vote signature from a byte slice

func (*LeiosEbCertificate) Type added in v0.136.0

func (c *LeiosEbCertificate) Type() uint

func (*LeiosEbCertificate) UnmarshalCBOR added in v0.136.0

func (c *LeiosEbCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*LeiosEbCertificate) Utxorpc added in v0.136.0

func (c *LeiosEbCertificate) Utxorpc() (*utxorpc.Certificate, error)

type MetaBytes added in v0.141.0

type MetaBytes struct{ Value []byte }

func (MetaBytes) TypeName added in v0.141.0

func (m MetaBytes) TypeName() string

type MetaInt added in v0.141.0

type MetaInt struct{ Value *big.Int }

func (MetaInt) TypeName added in v0.141.0

func (m MetaInt) TypeName() string

type MetaList added in v0.141.0

type MetaList struct {
	Items []TransactionMetadatum
}

func (MetaList) TypeName added in v0.141.0

func (m MetaList) TypeName() string

type MetaMap added in v0.141.0

type MetaMap struct {
	Pairs []MetaPair
}

func (MetaMap) TypeName added in v0.141.0

func (m MetaMap) TypeName() string

type MetaPair added in v0.141.0

type MetaPair struct {
	Key   TransactionMetadatum
	Value TransactionMetadatum
}

type MetaText added in v0.141.0

type MetaText struct{ Value string }

func (MetaText) TypeName added in v0.141.0

func (m MetaText) TypeName() string

type MirSource

type MirSource int32
const (
	MirSourceUnspecified MirSource = 0
	MirSourceReserves    MirSource = 1
	MirSourceTreasury    MirSource = 2
)

type MoveInstantaneousRewardsCertificate

type MoveInstantaneousRewardsCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType uint
	Reward   MoveInstantaneousRewardsCertificateReward
}

func (*MoveInstantaneousRewardsCertificate) Type added in v0.116.0

func (*MoveInstantaneousRewardsCertificate) UnmarshalCBOR

func (c *MoveInstantaneousRewardsCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*MoveInstantaneousRewardsCertificate) Utxorpc

type MoveInstantaneousRewardsCertificateReward

type MoveInstantaneousRewardsCertificateReward struct {
	Source   uint
	Rewards  map[*Credential]uint64
	OtherPot uint64
}

func (*MoveInstantaneousRewardsCertificateReward) UnmarshalCBOR

func (r *MoveInstantaneousRewardsCertificateReward) UnmarshalCBOR(
	data []byte,
) error

type MultiAsset

type MultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint] struct {
	// contains filtered or unexported fields
}

MultiAsset represents a collection of policies, assets, and quantities. It's used for TX outputs (uint64) and TX asset minting (int64 to allow for negative values for burning)

func NewMultiAsset

func NewMultiAsset[T MultiAssetTypeOutput | MultiAssetTypeMint](
	data map[Blake2b224]map[cbor.ByteString]T,
) MultiAsset[T]

NewMultiAsset creates a MultiAsset with the specified data

func (*MultiAsset[T]) Add added in v0.113.0

func (m *MultiAsset[T]) Add(assets *MultiAsset[T])

func (*MultiAsset[T]) Asset

func (m *MultiAsset[T]) Asset(policyId Blake2b224, assetName []byte) T

func (*MultiAsset[T]) Assets

func (m *MultiAsset[T]) Assets(policyId Blake2b224) [][]byte

func (*MultiAsset[T]) Compare added in v0.113.0

func (m *MultiAsset[T]) Compare(assets *MultiAsset[T]) bool

func (*MultiAsset[T]) MarshalCBOR

func (m *MultiAsset[T]) MarshalCBOR() ([]byte, error)

func (MultiAsset[T]) MarshalJSON

func (m MultiAsset[T]) MarshalJSON() ([]byte, error)

func (*MultiAsset[T]) Policies

func (m *MultiAsset[T]) Policies() []Blake2b224

func (*MultiAsset[T]) String added in v0.135.0

func (m *MultiAsset[T]) String() string

String returns a stable, human-friendly representation of the MultiAsset. Output format: [<policyId>.<assetNameHex>=<amount>, ...] sorted by policyId, then asset name

func (*MultiAsset[T]) ToPlutusData added in v0.130.0

func (m *MultiAsset[T]) ToPlutusData() data.PlutusData

func (*MultiAsset[T]) UnmarshalCBOR

func (m *MultiAsset[T]) UnmarshalCBOR(data []byte) error

type MultiAssetTypeMint

type MultiAssetTypeMint = int64

type MultiAssetTypeOutput

type MultiAssetTypeOutput = uint64

type NativeScript added in v0.110.0

type NativeScript struct {
	cbor.DecodeStoreCbor
	// contains filtered or unexported fields
}

func (NativeScript) Hash added in v0.132.0

func (s NativeScript) Hash() ScriptHash

func (*NativeScript) Item added in v0.110.0

func (n *NativeScript) Item() any

func (NativeScript) MarshalCBOR added in v0.142.0

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

func (NativeScript) RawScriptBytes added in v0.137.0

func (s NativeScript) RawScriptBytes() []byte

func (*NativeScript) UnmarshalCBOR added in v0.110.0

func (n *NativeScript) UnmarshalCBOR(data []byte) error

type NativeScriptAll added in v0.110.0

type NativeScriptAll struct {
	cbor.StructAsArray
	Type    uint
	Scripts []NativeScript
}

type NativeScriptAny added in v0.110.0

type NativeScriptAny struct {
	cbor.StructAsArray
	Type    uint
	Scripts []NativeScript
}

type NativeScriptInvalidBefore added in v0.110.0

type NativeScriptInvalidBefore struct {
	cbor.StructAsArray
	Type uint
	Slot uint64
}

type NativeScriptInvalidHereafter added in v0.110.0

type NativeScriptInvalidHereafter struct {
	cbor.StructAsArray
	Type uint
	Slot uint64
}

type NativeScriptNofK added in v0.110.0

type NativeScriptNofK struct {
	cbor.StructAsArray
	Type    uint
	N       uint
	Scripts []NativeScript
}

type NativeScriptPubkey added in v0.110.0

type NativeScriptPubkey struct {
	cbor.StructAsArray
	Type uint
	Hash []byte
}

type NewConstitutionGovAction

type NewConstitutionGovAction struct {
	cbor.StructAsArray
	Type         uint
	ActionId     *GovActionId
	Constitution struct {
		cbor.StructAsArray
		Anchor     GovAnchor
		ScriptHash []byte
	}
}

func (*NewConstitutionGovAction) ToPlutusData added in v0.130.0

func (a *NewConstitutionGovAction) ToPlutusData() data.PlutusData

type NoConfidenceGovAction

type NoConfidenceGovAction struct {
	cbor.StructAsArray
	Type     uint
	ActionId *GovActionId
}

func (*NoConfidenceGovAction) ToPlutusData added in v0.130.0

func (a *NoConfidenceGovAction) ToPlutusData() data.PlutusData

type Nonce added in v0.99.0

type Nonce struct {
	cbor.StructAsArray
	Type  uint
	Value [32]byte
}

func (*Nonce) MarshalCBOR added in v0.108.0

func (n *Nonce) MarshalCBOR() ([]byte, error)

func (*Nonce) UnmarshalCBOR added in v0.99.0

func (n *Nonce) UnmarshalCBOR(data []byte) error

func (*Nonce) UnmarshalJSON added in v0.108.0

func (n *Nonce) UnmarshalJSON(data []byte) error

type PlutusV1Script added in v0.127.0

type PlutusV1Script []byte

func (PlutusV1Script) Hash added in v0.132.0

func (s PlutusV1Script) Hash() ScriptHash

func (PlutusV1Script) RawScriptBytes added in v0.137.0

func (s PlutusV1Script) RawScriptBytes() []byte

type PlutusV2Script added in v0.127.0

type PlutusV2Script []byte

func (PlutusV2Script) Hash added in v0.132.0

func (s PlutusV2Script) Hash() ScriptHash

func (PlutusV2Script) RawScriptBytes added in v0.137.0

func (s PlutusV2Script) RawScriptBytes() []byte

type PlutusV3Script added in v0.127.0

type PlutusV3Script []byte

func (PlutusV3Script) Evaluate added in v0.133.0

func (s PlutusV3Script) Evaluate(
	scriptContext data.PlutusData,
	budget ExUnits,
) (ExUnits, error)

func (PlutusV3Script) Hash added in v0.132.0

func (s PlutusV3Script) Hash() ScriptHash

func (PlutusV3Script) RawScriptBytes added in v0.137.0

func (s PlutusV3Script) RawScriptBytes() []byte

type PoolId

type PoolId [28]byte

func NewPoolIdFromBech32

func NewPoolIdFromBech32(poolId string) (PoolId, error)

func (PoolId) String

func (p PoolId) String() string

type PoolKeyHash

type PoolKeyHash = Blake2b224

type PoolMetadata

type PoolMetadata struct {
	cbor.StructAsArray
	Url  string
	Hash PoolMetadataHash
}

func (*PoolMetadata) Utxorpc

func (p *PoolMetadata) Utxorpc() (*utxorpc.PoolMetadata, error)

type PoolMetadataHash

type PoolMetadataHash = Blake2b256

type PoolRegistrationCertificate

type PoolRegistrationCertificate struct {
	cbor.StructAsArray   `              json:"-"`
	cbor.DecodeStoreCbor `              json:"-"`
	CertType             uint          `json:"certType,omitempty"`
	Operator             PoolKeyHash   `json:"operator"`
	VrfKeyHash           VrfKeyHash    `json:"vrfKeyHash"`
	Pledge               uint64        `json:"pledge"`
	Cost                 uint64        `json:"cost"`
	Margin               GenesisRat    `json:"margin"`
	RewardAccount        AddrKeyHash   `json:"rewardAccount"`
	PoolOwners           []AddrKeyHash `json:"poolOwners"`
	Relays               []PoolRelay   `json:"relays"`
	PoolMetadata         *PoolMetadata `json:"poolMetadata,omitempty"`
}

func (*PoolRegistrationCertificate) Type added in v0.116.0

func (*PoolRegistrationCertificate) UnmarshalCBOR

func (c *PoolRegistrationCertificate) UnmarshalCBOR(cborData []byte) error

func (*PoolRegistrationCertificate) UnmarshalJSON added in v0.131.0

func (p *PoolRegistrationCertificate) UnmarshalJSON(data []byte) error

func (*PoolRegistrationCertificate) Utxorpc

type PoolRelay

type PoolRelay struct {
	Type     int     `json:"type"`
	Port     *uint32 `json:"port,omitempty"`
	Ipv4     *net.IP `json:"ipv4,omitempty"`
	Ipv6     *net.IP `json:"ipv6,omitempty"`
	Hostname *string `json:"hostname,omitempty"`
}

func (*PoolRelay) UnmarshalCBOR

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

func (*PoolRelay) Utxorpc

func (p *PoolRelay) Utxorpc() (*utxorpc.Relay, error)

type PoolRetirementCertificate

type PoolRetirementCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType    uint
	PoolKeyHash PoolKeyHash
	Epoch       uint64
}

func (*PoolRetirementCertificate) Type added in v0.116.0

func (c *PoolRetirementCertificate) Type() uint

func (*PoolRetirementCertificate) UnmarshalCBOR

func (c *PoolRetirementCertificate) UnmarshalCBOR(cborData []byte) error

func (*PoolRetirementCertificate) Utxorpc

type PoolRetirementInfo added in v0.141.0

type PoolRetirementInfo struct {
	RewardAddress AddrKeyHash // Pool reward address
	Epoch         uint64      // Epoch when retirement was announced
}

PoolRetirementInfo contains information about retired pools

type PoolRewards added in v0.141.0

type PoolRewards struct {
	// Pool operator rewards
	OperatorRewards uint64

	// Delegator rewards by stake key hash
	DelegatorRewards map[AddrKeyHash]uint64

	// Total rewards for this pool
	TotalRewards uint64
}

PoolRewards contains rewards for a specific pool

type PoolState added in v0.134.0

type PoolState interface {
	// PoolCurrentState returns the latest active registration certificate for the given pool key hash.
	// It also returns the epoch of a pending retirement certificate, if one exists.
	// If the pool is not registered, the registration certificate will be nil.
	PoolCurrentState(PoolKeyHash) (*PoolRegistrationCertificate, *uint64, error)
}

PoolState defines the interface for querying the current pool state

type ProposalProcedure

type ProposalProcedure interface {
	ToPlutusData() data.PlutusData
	Deposit() uint64
	RewardAccount() Address
	GovAction() GovAction
	Anchor() GovAnchor
	// contains filtered or unexported methods
}

type ProposalProcedureBase added in v0.134.0

type ProposalProcedureBase struct{}

type ProtocolParameterUpdate added in v0.95.0

type ProtocolParameterUpdate interface {
	IsProtocolParameterUpdate()
	Cbor() []byte
}

type ProtocolParameters added in v0.103.2

type ProtocolParameters interface {
	Utxorpc() (*cardano.PParams, error)
}

type ProtocolParametersProtocolVersion added in v0.99.0

type ProtocolParametersProtocolVersion struct {
	cbor.StructAsArray
	Major uint
	Minor uint
}

type RedeemerKey added in v0.130.1

type RedeemerKey struct {
	cbor.StructAsArray
	Tag   RedeemerTag
	Index uint32
}

type RedeemerTag added in v0.110.0

type RedeemerTag uint8
const (
	RedeemerTagSpend     RedeemerTag = 0
	RedeemerTagMint      RedeemerTag = 1
	RedeemerTagCert      RedeemerTag = 2
	RedeemerTagReward    RedeemerTag = 3
	RedeemerTagVoting    RedeemerTag = 4
	RedeemerTagProposing RedeemerTag = 5
)

type RedeemerValue added in v0.130.1

type RedeemerValue struct {
	cbor.StructAsArray
	Data    Datum
	ExUnits ExUnits
}

type RegistrationCertificate

type RegistrationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	Amount          int64
}

func (*RegistrationCertificate) Type added in v0.116.0

func (c *RegistrationCertificate) Type() uint

func (*RegistrationCertificate) UnmarshalCBOR

func (c *RegistrationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*RegistrationCertificate) Utxorpc

type RegistrationDrepCertificate

type RegistrationDrepCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType       uint
	DrepCredential Credential
	Amount         int64
	Anchor         *GovAnchor
}

func (*RegistrationDrepCertificate) Type added in v0.116.0

func (*RegistrationDrepCertificate) UnmarshalCBOR

func (c *RegistrationDrepCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*RegistrationDrepCertificate) Utxorpc

type ResignCommitteeColdCertificate

type ResignCommitteeColdCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType       uint
	ColdCredential Credential
	Anchor         *GovAnchor
}

func (*ResignCommitteeColdCertificate) Type added in v0.116.0

func (*ResignCommitteeColdCertificate) UnmarshalCBOR

func (c *ResignCommitteeColdCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*ResignCommitteeColdCertificate) Utxorpc

type RewardCalculationResult added in v0.141.0

type RewardCalculationResult struct {
	// Total rewards to be distributed
	TotalRewards uint64

	// Rewards per pool (operator + delegators)
	PoolRewards map[PoolKeyHash]PoolRewards

	// Updated ADA pots after reward distribution
	UpdatedPots AdaPots
}

RewardCalculationResult contains the calculated rewards

func CalculateRewards added in v0.141.0

func CalculateRewards(
	pots AdaPots,
	snapshot RewardSnapshot,
	params RewardParameters,
) (*RewardCalculationResult, error)

CalculateRewards calculates stake pool and delegator rewards

type RewardParameters added in v0.141.0

type RewardParameters struct {
	// Monetary expansion parameters
	MonetaryExpansion uint64 // rho - monetary expansion rate (0.003 means 0.3%)
	TreasuryGrowth    uint64 // tau - treasury growth rate (0.2 means 20%)

	// Decentralization parameter (0 = fully decentralized, 1 = fully centralized)
	Decentralization uint64

	// Protocol version for reward calculation rules
	ProtocolVersion ProtocolParametersProtocolVersion

	// Minimum pool cost
	MinPoolCost uint64

	// Pool influence parameter (a0)
	PoolInfluence *big.Rat

	// Expansion rate (rho)
	ExpansionRate *big.Rat

	// Treasury expansion rate (tau)
	TreasuryRate *big.Rat

	// Active slots coefficient (f) - from CIP-9
	ActiveSlotsCoeff *big.Rat

	// Expected slots per epoch - from network configuration
	ExpectedSlotsPerEpoch uint32
}

RewardParameters contains the protocol parameters needed for reward calculation

type RewardService added in v0.141.0

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

RewardService provides reward calculation services for the ledger

func NewRewardService added in v0.141.0

func NewRewardService(ledgerState LedgerState) *RewardService

NewRewardService creates a new reward service

func (*RewardService) CalculateEpochRewards added in v0.141.0

func (rs *RewardService) CalculateEpochRewards(
	epoch uint64,
) (*RewardCalculationResult, error)

CalculateEpochRewards calculates rewards for the given epoch

func (*RewardService) ValidateRewardDistribution added in v0.141.0

func (rs *RewardService) ValidateRewardDistribution(
	expectedRewards *RewardCalculationResult,
	actualRewards map[AddrKeyHash]uint64,
) error

ValidateRewardDistribution validates that a reward distribution transaction is correct

type RewardSnapshot added in v0.141.0

type RewardSnapshot struct {
	// Total active stake in the system
	TotalActiveStake uint64

	// Stake distribution by pool
	PoolStake map[PoolKeyHash]uint64

	// Delegator stake by pool
	DelegatorStake map[PoolKeyHash]map[AddrKeyHash]uint64

	// Pool parameters
	PoolParams map[PoolKeyHash]*PoolRegistrationCertificate

	// Stake registrations for reward eligibility
	StakeRegistrations map[AddrKeyHash]bool

	// Block production data for pool performance calculation
	PoolBlocks         map[PoolKeyHash]uint32 // Blocks produced by each pool
	TotalBlocksInEpoch uint32                 // Total blocks produced in epoch by stake pools

	// Deregistration timing (slot when deregistration occurred)
	// Accounts deregistered before reward calculation start (slot 172800)
	// don't receive rewards (rewards go to reserves)
	EarlyDeregistrations map[AddrKeyHash]uint64

	// Accounts deregistered after reward calculation start but before epoch end
	// receive rewards but they go to treasury since they can't be paid
	LateDeregistrations map[AddrKeyHash]uint64

	// Pool retirement information
	RetiredPools map[PoolKeyHash]PoolRetirementInfo

	// Multiple pool associations (for pre-Allegra behavior)
	// Maps stake key to list of pools they have reward addresses for
	StakeKeyPoolAssociations map[AddrKeyHash][]PoolKeyHash
}

RewardSnapshot represents the stake snapshot for reward calculation

type RewardState added in v0.141.0

type RewardState interface {
	// CalculateRewards calculates rewards for the given epoch based on stake snapshot
	CalculateRewards(
		pots AdaPots,
		snapshot RewardSnapshot,
		params RewardParameters,
	) (*RewardCalculationResult, error)

	// GetAdaPots returns the current ADA pots
	GetAdaPots() AdaPots

	// UpdateAdaPots updates the ADA pots (typically called after reward calculation)
	UpdateAdaPots(pots AdaPots) error

	// GetRewardSnapshot returns the stake snapshot for reward calculation
	GetRewardSnapshot(epoch uint64) (RewardSnapshot, error)
}

RewardState defines the interface for reward calculation and querying

type Script added in v0.127.0

type Script interface {
	Hash() ScriptHash
	RawScriptBytes() []byte
	// contains filtered or unexported methods
}

type ScriptHash added in v0.132.0

type ScriptHash = Blake2b224

func NewScriptHashFromBech32 added in v0.141.0

func NewScriptHashFromBech32(scriptHash string) (ScriptHash, error)

type ScriptRef added in v0.127.0

type ScriptRef struct {
	Type   uint
	Script Script
}

func (*ScriptRef) MarshalCBOR added in v0.133.0

func (s *ScriptRef) MarshalCBOR() ([]byte, error)

func (*ScriptRef) UnmarshalCBOR added in v0.127.0

func (s *ScriptRef) UnmarshalCBOR(data []byte) error

type SlotState added in v0.134.0

type SlotState interface {
	SlotToTime(uint64) (time.Time, error)
	TimeToSlot(time.Time) (uint64, error)
}

SlotState defines the interface for querying slots

type StakeDelegationCertificate

type StakeDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential *Credential
	PoolKeyHash     PoolKeyHash
}

func (*StakeDelegationCertificate) Type added in v0.116.0

func (c *StakeDelegationCertificate) Type() uint

func (*StakeDelegationCertificate) UnmarshalCBOR

func (c *StakeDelegationCertificate) UnmarshalCBOR(cborData []byte) error

func (*StakeDelegationCertificate) Utxorpc

type StakeDeregistrationCertificate

type StakeDeregistrationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
}

func (*StakeDeregistrationCertificate) Type added in v0.116.0

func (*StakeDeregistrationCertificate) UnmarshalCBOR

func (c *StakeDeregistrationCertificate) UnmarshalCBOR(cborData []byte) error

func (*StakeDeregistrationCertificate) Utxorpc

type StakeRegistrationCertificate

type StakeRegistrationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
}

func (*StakeRegistrationCertificate) Type added in v0.116.0

func (*StakeRegistrationCertificate) UnmarshalCBOR

func (c *StakeRegistrationCertificate) UnmarshalCBOR(cborData []byte) error

func (*StakeRegistrationCertificate) Utxorpc

type StakeRegistrationDelegationCertificate

type StakeRegistrationDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	PoolKeyHash     PoolKeyHash
	Amount          int64
}

func (*StakeRegistrationDelegationCertificate) Type added in v0.116.0

func (*StakeRegistrationDelegationCertificate) UnmarshalCBOR

func (c *StakeRegistrationDelegationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*StakeRegistrationDelegationCertificate) Utxorpc

type StakeVoteDelegationCertificate

type StakeVoteDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	PoolKeyHash     PoolKeyHash
	Drep            Drep
}

func (*StakeVoteDelegationCertificate) Type added in v0.116.0

func (*StakeVoteDelegationCertificate) UnmarshalCBOR

func (c *StakeVoteDelegationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*StakeVoteDelegationCertificate) Utxorpc

type StakeVoteRegistrationDelegationCertificate

type StakeVoteRegistrationDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	PoolKeyHash     PoolKeyHash
	Drep            Drep
	Amount          int64
}

func (*StakeVoteRegistrationDelegationCertificate) Type added in v0.116.0

func (*StakeVoteRegistrationDelegationCertificate) UnmarshalCBOR

func (c *StakeVoteRegistrationDelegationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*StakeVoteRegistrationDelegationCertificate) Utxorpc

type TipState added in v0.109.0

type TipState interface {
	Tip() (pcommon.Tip, error)
}

TipState defines the interface for querying the current tip

type Transaction

type Transaction interface {
	TransactionBody
	Type() int
	Cbor() []byte
	Hash() Blake2b256
	LeiosHash() Blake2b256
	Metadata() TransactionMetadatum
	IsValid() bool
	Consumed() []TransactionInput
	Produced() []Utxo
	Witnesses() TransactionWitnessSet
}

type TransactionBody

type TransactionBody interface {
	Cbor() []byte
	Fee() uint64
	Id() Blake2b256
	Inputs() []TransactionInput
	Outputs() []TransactionOutput
	TTL() uint64
	ProtocolParameterUpdates() (uint64, map[Blake2b224]ProtocolParameterUpdate)
	ValidityIntervalStart() uint64
	ReferenceInputs() []TransactionInput
	Collateral() []TransactionInput
	CollateralReturn() TransactionOutput
	TotalCollateral() uint64
	Certificates() []Certificate
	Withdrawals() map[*Address]uint64
	AuxDataHash() *Blake2b256
	RequiredSigners() []Blake2b224
	AssetMint() *MultiAsset[MultiAssetTypeMint]
	ScriptDataHash() *Blake2b256
	VotingProcedures() VotingProcedures
	ProposalProcedures() []ProposalProcedure
	CurrentTreasuryValue() int64
	Donation() uint64
	Utxorpc() (*utxorpc.Tx, error)
}

type TransactionBodyBase added in v0.117.0

type TransactionBodyBase struct {
	cbor.DecodeStoreCbor
	// contains filtered or unexported fields
}

TransactionBodyBase provides a set of functions that return empty values to satisfy the TransactionBody interface. It also provides functionality for generating a transaction hash and storing/retrieving the original CBOR

func (*TransactionBodyBase) AssetMint added in v0.117.0

func (*TransactionBodyBase) AuxDataHash added in v0.117.0

func (b *TransactionBodyBase) AuxDataHash() *Blake2b256

func (*TransactionBodyBase) Certificates added in v0.117.0

func (b *TransactionBodyBase) Certificates() []Certificate

func (*TransactionBodyBase) Collateral added in v0.117.0

func (b *TransactionBodyBase) Collateral() []TransactionInput

func (*TransactionBodyBase) CollateralReturn added in v0.117.0

func (b *TransactionBodyBase) CollateralReturn() TransactionOutput

func (*TransactionBodyBase) CurrentTreasuryValue added in v0.117.0

func (b *TransactionBodyBase) CurrentTreasuryValue() int64

func (*TransactionBodyBase) Donation added in v0.117.0

func (b *TransactionBodyBase) Donation() uint64

func (*TransactionBodyBase) Fee added in v0.117.0

func (b *TransactionBodyBase) Fee() uint64

func (*TransactionBodyBase) Id added in v0.136.0

func (*TransactionBodyBase) Inputs added in v0.117.0

func (b *TransactionBodyBase) Inputs() []TransactionInput

func (*TransactionBodyBase) Outputs added in v0.117.0

func (b *TransactionBodyBase) Outputs() []TransactionOutput

func (*TransactionBodyBase) ProposalProcedures added in v0.117.0

func (b *TransactionBodyBase) ProposalProcedures() []ProposalProcedure

func (*TransactionBodyBase) ReferenceInputs added in v0.117.0

func (b *TransactionBodyBase) ReferenceInputs() []TransactionInput

func (*TransactionBodyBase) RequiredSigners added in v0.117.0

func (b *TransactionBodyBase) RequiredSigners() []Blake2b224

func (*TransactionBodyBase) ScriptDataHash added in v0.117.0

func (b *TransactionBodyBase) ScriptDataHash() *Blake2b256

func (*TransactionBodyBase) TTL added in v0.117.0

func (b *TransactionBodyBase) TTL() uint64

func (*TransactionBodyBase) TotalCollateral added in v0.117.0

func (b *TransactionBodyBase) TotalCollateral() uint64

func (*TransactionBodyBase) Utxorpc added in v0.117.0

func (b *TransactionBodyBase) Utxorpc() (*utxorpc.Tx, error)

func (*TransactionBodyBase) ValidityIntervalStart added in v0.117.0

func (b *TransactionBodyBase) ValidityIntervalStart() uint64

func (*TransactionBodyBase) VotingProcedures added in v0.117.0

func (b *TransactionBodyBase) VotingProcedures() VotingProcedures

func (*TransactionBodyBase) Withdrawals added in v0.117.0

func (b *TransactionBodyBase) Withdrawals() map[*Address]uint64

type TransactionInput

type TransactionInput interface {
	Id() Blake2b256
	Index() uint32
	String() string
	Utxorpc() (*utxorpc.TxInput, error)
	ToPlutusData() data.PlutusData
}

type TransactionMetadataSet added in v0.141.0

type TransactionMetadataSet struct {
	cbor.DecodeStoreCbor
	// contains filtered or unexported fields
}

func (TransactionMetadataSet) GetMetadata added in v0.142.0

func (s TransactionMetadataSet) GetMetadata(
	key uint,
) (TransactionMetadatum, bool)

func (TransactionMetadataSet) MarshalCBOR added in v0.141.0

func (s TransactionMetadataSet) MarshalCBOR() ([]byte, error)

func (*TransactionMetadataSet) UnmarshalCBOR added in v0.141.0

func (s *TransactionMetadataSet) UnmarshalCBOR(cborData []byte) error

type TransactionMetadatum added in v0.141.0

type TransactionMetadatum interface {
	TypeName() string
	// contains filtered or unexported methods
}

func DecodeMetadatumRaw added in v0.141.0

func DecodeMetadatumRaw(b []byte) (TransactionMetadatum, error)

type TransactionOutput

type TransactionOutput interface {
	Address() Address
	Amount() uint64
	Assets() *MultiAsset[MultiAssetTypeOutput]
	Datum() *Datum
	DatumHash() *Blake2b256
	Cbor() []byte
	Utxorpc() (*utxorpc.TxOutput, error)
	ScriptRef() Script
	ToPlutusData() data.PlutusData
	String() string
}

type TransactionWitnessRedeemers added in v0.110.0

type TransactionWitnessRedeemers interface {
	Indexes(RedeemerTag) []uint
	Value(uint, RedeemerTag) RedeemerValue
	Iter() iter.Seq2[RedeemerKey, RedeemerValue]
}

type TransactionWitnessSet added in v0.110.0

type TransactionWitnessSet interface {
	Vkey() []VkeyWitness
	NativeScripts() []NativeScript
	Bootstrap() []BootstrapWitness
	PlutusData() []Datum
	PlutusV1Scripts() []PlutusV1Script
	PlutusV2Scripts() []PlutusV2Script
	PlutusV3Scripts() []PlutusV3Script
	Redeemers() TransactionWitnessRedeemers
}

type TreasuryWithdrawalGovAction

type TreasuryWithdrawalGovAction struct {
	cbor.StructAsArray
	Type        uint
	Withdrawals map[*Address]uint64
	PolicyHash  []byte
}

func (*TreasuryWithdrawalGovAction) ToPlutusData added in v0.130.0

func (a *TreasuryWithdrawalGovAction) ToPlutusData() data.PlutusData

type UpdateCommitteeGovAction

type UpdateCommitteeGovAction struct {
	cbor.StructAsArray
	Type        uint
	ActionId    *GovActionId
	Credentials []Credential
	CredEpochs  map[*Credential]uint
	Quorum      cbor.Rat
}

func (*UpdateCommitteeGovAction) ToPlutusData added in v0.130.0

func (a *UpdateCommitteeGovAction) ToPlutusData() data.PlutusData

type UpdateDrepCertificate

type UpdateDrepCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType       uint
	DrepCredential Credential
	Anchor         *GovAnchor
}

func (*UpdateDrepCertificate) Type added in v0.116.0

func (c *UpdateDrepCertificate) Type() uint

func (*UpdateDrepCertificate) UnmarshalCBOR

func (c *UpdateDrepCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*UpdateDrepCertificate) Utxorpc

type Utxo

type Utxo struct {
	cbor.StructAsArray
	Id     TransactionInput
	Output TransactionOutput
}

type UtxoState added in v0.109.0

type UtxoState interface {
	UtxoById(TransactionInput) (Utxo, error)
}

UtxoState defines the interface for querying the UTxO state

type UtxoValidationRuleFunc added in v0.109.0

type UtxoValidationRuleFunc func(Transaction, uint64, LedgerState, ProtocolParameters) error

type VerifyConfig added in v0.143.0

type VerifyConfig struct {
	// SkipBodyHashValidation disables body hash verification in VerifyBlock().
	// Useful for scenarios where full block CBOR is unavailable.
	SkipBodyHashValidation bool
	// SkipTransactionValidation disables transaction validation in VerifyBlock().
	// When false (default), LedgerState and ProtocolParameters must be set.
	SkipTransactionValidation bool
	// LedgerState provides the current ledger state for transaction validation.
	// Required if SkipTransactionValidation is false.
	LedgerState LedgerState
	// ProtocolParameters provides the current protocol parameters for transaction validation.
	// Required if SkipTransactionValidation is false.
	ProtocolParameters ProtocolParameters
}

VerifyConfig holds runtime verification toggles. Default values favor safety; tests or specific flows can opt out.

type VkeyWitness added in v0.110.0

type VkeyWitness struct {
	cbor.StructAsArray
	Vkey      []byte
	Signature []byte
}

type Vote added in v0.130.0

type Vote uint8

func (Vote) ToPlutusData added in v0.130.0

func (v Vote) ToPlutusData() data.PlutusData

type VoteDelegationCertificate

type VoteDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	Drep            Drep
}

func (*VoteDelegationCertificate) Type added in v0.116.0

func (c *VoteDelegationCertificate) Type() uint

func (*VoteDelegationCertificate) UnmarshalCBOR

func (c *VoteDelegationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*VoteDelegationCertificate) Utxorpc

type VoteRegistrationDelegationCertificate

type VoteRegistrationDelegationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType        uint
	StakeCredential Credential
	Drep            Drep
	Amount          int64
}

func (*VoteRegistrationDelegationCertificate) Type added in v0.116.0

func (*VoteRegistrationDelegationCertificate) UnmarshalCBOR

func (c *VoteRegistrationDelegationCertificate) UnmarshalCBOR(
	cborData []byte,
) error

func (*VoteRegistrationDelegationCertificate) Utxorpc

type Voter

type Voter struct {
	cbor.StructAsArray
	Type uint8
	Hash [28]byte
}

func (Voter) ToPlutusData added in v0.130.0

func (v Voter) ToPlutusData() data.PlutusData

type VotingProcedure

type VotingProcedure struct {
	cbor.StructAsArray
	Vote   uint8
	Anchor *GovAnchor
}

func (VotingProcedure) ToPlutusData added in v0.130.0

func (vp VotingProcedure) ToPlutusData() data.PlutusData

type VotingProcedures

type VotingProcedures map[*Voter]map[*GovActionId]VotingProcedure

VotingProcedures is a convenience type to avoid needing to duplicate the full type definition everywhere

type VrfKeyHash

type VrfKeyHash = Blake2b256

type VrfResult added in v0.108.0

type VrfResult struct {
	cbor.StructAsArray
	Output []byte
	Proof  []byte
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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