storage

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelHead  = "head"
	ChannelBlock = "block"
)
View Source
const (
	PriceTimeframeMinute = "1m"
	PriceTimeframeHour   = "1h"
	PriceTimeframeDay    = "1d"
)
View Source
const (
	SeriesBlobsSize     = "blobs_size"
	SeriesBlobsCount    = "blobs_count"
	SeriesBlobsFee      = "blobs_fee"
	SeriesTPS           = "tps"
	SeriesBPS           = "bps"
	SeriesFee           = "fee"
	SeriesSupplyChange  = "supply_change"
	SeriesBlockTime     = "block_time"
	SeriesTxCount       = "tx_count"
	SeriesEventsCount   = "events_count"
	SeriesGasPrice      = "gas_price"
	SeriesGasUsed       = "gas_used"
	SeriesGasLimit      = "gas_limit"
	SeriesGasEfficiency = "gas_efficiency"
	SeriesNsPfbCount    = "pfb_count"
	SeriesNsSize        = "size"
	SeriesBytesInBlock  = "bytes_in_block"
	SeriesRewards       = "rewards"
	SeriesCommissions   = "commissions"
	SeriesFlow          = "flow"
)
View Source
const (
	ViewBlockStatsByMinute    = "block_stats_by_minute"
	ViewBlockStatsByHour      = "block_stats_by_hour"
	ViewBlockStatsByDay       = "block_stats_by_day"
	ViewBlockStatsByWeek      = "block_stats_by_week"
	ViewBlockStatsByMonth     = "block_stats_by_month"
	ViewBlockStatsByYear      = "block_stats_by_year"
	ViewNamespaceStatsByHour  = "namespace_stats_by_hour"
	ViewNamespaceStatsByDay   = "namespace_stats_by_day"
	ViewNamespaceStatsByWeek  = "namespace_stats_by_week"
	ViewNamespaceStatsByMonth = "namespace_stats_by_month"
	ViewNamespaceStatsByYear  = "namespace_stats_by_year"
	ViewStakingByHour         = "staking_by_hour"
	ViewStakingByDay          = "staking_by_day"
	ViewStakingByMonth        = "staking_by_month"
	ViewLeaderboard           = "leaderboard"
	ViewLeaderboardDay        = "leaderboard_day"
	ViewSquareSize            = "square_size"
	ViewRollupStatsByHour     = "rollup_stats_by_hour"
	ViewRollupStatsByDay      = "rollup_stats_by_day"
	ViewRollupStatsByMonth    = "rollup_stats_by_month"
)
View Source
const DoNotModify = "[do-not-modify]"

Variables

View Source
var (
	ErrValidation = errors.New("validation error")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	bun.BaseModel `bun:"address" comment:"Table with celestia addresses."`

	Id         uint64      `bun:"id,pk,notnull,autoincrement" comment:"Unique internal identity"`
	Height     types.Level `bun:"height"                      comment:"Block number of the first address occurrence."`
	LastHeight types.Level `bun:"last_height"                 comment:"Block number of the last address occurrence."`
	Hash       []byte      `bun:"hash"                        comment:"Address hash."`
	Address    string      `bun:"address,unique:address_idx"  comment:"Human-readable address."`

	Balance Balance `bun:"rel:has-one,join:id=id"`
}

Address -

func (Address) String

func (address Address) String() string

func (Address) TableName

func (Address) TableName() string

TableName -

type AddressListFilter

type AddressListFilter struct {
	Limit     int
	Offset    int
	Sort      storage.SortOrder
	SortField string
}

type AddressMessageWithTx added in v1.2.0

type AddressMessageWithTx struct {
	bun.BaseModel `bun:"message,alias:message"`

	MsgAddress
	Msg *Message `bun:"rel:belongs-to,join:msg_id=id"`
	Tx  *Tx      `bun:"rel:belongs-to,join:msg__tx_id=id"`
}

type AddressMsgsFilter

type AddressMsgsFilter struct {
	Limit        int
	Offset       int
	Sort         storage.SortOrder
	MessageTypes []string
}

type AddressWithType

type AddressWithType struct {
	Address

	Type types.MsgAddressType
}

type Balance

type Balance struct {
	bun.BaseModel `bun:"balance" comment:"Table with account balances."`

	Id        uint64          `bun:"id,pk,notnull,autoincrement" comment:"Unique internal identity"`
	Currency  string          `bun:"currency,pk,notnull"         comment:"Balance currency"`
	Spendable decimal.Decimal `bun:"spendable,type:numeric"      comment:"Spendable balance"`
	Delegated decimal.Decimal `bun:"delegated,type:numeric"      comment:"Delegated balance"`
	Unbonding decimal.Decimal `bun:"unbonding,type:numeric"      comment:"Unbonding balance"`
}

func EmptyBalance

func EmptyBalance() Balance

func (Balance) IsEmpty

func (b Balance) IsEmpty() bool

func (Balance) TableName

func (Balance) TableName() string

type BlobLog added in v1.2.0

type BlobLog struct {
	bun.BaseModel `bun:"blob_log" comment:"Table with flatted blob entities."`

	Id          uint64          `bun:"id,pk,autoincrement" comment:"Unique internal identity"`
	Time        time.Time       `bun:"time,notnull,pk"     comment:"Message time"`
	Height      types.Level     `bun:"height"              comment:"Message block height"`
	Size        int64           `bun:"size"                comment:"Blob size"`
	Commitment  string          `bun:"commitment"          comment:"Blob commitment"`
	ContentType string          `bun:"content_type"        comment:"Blob content type"`
	Fee         decimal.Decimal `bun:"fee,type:numeric"    comment:"Fee per blob"`

	SignerId    uint64 `bun:"signer_id"    comment:"Blob signer identity"`
	NamespaceId uint64 `bun:"namespace_id" comment:"Namespace internal id"`
	MsgId       uint64 `bun:"msg_id"       comment:"Message id"`
	TxId        uint64 `bun:"tx_id"        comment:"Transaction id"`

	Message   *Message   `bun:"rel:belongs-to,join:msg_id=id"`
	Namespace *Namespace `bun:"rel:belongs-to,join:namespace_id=id"`
	Tx        *Tx        `bun:"rel:belongs-to,join:tx_id=id"`
	Signer    *Address   `bun:"rel:belongs-to,join:signer_id=id"`
	Rollup    *Rollup    `bun:"rel:belongs-to"`
}

func (BlobLog) TableName added in v1.2.0

func (BlobLog) TableName() string

type BlobLogFilters added in v1.2.0

type BlobLogFilters struct {
	Limit      int
	Offset     int
	Sort       sdk.SortOrder
	SortBy     string
	From       time.Time
	To         time.Time
	Commitment string
	Joins      bool
	Signers    []uint64
	Cursor     uint64
}

type Block

