postgres

package
v1.6.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginTransaction

func BeginTransaction(ctx context.Context, tx storage.Transactable) (models.Transaction, error)

Types

type Address

type Address struct {
	*postgres.Table[*storage.Address]
}

Address -

func NewAddress

func NewAddress(db *database.Bun) *Address

NewAddress -

func (*Address) ByHash

func (a *Address) ByHash(ctx context.Context, hash []byte) (address storage.Address, err error)

ByHash -

func (*Address) ListWithBalance

func (a *Address) ListWithBalance(ctx context.Context, filters storage.AddressListFilter) (result []storage.Address, err error)

type BlobLog added in v1.2.0

type BlobLog struct {
	*postgres.Table[*storage.BlobLog]
}

BlobLog -

func NewBlobLog added in v1.2.0

func NewBlobLog(db *database.Bun) *BlobLog

NewBlobLog -

func (*BlobLog) ByHeight added in v1.3.2

func (bl *BlobLog) ByHeight(ctx context.Context, height types.Level, fltrs storage.BlobLogFilters) (logs []storage.BlobLog, err error)

func (*BlobLog) ByNamespace added in v1.2.0

func (bl *BlobLog) ByNamespace(ctx context.Context, nsId uint64, fltrs storage.BlobLogFilters) (logs []storage.BlobLog, err error)

func (*BlobLog) ByProviders added in v1.2.0

func (bl *BlobLog) ByProviders(ctx context.Context, providers []storage.RollupProvider, fltrs storage.BlobLogFilters) (logs []storage.BlobLog, err error)

func (*BlobLog) BySigner added in v1.2.0

func (bl *BlobLog) BySigner(ctx context.Context, signerId uint64, fltrs storage.BlobLogFilters) (logs []storage.BlobLog, err error)

func (*BlobLog) ByTxId added in v1.3.2

func (bl *BlobLog) ByTxId(ctx context.Context, txId uint64, fltrs storage.BlobLogFilters) (logs []storage.BlobLog, err error)

func (*BlobLog) CountByHeight added in v1.3.2

func (bl *BlobLog) CountByHeight(ctx context.Context, height types.Level) (int, error)

func (*BlobLog) CountByTxId added in v1.3.2

func (bl *BlobLog) CountByTxId(ctx context.Context, txId uint64) (int, error)

type BlockSignature added in v1.4.0

type BlockSignature struct {
	*postgres.Table[*storage.BlockSignature]
}

BlockSignature -

func NewBlockSignature added in v1.4.0

func NewBlockSignature(db *database.Bun) *BlockSignature

NewBlockSignature -

func (*BlockSignature) LevelsByValidator added in v1.4.0

func (bs *BlockSignature) LevelsByValidator(ctx context.Context, validatorId uint64, startHeight types.Level) (levels []types.Level, err error)

type BlockStats

type BlockStats struct {
	// contains filtered or unexported fields
}

BlockStats -

func NewBlockStats

func NewBlockStats(db *database.Bun) *BlockStats

NewBlockStats -

func (*BlockStats) ByHeight

func (b *BlockStats) ByHeight(ctx context.Context, height pkgTypes.Level) (stats storage.BlockStats, err error)

ByHeight -

func (*BlockStats) LastFrom added in v1.1.0

func (b *BlockStats) LastFrom(ctx context.Context, head pkgTypes.Level, limit int) (stats []storage.BlockStats, err error)

type Blocks

type Blocks struct {
	*postgres.Table[*storage.Block]
}

Blocks -

func NewBlocks

func NewBlocks(db *database.Bun) *Blocks

NewBlocks -

func (*Blocks) ByHash

func (b *Blocks) ByHash(ctx context.Context, hash []byte) (block storage.Block, err error)

ByHash -

func (*Blocks) ByHeight

func (b *Blocks) ByHeight(ctx context.Context, height types.Level) (block storage.Block, err error)

ByHeight -

func (*Blocks) ByHeightWithStats

func (b *Blocks) ByHeightWithStats(ctx context.Context, height types.Level) (block storage.Block, err error)

ByHeightWithStats -

func (*Blocks) ByIdWithRelations

