 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Constants
- Variables
- type ActiveNamespace
- type Address
- type AddressListFilter
- type AddressMsgsFilter
- type AddressWithType
- type Balance
- type Block
- type BlockStats
- type Constant
- type CountRequest
- type DenomMetadata
- type Event
- type HistogramCountRequest
- type HistogramItem
- type HistogramRequest
- type IAddress
- type IBalance
- type IBlock
- type IBlockStats
- type IConstant
- type IDenomMetadata
- type IEvent
- type IMessage
- type INamespace
- type IState
- type IStats
- type ITx
- type IValidator
- type Listener
- type ListenerFactory
- type Message
- type MsgAddress
- type Namespace
- type NamespaceMessage
- type Notificator
- type Signer
- type State
- type SummaryRequest
- type Timeframe
- type Transaction
- type Tx
- type TxFilter
- type Validator
Constants ¶
      View Source
      
  
const ( ChannelHead = "head" ChannelTx = "tx" )
Variables ¶
      View Source
      
  
var Models = []any{ &State{}, &Constant{}, &DenomMetadata{}, &Balance{}, &Address{}, &Block{}, &BlockStats{}, &Tx{}, &Message{}, &Event{}, &Namespace{}, &NamespaceMessage{}, &Signer{}, &MsgAddress{}, &Validator{}, }
Functions ¶
This section is empty.
Types ¶
type ActiveNamespace ¶
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 -
type AddressListFilter ¶
type AddressMsgsFilter ¶
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"`
	Total    decimal.Decimal `bun:"total,type:numeric"          comment:"Total account balance"`
}
    func EmptyBalance ¶
func EmptyBalance() Balance
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"`
	ProposerAddress    pkgTypes.Hex `bun:"proposer_address"     comment:"Proposer address"`
	ChainId   string    `bun:"-"` // internal field for filling state
	Addresses []Address `bun:"-"` // internal field for balance passing
	Txs    []Tx       `bun:"rel:has-many"`
	Events []Event    `bun:"rel:has-many"`
	Stats  BlockStats `bun:"rel:has-one,join:height=height"`
}
    Block -
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           `bun:"tx_count"         comment:"Count of transactions in block"                          stats:"func:min max sum avg"`
	EventsCount   int64           `bun:"events_count"     comment:"Count of events in begin and end of block"               stats:"func:min max sum avg"`
	BlobsSize     int64           `bun:"blobs_size"       comment:"Summary blocks size from pay for blob"                   stats:"func:min max sum avg"`
	BlockTime     uint64          `bun:"block_time"       comment:"Time in milliseconds between current and previous block" stats:"func:min max sum avg"`
	SupplyChange  decimal.Decimal `bun:",type:numeric"    comment:"Change of total supply in the block"                     stats:"func:min max sum avg"`
	InflationRate decimal.Decimal `bun:",type:numeric"    comment:"Inflation rate"                                          stats:"func:min max avg"`
	Fee           decimal.Decimal `bun:"fee,type:numeric" comment:"Summary block fee"                                       stats:"func:min max sum avg"`
	MessagesCounts map[types.MsgType]int64 `bun:"-"`
}
    func (BlockStats) TableName ¶
func (BlockStats) TableName() string
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"`
}
    type CountRequest ¶
func (CountRequest) Validate ¶
func (req CountRequest) Validate() error
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 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,type:jsonb"             comment:"Event data"`
}
    Event -
type HistogramCountRequest ¶
type HistogramCountRequest struct {
	CountRequest
	Timeframe Timeframe
}
    func (HistogramCountRequest) Validate ¶
func (req HistogramCountRequest) Validate() error
type HistogramItem ¶
type HistogramRequest ¶
type HistogramRequest struct {
	SummaryRequest
	Timeframe Timeframe
}
    func (HistogramRequest) Validate ¶
func (req HistogramRequest) Validate() 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)
	ListWithStats(ctx context.Context, limit, offset uint64, order storage.SortOrder) ([]*Block, error)
}
    type IBlockStats ¶
type IDenomMetadata ¶
type IDenomMetadata interface {
	All(ctx context.Context) ([]DenomMetadata, error)
}
    type INamespace ¶
type INamespace interface {
	storage.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)
	MessagesByHeight(ctx context.Context, height pkgTypes.Level, limit, offset int) ([]NamespaceMessage, error)
	CountMessagesByHeight(ctx context.Context, height pkgTypes.Level) (int, error)
	Active(ctx context.Context, top int) ([]ActiveNamespace, error)
}
    type IStats ¶
type IStats interface {
	Count(ctx context.Context, req CountRequest) (string, error)
	Summary(ctx context.Context, req SummaryRequest) (string, error)
	HistogramCount(ctx context.Context, req HistogramCountRequest) ([]HistogramItem, error)
	Histogram(ctx context.Context, req HistogramRequest) ([]HistogramItem, error)
}
    type ITx ¶
type ITx interface {
	storage.Table[*Tx]
	ByHash(ctx context.Context, hash []byte) (Tx, 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)
}
    type IValidator ¶
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"`
	Data     map[string]any `bun:"data,type:jsonb"             comment:"Message data"`
	Namespace []Namespace       `bun:"m2m:namespace_message,join:Message=Namespace"`
	Validator *Validator        `bun:"rel:belongs-to"`
	Addresses []AddressWithType `bun:"-"`
}
    Message -
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) 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"`
	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"`
	Reserved    bool        `bun:"reserved,default:false"                       comment:"If namespace is reserved flag is true"`
}
    Namespace -
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" comment:"Message time"`
	Height types.Level `bun:"height"       comment:"Message block height"`
	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 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"`
}
    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"`
	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"`
}
    State -
type SummaryRequest ¶
type SummaryRequest struct {
	CountRequest
	Column   string
	Function string
}
    func (SummaryRequest) Validate ¶
func (req SummaryRequest) Validate() error
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)
	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
	SaveValidators(ctx context.Context, validators ...*Validator) error
	SaveEvents(ctx context.Context, events ...Event) error
	LastBlock(ctx context.Context) (block Block, err error)
	State(ctx context.Context, name string) (state State, err error)
	Namespace(ctx context.Context, id uint64) (ns Namespace, err 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)
	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) (err error)
	RollbackSigners(ctx context.Context, txIds []uint64) (err error)
	RollbackMessageAddresses(ctx context.Context, msgIds []uint64) (err error)
	DeleteBalances(ctx context.Context, ids []uint64) error
	LastAddressAction(ctx context.Context, address []byte) (uint64, 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:"m2m:signer,join:Tx=Address"`
	BlobsSize int64 `bun:"-"`
}
    Tx -
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"`
	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:""`
	MsgId  uint64         `bun:"msg_id" comment:"Message id when validator was created"`
	Height pkgTypes.Level `bun:"height" comment:"Height when validator was created"`
}
    
       Source Files
      ¶
      Source Files
      ¶
    
   Click to show internal directories. 
   Click to hide internal directories.