vaa

package
v0.0.0-...-957412a Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package observations handle the request of VAA data from governor endpoint defined in the api.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

Controller definition.

func NewController

func NewController(serv *Service, logger *zap.Logger) *Controller

NewController create a new controler.

func (*Controller) FindAll

func (c *Controller) FindAll(ctx *fiber.Ctx) error

FindAll handler for the endpoint /vaas/.

func (*Controller) FindByChain

func (c *Controller) FindByChain(ctx *fiber.Ctx) error

FindByChain handler for the endpoint /vaas/:emitterChain.

func (*Controller) FindByEmitter

func (c *Controller) FindByEmitter(ctx *fiber.Ctx) error

FindByEmitter handler for the endpoint /vaas/:emitterChain/:emitterAddress.

func (*Controller) FindByEmitterAndTargetChain

func (c *Controller) FindByEmitterAndTargetChain(ctx *fiber.Ctx) error

FindByEmitterAndTargetChain handler for the endpoint /vaas/:emitterChain/:emitterAddress/:targetChain

func (*Controller) FindById

func (c *Controller) FindById(ctx *fiber.Ctx) error

FindById handler for the endpoint /vaas/:emitterChain/:emitterAddress/:targetChain/:sequence.

func (*Controller) FindByTxId

func (c *Controller) FindByTxId(ctx *fiber.Ctx) error

FindByTxId handler for the endpoint /vaas/transactions/:txId

func (*Controller) FindRecent

func (c *Controller) FindRecent(ctx *fiber.Ctx) error

func (*Controller) FindSignedVAAByID

func (c *Controller) FindSignedVAAByID(ctx *fiber.Ctx) error

FindSignedVAAByID get a VAA []byte from a emitter chain, emitter address, target chain and sequence. This endpoint has been migrated from the guardian grpc api.

func (*Controller) GetNextGovernanceSequence

func (c *Controller) GetNextGovernanceSequence(ctx *fiber.Ctx) error

func (*Controller) GetVaaCount

func (c *Controller) GetVaaCount(ctx *fiber.Ctx) error

GetVaaCount handler for the endpoint /vaas/vaa-counts.

type Repository

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

Repository definition

func NewRepository

func NewRepository(db *mongo.Database, logger *zap.Logger) *Repository

NewRepository create a new Repository.

func (*Repository) Find

func (r *Repository) Find(ctx context.Context, q *VaaQuery) ([]*VaaDoc, error)

Find get a list of *VaaDoc. The input parameter [q *VaaQuery] define the filters to apply in the query.

func (*Repository) FindOne

func (r *Repository) FindOne(ctx context.Context, q *VaaQuery) (*VaaDoc, error)

FindOne get *VaaDoc. The input parameter [q *VaaQuery] define the filters to apply in the query.

func (*Repository) GetVaaCount

func (r *Repository) GetVaaCount(ctx context.Context, q *VaaQuery) ([]*VaaStats, error)

GetVaaCount get a count of vaa by chainID.

func (*Repository) RawQuery

func (r *Repository) RawQuery(ctx context.Context, filter interface{}, options ...*options.FindOptions) ([]*VaaDoc, error)

type Service

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

Service definition.

func NewService

func NewService(r *Repository, getCacheFunc cache.CacheGetFunc, logger *zap.Logger) *Service

NewService create a new Service.

func (*Service) FindAll

FindAll get all the the vaa.

func (*Service) FindByChain

func (s *Service) FindByChain(ctx context.Context, chain vaa.ChainID, p *pagination.Pagination) (*response.Response[[]*VaaDoc], error)

FindByChain get all the vaa by chainID.

func (*Service) FindByEmitter

func (s *Service) FindByEmitter(ctx context.Context, chain vaa.ChainID, emitter *vaa.Address, p *pagination.Pagination) (*response.Response[[]*VaaDoc], error)

FindByEmitter get all the vaa by chainID and emitter address.