type Block struct {
	bun.BaseModel `bun:"table:block" comment:"Table with celestia blocks."`

	Id           uint64         `bun:",pk,notnull,autoincrement" comment:"Unique internal identity"`
	Height       pkgTypes.Level `bun:"height"                    comment:"The number (height) of this block" stats:"func:min max,filterable"`
	Time         time.Time      `bun:"time,pk,notnull"           comment:"The time of block"                 stats:"func:min max,filterable"`
	VersionBlock uint64         `bun:"version_block"             comment:"Block version"`
	VersionApp   uint64         `bun:"version_app"               comment:"App version"`

	MessageTypes types.MsgTypeBits `bun:"message_types,type:bit(74)" comment:"Bit mask with containing messages"`

	Hash               pkgTypes.Hex `bun:"hash"                 comment:"Block hash"`
	ParentHash         pkgTypes.Hex `bun:"parent_hash"          comment:"Hash of parent block"`
	LastCommitHash     pkgTypes.Hex `bun:"last_commit_hash"     comment:"Last commit hash"`
	DataHash           pkgTypes.Hex `bun:"data_hash"            comment:"Data hash"`
	ValidatorsHash     pkgTypes.Hex `bun:"validators_hash"      comment:"Validators hash"`
	NextValidatorsHash pkgTypes.Hex `bun:"next_validators_hash" comment:"Next validators hash"`
	ConsensusHash      pkgTypes.Hex `bun:"consensus_hash"       comment:"Consensus hash"`
	AppHash            pkgTypes.Hex `bun:"app_hash"             comment:"App hash"`
	LastResultsHash    pkgTypes.Hex `bun:"last_results_hash"    comment:"Last results hash"`
	EvidenceHash       pkgTypes.Hex `bun:"evidence_hash"        comment:"Evidence hash"`
	ProposerId         uint64       `bun:"proposer_id,nullzero" comment:"Proposer internal id"`

	ChainId         string           `bun:"-"` // internal field for filling state
	ProposerAddress string           `bun:"-"` // internal field for proposer
	BlockSignatures []BlockSignature `bun:"-"` // internal field for block signature

	Txs      []Tx       `bun:"rel:has-many"`
	Events   []Event    `bun:"rel:has-many"`
	Stats    BlockStats `bun:"rel:has-one,join:height=height"`
	Proposer Validator  `bun:"rel:belongs-to"`
}

Block -

func (Block) TableName

func (Block) TableName() string

TableName -

type BlockSignature added in v1.4.0

type BlockSignature struct {
	bun.BaseModel `bun:"block_signature" comment:"Table with block signatures"`

	Id          uint64      `bun:"id,pk,notnull,autoincrement" comment:"Unique internal id"`
	Height      types.Level `bun:",notnull"                    comment:"The number (height) of this block"`
	Time        time.Time   `bun:"time,pk,notnull"             comment:"The time of block"`
	ValidatorId uint64      `bun:"validator_id"                comment:"Validator's internal identity"`

	Validator *Validator `bun:"rel:belongs-to"`
}

func (BlockSignature) TableName added in v1.4.0

func (BlockSignature) TableName() string

type BlockStats

type BlockStats struct {
	bun.BaseModel `bun:"table:block_stats" comment:"Table with celestia block stats."`

	Id     uint64         `bun:",pk,notnull,autoincrement" comment:"Unique internal identity"`
	Height pkgTypes.Level `bun:"height"                    comment:"The number (height) of this block" stats:"func:min max,filterable"`
	Time   time.Time      `bun:"time,pk,notnull"           comment:"The time of block"                 stats:"func:min max,filterable"`

	TxCount       int64           `` /* 135-byte string literal not displayed */
	EventsCount   int64           `` /* 135-byte string literal not displayed */
	BlobsSize     int64           `` /* 135-byte string literal not displayed */
	BlobsCount    int             `` /* 135-byte string literal not displayed */
	BlockTime     uint64          `` /* 135-byte string literal not displayed */
	GasLimit      int64           `` /* 135-byte string literal not displayed */
	GasUsed       int64           `` /* 135-byte string literal not displayed */
	SupplyChange  decimal.Decimal `` /* 135-byte string literal not displayed */
	InflationRate decimal.Decimal `` /* 131-byte string literal not displayed */
	Fee           decimal.Decimal `` /* 135-byte string literal not displayed */
	Rewards       decimal.Decimal `` /* 135-byte string literal not displayed */
	Commissions   decimal.Decimal `` /* 135-byte string literal not displayed */
	BytesInBlock  int64           `` /* 135-byte string literal not displayed */
	SquareSize    uint64          `bun:"square_size"              comment:"Size of the square after splitting all the block data into shares"`
}

func (BlockStats) TableName

func (BlockStats) TableName() string

type ByGasPrice added in v1.1.0

type ByGasPrice []Gas

func (ByGasPrice) Len added in v1.1.0

func (gp ByGasPrice) Len() int

func (ByGasPrice) Less added in v1.1.0

func (gp ByGasPrice) Less(i, j int) bool

func (ByGasPrice) Swap added in v1.1.0

func (gp ByGasPrice) Swap(i, j int)

type Change24hBlockStats added in v1.9.7

type Change24hBlockStats struct {
	TxCount      float64 `bun:"tx_count_24h"`
	Fee          float64 `bun:"fee_24h"`
	BlobsSize    float64 `bun:"blobs_size_24h"`
	BytesInBlock float64 `bun:"bytes_in_block_24h"`
}

type Constant

type Constant struct {
	bun.BaseModel `bun:"table:constant" comment:"Table with celestia constants."`

	Module types.ModuleName `bun:"module,pk,type:module_name" comment:"Module name which declares constant"`
	Name   string           `bun:"name,pk,type:text"          comment:"Constant name"`
	Value  string           `bun:"value,type:text"            comment:"Constant value"`
}

func (Constant) MustUint32 added in v1.7.0

func (c Constant) MustUint32() uint32

func (Constant) MustUint64 added in v1.7.0

func (c Constant) MustUint64() uint64

func (Constant) TableName

func (Constant) TableName() string

type CountItem added in v1.9.7

type CountItem struct {
	Name  string `bun:"name"`
	Value int64  `bun:"value"`
}

type CountRequest

type CountRequest struct {
	Table string
	From  uint64
	To    uint64
}

func (CountRequest) Validate

func (req CountRequest) Validate() error

type Delegation added in v1.6.0

type Delegation struct {
	bun.BaseModel `bun:"delegation" comment:"Table with delegations"`

	Id          uint64          `bun:"id,pk,notnull,autoincrement"         comment:"Unique internal id"`
	AddressId   uint64          `bun:"address_id,unique:delegation_pair"   comment:"Internal address id"`
	ValidatorId uint64          `bun:"validator_id,unique:delegation_pair" comment:"Internal validator id"`
	Amount      decimal.Decimal `bun:"amount,type:numeric"                 comment:"Delegated amount"`

	Address   *Address   `bun:"rel:belongs-to,join:address_id=id"`
	Validator *Validator `bun:"rel:belongs-to,join:validator_id=id"`
}

Delegation -

func (Delegation) String added in v1.6.0

func (d Delegation) String() string

func (Delegation) TableName added in v1.6.0

func (Delegation) TableName() string

TableName -

type DenomMetadata

type DenomMetadata struct {
	bun.BaseModel `bun:"table:denom_metadata" comment:"Table with celestia coins metadata."`

	Id          uint64 `bun:"id,pk,notnull,autoincrement" comment:"Internal unique identity"`
	Description string `bun:"description,type:text"       comment:"Denom description"`
	Base        string `bun:"base,type:text"              comment:"Denom base"`
	Display     string `bun:"display,type:text"           comment:"Denom display"`
	Name        string `bun:"name,type:text"              comment:"Denom name"`
	Symbol      string `bun:"symbol,type:text"            comment:"Denom symbol"`
	Uri         string `bun:"uri,type:text"               comment:"Denom uri"`

	Units []byte `bun:"units,type:bytea" comment:"Denom units information"`
}

func (DenomMetadata) TableName