func (b *Blocks) ByIdWithRelations(ctx context.Context, id uint64) (block storage.Block, err error)

ByIdWithRelations -

func (*Blocks) ByProposer added in v1.4.0

func (b *Blocks) ByProposer(ctx context.Context, proposerId uint64, limit, offset int) (blocks []storage.Block, err error)

func (*Blocks) Last

func (b *Blocks) Last(ctx context.Context) (block storage.Block, err error)

Last -

func (*Blocks) ListWithStats

func (b *Blocks) ListWithStats(ctx context.Context, limit, offset uint64, order sdk.SortOrder) (blocks []*storage.Block, err error)

ListWithStats -

func (*Blocks) Time added in v1.5.0

func (b *Blocks) Time(ctx context.Context, height pkgTypes.Level) (response time.Time, err error)

type Constant

type Constant struct {
	// contains filtered or unexported fields
}

Constant -

func NewConstant

func NewConstant(db *database.Bun) *Constant

NewConstant -

func (*Constant) All

func (constant *Constant) All(ctx context.Context) (c []storage.Constant, err error)

func (*Constant) ByModule

func (constant *Constant) ByModule(ctx context.Context, module types.ModuleName) (c []storage.Constant, err error)

func (*Constant) Get

func (constant *Constant) Get(ctx context.Context, module types.ModuleName, name string) (c storage.Constant, err error)

type Delegation added in v1.6.0

type Delegation struct {
	*postgres.Table[*storage.Delegation]
}

Delegation -

func NewDelegation added in v1.6.0

func NewDelegation(db *database.Bun) *Delegation

NewDelegation -

func (*Delegation) ByAddress added in v1.6.0

func (d *Delegation) ByAddress(ctx context.Context, addressId uint64, limit, offset int) (delegations []storage.Delegation, err error)

func (*Delegation) ByValidator added in v1.6.0

func (d *Delegation) ByValidator(ctx context.Context, validatorId uint64, limit, offset int) (delegations []storage.Delegation, err error)

type DelegationLog added in v1.6.0

type DelegationLog struct {
	*postgres.Table[*storage.StakingLog]
}

DelegationLog -

func NewDelegationLog added in v1.6.0

func NewDelegationLog(db *database.Bun) *DelegationLog

NewDelegationLog -

func (*DelegationLog) ByValidator added in v1.6.0

func (d *DelegationLog) ByValidator(ctx context.Context, id uint64, limit, offset int) (logs []storage.StakingLog, err error)

type DenomMetadata

type DenomMetadata struct {
	// contains filtered or unexported fields
}

DenomMetadata -

func NewDenomMetadata

func NewDenomMetadata(db *database.Bun) *DenomMetadata

NewDenomMetadata -

func (*DenomMetadata) All

func (dm *DenomMetadata) All(ctx context.Context) (metadata []storage.DenomMetadata, err error)

type Event

type Event struct {
	*postgres.Table[*storage.Event]
}

Event -

func NewEvent

func NewEvent(db *database.Bun) *Event

NewEvent -

func (*Event) ByBlock

func (e *Event) ByBlock(ctx context.Context, height pkgTypes.Level, fltrs storage.EventFilter) (events []storage.Event, err error)

ByBlock -

func (*Event) ByTxId

func (e *Event) ByTxId(ctx context.Context, txId uint64, fltrs storage.EventFilter) (events []storage.Event, err error)

ByTxId -

type Export added in v1.5.0

type Export struct {
	*bun.DB
}

func NewExport added in v1.5.0

func NewExport(cfg config.Database) *Export

func (*Export) Close added in v1.5.0

func (e *Export) Close() error

func (*Export) ToCsv added in v1.5.0

func (e *Export) ToCsv(ctx context.Context, writer io.Writer, query string) error

type Jail added in v1.6.0

type Jail struct {
	*postgres.Table[*storage.Jail]
}

Jail -

func NewJail added in v1.6.0

func NewJail(db *database.Bun) *Jail

NewJail -

func (*Jail) ByValidator added in v1.6.0

func (j *Jail) ByValidator(ctx context.Context, id uint64, limit, offset int) (jails []storage.Jail, err error)

type Message

type Message struct {
	*postgres.Table[*storage.Message]
}

Message -

