Documentation ¶
Overview ¶
Package observations handle the request of VAA data from governor endpoint defined in the api.
Index ¶
- type Controller
- func (c *Controller) FindAll(ctx *fiber.Ctx) error
- func (c *Controller) FindByChain(ctx *fiber.Ctx) error
- func (c *Controller) FindByEmitter(ctx *fiber.Ctx) error
- func (c *Controller) FindByEmitterAndTargetChain(ctx *fiber.Ctx) error
- func (c *Controller) FindById(ctx *fiber.Ctx) error
- func (c *Controller) FindByTxId(ctx *fiber.Ctx) error
- func (c *Controller) FindRecent(ctx *fiber.Ctx) error
- func (c *Controller) FindSignedVAAByID(ctx *fiber.Ctx) error
- func (c *Controller) GetNextGovernanceSequence(ctx *fiber.Ctx) error
- func (c *Controller) GetVaaCount(ctx *fiber.Ctx) error
- type Repository
- func (r *Repository) Find(ctx context.Context, q *VaaQuery) ([]*VaaDoc, error)
- func (r *Repository) FindOne(ctx context.Context, q *VaaQuery) (*VaaDoc, error)
- func (r *Repository) GetVaaCount(ctx context.Context, q *VaaQuery) ([]*VaaStats, error)
- func (r *Repository) RawQuery(ctx context.Context, filter interface{}, options ...*options.FindOptions) ([]*VaaDoc, error)
- type Service
- func (s *Service) FindAll(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*VaaDoc], error)
- func (s *Service) FindByChain(ctx context.Context, chain vaa.ChainID, p *pagination.Pagination) (*response.Response[[]*VaaDoc], error)
- func (s *Service) FindByEmitter(ctx context.Context, chain vaa.ChainID, emitter *vaa.Address, ...) (*response.Response[[]*VaaDoc], error)
- func (s *Service) FindByEmitterAndTargetChain(ctx context.Context, emitterChain vaa.ChainID, emitterAddress *vaa.Address, ...) (*response.Response[[]*VaaDoc], error)
- func (s *Service) FindById(ctx context.Context, emitterChain vaa.ChainID, emitter *vaa.Address, ...) (*response.Response[*VaaDoc], error)
- func (s *Service) FindByTxId(ctx context.Context, txId []byte) (*response.Response[*VaaDoc], error)
- func (s *Service) FindRecent(ctx context.Context, numRows *uint, emitterChain *uint, emitterAddr string) (*response.Response[[]*VaaDoc], error)
- func (s *Service) GetNextGovernanceSequence(ctx context.Context, governanceChain vaa.ChainID, ...) (*uint64, error)
- func (s *Service) GetVaaCount(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*VaaStats], error)
- type VaaDoc
- type VaaQuery
- func (q *VaaQuery) SetEmitterAddress(emitter string) *VaaQuery
- func (q *VaaQuery) SetEmitterChain(chainID vaa.ChainID) *VaaQuery
- func (q *VaaQuery) SetPagination(p *pagination.Pagination) *VaaQuery
- func (q *VaaQuery) SetSequence(seq uint64) *VaaQuery
- func (q *VaaQuery) SetTargetChain(chainID vaa.ChainID) *VaaQuery
- func (q *VaaQuery) SetTxId(txId []byte) *VaaQuery
- type VaaStats
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 ¶
Find get a list of *VaaDoc. The input parameter [q *VaaQuery] define the filters to apply in the query.
func (*Repository) FindOne ¶
FindOne get *VaaDoc. The input parameter [q *VaaQuery] define the filters to apply in the query.
func (*Repository) GetVaaCount ¶
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 ¶
func (s *Service) FindAll(ctx context.Context, p *pagination.Pagination) (*response.Response[[]*VaaDoc], error)
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 (*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 (*Service) FindRecent ¶
func (*Service) GetNextGovernanceSequence ¶
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 (*VaaQuery) SetEmitterAddress ¶
SetEmitterAddress set the emitter field of the VaaQuery struct.
func (*VaaQuery) SetEmitterChain ¶
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 ¶
SetSequence set the sequence field of the VaaQuery struct.
func (*VaaQuery) SetTargetChain ¶
SetTargetChain set the targetChain field of the VaaQuery struct.