func (DenomMetadata) TableName() string

type DistributionItem added in v1.6.1

type DistributionItem struct {
	Name  int    `bun:"name"`
	Value string `bun:"value"`
}

type Event

type Event struct {
	bun.BaseModel `bun:"event" comment:"Table with celestia events."`

	Id       uint64          `bun:"id,pk,notnull,autoincrement"      comment:"Unique internal id"`
	Height   pkgTypes.Level  `bun:"height,notnull"                   comment:"The number (height) of this block" stats:"func:min max,filterable"`
	Time     time.Time       `bun:"time,pk,notnull"                  comment:"The time of block"                 stats:"func:min max,filterable"`
	Position int64           `bun:"position"                         comment:"Position in transaction"`
	Type     types.EventType `bun:",type:event_type"                 comment:"Event type"                        stats:"filterable"`
	TxId     *uint64         `bun:"tx_id"                            comment:"Transaction id"`
	Data     map[string]any  `bun:"data,msgpack,type:bytea,nullzero" comment:"Event data"`
}

Event -

func (Event) TableName

func (Event) TableName() string

TableName -

type EventFilter added in v1.5.0

type EventFilter struct {
	Limit  int
	Offset int
	Time   time.Time
}

type Export added in v1.5.0

type Export interface {
	ToCsv(ctx context.Context, writer io.Writer, query string) error
	Close() error
}

type Gas added in v1.1.0

type Gas struct {
	GasWanted int64           `bun:"gas_wanted"`
	GasUsed   int64           `bun:"gas_used"`
	Fee       decimal.Decimal `bun:"fee"`
	GasPrice  decimal.Decimal `bun:"gas_price"`
}

type Grant added in v1.7.0

type Grant struct {
	bun.BaseModel `bun:"grant" comment:"Table with grants"`

	Id            uint64         `bun:"id,pk,notnull,autoincrement"    comment:"Unique internal identity"`
	Height        types.Level    `bun:"height"                         comment:"Block height"`
	RevokeHeight  *types.Level   `bun:"revoke_height"                  comment:"Block height when grant was revoked"`
	Time          time.Time      `bun:"time"                           comment:"The time of block"`
	GranterId     uint64         `bun:"granter_id,unique:grant_key"    comment:"Granter internal identity"`
	GranteeId     uint64         `bun:"grantee_id,unique:grant_key"    comment:"Grantee internal identity"`
	Authorization string         `bun:"authorization,unique:grant_key" comment:"Authorization type"`
	Expiration    *time.Time     `bun:"expiration"                     comment:"Expiration time"`
	Revoked       bool           `bun:"revoked"                        comment:"Is grant revoked"`
	Params        map[string]any `bun:"params,type:jsonb,nullzero"     comment:"Authorization parameters"`

	Granter *Address `bun:"rel:has-one"`
	Grantee *Address `bun:"rel:has-one"`
}

func (Grant) String added in v1.7.0

func (g Grant) String() string

func (Grant) TableName added in v1.7.0

func (Grant) TableName() string

type HistogramCountRequest

type HistogramCountRequest struct {
	CountRequest
	Timeframe Timeframe
}

func (HistogramCountRequest) Validate

func (req HistogramCountRequest) Validate() error

type HistogramItem

type HistogramItem struct {
	Time  time.Time `bun:"bucket"`
	Value string    `bun:"value"`
}

type HistogramRequest

type HistogramRequest struct {
	SummaryRequest
	Timeframe Timeframe
}

func (HistogramRequest) Validate

func (req HistogramRequest) Validate() error

type IAddress

type IAddress interface {
	storage.Table[*Address]

	ByHash(ctx context.Context, hash []byte) (Address, error)
	ListWithBalance(ctx context.Context, filters AddressListFilter) ([]Address, error)
	Series(ctx context.Context, addressId uint64, timeframe Timeframe, column string, req SeriesRequest) (items []HistogramItem, err error)
	IdByHash(ctx context.Context, hash ...[]byte) ([]uint64, error)
	IdByAddress(ctx context.Context, address string, ids ...uint64) (uint64, error)
}

type IBalance

type IBalance interface {
	storage.Table[*Balance]
}

type IBlobLog added in v1.2.0

type IBlobLog interface {
	sdk.Table[*BlobLog]

	ByNamespace(ctx context.Context, nsId uint64, fltrs BlobLogFilters) ([]BlobLog, error)
	ByProviders(ctx context.Context, providers []RollupProvider, fltrs BlobLogFilters) ([]BlobLog, error)
	BySigner(ctx context.Context, signerId uint64, fltrs BlobLogFilters) ([]BlobLog, error)
	ByTxId(ctx context.Context, txId uint64, fltrs BlobLogFilters) ([]BlobLog, error)
	ByHeight(ctx context.Context, height types.Level, fltrs BlobLogFilters) ([]BlobLog, error)
	CountByTxId(ctx context.Context, txId uint64) (int, error)
	CountByHeight(ctx context.Context, height types.Level) (int, error)
	ExportByProviders(ctx context.Context, providers []RollupProvider, from, to time.Time, stream io.Writer) (err error)
	Blob(ctx context.Context, height types.Level, nsId uint64, commitment string) (BlobLog, error)
	ListBlobs(ctx context.Context, fltrs ListBlobLogFilters) ([]BlobLog, error)
}

type IBlock

type IBlock interface {
	storage.Table[*Block]

	Last(ctx context.Context) (Block, error)
	ByIdWithRelations(ctx context.Context, id uint64) (Block, error)
	ByHeight(ctx context.Context, height pkgTypes.Level) (Block, error)
	ByHeightWithStats(ctx context.Context, height pkgTypes.Level) (Block, error)
	ByHash(ctx context.Context, hash []byte) (Block, error)
	ByProposer(ctx context.Context, proposerId uint64, limit, offset int) ([]Block, error)
	ListWithStats(ctx context.Context, limit, offset uint64, order storage.SortOrder) ([]*Block, error)
	Time(ctx context.Context, height pkgTypes.Level) (time.Time, error)
}

type IBlockSignature added in v1.4.0

type IBlockSignature interface {
	storage.Table[*BlockSignature]

	LevelsByValidator(ctx context.Context, validatorId uint64, startHeight types.Level) ([]types.Level, error)
}

type IBlockStats

type IBlockStats interface {
	ByHeight(ctx context.Context, height pkgTypes.Level) (BlockStats, error)
	LastFrom(ctx context.Context, head pkgTypes.Level, limit int) ([]BlockStats, error)
}

type IConstant

type IConstant interface {
	Get(ctx context.Context, module types.ModuleName, name string) (Constant, error)
	ByModule(ctx context.Context, module types.ModuleName) ([]Constant, error)
	All(ctx context.Context) ([]Constant, error)
}

type IDelegation added in v1.6.0

type IDelegation interface {
	storage.Table[*Delegation]

	ByAddress(ctx context.Context, addressId uint64, limit, offset int, showZero bool) ([]Delegation, error)
	ByValidator(ctx context.Context, validatorId uint64, limit, offset int, showZero bool) ([]Delegation, error)
}

type IDenomMetadata

type IDenomMetadata interface {
	All(ctx context.Context) ([]DenomMetadata, error)
}

type IEvent

type IEvent interface {
	storage.Table[*Event]

	ByTxId(ctx context.Context, txId uint64, fltrs EventFilter) ([]Event, error)
	ByBlock(ctx context.Context, height pkgTypes.Level, fltrs EventFilter) ([]Event, error)
}

