Documentation ¶
Index ¶
- type AssetDTO
- type AttributeDoc
- type ChainActivityQuery
- type ChainActivityResult
- type ChainActivityTimeSpan
- type ChainPairDTO
- type DestinationTx
- type FindTransactionsInput
- type GlobalTransactionDoc
- type GlobalTransactionQuery
- type OriginTx
- type Repository
- func (r *Repository) FindChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
- func (r *Repository) FindGlobalTransactionByID(ctx context.Context, q *GlobalTransactionQuery) (*GlobalTransactionDoc, error)
- func (r *Repository) FindTransactions(ctx context.Context, input *FindTransactionsInput) ([]TransactionDto, error)
- func (r *Repository) GetScorecards(ctx context.Context) (*Scorecards, error)
- func (r *Repository) GetTopAssets(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]AssetDTO, error)
- func (r *Repository) GetTopChainPairs(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]ChainPairDTO, error)
- func (r *Repository) GetTransactionCount(ctx context.Context, q *TransactionCountQuery) ([]TransactionCountResult, error)
- func (r *Repository) ListTransactionsByAddress(ctx context.Context, address string, pagination *pagination.Pagination) ([]TransactionDto, error)
- type Scorecards
- type Service
- func (s *Service) FindGlobalTransactionByID(ctx context.Context, chainID vaa.ChainID, emitter *types.Address, seq string) (*GlobalTransactionDoc, error)
- func (s *Service) GetChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
- func (s *Service) GetScorecards(ctx context.Context) (*Scorecards, error)
- func (s *Service) GetTokenByChainAndAddress(ctx context.Context, chainID vaa.ChainID, tokenAddress *types.Address) (*Token, error)
- func (s *Service) GetTopAssets(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]AssetDTO, error)
- func (s *Service) GetTopChainPairs(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]ChainPairDTO, error)
- func (s *Service) GetTransactionByID(ctx context.Context, chain vaa.ChainID, emitter *types.Address, seq string) (*TransactionDto, error)
- func (s *Service) GetTransactionCount(ctx context.Context, q *TransactionCountQuery) ([]TransactionCountResult, error)
- func (s *Service) ListTransactions(ctx context.Context, pagination *pagination.Pagination) ([]TransactionDto, error)
- func (s *Service) ListTransactionsByAddress(ctx context.Context, address string, pagination *pagination.Pagination) ([]TransactionDto, error)
- type Token
- type TopStatisticsTimeSpan
- type TransactionCountQuery
- type TransactionCountResult
- type TransactionDto
- type TransactionUpdate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssetDTO ¶
type AssetDTO struct { EmitterChain sdk.ChainID TokenChain sdk.ChainID TokenAddress string Volume string }
AssetDTO is used for the return value of the function `GetTopAssets`.
type AttributeDoc ¶
type AttributeDoc struct { Type string `bson:"type" json:"type"` Value map[string]any `bson:"value" json:"value"` }
AttributeDoc represents a custom attribute for a origin transaction.
type ChainActivityQuery ¶
type ChainActivityQuery struct { TimeSpan ChainActivityTimeSpan IsNotional bool AppIDs []string }
func (*ChainActivityQuery) GetAppIDs ¶
func (q *ChainActivityQuery) GetAppIDs() []string
func (*ChainActivityQuery) HasAppIDS ¶
func (q *ChainActivityQuery) HasAppIDS() bool
type ChainActivityResult ¶
type ChainActivityTimeSpan ¶
type ChainActivityTimeSpan string
const ( ChainActivityTs7Days ChainActivityTimeSpan = "7d" ChainActivityTs30Days ChainActivityTimeSpan = "30d" ChainActivityTs90Days ChainActivityTimeSpan = "90d" ChainActivityTs1Year ChainActivityTimeSpan = "1y" ChainActivityTsAllTime ChainActivityTimeSpan = "all-time" )
func ParseChainActivityTimeSpan ¶
func ParseChainActivityTimeSpan(s string) (ChainActivityTimeSpan, error)
ParseChainActivityTimeSpan parses a string and returns a `ChainActivityTimeSpan`.
type ChainPairDTO ¶
type ChainPairDTO struct { EmitterChain sdk.ChainID DestinationChain sdk.ChainID NumberOfTransfers string }
ChainPairDTO is used for the return value of the function `GetTopChainPairs`.
type DestinationTx ¶
type DestinationTx struct { ChainID sdk.ChainID `bson:"chainId" json:"chainId"` Status string `bson:"status" json:"status"` Method string `bson:"method" json:"method"` TxHash string `bson:"txHash" json:"txHash"` From string `bson:"from" json:"from"` To string `bson:"to" json:"to"` BlockNumber string `bson:"blockNumber" json:"blockNumber"` Timestamp *time.Time `bson:"timestamp" json:"timestamp"` UpdatedAt *time.Time `bson:"updatedAt" json:"updatedAt"` }
DestinationTx represents a destination transaction.
type FindTransactionsInput ¶
type FindTransactionsInput struct {
// contains filtered or unexported fields
}
FindTransactionsInput is used to pass parameters to the `FindTransactions` method.
type GlobalTransactionDoc ¶
type GlobalTransactionDoc struct { ID string `bson:"_id" json:"id"` OriginTx *OriginTx `bson:"originTx" json:"originTx"` DestinationTx *DestinationTx `bson:"destinationTx" json:"destinationTx"` }
type GlobalTransactionQuery ¶
type GlobalTransactionQuery struct { pagination.Pagination // contains filtered or unexported fields }
GlobalTransactionQuery respresent a query for the globalTransactions mongodb document.
func Query ¶
func Query() *GlobalTransactionQuery
Query create a new VaaQuery with default pagination vaues.
func (*GlobalTransactionQuery) SetId ¶
func (q *GlobalTransactionQuery) SetId(id string) *GlobalTransactionQuery
SetId set the chainId field of the VaaQuery struct.
type OriginTx ¶
type OriginTx struct { TxHash string `bson:"nativeTxHash" json:"txHash"` From string `bson:"from" json:"from"` Status string `bson:"status" json:"status"` Attribute *AttributeDoc `bson:"attribute" json:"attribute"` }
OriginTx represents a origin transaction.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func (*Repository) FindChainActivity ¶
func (r *Repository) FindChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
func (*Repository) FindGlobalTransactionByID ¶
func (r *Repository) FindGlobalTransactionByID(ctx context.Context, q *GlobalTransactionQuery) (*GlobalTransactionDoc, error)
func (*Repository) FindTransactions ¶
func (r *Repository) FindTransactions( ctx context.Context, input *FindTransactionsInput, ) ([]TransactionDto, error)
FindTransactions returns transactions matching a specified search criteria.
func (*Repository) GetScorecards ¶
func (r *Repository) GetScorecards(ctx context.Context) (*Scorecards, error)
func (*Repository) GetTopAssets ¶
func (r *Repository) GetTopAssets(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]AssetDTO, error)
func (*Repository) GetTopChainPairs ¶
func (r *Repository) GetTopChainPairs(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]ChainPairDTO, error)
func (*Repository) GetTransactionCount ¶
func (r *Repository) GetTransactionCount(ctx context.Context, q *TransactionCountQuery) ([]TransactionCountResult, error)
GetTransactionCount get the last transactions.
func (*Repository) ListTransactionsByAddress ¶
func (r *Repository) ListTransactionsByAddress( ctx context.Context, address string, pagination *pagination.Pagination, ) ([]TransactionDto, error)
ListTransactionsByAddress returns a sorted list of transactions for a given address.
Pagination is implemented using a keyset cursor pattern, based on the (timestamp, ID) pair.
type Scorecards ¶
type Scorecards struct { // Number of VAAs emitted in the last 24 hours (includes Pyth messages). Messages24h string // Number of VAAs emitted since the creation of the network (does not include Pyth messages) TotalTxCount string //Volume transferred since the creation of the network, in USD. TotalTxVolume string // Total value locked in USD. Tvl string // Number of VAAs emitted in the last 24 hours (does not include Pyth messages). TxCount24h string // Volume transferred through the token bridge in the last 24 hours, in USD. Volume24h string }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo *Repository, cache cache.Cache, expiration time.Duration, logger *zap.Logger) *Service
NewService create a new Service.
func (*Service) FindGlobalTransactionByID ¶
func (s *Service) FindGlobalTransactionByID(ctx context.Context, chainID vaa.ChainID, emitter *types.Address, seq string) (*GlobalTransactionDoc, error)
FindGlobalTransactionByID find a global transaction by id.
func (*Service) GetChainActivity ¶
func (s *Service) GetChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
GetChainActivity get chain activity.
func (*Service) GetScorecards ¶
func (s *Service) GetScorecards(ctx context.Context) (*Scorecards, error)
func (*Service) GetTokenByChainAndAddress ¶
func (s *Service) GetTokenByChainAndAddress(ctx context.Context, chainID vaa.ChainID, tokenAddress *types.Address) (*Token, error)
GetTokenByChainAndAddress get token by chain and address.
func (*Service) GetTopAssets ¶
func (*Service) GetTopChainPairs ¶
func (s *Service) GetTopChainPairs(ctx context.Context, timeSpan *TopStatisticsTimeSpan) ([]ChainPairDTO, error)
func (*Service) GetTransactionByID ¶
func (*Service) GetTransactionCount ¶
func (s *Service) GetTransactionCount(ctx context.Context, q *TransactionCountQuery) ([]TransactionCountResult, error)
GetTransactionCount get the last transactions.
func (*Service) ListTransactions ¶
func (s *Service) ListTransactions( ctx context.Context, pagination *pagination.Pagination, ) ([]TransactionDto, error)
func (*Service) ListTransactionsByAddress ¶
func (s *Service) ListTransactionsByAddress( ctx context.Context, address string, pagination *pagination.Pagination, ) ([]TransactionDto, error)
type Token ¶
type Token struct { Symbol domain.Symbol `json:"symbol"` CoingeckoID string `json:"coingeckoId"` Decimals int64 `json:"decimals"` }
Token represents a token.
type TopStatisticsTimeSpan ¶
type TopStatisticsTimeSpan string
TopStatisticsTimeSpan is used as an input parameter for the functions `GetTopAssets` and `GetTopChainPairs`.
const ( TimeSpan7Days TopStatisticsTimeSpan = "7d" TimeSpan15Days TopStatisticsTimeSpan = "15d" TimeSpan30Days TopStatisticsTimeSpan = "30d" )
func ParseTopStatisticsTimeSpan ¶
func ParseTopStatisticsTimeSpan(s string) (*TopStatisticsTimeSpan, error)
ParseTopStatisticsTimeSpan parses a string and returns a `TopAssetsTimeSpan`.
type TransactionCountQuery ¶
type TransactionCountResult ¶
type TransactionDto ¶
type TransactionDto struct { ID string `bson:"_id"` EmitterChain sdk.ChainID `bson:"emitterChain"` EmitterAddr string `bson:"emitterAddr"` TxHash string `bson:"txHash"` Timestamp time.Time `bson:"timestamp"` Symbol string `bson:"symbol"` UsdAmount string `bson:"usdAmount"` TokenAmount string `bson:"tokenAmount"` GlobalTransations []GlobalTransactionDoc `bson:"globalTransactions"` Payload map[string]interface{} `bson:"payload"` StandardizedProperties map[string]interface{} `bson:"standardizedProperties"` }
type TransactionUpdate ¶
type TransactionUpdate struct { }
TransactionUpdate represents a transaction document.