event

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 8 Imported by: 9 modules, 5 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasGovernanceData added in v0.36.0

func HasGovernanceData(tx ledger.Transaction) bool

HasGovernanceData returns true if the transaction contains any governance data

Types

type AnchorData added in v0.36.0

type AnchorData struct {
	Url      string `json:"url"`
	DataHash string `json:"dataHash"`
}

AnchorData represents a governance anchor (URL + hash)

type BlockContext added in v0.33.0

type BlockContext struct {
	Era          string `json:"era"`
	BlockNumber  uint64 `json:"blockNumber"`
	SlotNumber   uint64 `json:"slotNumber"`
	NetworkMagic uint32 `json:"networkMagic"`
}

func NewBlockContext added in v0.33.0

func NewBlockContext(block ledger.Block, networkMagic uint32) BlockContext

func NewBlockHeaderContext added in v0.33.0

func NewBlockHeaderContext(block ledger.BlockHeader) BlockContext

type BlockEvent added in v0.33.0

type BlockEvent struct {
	Block            ledger.Block     `json:"-"`
	IssuerVkey       string           `json:"issuerVkey"`
	BlockHash        string           `json:"blockHash"`
	BlockCbor        byteSliceJsonHex `json:"blockCbor,omitempty"`
	BlockBodySize    uint64           `json:"blockBodySize"`
	TransactionCount uint64           `json:"transactionCount"`
}

func NewBlockEvent added in v0.33.0

func NewBlockEvent(block ledger.Block, includeCbor bool) BlockEvent

type CommitteeCertificateData added in v0.36.0

type CommitteeCertificateData struct {
	CertificateType string     `json:"certificateType"`
	ColdCredential  string     `json:"coldCredential"`
	HotCredential   string     `json:"hotCredential,omitempty"`
	Anchor          AnchorData `json:"anchor,omitempty"`
}

CommitteeCertificateData represents CC hot key auth or resignation

type DRepCertificateData added in v0.36.0

type DRepCertificateData struct {
	CertificateType string     `json:"certificateType"`
	DRepHash        string     `json:"drepHash"`
	DRepId          string     `json:"drepId"`
	Deposit         int64      `json:"deposit,omitempty"`
	Anchor          AnchorData `json:"anchor,omitempty"`
}

DRepCertificateData represents DRep registration/update/retirement

type Event

type Event struct {
	Timestamp time.Time `json:"timestamp"`
	Context   any       `json:"context,omitempty"`
	Payload   any       `json:"payload"`
	Type      string    `json:"type"`
}

func New

func New(
	eventType string,
	timestamp time.Time,
	context, payload any,
) Event

type GovernanceContext added in v0.36.0

type GovernanceContext struct {
	TransactionHash string `json:"transactionHash"`
	BlockNumber     uint64 `json:"blockNumber"`
	SlotNumber      uint64 `json:"slotNumber"`
	TransactionIdx  uint32 `json:"transactionIdx"`
	NetworkMagic    uint32 `json:"networkMagic"`
}

GovernanceContext provides the context for governance events

func NewGovernanceContext added in v0.36.0

func NewGovernanceContext(
	block ledger.Block,
	tx ledger.Transaction,
	index uint32,
	networkMagic uint32,
) GovernanceContext

NewGovernanceContext creates a new GovernanceContext

type GovernanceEvent added in v0.36.0

type GovernanceEvent struct {
	Transaction     ledger.Transaction `json:"-"`
	BlockHash       string             `json:"blockHash"`
	TransactionCbor byteSliceJsonHex   `json:"transactionCbor,omitempty"`

	// Proposal procedures (governance actions created in this tx)
	ProposalProcedures []ProposalProcedureData `json:"proposalProcedures,omitempty"`

	// Voting procedures (votes cast in this tx)
	VotingProcedures []VotingProcedureData `json:"votingProcedures,omitempty"`

	// DRep certificates (registrations, updates, retirements)
	DRepCertificates []DRepCertificateData `json:"drepCertificates,omitempty"`

	// Vote delegation certificates
	VoteDelegationCertificates []VoteDelegationCertificateData `json:"voteDelegationCertificates,omitempty"`

	// Constitutional Committee certificates
	CommitteeCertificates []CommitteeCertificateData `json:"committeeCertificates,omitempty"`
}