type IGrant added in v1.7.0

type IGrant interface {
	storage.Table[*Grant]

	ByGranter(ctx context.Context, id uint64, limit, offset int) ([]Grant, error)
	ByGrantee(ctx context.Context, id uint64, limit, offset int) ([]Grant, error)
}

type IJail added in v1.6.0

type IJail interface {
	storage.Table[*Jail]

	ByValidator(ctx context.Context, id uint64, limit, offset int) ([]Jail, error)
}

type IMessage

type IMessage interface {
	storage.Table[*Message]

	ByTxId(ctx context.Context, txId uint64, limit, offset int) ([]Message, error)
	ListWithTx(ctx context.Context, filters MessageListWithTxFilters) ([]MessageWithTx, error)
	ByAddress(ctx context.Context, id uint64, filters AddressMsgsFilter) ([]AddressMessageWithTx, error)
}

type INamespace

type INamespace interface {
	sdk.Table[*Namespace]

	ByNamespaceId(ctx context.Context, namespaceId []byte) ([]Namespace, error)
	ByNamespaceIdAndVersion(ctx context.Context, namespaceId []byte, version byte) (Namespace, error)
	Messages(ctx context.Context, id uint64, limit, offset int) ([]NamespaceMessage, error)
	ListWithSort(ctx context.Context, sortField string, sort sdk.SortOrder, limit, offset int) (ns []Namespace, err error)
	GetByIds(ctx context.Context, ids ...uint64) (ns []Namespace, err error)
}

type IPrice added in v1.2.0

type IPrice interface {
	Save(ctx context.Context, price *Price) error
	Last(ctx context.Context) (Price, error)
	Get(ctx context.Context, timeframe string, start, end time.Time, limit int) ([]Price, error)
}

type IRedelegation added in v1.6.0

type IRedelegation interface {
	storage.Table[*Redelegation]

	ByAddress(ctx context.Context, addressId uint64, limit, offset int) ([]Redelegation, error)
}

type IRollup added in v1.2.0

type IRollup interface {
	sdk.Table[*Rollup]

	Leaderboard(ctx context.Context, fltrs LeaderboardFilters) ([]RollupWithStats, error)
	LeaderboardDay(ctx context.Context, fltrs LeaderboardFilters) ([]RollupWithDayStats, error)
	Namespaces(ctx context.Context, rollupId uint64, limit, offset int) (namespaceIds []uint64, err error)
	Providers(ctx context.Context, rollupId uint64) (providers []RollupProvider, err error)
	RollupsByNamespace(ctx context.Context, namespaceId uint64, limit, offset int) (rollups []Rollup, err error)
	ById(ctx context.Context, rollupId uint64) (RollupWithStats, error)
	Series(ctx context.Context, rollupId uint64, timeframe, column string, req SeriesRequest) (items []HistogramItem, err error)
	AllSeries(ctx context.Context) ([]RollupHistogramItem, error)
	Count(ctx context.Context) (int64, error)
	Distribution(ctx context.Context, rollupId uint64, series, groupBy string) (items []DistributionItem, err error)
	BySlug(ctx context.Context, slug string) (RollupWithStats, error)
}

type IRollupProvider added in v1.2.0

type IRollupProvider interface {
	storage.Table[*RollupProvider]
}

type ISearch added in v1.4.0

type ISearch interface {
	Search(ctx context.Context, query []byte) ([]SearchResult, error)
	SearchText(ctx context.Context, text string) ([]SearchResult, error)
}

type IStakingLog added in v1.6.0

type IStakingLog interface {
	storage.Table[*StakingLog]
}

type IState

type IState interface {
	storage.Table[*State]

	ByName(ctx context.Context, name string) (State, error)
}

type IStats

type IStats interface {
	Count(ctx context.Context, req CountRequest) (string, error)
	Summary(ctx context.Context, req SummaryRequest) (string, error)
	TPS(ctx context.Context) (TPS, error)
	Series(ctx context.Context, timeframe Timeframe, name string, req SeriesRequest) ([]SeriesItem, error)
	CumulativeSeries(ctx context.Context, timeframe Timeframe, name string, req SeriesRequest) ([]SeriesItem, error)
	NamespaceSeries(ctx context.Context, timeframe Timeframe, name string, nsId uint64, req SeriesRequest) (response []SeriesItem, err error)
	StakingSeries(ctx context.Context, timeframe Timeframe, name string, validatorId uint64, req SeriesRequest) (response []SeriesItem, err error)
	RollupStats24h(ctx context.Context) ([]RollupStats24h, error)
	SquareSize(ctx context.Context, from, to *time.Time) (map[int][]SeriesItem, error)
	Change24hBlockStats(ctx context.Context) (response Change24hBlockStats, err error)
	MessagesCount24h(ctx context.Context) ([]CountItem, error)
}

type ITx

type ITx interface {
	storage.Table[*Tx]

	ByHash(ctx context.Context, hash []byte) (Tx, error)
	IdByHash(ctx context.Context, hash []byte) (uint64, error)
	Filter(ctx context.Context, fltrs TxFilter) ([]Tx, error)
	ByIdWithRelations(ctx context.Context, id uint64) (Tx, error)
	ByAddress(ctx context.Context, addressId uint64, fltrs TxFilter) ([]Tx, error)
	Genesis(ctx context.Context, limit, offset int, sortOrder storage.SortOrder) ([]Tx, error)
	Gas(ctx context.Context, height pkgTypes.Level, ts time.Time) ([]Gas, error)
}

type IUndelegation added in v1.6.0

type IUndelegation interface {
	storage.Table[*Undelegation]

	ByAddress(ctx context.Context, addressId uint64, limit, offset int) ([]Undelegation, error)
}

type IValidator

type IValidator interface {
	storage.Table[*Validator]

	ByAddress(ctx context.Context, address string) (Validator, error)
	TotalVotingPower(ctx context.Context) (decimal.Decimal, error)
	ListByPower(ctx context.Context, fltrs ValidatorFilters) ([]Validator, error)
	JailedCount(ctx context.Context) (int, error)
}

type IVestingAccount added in v1.7.0

type IVestingAccount interface {
	storage.Table[*VestingAccount]

	ByAddress(ctx context.Context, addressId uint64, limit, offset int, showEnded bool) ([]VestingAccount, error)
}

type IVestingPeriod added in v1.7.0

type IVestingPeriod interface {
	storage.Table[*VestingPeriod]

	ByVesting(ctx context.Context, id uint64, limit, offset int) ([]VestingPeriod, error)
}

type Jail added in v1.6.0

type Jail struct {
	bun.BaseModel `bun:"jail" comment:"Table with all jailed events."`

	Id          uint64          `bun:"id,pk,notnull,autoincrement" comment:"Unique internal id"`
	Time        time.Time       `bun:"time,pk,notnull"             comment:"The time of block"`
	Height      pkgTypes.Level  `bun:"height,notnull"              comment:"The number (height) of this block"`
	ValidatorId uint64          `bun:"validator_id,notnull"        comment:"Internal validator id"`
	Reason      string          `bun:"reason"                      comment:"Reason"`
	Burned      decimal.Decimal `bun:"burned,type:numeric"         comment:"Burned coins"`

	Validator *Validator `bun:"rel:belongs-to,join:validator_id=id"`
}

Jail -

func (Jail) TableName added in v1.6.0

func (Jail) TableName() string