func NewMessage

func NewMessage(db *database.Bun) *Message

NewMessage -

func (*Message) ByAddress added in v1.2.0

func (m *Message) ByAddress(ctx context.Context, addressId uint64, filters storage.AddressMsgsFilter) (msgs []storage.AddressMessageWithTx, err error)

func (*Message) ByTxId

func (m *Message) ByTxId(ctx context.Context, txId uint64, limit, offset int) (messages []storage.Message, err error)

ByTxId -

func (*Message) ListWithTx added in v1.0.4

func (m *Message) ListWithTx(ctx context.Context, filters storage.MessageListWithTxFilters) (msgs []storage.MessageWithTx, err error)

type Namespace

type Namespace struct {
	*postgres.Table[*storage.Namespace]
}

Namespace -

func NewNamespace

func NewNamespace(db *database.Bun) *Namespace

NewNamespace -

func (*Namespace) ByNamespaceId

func (n *Namespace) ByNamespaceId(ctx context.Context, namespaceId []byte) (namespace []storage.Namespace, err error)

ByNamespaceId -

func (*Namespace) ByNamespaceIdAndVersion

func (n *Namespace) ByNamespaceIdAndVersion(ctx context.Context, namespaceId []byte, version byte) (namespace storage.Namespace, err error)

ByNamespaceIdAndVersion -

func (*Namespace) CountMessagesByHeight

func (n *Namespace) CountMessagesByHeight(ctx context.Context, height pkgTypes.Level) (int, error)

func (*Namespace) CountMessagesByTxId added in v1.1.5

func (n *Namespace) CountMessagesByTxId(ctx context.Context, txId uint64) (int, error)

func (*Namespace) GetByIds added in v1.2.0

func (n *Namespace) GetByIds(ctx context.Context, ids ...uint64) (ns []storage.Namespace, err error)

func (*Namespace) ListWithSort added in v1.1.2

func (n *Namespace) ListWithSort(ctx context.Context, sortField string, sort sdk.SortOrder, limit, offset int) (ns []storage.Namespace, err error)

func (*Namespace) Messages

func (n *Namespace) Messages(ctx context.Context, id uint64, limit, offset int) (msgs []storage.NamespaceMessage, err error)

Messages -

func (*Namespace) MessagesByHeight

func (n *Namespace) MessagesByHeight(ctx context.Context, height pkgTypes.Level, limit, offset int) (msgs []storage.NamespaceMessage, err error)

MessagesByHeight -

func (*Namespace) MessagesByTxId added in v1.1.5

func (n *Namespace) MessagesByTxId(ctx context.Context, txId uint64, limit, offset int) (msgs []storage.NamespaceMessage, err error)

type Notificator

type Notificator struct {
	// contains filtered or unexported fields
}

func NewNotificator

func NewNotificator(cfg config.Database, db *bun.DB) *Notificator

func (*Notificator) Close

func (n *Notificator) Close() error

func (*Notificator) Listen

func (n *Notificator) Listen() chan *pq.Notification

func (*Notificator) Notify

func (n *Notificator) Notify(ctx context.Context, channel string, payload string) error

func (*Notificator) Subscribe

func (n *Notificator) Subscribe(ctx context.Context, channels ...string) error

type Price added in v1.2.0

type Price struct {
	// contains filtered or unexported fields
}

Price -

func NewPrice added in v1.2.0

func NewPrice(db *database.Bun) *Price

NewPrice -

func (*Price) Get added in v1.2.0

func (p *Price) Get(ctx context.Context, timeframe string, start, end time.Time, limit int) (price []storage.Price, err error)

func (*Price) Last added in v1.2.0

func (p *Price) Last(ctx context.Context) (price storage.Price, err error)

func (*Price) Save added in v1.2.0

func (p *Price) Save(ctx context.Context, price *storage.Price) error

type Redelegation added in v1.6.0

type Redelegation struct {
	*postgres.Table[*storage.Redelegation]
}

Redelegation -

func NewRedelegation added in v1.6.0

func NewRedelegation(db *database.Bun) *Redelegation

NewRedelegation -

func (*Redelegation) ByAddress added in v1.6.0

