Documentation ¶
Index ¶
- Constants
- Variables
- func NewAPIRouter(params api.RouterFactoryParams) error
- type APIContext
- func (c *APIContext) Aggregate(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) GetAddress(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) GetAsset(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) GetOutput(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) GetTransaction(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) ListAddresses(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) ListAssets(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) ListOutputs(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) ListTransactions(w web.ResponseWriter, r *web.Request)
- func (c *APIContext) Overview(w web.ResponseWriter, _ *web.Request)
- func (c *APIContext) Search(w web.ResponseWriter, r *web.Request)
- type Address
- type AddressList
- type AggregateParams
- type Aggregates
- type AggregatesHistogram
- type Asset
- type AssetList
- type AssetTokenCounts
- type ChainInfo
- type DB
- func (r *DB) AddTx(tx *avm.UniqueTx, ts uint64, canonicalSerialization []byte) error
- func (r *DB) Aggregate(params AggregateParams) (*AggregatesHistogram, error)
- func (r *DB) ListAddresses(params *ListAddressesParams) (*AddressList, error)
- func (r *DB) ListAssets(params *ListAssetsParams) (*AssetList, error)
- func (r *DB) ListOutputs(params *ListOutputsParams) (*OutputList, error)
- func (r *DB) ListTransactions(params *ListTransactionsParams) (*TransactionList, error)
- func (r *DB) Search(params SearchParams) (*SearchResults, error)
- type Index
- func (i *Index) Add(ingestable services.Ingestable) error
- func (i *Index) Aggregate(params AggregateParams) (*AggregatesHistogram, error)
- func (i *Index) Bootstrap() error
- func (i *Index) GetAddress(id ids.ShortID) (*Address, error)
- func (i *Index) GetAsset(idStrOrAlias string) (*Asset, error)
- func (i *Index) GetChainInfo(alias string, networkID uint32) (*ChainInfo, error)
- func (i *Index) GetOutput(id ids.ID) (*Output, error)
- func (i *Index) GetTransaction(id ids.ID) (*Transaction, error)
- func (i *Index) ListAddresses(params *ListAddressesParams) (*AddressList, error)
- func (i *Index) ListAssets(params *ListAssetsParams) (*AssetList, error)
- func (i *Index) ListOutputs(params *ListOutputsParams) (*OutputList, error)
- func (i *Index) ListTransactions(params *ListTransactionsParams) (*TransactionList, error)
- func (i *Index) Search(params SearchParams) (*SearchResults, error)
- type Input
- type InputCredentials
- type ListAddressesParams
- type ListAssetsParams
- type ListMetadata
- type ListOutputsParams
- type ListParams
- type ListTransactionsParams
- type Output
- type OutputAddress
- type OutputList
- type OutputType
- type Redis
- type SearchParams
- type SearchResult
- type SearchResultSet
- type SearchResultType
- type SearchResults
- type Transaction
- type TransactionList
- type TransactionSort
- type TransactionType
Constants ¶
View Source
const ( PaginationMaxLimit = 500 PaginationDefaultLimit = 500 PaginationDefaultOffset = 0 TransactionSortDefault TransactionSort = TransactionSortTimestampAsc TransactionSortTimestampAsc = "timestamp-asc" TransactionSortTimestampDesc = "timestamp-desc" )
View Source
const (
MaxAggregateIntervalCount = 20000
)
View Source
const ( // MaxSerializationLen is the maximum number of bytes a canonically // serialized tx can be stored as in the database. MaxSerializationLen = 16_384 )
Variables ¶
View Source
var ( ErrAggregateIntervalCountTooLarge = errors.New("requesting too many intervals") ErrFailedToParseStringAsBigInt = errors.New("failed to parse string to big.Int") )
View Source
var ( VMName = "avm" OutputTypesSECP2556K1Transfer OutputType = 0x000000ff TXTypeBase TransactionType = "base" TXTypeCreateAsset TransactionType = "create_asset" TXTypeImport TransactionType = "import" TXTypeExport TransactionType = "export" ResultTypeTransaction SearchResultType = "transaction" ResultTypeAsset SearchResultType = "asset" ResultTypeAddress SearchResultType = "address" ResultTypeOutput SearchResultType = "output" IntervalMinute = 1 * time.Minute IntervalHour = 60 * time.Minute IntervalDay = 1440 * time.Minute IntervalWeek = 7 * IntervalDay IntervalMonth = 30 * IntervalDay IntervalYear = 365 * IntervalDay IntervalAll = time.Duration(0) IntervalNames = map[string]time.Duration{ "minute": IntervalMinute, "hour": IntervalHour, "day": IntervalDay, "week": IntervalWeek, "month": IntervalMonth, "year": IntervalYear, "all": IntervalAll, } )
View Source
var ( // ErrSerializationTooLong is returned when trying to ingest data with a // serialization larger than our max ErrSerializationTooLong = errors.New("serialization is too long") )
View Source
var (
ErrUndefinedSort = errors.New("undefined sort")
)
Functions ¶
func NewAPIRouter ¶
func NewAPIRouter(params api.RouterFactoryParams) error
Types ¶
type APIContext ¶
type APIContext struct { *api.RootRequestContext // contains filtered or unexported fields }
func (*APIContext) Aggregate ¶
func (c *APIContext) Aggregate(w web.ResponseWriter, r *web.Request)
func (*APIContext) GetAddress ¶
func (c *APIContext) GetAddress(w web.ResponseWriter, r *web.Request)
func (*APIContext) GetAsset ¶
func (c *APIContext) GetAsset(w web.ResponseWriter, r *web.Request)
func (*APIContext) GetOutput ¶
func (c *APIContext) GetOutput(w web.ResponseWriter, r *web.Request)
func (*APIContext) GetTransaction ¶
func (c *APIContext) GetTransaction(w web.ResponseWriter, r *web.Request)
func (*APIContext) ListAddresses ¶
func (c *APIContext) ListAddresses(w web.ResponseWriter, r *web.Request)
func (*APIContext) ListAssets ¶
func (c *APIContext) ListAssets(w web.ResponseWriter, r *web.Request)
func (*APIContext) ListOutputs ¶
func (c *APIContext) ListOutputs(w web.ResponseWriter, r *web.Request)
func (*APIContext) ListTransactions ¶
func (c *APIContext) ListTransactions(w web.ResponseWriter, r *web.Request)
func (*APIContext) Overview ¶
func (c *APIContext) Overview(w web.ResponseWriter, _ *web.Request)
func (*APIContext) Search ¶
func (c *APIContext) Search(w web.ResponseWriter, r *web.Request)
type Address ¶
type Address struct { Address stringShortID `json:"address"` ChainID stringID `json:"chainID"` PublicKey []byte `json:"publicKey"` TransactionCount uint64 `json:"transactionCount"` Balance tokenAmount `json:"balance"` TotalReceived tokenAmount `json:"totalReceived"` TotalSent tokenAmount `json:"totalSent"` UTXOCount uint64 `json:"utxoCount"` Score uint64 `json:"-"` }
type AddressList ¶
type AddressList struct { ListMetadata Addresses []*Address `json:"addresses"` }
type AggregateParams ¶
type AggregateParams struct { AssetID *ids.ID StartTime time.Time EndTime time.Time IntervalSize time.Duration }
func GetAggregateTransactionsParamsForHTTPRequest ¶
func GetAggregateTransactionsParamsForHTTPRequest(r *http.Request) (*AggregateParams, error)
type Aggregates ¶
type Aggregates struct { // Idx is used internally when creating a histogram of Aggregates. // It is exported only so it can be written to by dbr. Idx int `json:"-"` StartTime time.Time `json:"startTime"` EndTime time.Time `json:"endTime"` TransactionVolume tokenAmount `json:"transactionVolume"` TransactionCount uint64 `json:"transactionCount"` AddressCount uint64 `json:"addressCount"` OutputCount uint64 `json:"outputCount"` AssetCount uint64 `json:"assetCount"` }
type AggregatesHistogram ¶
type AggregatesHistogram struct { Aggregates Aggregates `json:"aggregates"` IntervalSize time.Duration `json:"intervalSize,omitempty"` Intervals []Aggregates `json:"intervals,omitempty"` }
type Asset ¶
type Asset struct { ID stringID `json:"id"` ChainID stringID `json:"chainID"` Name string `json:"name"` Symbol string `json:"symbol"` Alias string `json:"alias"` Denomination uint8 `json:"denomination"` CurrentSupply tokenAmount `json:"currentSupply"` CreatedAt time.Time `json:"timestamp"` Score uint64 `json:"-"` }
type AssetList ¶
type AssetList struct { ListMetadata Assets []*Asset `json:"assets"` }
type AssetTokenCounts ¶
type AssetTokenCounts map[stringID]tokenAmount
AssetTokenCounts maps asset IDs to a tokenAmount for that asset
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a services.Accumulator backed by redis
func (*DB) Aggregate ¶
func (r *DB) Aggregate(params AggregateParams) (*AggregatesHistogram, error)
func (*DB) ListAddresses ¶
func (r *DB) ListAddresses(params *ListAddressesParams) (*AddressList, error)
func (*DB) ListAssets ¶
func (r *DB) ListAssets(params *ListAssetsParams) (*AssetList, error)
func (*DB) ListOutputs ¶
func (r *DB) ListOutputs(params *ListOutputsParams) (*OutputList, error)
func (*DB) ListTransactions ¶
func (r *DB) ListTransactions(params *ListTransactionsParams) (*TransactionList, error)
func (*DB) Search ¶
func (r *DB) Search(params SearchParams) (*SearchResults, error)
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) Aggregate ¶
func (i *Index) Aggregate(params AggregateParams) (*AggregatesHistogram, error)
func (*Index) GetChainInfo ¶
func (*Index) GetTransaction ¶
func (i *Index) GetTransaction(id ids.ID) (*Transaction, error)
func (*Index) ListAddresses ¶
func (i *Index) ListAddresses(params *ListAddressesParams) (*AddressList, error)
func (*Index) ListAssets ¶
func (i *Index) ListAssets(params *ListAssetsParams) (*AssetList, error)
func (*Index) ListOutputs ¶
func (i *Index) ListOutputs(params *ListOutputsParams) (*OutputList, error)
func (*Index) ListTransactions ¶
func (i *Index) ListTransactions(params *ListTransactionsParams) (*TransactionList, error)
func (*Index) Search ¶
func (i *Index) Search(params SearchParams) (*SearchResults, error)
type Input ¶
type Input struct { Output *Output `json:"output"` Creds []InputCredentials `json:"credentials"` }
type InputCredentials ¶
type ListAddressesParams ¶
type ListAddressesParams struct { ListParams Address *ids.ShortID Query string }
func ListAddressesParamsForHTTPRequest ¶
func ListAddressesParamsForHTTPRequest(r *http.Request) (*ListAddressesParams, error)
func (*ListAddressesParams) Apply ¶
func (p *ListAddressesParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder
type ListAssetsParams ¶
type ListAssetsParams struct { ListParams ID *ids.ID Query string Alias string }
func ListAssetsParamsForHTTPRequest ¶
func ListAssetsParamsForHTTPRequest(r *http.Request) (*ListAssetsParams, error)
func (*ListAssetsParams) Apply ¶
func (p *ListAssetsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder
type ListMetadata ¶
type ListMetadata struct {
Count uint64 `json:"count"`
}
type ListOutputsParams ¶
type ListOutputsParams struct { ListParams ID *ids.ID Query string Addresses []ids.ShortID Spent *bool }
func ListOutputsParamsForHTTPRequest ¶
func ListOutputsParamsForHTTPRequest(r *http.Request) (*ListOutputsParams, error)
func (*ListOutputsParams) Apply ¶
func (p *ListOutputsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder
type ListParams ¶
func ListParamForHTTPRequest ¶
func ListParamForHTTPRequest(r *http.Request) (params ListParams, err error)
func (ListParams) Apply ¶
func (p ListParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder
type ListTransactionsParams ¶
type ListTransactionsParams struct { ListParams ID *ids.ID Query string Addresses []ids.ShortID AssetID *ids.ID StartTime time.Time EndTime time.Time Sort TransactionSort }
func ListTransactionsParamsForHTTPRequest ¶
func ListTransactionsParamsForHTTPRequest(r *http.Request) (*ListTransactionsParams, error)
func (*ListTransactionsParams) Apply ¶
func (p *ListTransactionsParams) Apply(b *dbr.SelectBuilder) *dbr.SelectBuilder
type Output ¶
type Output struct { ID stringID `json:"id"` TransactionID stringID `json:"transactionID"` OutputIndex uint64 `json:"outputIndex"` AssetID stringID `json:"assetID"` OutputType OutputType `json:"outputType"` Amount tokenAmount `json:"amount"` Locktime uint64 `json:"locktime"` Threshold uint64 `json:"threshold"` Addresses []stringShortID `json:"addresses"` CreatedAt time.Time `json:"timestamp"` RedeemingTransactionID stringID `json:"redeemingTransactionID"` Score uint64 `json:"-"` }
type OutputAddress ¶
type OutputList ¶
type OutputList struct { ListMetadata Outputs []*Output `json:"outputs"` }
type Redis ¶
type Redis struct {
// contains filtered or unexported fields
}
Redis is an Accumulator and Index backed by redis
func NewRedisIndex ¶
NewRedisIndex creates a new Redis for the given config
func (*Redis) GetRecentTransactions ¶
GetRecentTransactions returns a list of the N most recent transactions
func (*Redis) GetTxCount ¶
GetTransactionCount returns the number of transactions this Server as seen
type SearchParams ¶
type SearchParams struct { ListParams Query string }
func SearchParamsForHTTPRequest ¶
func SearchParamsForHTTPRequest(r *http.Request) (*SearchParams, error)
type SearchResult ¶
type SearchResult struct { // SearchResultType is the type of object found SearchResultType `json:"type"` // Data is the object itself Data interface{} `json:"data"` // Score is a rank of how well this result matches the query Score uint64 `json:"score"` }
SearchResult represents a single item matching a search query.
type SearchResultSet ¶
type SearchResultSet []SearchResult
func (SearchResultSet) Len ¶
func (srs SearchResultSet) Len() int
func (SearchResultSet) Less ¶
func (s SearchResultSet) Less(i, j int) bool
func (SearchResultSet) Swap ¶
func (s SearchResultSet) Swap(i, j int)
type SearchResultType ¶
type SearchResultType string
SearchResultType is the type for an object found from a search query.
type SearchResults ¶
type SearchResults struct { // Count is the total number of matching results Count uint64 `json:"count"` // Results is a list of SearchResult Results SearchResultSet `json:"results"` }
SearchResults represents a set of items returned for a search query.
type Transaction ¶
type Transaction struct { ID stringID `json:"id"` ChainID stringID `json:"chainID"` Type string `json:"type"` Inputs []*Input `json:"inputs"` Outputs []*Output `json:"outputs"` InputTotals AssetTokenCounts `json:"inputTotals"` OutputTotals AssetTokenCounts `json:"outputTotals"` ReusedAddressTotals AssetTokenCounts `json:"reusedAddressTotals"` CanonicalSerialization []byte `json:"canonicalSerialization,omitempty"` CreatedAt time.Time `json:"timestamp"` Score uint64 `json:"-"` }
type TransactionList ¶
type TransactionList struct { ListMetadata Transactions []*Transaction `json:"transactions"` }
type TransactionType ¶
type TransactionType string
TransactionType represents a sub class of Transaction
Click to show internal directories.
Click to hide internal directories.