TableName -

type LeaderboardFilters added in v1.10.4

type LeaderboardFilters struct {
	SortField string
	Sort      sdk.SortOrder
	Limit     int
	Offset    int
	Category  []types.RollupCategory
}

type ListBlobLogFilters added in v1.10.0

type ListBlobLogFilters struct {
	Limit      int
	Offset     int
	Sort       sdk.SortOrder
	SortBy     string
	From       time.Time
	To         time.Time
	Commitment string
	Signers    []uint64
	Namespaces []uint64
	Cursor     uint64
}

type Listener

type Listener interface {
	io.Closer

	Subscribe(ctx context.Context, channels ...string) error
	Listen() chan *pq.Notification
}

type ListenerFactory

type ListenerFactory interface {
	CreateListener() Listener
}

type Message

type Message struct {
	bun.BaseModel `bun:"message" comment:"Table with celestia messages."`

	Id       uint64            `bun:"id,pk,notnull,autoincrement" comment:"Unique internal id"`
	Height   pkgTypes.Level    `bun:",notnull"                    comment:"The number (height) of this block" stats:"func:min max,filterable"`
	Time     time.Time         `bun:"time,pk,notnull"             comment:"The time of block"                 stats:"func:min max,filterable"`
	Position int64             `bun:"position"                    comment:"Position in transaction"`
	Type     types.MsgType     `bun:",type:msg_type"              comment:"Message type"                      stats:"filterable"`
	TxId     uint64            `bun:"tx_id"                       comment:"Parent transaction id"`
	Size     int               `bun:"size"                        comment:"Message size in bytes"`
	Data     types.PackedBytes `bun:"data,type:bytea,nullzero"    comment:"Message data"`

	Namespace      []Namespace       `bun:"m2m:namespace_message,join:Message=Namespace"`
	Addresses      []AddressWithType `bun:"-"`
	BlobLogs       []*BlobLog        `bun:"-"`
	Grants         []Grant           `bun:"-"`
	InternalMsgs   []string          `bun:"-"` // field for parsing MsgExec internal messages
	VestingAccount *VestingAccount   `bun:"-"` // internal field
}

Message -

func (Message) TableName

func (Message) TableName() string

TableName -

type MessageListWithTxFilters added in v1.0.4

type MessageListWithTxFilters struct {
	Height               pkgTypes.Level
	Limit                int
	Offset               int
	ExcludedMessageTypes []string
	MessageTypes         []string
}

type MessageWithTx added in v1.0.4

type MessageWithTx struct {
	bun.BaseModel `bun:"message,alias:message"`

	Message
	Tx *Tx `bun:"rel:belongs-to"`
}

type MsgAddress

type MsgAddress struct {
	bun.BaseModel `bun:"msg_address" comment:"Table with relation tx to address"`

	AddressId uint64               `bun:"address_id,pk"             comment:"Address internal id"`
	MsgId     uint64               `bun:"msg_id,pk"                 comment:"Message internal id"`
	Type      types.MsgAddressType `bun:",pk,type:msg_address_type" comment:"The reason why address link to transaction"`

	Address *Address `bun:"rel:belongs-to,join:address_id=id"`
	Msg     *Message `bun:"rel:belongs-to,join:msg_id=id"`
}

func (MsgAddress) String added in v1.0.4

func (m MsgAddress) String() string

func (MsgAddress) TableName

func (MsgAddress) TableName() string

type Namespace

type Namespace struct {
	bun.BaseModel `bun:"namespace" comment:"Table with celestia namespaces."`

	Id              uint64      `bun:"id,pk,autoincrement"                          comment:"Unique internal identity"`
	FirstHeight     types.Level `bun:"first_height,notnull"                         comment:"Block height of the first message changing the namespace"`
	LastHeight      types.Level `bun:"last_height,notnull"                          comment:"Block height of the last message changing the namespace"`
	Version         byte        `bun:"version,unique:namespace_id_version_idx"      comment:"Namespace version"`
	NamespaceID     []byte      `bun:"namespace_id,unique:namespace_id_version_idx" comment:"Namespace identity"`
	Size            int64       `bun:"size"                                         comment:"Blobs size"`
	PfbCount        int64       `bun:"pfb_count"                                    comment:"Count of pay for blobs messages for the namespace"`
	BlobsCount      int64       `bun:"blobs_count"                                  comment:"Count of blobs sent to namespace"`
	Reserved        bool        `bun:"reserved,default:false"                       comment:"If namespace is reserved flag is true"`
	LastMessageTime time.Time   `bun:"last_message_time"                            comment:"Time when last pay for blob was sent"`
}

Namespace -

func (Namespace) Copy added in v1.3.0

func (ns Namespace) Copy() *Namespace

func (Namespace) Hash

func (ns Namespace) Hash() string

func (Namespace) String

func (ns Namespace) String() string

func (Namespace) TableName

func (Namespace) TableName() string

TableName -

type NamespaceMessage

type NamespaceMessage struct {
	bun.BaseModel `bun:"namespace_message" comment:"Table with relation messages to namespace."`

	NamespaceId uint64 `bun:"namespace_id,pk" comment:"Namespace internal id"`
	MsgId       uint64 `bun:"msg_id,pk"       comment:"Message id"`
	TxId        uint64 `bun:"tx_id"           comment:"Transaction id"`

	Time   time.Time   `bun:"time,notnull,pk" comment:"Message time"`
	Height types.Level `bun:"height"          comment:"Message block height"`
	Size   uint64      `bun:"size"            comment:"Total namespace size change due to message"`

	Message   *Message   `bun:"rel:belongs-to,join:msg_id=id"`
	Namespace *Namespace `bun:"rel:belongs-to,join:namespace_id=id"`
	Tx        *Tx        `bun:"rel:belongs-to,join:tx_id=id"`
}

func (NamespaceMessage) TableName

func (NamespaceMessage) TableName() string

type Notificator

type Notificator interface {
	Notify(ctx context.Context, channel string, payload string) error
}

type Price added in v1.2.0

type Price struct {
	bun.BaseModel `bun:"price" comment:"Table with TIA price"`

	Time  time.Time       `bun:"time,pk"             comment:"Time of candles"`
	Open  decimal.Decimal `bun:"open,,type:numeric"  comment:"Open price"`
	High  decimal.Decimal `bun:"high,,type:numeric"  comment:"High price"`
	Low   decimal.Decimal `bun:"low,,type:numeric"   comment:"Low price"`
	Close decimal.Decimal `bun:"close,,type:numeric" comment:"Close price"`
}

func (Price) TableName added in v1.2.0

func (Price) TableName() string

TableName -

type Redelegation added in v1.6.0

type Redelegation struct {
	bun.BaseModel `bun:"redelegation" comment:"Table with redelegations"`

	Id             uint64          `bun:"id,pk,notnull,autoincrement" comment:"Unique internal id"`
	Time           time.Time       `bun:"time,notnull"                comment:"The time of block"`
	Height         pkgTypes.Level  `bun:",notnull"                    comment:"The number (height) of this block"`
	AddressId      uint64          `bun:"address_id"                  comment:"Internal address id"`
	SrcId          uint64          `bun:"src_id"                      comment:"Internal source validator id"`
	DestId         uint64          `bun:"dest_id"                     comment:"Internal destination validator id"`
	Amount         decimal.Decimal `bun:"amount,type:numeric"         comment:"Delegated amount"`
	CompletionTime time.Time       `bun:"completion_time"             comment:"Time when redelegation will be completed"`

	Address     *Address   `bun:"rel:belongs-to,join:address_id=id"`
	Source      *Validator `bun:"rel:belongs-to,join:src_id=id"`
	Destination *Validator `bun:"rel:belongs-to,join:dest_id=id"`
}

