Documentation
¶
Index ¶
- Constants
- type AttestationVaa
- type GuardianSet
- type GuardianSetKey
- type GuardianSetStorager
- type IndexingTimestamps
- type MongoGuardianSetRepository
- type Pagination
- type PostgresGuardianSetRepository
- type PostgresVaaRepository
- type VaaDoc
- type VaaQuery
- type VaaRepository
- func (r *VaaRepository) FindById(ctx context.Context, id string) (*VaaDoc, error)
- func (r *VaaRepository) FindPage(ctx context.Context, query VaaQuery, pagination Pagination) ([]*VaaDoc, error)
- func (r *VaaRepository) FindPageByTimeRange(ctx context.Context, startTime time.Time, endTime time.Time, ...) ([]*VaaDoc, error)
Constants ¶
const ( VaaIdTxHash = "vaaIdTxHash" TransferPrices = "transferPrices" Vaas = "vaas" DuplicateVaas = "duplicateVaas" GuardianSets = "guardianSets" NodeGovernorVaas = "nodeGovernorVaas" GovernorVaas = "governorVaas" Observations = "observations" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttestationVaa ¶
type AttestationVaa struct { ID string `db:"id"` VaaID string `db:"vaa_id"` Version uint8 `db:"version"` EmitterChain sdk.ChainID `db:"emitter_chain_id"` EmitterAddress string `db:"emitter_address"` Sequence uint64 `db:"sequence"` GuardianSetIdx uint32 `db:"guardian_set_index"` Raw []byte `db:"raw"` Timestamp time.Time `db:"timestamp"` Active bool `db:"active"` IsDuplicated bool `db:"is_duplicated"` ConsistencyLevel *uint8 `db:"consistency_level"` CreatedAt time.Time `db:"created_at"` UpdatedAt *time.Time `db:"updated_at"` }
AttestationVaa represent a vaa attestation row in the postgres database.
type GuardianSet ¶
type GuardianSet struct { GuardianSetIndex uint32 `bson:"_id" json:"guardianSetIndex" db:"guardian_set_id"` Keys []GuardianSetKey `bson:"keys" json:"keys" db:"keys"` ExpirationTime *time.Time `bson:"expirationTime" json:"expirationTime" db:"expiration_time"` CreatedAt *time.Time `bson:"-" json:"createdAt" db:"created_at"` UpdatedAt time.Time `bson:"updatedAt" json:"updatedAt" db:"updated_at"` }
GuardianSet is a document for GuardianSet.
type GuardianSetKey ¶
type GuardianSetKey struct { Index uint32 `bson:"index" json:"index" db:"index"` Address []byte `bson:"address" json:"address" db:"address"` }
GuardianSetKey is a key document for GuardianSet.
type GuardianSetStorager ¶
type GuardianSetStorager interface { FindAll(ctx context.Context) ([]*GuardianSet, error) Upsert(ctx context.Context, doc *GuardianSet) error }
type IndexingTimestamps ¶
IndexingTimestamps struct.
func IndexedAt ¶
func IndexedAt(t time.Time) IndexingTimestamps
IndexedAt returns a new IndexingTimestamps.
type MongoGuardianSetRepository ¶
type MongoGuardianSetRepository struct {
// contains filtered or unexported fields
}
MongoGuardianSetRepository repository.
func NewMongoGuardianSetRepository ¶
func NewMongoGuardianSetRepository(db *mongo.Database, logger *zap.Logger) *MongoGuardianSetRepository
NewMongoGuardianSetRepository create a new guardian set repository.
func (*MongoGuardianSetRepository) FindAll ¶
func (r *MongoGuardianSetRepository) FindAll(ctx context.Context) ([]*GuardianSet, error)
FindAll finds all guardian sets.
func (*MongoGuardianSetRepository) FindByIndex ¶
func (r *MongoGuardianSetRepository) FindByIndex(ctx context.Context, index uint32) (*GuardianSet, error)
FindByIndex finds guardian set by index.
func (*MongoGuardianSetRepository) Upsert ¶
func (r *MongoGuardianSetRepository) Upsert(ctx context.Context, doc *GuardianSet) error
Upsert upserts a guardian set document.
type Pagination ¶
Pagination is a pagination for VAA.
type PostgresGuardianSetRepository ¶
type PostgresGuardianSetRepository struct {
// contains filtered or unexported fields
}
PostgresGuardianSetRepository is a repository.
func NewPostgresGuardianSetRepository ¶
func NewPostgresGuardianSetRepository(db *db.DB, logger *zap.Logger) *PostgresGuardianSetRepository
NewPostgresGuardianSetRepository creates a new repository.
func (*PostgresGuardianSetRepository) FindAll ¶
func (r *PostgresGuardianSetRepository) FindAll(ctx context.Context) ([]*GuardianSet, error)
GuardianSet is a document for GuardianSet.
func (*PostgresGuardianSetRepository) Upsert ¶
func (r *PostgresGuardianSetRepository) Upsert(ctx context.Context, gs *GuardianSet) error
Upsert upserts a guardian set document.
type PostgresVaaRepository ¶
type PostgresVaaRepository struct {
// contains filtered or unexported fields
}
PostgresVaaRepository is a repository for VAA.
func NewPostgresVaaRepository ¶
func NewPostgresVaaRepository(db *db.DB, logger *zap.Logger) *PostgresVaaRepository
NewPostgresVaaRepository creates a new Vaa repository.
func (*PostgresVaaRepository) FindPage ¶
func (r *PostgresVaaRepository) FindPage(ctx context.Context, queryFilters VaaQuery, pagination Pagination) ([]*AttestationVaa, error)
FindPage finds VAA by query and pagination.
type VaaDoc ¶
type VaaDoc struct { ID string `bson:"_id" json:"id"` Vaa []byte `bson:"vaas" json:"vaa"` ChainID uint16 `bson:"emitterChain"` EmitterAddress string `bson:"emitterAddr"` Sequence string `bson:"sequence"` GuardianSetIndex uint32 `bson:"guardianSetIndex"` IndexedAt time.Time `bson:"indexedAt"` Timestamp *time.Time `bson:"timestamp"` UpdatedAt *time.Time `bson:"updatedAt"` TxHash string `bson:"txHash"` Version int `bson:"version"` Revision int `bson:"revision"` }
VaaDoc is a document for VAA.
type VaaQuery ¶
type VaaQuery struct { StartTime *time.Time EndTime *time.Time EmitterChainID *sdk.ChainID EmitterAddress *string Sequence *string }
VaaQuery is a query for VAA.
type VaaRepository ¶
type VaaRepository struct {
// contains filtered or unexported fields
}
VaaRepository is a repository for VAA.
func NewVaaRepository ¶
func NewVaaRepository(db *mongo.Database, logger *zap.Logger) *VaaRepository
NewVaaRepository create a new Vaa repository.
func (*VaaRepository) FindPage ¶
func (r *VaaRepository) FindPage(ctx context.Context, query VaaQuery, pagination Pagination) ([]*VaaDoc, error)
FindPage finds VAA by query and pagination.