func (d *Redelegation) ByAddress(ctx context.Context, addressId uint64, limit, offset int) (redelegations []storage.Redelegation, err error)

type Rollup added in v1.2.0

type Rollup struct {
	*postgres.Table[*storage.Rollup]
}

Rollup -

func NewRollup added in v1.2.0

func NewRollup(db *database.Bun) *Rollup

NewRollup -

func (*Rollup) BySlug added in v1.4.0

func (r *Rollup) BySlug(ctx context.Context, slug string) (rollup storage.Rollup, err error)

func (*Rollup) Count added in v1.3.2

func (r *Rollup) Count(ctx context.Context) (int64, error)

func (*Rollup) Distribution added in v1.6.1

func (r *Rollup) Distribution(ctx context.Context, rollupId uint64, series, groupBy string) (items []storage.DistributionItem, err error)

func (*Rollup) Leaderboard added in v1.2.0

func (r *Rollup) Leaderboard(ctx context.Context, sortField string, sort sdk.SortOrder, limit, offset int) (rollups []storage.RollupWithStats, err error)

func (*Rollup) Namespaces added in v1.2.0

func (r *Rollup) Namespaces(ctx context.Context, rollupId uint64, limit, offset int) (namespaceIds []uint64, err error)

func (*Rollup) Providers added in v1.2.0

func (r *Rollup) Providers(ctx context.Context, rollupId uint64) (providers []storage.RollupProvider, err error)

func (*Rollup) RollupsByNamespace added in v1.5.0

func (r *Rollup) RollupsByNamespace(ctx context.Context, namespaceId uint64, limit, offset int) (rollups []storage.Rollup, err error)

func (*Rollup) Series added in v1.3.2

func (r *Rollup) Series(ctx context.Context, rollupId uint64, timeframe, column string, req storage.SeriesRequest) (items []storage.HistogramItem, err error)

func (*Rollup) Stats added in v1.2.0

func (r *Rollup) Stats(ctx context.Context, rollupId uint64) (stats storage.RollupStats, err error)
type Search struct {
	// contains filtered or unexported fields
}

Search -

func NewSearch added in v1.4.0

func NewSearch(db *database.Bun) *Search

NewSearch -

func (*Search) Search added in v1.4.0

func (s *Search) Search(ctx context.Context, query []byte) (results []storage.SearchResult, err error)

func (*Search) SearchText added in v1.4.0

func (s *Search) SearchText(ctx context.Context, text string) (results []storage.SearchResult, err error)

type State

type State struct {
	*postgres.Table[*storage.State]
}

State -

func NewState

func NewState(db *database.Bun) *State

NewState -

func (*State) ByName

func (s *State) ByName(ctx context.Context, name string) (state storage.State, err error)

ByName -

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

func NewStats

func NewStats(conn *database.Bun) Stats

func (Stats) Count

func (s Stats) Count(ctx context.Context, req storage.CountRequest) (string, error)

func (Stats) Histogram

func (s Stats) Histogram(ctx context.Context, req storage.HistogramRequest) (response []storage.HistogramItem, err error)

func (Stats) HistogramCount

func (s Stats) HistogramCount(ctx context.Context, req storage.HistogramCountRequest) (response []storage.HistogramItem, err error)

func (Stats) NamespaceSeries added in v1.1.0

func (s Stats) NamespaceSeries(ctx context.Context, timeframe storage.Timeframe, name string, nsId uint64, req storage.SeriesRequest) (response []storage.SeriesItem, err error)

func (Stats) Series added in v1.1.0

func (s Stats) Series(ctx context.Context, timeframe storage.Timeframe, name string, req storage.SeriesRequest) (response []storage.SeriesItem, err error)

func (Stats) StakingSeries added in v1.6.0

func (s Stats) StakingSeries(ctx context.Context, timeframe storage.Timeframe, name string, validatorId uint64, req storage.SeriesRequest) (response []storage.SeriesItem, err error)

func (Stats) Summary

func (s Stats) Summary(ctx context.Context, req storage.SummaryRequest) (string, error)

func (Stats) TPS added in v1.1.0

func (s Stats) TPS(ctx context.Context) (response storage.TPS, err error)

func (Stats) TxCountForLast24h added in v1.1.0

