Documentation
¶
Index ¶
- type AggregationsAppActivity
- type AppActivityTotalData
- type ApplicationActivityQuery
- type ApplicationActivityResult
- type ApplicationActivityTotalsResult
- type AssetDTO
- type AttributeDoc
- type ChainActivityQuery
- type ChainActivityResult
- type ChainActivityTimeSpan
- type ChainActivityTopResult
- type ChainActivityTopResults
- type ChainActivityTopsQuery
- type ChainPairDTO
- type DestinationTx
- type FindTransactionsInput
- type GlobalTransactionDoc
- type GlobalTransactionQuery
- type OriginTx
- type Repository
- func (r *Repository) FindApplicationActivity(ctx *fasthttp.RequestCtx, q ApplicationActivityQuery) ([]ApplicationActivityTotalsResult, []ApplicationActivityResult, error)
- func (r *Repository) FindChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
- func (r *Repository) FindChainActivityTops(ctx *fasthttp.RequestCtx, q ChainActivityTopsQuery) ([]ChainActivityTopResult, error)
- func (r *Repository) FindGlobalTransactionByID(ctx context.Context, q *GlobalTransactionQuery) (*GlobalTransactionDoc, error)
- func (r *Repository) FindTokenSymbolActivity(ctx context.Context, payload TokenSymbolActivityQuery) ([]TokenSymbolActivityResult, error)
- func (r *Repository) FindTokensVolume(ctx context.Context) ([]TokenVolume, 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) GetApplicationActivity(ctx *fasthttp.RequestCtx, q ApplicationActivityQuery) ([]AppActivityTotalData, error)
- func (s *Service) GetChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
- func (s *Service) GetChainActivityTops(ctx *fasthttp.RequestCtx, q ChainActivityTopsQuery) (ChainActivityTopResults, 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) GetTokenProvider() *domain.TokenProvider
- func (s *Service) GetTokenSymbolActivity(ctx context.Context, payload TokenSymbolActivityQuery) (TokenSymbolActivityResponse, error)
- func (s *Service) GetTokensByVolume(ctx context.Context, limit int) ([]TokenVolume, 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 StatsData
- type StatsOverview
- type TimeRangeData
- type Timespan
- type Token
- type TokenSymbolActivity
- type TokenSymbolActivityQuery
- type TokenSymbolActivityResponse
- type TokenSymbolActivityResult
- type TokenSymbolPerChainPairData
- type TokenVolume
- 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 AggregationsAppActivity ¶
type AppActivityTotalData ¶
type AppActivityTotalData struct { AppID string `json:"app_id"` TimeRangeData []TimeRangeData[AggregationsAppActivity] `json:"time_range_data"` }
type ApplicationActivityResult ¶
type ApplicationActivityResult struct { From time.Time `mapstructure:"_time" json:"from"` To time.Time `mapstructure:"to" json:"to"` Volume float64 `mapstructure:"total_value_transferred" json:"total_value_transferred"` Txs uint64 `mapstructure:"total_messages" json:"total_messages"` AppID1 string `mapstructure:"app_id_1" json:"app_id_1"` AppID2 string `mapstructure:"app_id_2" json:"app_id_2"` AppID3 string `mapstructure:"app_id_3" json:"app_id_3"` }
type ApplicationActivityTotalsResult ¶
type ApplicationActivityTotalsResult struct { From time.Time `json:"from" mapstructure:"_time"` To time.Time `json:"to" mapstructure:"to"` Volume float64 `mapstructure:"total_value_transferred" json:"total_value_transferred"` Txs uint64 `mapstructure:"total_messages" json:"total_messages"` AppID string `mapstructure:"app_id" json:"app_id"` }
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 ChainActivityTopResult ¶
type ChainActivityTopResult struct { Time time.Time `json:"from" mapstructure:"_time"` To string `json:"to" mapstructure:"to"` ChainSourceID string `mapstructure:"emitter_chain" json:"emitter_chain"` ChainDestinationID string `mapstructure:"destination_chain" json:"destination_chain,omitempty"` Volume uint64 `mapstructure:"volume" json:"volume"` Txs uint64 `mapstructure:"count" json:"count"` }
type ChainActivityTopResults ¶
type ChainActivityTopResults []ChainActivityTopResult
type ChainActivityTopsQuery ¶
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) FindApplicationActivity ¶
func (r *Repository) FindApplicationActivity(ctx *fasthttp.RequestCtx, q ApplicationActivityQuery) ([]ApplicationActivityTotalsResult, []ApplicationActivityResult, error)
func (*Repository) FindChainActivity ¶
func (r *Repository) FindChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
func (*Repository) FindChainActivityTops ¶
func (r *Repository) FindChainActivityTops(ctx *fasthttp.RequestCtx, q ChainActivityTopsQuery) ([]ChainActivityTopResult, error)
func (*Repository) FindGlobalTransactionByID ¶
func (r *Repository) FindGlobalTransactionByID(ctx context.Context, q *GlobalTransactionQuery) (*GlobalTransactionDoc, error)
func (*Repository) FindTokenSymbolActivity ¶
func (r *Repository) FindTokenSymbolActivity(ctx context.Context, payload TokenSymbolActivityQuery) ([]TokenSymbolActivityResult, error)
func (*Repository) FindTokensVolume ¶
func (r *Repository) FindTokensVolume(ctx context.Context) ([]TokenVolume, 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 (includes Pyth messages). TotalMessages 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 // Volume transferred through the token bridge in the last 24 hours, in USD. Volume24h string // Volume transferred in the last 7 days, in USD. Volume7d string // Volume transferred in the last 30 days, in USD. Volume30d string }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(repo repository, cache cache.Cache, expiration time.Duration, tokenProvider *domain.TokenProvider, metrics metrics.Metrics, 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) GetApplicationActivity ¶
func (s *Service) GetApplicationActivity(ctx *fasthttp.RequestCtx, q ApplicationActivityQuery) ([]AppActivityTotalData, error)
func (*Service) GetChainActivity ¶
func (s *Service) GetChainActivity(ctx context.Context, q *ChainActivityQuery) ([]ChainActivityResult, error)
GetChainActivity get chain activity.
func (*Service) GetChainActivityTops ¶
func (s *Service) GetChainActivityTops(ctx *fasthttp.RequestCtx, q ChainActivityTopsQuery) (ChainActivityTopResults, error)
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) GetTokenProvider ¶
func (s *Service) GetTokenProvider() *domain.TokenProvider
func (*Service) GetTokenSymbolActivity ¶
func (s *Service) GetTokenSymbolActivity(ctx context.Context, payload TokenSymbolActivityQuery) (TokenSymbolActivityResponse, error)
func (*Service) GetTokensByVolume ¶
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 StatsOverview ¶
StatsOverview Mayan overview stats
type TimeRangeData ¶
type Token ¶
type Token struct { Symbol domain.Symbol `json:"symbol"` CoingeckoID string `json:"coingeckoId"` Decimals int64 `json:"decimals"` }
Token represents a token.
type TokenSymbolActivity ¶
type TokenSymbolActivity struct { TokenSymbol string `json:"token_symbol"` TotalMessages uint64 `json:"total_messages"` TotalValueTransferred float64 `json:"total_value_transferred"` TimeRangeData []*TimeRangeData[*TokenSymbolPerChainPairData] `json:"time_range_data"` }
type TokenSymbolActivityResponse ¶
type TokenSymbolActivityResponse struct {
Tokens []TokenSymbolActivity `json:"tokens"`
}
type TokenSymbolActivityResult ¶
type TokenSymbolActivityResult struct { Symbol string `mapstructure:"symbol" json:"symbol,omitempty"` From time.Time `mapstructure:"_time" json:"from"` To time.Time `mapstructure:"to" json:"to"` Volume float64 `mapstructure:"volume" json:"total_value_transferred"` Txs uint64 `mapstructure:"txs" json:"total_messages"` EmitterChainStr string `mapstructure:"emitter_chain"` DestinationChainStr string `mapstructure:"destination_chain"` EmitterChain sdk.ChainID `json:"emitter_chain"` DestinationChain sdk.ChainID `json:"destination_chain"` }
type TokenVolume ¶
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.