Redelegation -

func (Redelegation) TableName added in v1.6.0

func (Redelegation) TableName() string

TableName -

type RolluDayStats added in v1.9.10

type RolluDayStats struct {
	AvgSize        float64         `bun:"avg_size"`
	BlobsCount     int64           `bun:"blobs_count"`
	TotalSize      int64           `bun:"total_size"`
	Throghput      int64           `bun:"throughput"`
	TotalFee       decimal.Decimal `bun:"total_fee"`
	NamespaceCount int64           `bun:"namespace_count"`
	PfbCount       int64           `bun:"pfb_count"`
	MBPrice        decimal.Decimal `bun:"mb_price"`
}

type Rollup added in v1.2.0

type Rollup struct {
	bun.BaseModel `bun:"rollup" comment:"Table with rollups."`

	Id             uint64               `bun:"id,pk,autoincrement"           comment:"Unique internal identity"`
	Name           string               `bun:"name"                          comment:"Rollup's name"`
	Description    string               `bun:"description"                   comment:"Rollup's description"`
	Website        string               `bun:"website"                       comment:"Website"`
	GitHub         string               `bun:"github"                        comment:"Github repository"`
	Twitter        string               `bun:"twitter"                       comment:"Twitter account"`
	Slug           string               `bun:"slug,unique:rollup_slug"       comment:"Rollup slug"`
	BridgeContract string               `bun:"bridge_contract"               comment:"Link to bridge contract"`
	L2Beat         string               `bun:"l2_beat"                       comment:"Link to L2 Beat"`
	Explorer       string               `bun:"explorer"                      comment:"Link to chain explorer"`
	Stack          string               `bun:"stack"                         comment:"Underlaying stack"`
	Compression    string               `bun:"compression"                   comment:"Compression"`
	Provider       string               `bun:"provider"                      comment:"RaaS provider"`
	Type           types.RollupType     `bun:"type,type:rollup_type"         comment:"Type of rollup: settled or sovereign"`
	Category       types.RollupCategory `bun:"category,type:rollup_category" comment:"Category of rollup"`
	VM             string               `bun:"vm"                            comment:"Virtual machine"`
	Links          []string             `bun:"links,array"                   comment:"Other links to rollup related sites"`

	Providers []*RollupProvider `bun:"rel:has-many,join:id=rollup_id"`
}

Rollup -

func (Rollup) IsEmpty added in v1.2.0

func (r Rollup) IsEmpty() bool

func (Rollup) TableName added in v1.2.0

func (Rollup) TableName() string

TableName -

type RollupHistogramItem added in v1.9.10

type RollupHistogramItem struct {
	Fee        string    `bun:"fee"`
	BlobsCount int64     `bun:"blobs_count"`
	Size       int64     `bun:"size"`
	Name       string    `bun:"name"`
	Time       time.Time `bun:"time"`
}

type RollupProvider added in v1.2.0

type RollupProvider struct {
	bun.BaseModel `bun:"rollup_provider" comment:"Table with data providers for rollups."`

	RollupId    uint64 `bun:"rollup_id,pk"    comment:"Unique internal rollup identity"`
	NamespaceId uint64 `bun:"namespace_id,pk" comment:"Namespace identity. May be NULL"`
	AddressId   uint64 `bun:"address_id,pk"   comment:"Celestia address of data provider"`
}

RollupProvider -

func (RollupProvider) TableName added in v1.2.0

func (RollupProvider) TableName() string

TableName -

type RollupStats added in v1.3.2

type RollupStats struct {
	Size            int64           `bun:"size"`
	BlobsCount      int64           `bun:"blobs_count"`
	LastActionTime  time.Time       `bun:"last_time"`
	FirstActionTime time.Time       `bun:"first_time"`
	Fee             decimal.Decimal `bun:"fee"`
	SizePct         float64         `bun:"size_pct"`
	FeePct          float64         `bun:"fee_pct"`
	BlobsCountPct   float64         `bun:"blobs_count_pct"`
}

type RollupStats24h added in v1.9.7

type RollupStats24h struct {
	RollupId   int64   `bun:"rollup_id"`
	Name       string  `bun:"name"`
	Size       int64   `bun:"size"`
	Fee        float64 `bun:"fee"`
	BlobsCount int64   `bun:"blobs_count"`
}

type RollupWithDayStats added in v1.9.10

type RollupWithDayStats struct {
	Rollup
	RolluDayStats
}

type RollupWithStats added in v1.2.0

type RollupWithStats struct {
	Rollup
	RollupStats
}

type SearchResult added in v1.4.0

type SearchResult struct {
	Id    uint64 `bun:"id"`
	Value string `bun:"value"`
	Type  string `bun:"type"`
}

type SeriesItem added in v1.1.0

type SeriesItem struct {
	Time  time.Time `bun:"ts"`
	Value string    `bun:"value"`
	Max   string    `bun:"max"`
	Min   string    `bun:"min"`
}

type SeriesRequest added in v1.1.0

type SeriesRequest struct {
	From time.Time
	To   time.Time
}

func NewSeriesRequest added in v1.3.2

func NewSeriesRequest(from, to int64) SeriesRequest

type Signer

type Signer struct {
	bun.BaseModel `bun:"signer" comment:"Table with signers tx"`

	AddressId uint64 `bun:"address_id,pk" comment:"Address internal id"`
	TxId      uint64 `bun:"tx_id,pk"      comment:"Transaction internal id"`

	Address *Address `bun:"rel:belongs-to,join:address_id=id"`
	Tx      *Tx      `bun:"rel:belongs-to,join:tx_id=id"`
}

func (Signer) TableName

func (Signer) TableName() string

type StakingLog added in v1.6.0

type StakingLog struct {
	bun.BaseModel `bun:"staking_log" comment:"Table with staking events log"`

	Id          uint64               `bun:"id,pk,notnull,autoincrement" comment:"Unique internal id"`
	Time        time.Time            `bun:"time,pk,notnull"             comment:"The time of block"                 stats:"func:min max,filterable"`
	Height      pkgTypes.Level       `bun:"height,notnull"              comment:"The number (height) of this block" stats:"func:min max,filterable"`
	AddressId   *uint64              `bun:"address_id"                  comment:"Internal address id"`
	ValidatorId uint64               `bun:"validator_id"                comment:"Internal validator id"`
	Change      decimal.Decimal      `bun:"change,type:numeric"         comment:"Change amount"`
	Type        types.StakingLogType `bun:"type,type:staking_log_type"  comment:"Staking log type"`

	Address   *Address   `bun:"rel:belongs-to,join:address_id=id"`
	Validator *Validator `bun:"rel:belongs-to,join:validator_id=id"`
}

Delegation -

func (StakingLog) TableName added in v1.6.0

func (StakingLog) TableName() string

TableName -

type State