func (s Stats) TxCountForLast24h(ctx context.Context) (response []storage.TxCountForLast24hItem, err error)

type Storage

type Storage struct {
	*postgres.Storage

	Blocks          models.IBlock
	BlockStats      models.IBlockStats
	BlockSignatures models.IBlockSignature
	BlobLogs        models.IBlobLog
	Constants       models.IConstant
	DenomMetadata   models.IDenomMetadata
	Tx              models.ITx
	Message         models.IMessage
	Event           models.IEvent
	Address         models.IAddress
	Namespace       models.INamespace
	Price           models.IPrice
	State           models.IState
	Stats           models.IStats
	Search          models.ISearch
	Validator       models.IValidator
	DelegationLogs  models.IStakingLog
	Delegation      models.IDelegation
	Redelegation    models.IRedelegation
	Undelegation    models.IUndelegation
	Jails           models.IJail
	Rollup          models.IRollup
	Export          models.Export
	Notificator     *Notificator
	// contains filtered or unexported fields
}

Storage -

func Create

func Create(ctx context.Context, cfg config.Database, scriptsDir string) (Storage, error)

Create -

func (Storage) Close added in v1.5.0

func (s Storage) Close() error

func (Storage) CreateListener

func (s Storage) CreateListener() models.Listener

type Transaction

type Transaction struct {
	storage.Transaction
}

func (Transaction) CancelUnbondings added in v1.6.0

func (tx Transaction) CancelUnbondings(ctx context.Context, cancellations ...models.Undelegation) error

func (Transaction) Delegation added in v1.6.3

func (tx Transaction) Delegation(ctx context.Context, validatorId, addressId uint64) (val models.Delegation, err error)

func (Transaction) DeleteBalances

func (tx Transaction) DeleteBalances(ctx context.Context, ids []uint64) error

func (Transaction) DeleteDelegationsByValidator added in v1.6.0

func (tx Transaction) DeleteDelegationsByValidator(ctx context.Context, ids ...uint64) error

func (Transaction) DeleteProviders added in v1.2.0

func (tx Transaction) DeleteProviders(ctx context.Context, rollupId uint64) error

func (Transaction) DeleteRollup added in v1.2.0

func (tx Transaction) DeleteRollup(ctx context.Context, rollupId uint64) error

func (Transaction) GetProposerId added in v1.1.0

func (tx Transaction) GetProposerId(ctx context.Context, address string) (id uint64, err error)

func (Transaction) Jail added in v1.6.0

func (tx Transaction) Jail(ctx context.Context, validators ...*models.Validator) error

func (Transaction) LastAddressAction

func (tx Transaction) LastAddressAction(ctx context.Context, address []byte) (uint64, error)

func (Transaction) LastBlock

func (tx Transaction) LastBlock(ctx context.Context) (block models.Block, err error)

func (Transaction) LastNamespaceMessage added in v1.1.0

func (tx Transaction) LastNamespaceMessage(ctx context.Context, nsId uint64) (msg models.NamespaceMessage, err error)

func (Transaction) Namespace

func (tx Transaction) Namespace(ctx context.Context, id uint64) (ns models.Namespace, err error)

func (Transaction) RetentionBlockSignatures added in v1.4.0

func (tx Transaction) RetentionBlockSignatures(ctx context.Context, height types.Level) error

func (Transaction) RetentionCompletedRedelegations added in v1.6.0

func (tx Transaction) RetentionCompletedRedelegations(ctx context.Context, blockTime time.Time) error

func (Transaction) RetentionCompletedUnbondings added in v1.6.0

func (tx Transaction) RetentionCompletedUnbondings(ctx context.Context, blockTime time.Time) error

func (Transaction) RollbackAddresses

func (tx Transaction) RollbackAddresses(ctx context.Context, height types.Level) (address []models.Address, err error)

func (Transaction) RollbackBlobLog added in v1.2.0

func (tx Transaction) RollbackBlobLog(ctx context.Context, height types.Level) (err error)

func (Transaction) RollbackBlock

func (tx Transaction) RollbackBlock(ctx context.Context, height types.Level) error

func (Transaction) RollbackBlockSignatures added in v1.4.0