GovernanceEvent contains all governance-related data from a transaction

func NewGovernanceEvent added in v0.36.0

func NewGovernanceEvent(
	block ledger.Block,
	tx ledger.Transaction,
	includeCbor bool,
) GovernanceEvent

NewGovernanceEvent creates a new GovernanceEvent from a transaction

type ProposalProcedureData added in v0.36.0

type ProposalProcedureData struct {
	Index         uint32     `json:"index"`
	Deposit       uint64     `json:"deposit"`
	RewardAccount string     `json:"rewardAccount"`
	ActionType    string     `json:"actionType"`
	Anchor        AnchorData `json:"anchor,omitempty"`
}

ProposalProcedureData represents a governance proposal

type RollbackEvent added in v0.33.0

type RollbackEvent struct {
	BlockHash  string `json:"blockHash"`
	SlotNumber uint64 `json:"slotNumber"`
}

func NewRollbackEvent added in v0.33.0

func NewRollbackEvent(point ocommon.Point) RollbackEvent

type TransactionContext added in v0.33.0

type TransactionContext struct {
	TransactionHash string `json:"transactionHash"`
	BlockNumber     uint64 `json:"blockNumber"`
	SlotNumber      uint64 `json:"slotNumber"`
	TransactionIdx  uint32 `json:"transactionIdx"`
	NetworkMagic    uint32 `json:"networkMagic"`
}

func NewTransactionContext added in v0.33.0

func NewTransactionContext(
	block ledger.Block,
	tx ledger.Transaction,
	index uint32,
	networkMagic uint32,
) TransactionContext

type TransactionEvent added in v0.33.0

type TransactionEvent struct {
	Transaction     ledger.Transaction            `json:"-"`
	Witnesses       lcommon.TransactionWitnessSet `json:"witnesses,omitempty"`
	Withdrawals     map[string]uint64             `json:"withdrawals,omitempty"`
	Metadata        lcommon.TransactionMetadatum  `json:"metadata,omitempty"`
	BlockHash       string                        `json:"blockHash"`
	ReferenceInputs []ledger.TransactionInput     `json:"referenceInputs,omitempty"`
	Certificates    []ledger.Certificate          `json:"certificates,omitempty"`
	Outputs         []ledger.TransactionOutput    `json:"outputs"`
	ResolvedInputs  []ledger.TransactionOutput    `json:"resolvedInputs,omitempty"`
	Inputs          []ledger.TransactionInput     `json:"inputs"`
	TransactionCbor byteSliceJsonHex              `json:"transactionCbor,omitempty"`
	Fee             uint64                        `json:"fee"`
	TTL             uint64                        `json:"ttl,omitempty"`
}

func NewTransactionEvent added in v0.33.0

func NewTransactionEvent(
	block ledger.Block,
	tx ledger.Transaction,
	includeCbor bool,
	resolvedInputs []ledger.TransactionOutput,
) TransactionEvent

type VoteDelegationCertificateData added in v0.36.0

type VoteDelegationCertificateData struct {
	CertificateType string `json:"certificateType"`
	StakeCredential string `json:"stakeCredential"`
	DRepType        string `json:"drepType"`
	DRepHash        string `json:"drepHash,omitempty"`
	DRepId          string `json:"drepId,omitempty"`
	PoolKeyHash     string `json:"poolKeyHash,omitempty"`
	Deposit         int64  `json:"deposit,omitempty"`
}

VoteDelegationCertificateData represents vote delegation

type VotingProcedureData added in v0.36.0

type VotingProcedureData struct {
	VoterType      string     `json:"voterType"`
	VoterHash      string     `json:"voterHash"`
	VoterId        string     `json:"voterId"`
	GovActionTxId  string     `json:"govActionTxId"`
	GovActionIndex uint32     `json:"govActionIndex"`
	Vote           string     `json:"vote"`
	Anchor         AnchorData `json:"anchor,omitempty"`
}

VotingProcedureData represents a vote cast

Jump to

Keyboard shortcuts

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