type State struct {
	bun.BaseModel `bun:"state" comment:"Current indexer state"`

	Id              uint64          `bun:",pk,autoincrement"         comment:"Unique internal identity"`
	Name            string          `bun:",unique:state_name"        comment:"Indexer name"`
	LastHeight      types.Level     `bun:"last_height"               comment:"Last block height"`
	LastHash        []byte          `bun:"last_hash"                 comment:"Last block hash"`
	LastTime        time.Time       `bun:"last_time"                 comment:"Time of last block"`
	ChainId         string          `bun:"chain_id"                  comment:"Celestia chain id"`
	TotalTx         int64           `bun:"total_tx"                  comment:"Transactions count in celestia"`
	TotalAccounts   int64           `bun:"total_accounts"            comment:"Accounts count in celestia"`
	TotalNamespaces int64           `bun:"total_namespaces"          comment:"Namespaces count in celestia"`
	TotalBlobsSize  int64           `bun:"total_blobs_size"          comment:"Total blobs size"`
	TotalValidators int             `bun:"total_validators"          comment:"Total validator's count"`
	TotalSupply     decimal.Decimal `bun:"total_supply,type:numeric" comment:"Total supply in celestia"`
	TotalFee        decimal.Decimal `bun:"total_fee,type:numeric"    comment:"Total paid fee"`
	TotalStake      decimal.Decimal `bun:"total_stake,type:numeric"  comment:"Total stake"`

	TotalVotingPower decimal.Decimal `bun:"-"`
}

State -

func (State) TableName

func (State) TableName() string

TableName -

type SummaryRequest

type SummaryRequest struct {
	CountRequest
	Column   string
	Function string
}

func (SummaryRequest) Validate

func (req SummaryRequest) Validate() error

type TPS added in v1.1.0

type TPS struct {
	Low               float64
	High              float64
	Current           float64
	ChangeLastHourPct float64
}

type Timeframe

type Timeframe string
const (
	TimeframeHour  Timeframe = "hour"
	TimeframeDay   Timeframe = "day"
	TimeframeWeek  Timeframe = "week"
	TimeframeMonth Timeframe = "month"
	TimeframeYear  Timeframe = "year"
)

type Transaction

type Transaction interface {
	sdk.Transaction

	SaveConstants(ctx context.Context, constants ...Constant) error
	SaveTransactions(ctx context.Context, txs ...Tx) error
	SaveNamespaces(ctx context.Context, namespaces ...*Namespace) (int64, error)
	SaveAddresses(ctx context.Context, addresses ...*Address) (int64, error)
	SaveVestingAccounts(ctx context.Context, accounts ...*VestingAccount) error
	SaveVestingPeriods(ctx context.Context, periods ...VestingPeriod) error
	SaveBalances(ctx context.Context, balances ...Balance) error
	SaveMessages(ctx context.Context, msgs ...*Message) error
	SaveSigners(ctx context.Context, addresses ...Signer) error
	SaveMsgAddresses(ctx context.Context, addresses ...MsgAddress) error
	SaveNamespaceMessage(ctx context.Context, nsMsgs ...NamespaceMessage) error
	SaveBlobLogs(ctx context.Context, logs ...BlobLog) error
	SaveValidators(ctx context.Context, validators ...*Validator) (int, error)
	SaveEvents(ctx context.Context, events ...Event) error
	SaveRollup(ctx context.Context, rollup *Rollup) error
	SaveGrants(ctx context.Context, grants ...Grant) error
	UpdateRollup(ctx context.Context, rollup *Rollup) error
	SaveProviders(ctx context.Context, providers ...RollupProvider) error
	SaveUndelegations(ctx context.Context, undelegations ...Undelegation) error
	SaveRedelegations(ctx context.Context, redelegations ...Redelegation) error
	SaveDelegations(ctx context.Context, delegations ...Delegation) error
	UpdateSlashedDelegations(ctx context.Context, validatorId uint64, fraction decimal.Decimal) ([]Balance, error)
	SaveStakingLogs(ctx context.Context, logs ...StakingLog) error
	SaveJails(ctx context.Context, jails ...Jail) error
	SaveBlockSignatures(ctx context.Context, signs ...BlockSignature) error
	RetentionBlockSignatures(ctx context.Context, height types.Level) error
	CancelUnbondings(ctx context.Context, cancellations ...Undelegation) error
	RetentionCompletedUnbondings(ctx context.Context, blockTime time.Time) error
	RetentionCompletedRedelegations(ctx context.Context, blockTime time.Time) error
	Jail(ctx context.Context, validators ...*Validator) error

	RollbackBlock(ctx context.Context, height types.Level) error
	RollbackBlockStats(ctx context.Context, height types.Level) (stats BlockStats, err error)
	RollbackAddresses(ctx context.Context, height types.Level) (address []Address, err error)
	RollbackVestingAccounts(ctx context.Context, height types.Level) error
	RollbackVestingPeriods(ctx context.Context, height types.Level) error
	RollbackTxs(ctx context.Context, height types.Level) (txs []Tx, err error)
	RollbackEvents(ctx context.Context, height types.Level) (events []Event, err error)
	RollbackMessages(ctx context.Context, height types.Level) (msgs []Message, err error)
	RollbackNamespaceMessages(ctx context.Context, height types.Level) (msgs []NamespaceMessage, err error)
	RollbackNamespaces(ctx context.Context, height types.Level) (ns []Namespace, err error)
	RollbackValidators(ctx context.Context, height types.Level) ([]Validator, error)
	RollbackBlobLog(ctx context.Context, height types.Level) error
	RollbackGrants(ctx context.Context, height types.Level) error
	RollbackBlockSignatures(ctx context.Context, height types.Level) (err error)
	RollbackSigners(ctx context.Context, txIds []uint64) (err error)
	RollbackMessageAddresses(ctx context.Context, msgIds []uint64) (err error)
	RollbackUndelegations(ctx context.Context, height types.Level) (err error)
	RollbackRedelegations(ctx context.Context, height types.Level) (err error)
	RollbackStakingLogs(ctx context.Context, height types.Level) ([]StakingLog, error)
	RollbackJails(ctx context.Context, height types.Level) ([]Jail, error)
	DeleteBalances(ctx context.Context, ids []uint64) error
	DeleteProviders(ctx context.Context, rollupId uint64) error
	DeleteRollup(ctx context.Context, rollupId uint64) error
	DeleteDelegationsByValidator(ctx context.Context, ids ...uint64) error
	UpdateValidators(ctx context.Context, validators ...*Validator) error

	State(ctx context.Context, name string) (state State, err error)
	LastBlock(ctx context.Context) (block Block, err error)
	Namespace(ctx context.Context, id uint64) (ns Namespace, err error)
	LastNamespaceMessage(ctx context.Context, nsId uint64) (msg NamespaceMessage, err error)
	LastAddressAction(ctx context.Context, address []byte) (uint64, error)
	GetProposerId(ctx context.Context, address string) (uint64, error)
	Validator(ctx context.Context, id uint64) (val Validator, err error)
	Delegation(ctx context.Context, validatorId, addressId uint64) (val Delegation, err error)
	RefreshLeaderboard(ctx context.Context) error
}

type Tx