func (tx Transaction) RollbackBlockSignatures(ctx context.Context, height types.Level) (err error)

func (Transaction) RollbackBlockStats

func (tx Transaction) RollbackBlockStats(ctx context.Context, height types.Level) (stats models.BlockStats, err error)

func (Transaction) RollbackEvents

func (tx Transaction) RollbackEvents(ctx context.Context, height types.Level) (events []models.Event, err error)

func (Transaction) RollbackJails added in v1.6.0

func (tx Transaction) RollbackJails(ctx context.Context, height types.Level) (jails []models.Jail, err error)

func (Transaction) RollbackMessageAddresses

func (tx Transaction) RollbackMessageAddresses(ctx context.Context, msgIds []uint64) (err error)

func (Transaction) RollbackMessages

func (tx Transaction) RollbackMessages(ctx context.Context, height types.Level) (msgs []models.Message, err error)

func (Transaction) RollbackNamespaceMessages

func (tx Transaction) RollbackNamespaceMessages(ctx context.Context, height types.Level) (msgs []models.NamespaceMessage, err error)

func (Transaction) RollbackNamespaces

func (tx Transaction) RollbackNamespaces(ctx context.Context, height types.Level) (ns []models.Namespace, err error)

func (Transaction) RollbackRedelegations added in v1.6.0

func (tx Transaction) RollbackRedelegations(ctx context.Context, height types.Level) (err error)

func (Transaction) RollbackSigners

func (tx Transaction) RollbackSigners(ctx context.Context, txIds []uint64) (err error)

func (Transaction) RollbackStakingLogs added in v1.6.0

func (tx Transaction) RollbackStakingLogs(ctx context.Context, height types.Level) (logs []models.StakingLog, err error)

func (Transaction) RollbackTxs

func (tx Transaction) RollbackTxs(ctx context.Context, height types.Level) (txs []models.Tx, err error)

func (Transaction) RollbackUndelegations added in v1.6.0

func (tx Transaction) RollbackUndelegations(ctx context.Context, height types.Level) (err error)

func (Transaction) RollbackValidators

func (tx Transaction) RollbackValidators(ctx context.Context, height types.Level) (validators []models.Validator, err error)

func (Transaction) SaveAddresses

func (tx Transaction) SaveAddresses(ctx context.Context, addresses ...*models.Address) (int64, error)

func (Transaction) SaveBalances

func (tx Transaction) SaveBalances(ctx context.Context, balances ...models.Balance) error

func (Transaction) SaveBlobLogs added in v1.2.0

func (tx Transaction) SaveBlobLogs(ctx context.Context, logs ...models.BlobLog) error

func (Transaction) SaveBlockSignatures added in v1.4.0

func (tx Transaction) SaveBlockSignatures(ctx context.Context, signs ...models.BlockSignature) error

func (Transaction) SaveConstants

func (tx Transaction) SaveConstants(ctx context.Context, constants ...models.Constant) error

func (Transaction) SaveDelegations added in v1.6.0

func (tx Transaction) SaveDelegations(ctx context.Context, delegations ...models.Delegation) error

func (Transaction) SaveEvents

func (tx Transaction) SaveEvents(ctx context.Context, events ...models.Event) error

func (Transaction) SaveJails added in v1.6.0

func (tx Transaction) SaveJails(ctx context.Context, jails ...models.Jail) error

func (Transaction) SaveMessages

func (tx Transaction) SaveMessages(ctx context.Context, msgs ...*models.Message) error

func (Transaction) SaveMsgAddresses

func (tx Transaction) SaveMsgAddresses(ctx context.Context, addresses ...models.MsgAddress) error

func (Transaction) SaveNamespaceMessage

func (tx Transaction) SaveNamespaceMessage(ctx context.Context, nsMsgs ...models.NamespaceMessage) error

func (Transaction) SaveNamespaces

func (tx Transaction) SaveNamespaces(ctx context.Context, namespaces ...*models.Namespace) (int64, error)

func (Transaction) SaveProviders added in v1.2.0

func (tx Transaction) SaveProviders(ctx context.Context, providers ...models.RollupProvider) error

func (Transaction) SaveRedelegations added in v1.6.0

