models

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatEventSig

func FormatEventSig(eventSig uint32) string

FormatEventSig formats an event signature as a hex string for better readability in logs

func ValidateBlockIDExt

func ValidateBlockIDExt(block *ton.BlockIDExt) error

ValidateBlockIDExt validates that BlockIDExt hashes have the expected length.

Types

type BlockRange

type BlockRange struct {
	Prev *ton.BlockIDExt // previous block (nil for unspecified:likely the first block in localnet)
	To   *ton.BlockIDExt // target block to process up to
}

BlockRange represents a range of blocks to process

func (*BlockRange) FromSeqNo

func (br *BlockRange) FromSeqNo() uint32

func (*BlockRange) ToSeqNo

func (br *BlockRange) ToSeqNo() uint32

type Filter

type Filter struct {
	ID            int64            // ID is a unique identifier for the filter.
	Name          string           // Name is a human-readable name for the filter, used for identification purposes.
	Address       *address.Address // specifies the source address for which logs are being filtered.
	MsgType       tlb.MsgType      // Message type to determine how to index
	EventSig      uint32           // EventSig is a identifier for the event log(topic in external out messages, opcode in internal messages).
	StartingSeqNo uint32           // StartingSeqNo defines the starting sequence number for log polling.
	LogRetention  time.Duration    // LogRetention period for logs. 0 = keep forever.
	MaxLogsKept   int64            // Maximum logs to retain per filter. 0 = unlimited.
}

internal types for processing

type FilterIndex

type FilterIndex map[string][]*Filter

FilterIndex maps filter key strings to matching Filter objects for efficient O(1) lookup. This pattern matches Solana's filtersByID approach, enabling direct property access (e.g., filter.LogRetention) without a separate retention map.

type FilterKey

type FilterKey struct {
	Address  *address.Address
	MsgType  tlb.MsgType
	EventSig uint32
}

FilterKey uniquely identifies a filter by address, message type, and event signature

func (FilterKey) String

func (fk FilterKey) String() string

String returns a canonical string representation for use as a map key.

type Log

type Log struct {
	ID           int64            // Unique identifier for the log entry.
	FilterID     int64            // Identifier of the filter that matched this log.
	ChainID      string           // ChainID of the blockchain where the log was generated.
	Address      *address.Address // Source contract address associated with the log entry.
	EventSig     uint32           // EventSig is a identifier for the event log(topic in external out messages, opcode in internal messages).
	Data         *cell.Cell       // Event msg body containing the log data.
	TxHash       TxHash           // Transaction hash for uniqueness within the blockchain.
	TxLT         uint64           // Logical time (LT) of the transaction, used for ordering and uniqueness.
	TxTimestamp  time.Time        // Timestamp of the transaction that generated the log.
	Block        *ton.BlockIDExt  // Shard block metadata
	MCBlockSeqno uint32           // Masterchain block sequence number
	MsgLT        uint64           // Message logical time for ordering
	MsgIndex     int64            // Index of the message within the transaction (0, 1, 2, ...)
	ExpiresAt    *time.Time       // Pre-computed expiration time (tx_timestamp + retention). nil = no expiry.
}

func (Log) String

func (l Log) String() string

func (Log) Validate

func (l Log) Validate(expectedChainID string) error

Validate checks if the log is valid for the given expected chainID.

type RawLog

type RawLog struct {
	Tx    *tlb.Transaction
	Block *tlb.Block
	Data  *cell.Cell
	Topic uint32
}

RawLog contains raw log data + metadata that can be transformed by consumers as needed (eg. o11y)

type ReplayStatus

type ReplayStatus int

ReplayStatus represents the current state of a replay operation

const (
	ReplayStatusNoRequest ReplayStatus = iota
	ReplayStatusRequested
	ReplayStatusPending
	ReplayStatusComplete
)

func (ReplayStatus) String

func (rs ReplayStatus) String() string

type Tx

type Tx struct {
	Transaction  *tlb.Transaction // raw TON transaction from blockchain
	Block        *ton.BlockIDExt  // shard block metadata (workchain 0)
	MCBlockSeqno uint32           // masterchain block seqno that finalized this shard block
}

type TxHash

type TxHash [32]byte // transaction hash

type TypedLog

type TypedLog[T any] struct {
	Log
	TypedData T // Parsed event data from the log's cell data(on query execution)
}

TypedLog represents a log entry with its parsed data.

func (TypedLog[T]) String

func (l TypedLog[T]) String() string

Jump to

Keyboard shortcuts

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