func (*Service) FindByEmitterAndTargetChain

func (s *Service) FindByEmitterAndTargetChain(ctx context.Context, emitterChain vaa.ChainID, emitterAddress *vaa.Address, targetChain vaa.ChainID, p *pagination.Pagination) (*response.Response[[]*VaaDoc], error)

func (*Service) FindById

func (s *Service) FindById(ctx context.Context, emitterChain vaa.ChainID, emitter *vaa.Address, targetChain vaa.ChainID, seq uint64) (*response.Response[*VaaDoc], error)

FindById get a vaa by chainID, emitter address and sequence number.

func (*Service) FindByTxId

func (s *Service) FindByTxId(ctx context.Context, txId []byte) (*response.Response[*VaaDoc], error)

func (*Service) FindRecent

func (s *Service) FindRecent(ctx context.Context, numRows *uint, emitterChain *uint, emitterAddr string) (*response.Response[[]*VaaDoc], error)

func (*Service) GetNextGovernanceSequence

func (s *Service) GetNextGovernanceSequence(ctx context.Context, governanceChain vaa.ChainID, governanceEmitter *vaa.Address) (*uint64, error)

func (*Service) GetVaaCount

func (s *Service) GetVaaCount(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*VaaStats], error)

GetVaaCount get a list a list of vaa count grouped by chainID.

type VaaDoc

type VaaDoc struct {
	ID               string      `bson:"_id" json:"id"`
	Version          uint8       `bson:"version" json:"version"`
	EmitterChain     vaa.ChainID `bson:"emitterChain" json:"emitterChain"`
	EmitterAddr      string      `bson:"emitterAddr" json:"emitterAddr"`
	TargetChain      vaa.ChainID `bson:"targetChain" json:"targetChain"`
	Sequence         uint64      `bson:"sequence" json:"sequence"`
	GuardianSetIndex uint32      `bson:"guardianSetIndex" json:"guardianSetIndex"`
	TxId             []byte      `bson:"txId,omitempty" json:"txId,omitempty"`
	Vaa              []byte      `bson:"vaas" json:"vaa"`
	Timestamp        *time.Time  `bson:"timestamp" json:"timestamp"`

	UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"`
	IndexedAt *time.Time `bson:"indexedAt" json:"indexedAt"`
}

VaaDoc represent an vaa document.

type VaaQuery

type VaaQuery struct {
	pagination.Pagination
	// contains filtered or unexported fields
}

VaaQuery respresent a query for the vaa mongodb document.

func Query

func Query() *VaaQuery

Query create a new VaaQuery with default pagination vaues.

func (*VaaQuery) SetEmitterAddress

func (q *VaaQuery) SetEmitterAddress(emitter string) *VaaQuery

SetEmitterAddress set the emitter field of the VaaQuery struct.

func (*VaaQuery) SetEmitterChain

func (q *VaaQuery) SetEmitterChain(chainID vaa.ChainID) *VaaQuery

SetEmitterChain set the emitterChain field of the VaaQuery struct.

func (*VaaQuery) SetPagination

func (q *VaaQuery) SetPagination(p *pagination.Pagination) *VaaQuery

SetPagination set the pagination field of the VaaQuery struct.

func (*VaaQuery) SetSequence

func (q *VaaQuery) SetSequence(seq uint64) *VaaQuery

SetSequence set the sequence field of the VaaQuery struct.

func (*VaaQuery) SetTargetChain

func (q *VaaQuery) SetTargetChain(chainID vaa.ChainID) *VaaQuery

SetTargetChain set the targetChain field of the VaaQuery struct.

func (*VaaQuery) SetTxId

func (q *VaaQuery) SetTxId(txId []byte) *VaaQuery

type VaaStats

type VaaStats struct {
	ChainID vaa.ChainID `bson:"_id" json:"chainId"`
	Count   int64       `bson:"count" json:"count"`
}

VaaStats definition.

Jump to

Keyboard shortcuts

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