func (tx Transaction) SaveRedelegations(ctx context.Context, redelegations ...models.Redelegation) error

func (Transaction) SaveRollup added in v1.2.0

func (tx Transaction) SaveRollup(ctx context.Context, rollup *models.Rollup) error

func (Transaction) SaveSigners

func (tx Transaction) SaveSigners(ctx context.Context, addresses ...models.Signer) error

func (Transaction) SaveStakingLogs added in v1.6.0

func (tx Transaction) SaveStakingLogs(ctx context.Context, logs ...models.StakingLog) error

func (Transaction) SaveTransactions

func (tx Transaction) SaveTransactions(ctx context.Context, txs ...models.Tx) error

func (Transaction) SaveUndelegations added in v1.6.0

func (tx Transaction) SaveUndelegations(ctx context.Context, undelegations ...models.Undelegation) error

func (Transaction) SaveValidators

func (tx Transaction) SaveValidators(ctx context.Context, validators ...*models.Validator) (int, error)

func (Transaction) State

func (tx Transaction) State(ctx context.Context, name string) (state models.State, err error)

func (Transaction) UpdateRollup added in v1.2.0

func (tx Transaction) UpdateRollup(ctx context.Context, rollup *models.Rollup) error

func (Transaction) UpdateSlashedDelegations added in v1.6.0

func (tx Transaction) UpdateSlashedDelegations(ctx context.Context, validatorId uint64, fraction decimal.Decimal) (balances []models.Balance, err error)

func (Transaction) UpdateValidators added in v1.6.0

func (tx Transaction) UpdateValidators(ctx context.Context, validators ...*models.Validator) error

func (Transaction) Validator added in v1.6.3

func (tx Transaction) Validator(ctx context.Context, id uint64) (val models.Validator, err error)

type Tx

type Tx struct {
	*postgres.Table[*storage.Tx]
}

Tx -

func NewTx

func NewTx(db *database.Bun) *Tx

NewTx -

func (*Tx) ByAddress

func (tx *Tx) ByAddress(ctx context.Context, addressId uint64, fltrs storage.TxFilter) ([]storage.Tx, error)

func (*Tx) ByHash

func (tx *Tx) ByHash(ctx context.Context, hash []byte) (transaction storage.Tx, err error)

func (*Tx) ByIdWithRelations

func (tx *Tx) ByIdWithRelations(ctx context.Context, id uint64) (transaction storage.Tx, err error)

func (*Tx) Filter

func (tx *Tx) Filter(ctx context.Context, fltrs storage.TxFilter) (txs []storage.Tx, err error)

func (*Tx) Gas added in v1.1.0

func (tx *Tx) Gas(ctx context.Context, height types.Level, ts time.Time) (response []storage.Gas, err error)

func (*Tx) Genesis

func (tx *Tx) Genesis(ctx context.Context, limit, offset int, sortOrder sdk.SortOrder) (txs []storage.Tx, err error)

type Undelegation added in v1.6.0

type Undelegation struct {
	*postgres.Table[*storage.Undelegation]
}

Undelegation -

func NewUndelegation added in v1.6.0

func NewUndelegation(db *database.Bun) *Undelegation

NewUndelegation -

func (*Undelegation) ByAddress added in v1.6.0

func (d *Undelegation) ByAddress(ctx context.Context, addressId uint64, limit, offset int) (undelegations []storage.Undelegation, err error)

type Validator

type Validator struct {
	*postgres.Table[*storage.Validator]
}

Validator -

func NewValidator

func NewValidator(db *database.Bun) *Validator

NewValidator -

func (*Validator) ByAddress

func (v *Validator) ByAddress(ctx context.Context, address string) (validator storage.Validator, err error)

func (*Validator) JailedCount added in v1.6.0

func (v *Validator) JailedCount(ctx context.Context) (int, error)

func (*Validator) ListByPower added in v1.6.0

func (v *Validator) ListByPower(ctx context.Context, fltrs storage.ValidatorFilters) (validators []storage.Validator, err error)

func (*Validator) TotalVotingPower added in v1.6.0

func (v *Validator) TotalVotingPower(ctx context.Context) (decimal.Decimal, error)

Jump to

Keyboard shortcuts

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