type Tx struct {
	bun.BaseModel `bun:"tx" comment:"Table with celestia transactions."`

	Id            uint64          `bun:"id,autoincrement,pk,notnull" comment:"Unique internal id"`
	Height        pkgTypes.Level  `bun:",notnull"                    comment:"The number (height) of this block"                 stats:"func:min max,filterable"`
	Time          time.Time       `bun:"time,pk,notnull"             comment:"The time of block"                                 stats:"func:min max,filterable"`
	Position      int64           `bun:"position"                    comment:"Position in block"`
	GasWanted     int64           `bun:"gas_wanted"                  comment:"Gas wanted"                                        stats:"func:min max sum avg"`
	GasUsed       int64           `bun:"gas_used"                    comment:"Gas used"                                          stats:"func:min max sum avg"`
	TimeoutHeight uint64          `bun:"timeout_height"              comment:"Block height until which the transaction is valid" stats:"func:min max avg"`
	EventsCount   int64           `bun:"events_count"                comment:"Events count in transaction"                       stats:"func:min max sum avg"`
	MessagesCount int64           `bun:"messages_count"              comment:"Messages count in transaction"                     stats:"func:min max sum avg"`
	Fee           decimal.Decimal `bun:"fee,type:numeric"            comment:"Paid fee"                                          stats:"func:min max sum avg"`
	Status        types.Status    `bun:"status,type:status"          comment:"Transaction status"                                stats:"filterable"`

	Error        string            `bun:"error,type:text"            comment:"Error string if failed"`
	Codespace    string            `bun:"codespace,type:text"        comment:"Codespace"                                    stats:"filterable"`
	Hash         []byte            `bun:"hash"                       comment:"Transaction hash"`
	Memo         string            `bun:"memo,type:text"             comment:"Note or comment to send with the transaction"`
	MessageTypes types.MsgTypeBits `bun:"message_types,type:bit(74)" comment:"Bit mask with containing messages"            stats:"filterable"`

	Messages []Message `bun:"rel:has-many,join:id=tx_id"`
	Events   []Event   `bun:"rel:has-many"`

	Signers    []Address `bun:"-"`
	BlobsSize  int64     `bun:"-"`
	BytesSize  int64     `bun:"-"`
	BlobsCount int       `bun:"-"`
}

Tx -

func (Tx) TableName

func (Tx) TableName() string

TableName -

type TxFilter

type TxFilter struct {
	Limit                int
	Offset               int
	Sort                 storage.SortOrder
	Status               []string
	MessageTypes         types.MsgTypeBits
	ExcludedMessageTypes types.MsgTypeBits
	Height               *uint64
	TimeFrom             time.Time
	TimeTo               time.Time
	WithMessages         bool
}

type Undelegation added in v1.6.0

type Undelegation struct {
	bun.BaseModel `bun:"undelegation" comment:"Table with undelegations"`

	Id             uint64          `bun:"id,pk,notnull,autoincrement" comment:"Unique internal id"`
	Time           time.Time       `bun:"time,notnull"                comment:"The time of block"`
	Height         pkgTypes.Level  `bun:",notnull"                    comment:"The number (height) of this block"`
	AddressId      uint64          `bun:"address_id"                  comment:"Internal address id"`
	ValidatorId    uint64          `bun:"validator_id"                comment:"Internal validator id"`
	Amount         decimal.Decimal `bun:"amount,type:numeric"         comment:"Delegated amount"`
	CompletionTime time.Time       `bun:"completion_time"             comment:"Time when undelegation will be completed"`

	Address   *Address   `bun:"rel:belongs-to,join:address_id=id"`
	Validator *Validator `bun:"rel:belongs-to,join:validator_id=id"`
}

Undelegation -

func (Undelegation) TableName added in v1.6.0

func (Undelegation) TableName() string

TableName -

type Validator

type Validator struct {
	bun.BaseModel `bun:"validator" comment:"Table with celestia validators."`

	Id          uint64 `bun:"id,pk,notnull,autoincrement"                comment:"Unique internal identity"`
	Delegator   string `bun:"delegator,type:text"                        comment:"Delegator address"`
	Address     string `bun:"address,unique:address_validator,type:text" comment:"Validator address"`
	ConsAddress string `bun:"cons_address"                               comment:"Consensus address"`

	Moniker  string `bun:"moniker,type:text"  comment:"Human-readable name for the validator"`
	Website  string `bun:"website,type:text"  comment:"Website link"`
	Identity string `bun:"identity,type:text" comment:"Optional identity signature"`
	Contacts string `bun:"contacts,type:text" comment:"Contacts"`
	Details  string `bun:"details,type:text"  comment:"Detailed information about validator"`

	Rate              decimal.Decimal `bun:"rate,type:numeric"                comment:"Commission rate charged to delegators, as a fraction"`
	MaxRate           decimal.Decimal `bun:"max_rate,type:numeric"            comment:"Maximum commission rate which validator can ever charge, as a fraction"`
	MaxChangeRate     decimal.Decimal `bun:"max_change_rate,type:numeric"     comment:"Maximum daily increase of the validator commission, as a fraction"`
	MinSelfDelegation decimal.Decimal `bun:"min_self_delegation,type:numeric" comment:""`

	Stake       decimal.Decimal `bun:"stake,type:numeric"       comment:"Validator's stake"`
	Rewards     decimal.Decimal `bun:"rewards,type:numeric"     comment:"Validator's rewards"`
	Commissions decimal.Decimal `bun:"commissions,type:numeric" comment:"Commissions"`
	Height      pkgTypes.Level  `bun:"height"                   comment:"Height when validator was created"`

	Jailed *bool `bun:"jailed" comment:"True if validator was punished"`
}

func EmptyValidator added in v1.6.0

func EmptyValidator() Validator

func (Validator) TableName

func (Validator) TableName() string

type ValidatorFilters added in v1.6.0

type ValidatorFilters struct {
	Limit  int
	Offset int
	Jailed *bool
}

type VestingAccount added in v1.7.0

type VestingAccount struct {
	bun.BaseModel `bun:"vesting_account" comment:"Table with vesting accounts"`

	Id        uint64            `bun:"id,pk,notnull,autoincrement" comment:"Unique internal identity"`
	Height    pkgTypes.Level    `bun:"height,notnull"              comment:"The number (height) of this block"`
	Time      time.Time         `bun:"time,notnull"                comment:"The time of block"`
	TxId      *uint64           `bun:"tx_id"                       comment:"Transaction internal identity"`
	AddressId uint64            `bun:"address_id,notnull"          comment:"Address internal id"`
	Type      types.VestingType `bun:"type,type:vesting_type"      comment:"Type vesting account"`
	Amount    decimal.Decimal   `bun:"amount,type:numeric"         comment:"Vested amount"`
	StartTime *time.Time        `bun:"start_time"                  comment:"Start time of unlock value"`
	EndTime   *time.Time        `bun:"end_time"                    comment:"End time of unlock value"`

	Address *Address `bun:"rel:has-one"`
	Tx      *Tx      `bun:"rel:has-one"`

	VestingPeriods []VestingPeriod `bun:"rel:has-many"`
}

func (VestingAccount) TableName added in v1.7.0

func (VestingAccount) TableName() string

type VestingPeriod added in v1.7.0

type VestingPeriod struct {
	bun.BaseModel `bun:"vesting_period" comment:"Table with vesting periods"`

	Id               uint64          `bun:"id,pk,notnull,autoincrement" comment:"Unique internal identity"`
	Height           pkgTypes.Level  `bun:"height,notnull"              comment:"The number (height) of this block"`
	VestingAccountId uint64          `bun:"vesting_account_id"          comment:"Vesting account internal identity"`
	Time             time.Time       `bun:"time,notnull"                comment:"The time of periodic vesting"`
	Amount           decimal.Decimal `bun:"amount,type:numeric"         comment:"Vested amount"`
}

func (VestingPeriod) TableName added in v1.7.0

func (VestingPeriod) TableName() string

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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