common

package
v0.121.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 17 Imported by: 18

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 (
	CertificateTypeStakeRegistration               = 0
	CertificateTypeStakeDeregistration             = 1
	CertificateTypeStakeDelegation                 = 2
	CertificateTypePoolRegistration                = 3
	CertificateTypePoolRetirement                  = 4
	CertificateTypeGenesisKeyDelegation            = 5
	CertificateTypeMoveInstantaneousRewards        = 6
	CertificateTypeRegistration                    = 7
	CertificateTypeDeregistration                  = 8
	CertificateTypeVoteDelegation                  = 9
	CertificateTypeStakeVoteDelegation             = 10
	CertificateTypeStakeRegistrationDelegation     = 11
	CertificateTypeVoteRegistrationDelegation      = 12
	CertificateTypeStakeVoteRegistrationDelegation = 13
	CertificateTypeAuthCommitteeHot                = 14
	CertificateTypeResignCommitteeCold             = 15
	CertificateTypeRegistrationDrep                = 16
	CertificateTypeDeregistrationDrep              = 17
	CertificateTypeUpdateDrep                      = 18
)
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
)

Variables

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

Functions

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 TransactionBodyToUtxorpc added in v0.117.0

func TransactionBodyToUtxorpc(tx TransactionBody) *utxorpc.Tx

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

Types

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 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

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) 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) String

func (a Address) String() string

String returns the bech32-encoded version of the address

func (Address) Type added in v0.109.0

func (a Address) Type() uint8

func (*Address) UnmarshalCBOR

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

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
	HostCredential 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) String

func (b Blake2b160) String() string

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) Bytes

func (b Blake2b224) Bytes() []byte

func (Blake2b224) MarshalJSON added in v0.100.0

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

func (Blake2b224) String

func (b Blake2b224) String() string

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) String

func (b Blake2b256) String() string

type Block added in v0.105.0

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

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
}

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)
	PoolRegistration([]byte) ([]PoolRegistrationCertificate, error)
}

CertState defines the interface for querying the certificate state

type Certificate

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

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) 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

type CredentialHash added in v0.115.0

type CredentialHash = Blake2b224

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) UnmarshalCBOR

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

func (*Drep) Utxorpc added in v0.121.0

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

DRep implementation

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 uint64
	Steps  uint64
}

ExUnits represents the steps and memory usage for script execution

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 struct {
	*big.Rat
}

GenesisRat is a wrapper to big.Rat that allows for unmarshaling from a bare float from JSON

func (*GenesisRat) UnmarshalJSON added in v0.99.0

func (r *GenesisRat) UnmarshalJSON(data []byte) error

type GovAction

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

type GovActionId

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

type GovActionWrapper

type GovActionWrapper struct {
	Type   uint
	Action GovAction
}

func (*GovActionWrapper) MarshalCBOR

func (g *GovActionWrapper) MarshalCBOR() ([]byte, error)

func (*GovActionWrapper) UnmarshalCBOR

func (g *GovActionWrapper) UnmarshalCBOR(data []byte) error

type GovAnchor

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

type HardForkInitiationGovAction

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

type InfoGovAction

type InfoGovAction struct {
	cbor.StructAsArray
	Type uint
}

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
	NetworkId() uint
}

LedgerState defines the interface for querying the ledger

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]) 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 {
	// contains filtered or unexported fields
}

func (*NativeScript) Item added in v0.110.0

func (n *NativeScript) Item() any

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
	}
}

type NoConfidenceGovAction

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

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 ParameterChangeGovAction

type ParameterChangeGovAction struct {
	cbor.StructAsArray
	Type        uint
	ActionId    *GovActionId
	ParamUpdate cbor.RawMessage // NOTE: we use raw to defer processing to account for per-era types
	PolicyHash  []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

type PoolMetadataHash

type PoolMetadataHash = Blake2b256

type PoolRegistrationCertificate

type PoolRegistrationCertificate struct {
	cbor.StructAsArray
	cbor.DecodeStoreCbor
	CertType      uint
	Operator      PoolKeyHash
	VrfKeyHash    VrfKeyHash
	Pledge        uint64
	Cost          uint64
	Margin        cbor.Rat
	RewardAccount AddrKeyHash
	PoolOwners    []AddrKeyHash
	Relays        []PoolRelay
	PoolMetadata  *PoolMetadata
}

func (*PoolRegistrationCertificate) Type added in v0.116.0

func (*PoolRegistrationCertificate) UnmarshalCBOR

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

func (*PoolRegistrationCertificate) Utxorpc

type PoolRelay

type PoolRelay struct {
	Type     int
	Port     *uint32
	Ipv4     *net.IP
	Ipv6     *net.IP
	Hostname *string
}

func (*PoolRelay) UnmarshalCBOR

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

func (*PoolRelay) Utxorpc

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

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 ProposalProcedure

type ProposalProcedure struct {
	cbor.StructAsArray
	Deposit       uint64
	RewardAccount Address
	GovAction     GovActionWrapper
	Anchor        GovAnchor
}

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
}

type ProtocolParametersProtocolVersion added in v0.99.0

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

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 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 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
	StakeDeregistration 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
	StakeRegistration 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     []byte
	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     []byte
	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
	Metadata() *cbor.LazyValue
	IsValid() bool
	Consumed() []TransactionInput
	Produced() []Utxo
	Witnesses() TransactionWitnessSet
}

type TransactionBody

type TransactionBody interface {
	Cbor() []byte
	Fee() uint64
	Hash() 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
}

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) Hash added in v0.117.0

func (b *TransactionBodyBase) Hash() Blake2b256

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

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
}

type TransactionOutput

type TransactionOutput interface {
	Address() Address
	Amount() uint64
	Assets() *MultiAsset[MultiAssetTypeOutput]
	Datum() *cbor.LazyValue
	DatumHash() *Blake2b256
	Cbor() []byte
	Utxorpc() *utxorpc.TxOutput
}

type TransactionWitnessRedeemers added in v0.110.0

type TransactionWitnessRedeemers interface {
	Indexes(RedeemerTag) []uint
	Value(uint, RedeemerTag) (cbor.LazyValue, ExUnits)
}

type TransactionWitnessSet added in v0.110.0

type TransactionWitnessSet interface {
	Vkey() []VkeyWitness
	NativeScripts() []NativeScript
	Bootstrap() []BootstrapWitness
	PlutusData() []cbor.Value
	PlutusV1Scripts() [][]byte
	PlutusV2Scripts() [][]byte
	PlutusV3Scripts() [][]byte
	Redeemers() TransactionWitnessRedeemers
}

type TreasuryWithdrawalGovAction

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

type UpdateCommitteeGovAction

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

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 {
	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 VkeyWitness added in v0.110.0

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

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
}

type VotingProcedure

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

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
}

Jump to

Keyboard shortcuts

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