api

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2022 License: BSD-3-Clause Imports: 20 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AVMName     = "avm"
	XChainAlias = "x"
	PVMName     = "pvm"
	PChainAlias = "p"
)
View Source
const DefaultOffsetLimit = 10000
View Source
const MetricAddressChainsCount = "api_address_chains_count"
View Source
const MetricAddressChainsMillis = "api_address_chains_millis"
View Source
const MetricAddressesCount = "api_addresses_count"
View Source
const MetricAddressesMillis = "api_addresses_millis"
View Source
const MetricAggregateCount = "api_aggregate_count"
View Source
const MetricAggregateMillis = "api_aggregate_millis"
View Source
const MetricAssetCount = "api_asset_count"
View Source
const MetricAssetMillis = "api_asset_millis"
View Source
const MetricCTransactionsCount = "api_ctransactions_count"
View Source
const MetricCTransactionsMillis = "api_ctransactions_millis"
View Source
const MetricCount = "api_count"
View Source
const MetricMillis = "api_millis"
View Source
const MetricSearchCount = "api_search_count"
View Source
const MetricSearchMillis = "api_search_millis"
View Source
const MetricTransactionsCount = "api_transactions_count"
View Source
const MetricTransactionsMillis = "api_transactions_millis"

Variables

View Source
var (
	// ErrCacheableFnFailed is returned when the execution of a CacheableFn
	// fails.
	ErrCacheableFnFailed = errors.New("failed to load resource")
)

Functions

func AddV2Routes added in v1.1.2

func AddV2Routes(ctx *Context, router *web.Router, path string, indexBytes []byte, chainID *ids.ID)

AddV2Routes mounts a V2 API router at the given path, displaying the given indexBytes at the root. If chainID is not nil the handlers run in v1 compatible mode where the `version` param is set to "1" and requests to default to filtering by the given chainID.

func ParseGetJSON added in v1.1.3

func ParseGetJSON(r *web.Request, n int64) (url.Values, error)

func WriteErr

func WriteErr(w http.ResponseWriter, code int, msg string)

WriteErr writes the given error message to the http response

func WriteJSON

func WriteJSON(w http.ResponseWriter, msg []byte)

WriteJSON writes the given bytes to the http response as JSON

Types

type Context added in v1.1.2

type Context struct {
	// contains filtered or unexported fields
}

Context is the base context for APIs in the ortelius systems

func (*Context) NetworkID added in v1.1.2

func (c *Context) NetworkID() uint32

NetworkID returns the networkID this request is for

func (*Context) WriteCacheable added in v1.1.2

func (c *Context) WriteCacheable(w http.ResponseWriter, cacheable utils.Cacheable)

WriteCacheable writes to the http response the output of the given Cacheable's function, either from the cache or from a new execution of the function

func (*Context) WriteErr added in v1.1.2

func (c *Context) WriteErr(w http.ResponseWriter, code int, err error)

WriteErr writes an error response to the http response

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorResponse represents an API error to return to the caller

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is an HTTP server configured with various ortelius APIs

func NewServer

func NewServer(sc *servicesctrl.Control, conf cfg.Config) (*Server, error)

NewServer creates a new *Server based on the given config

func (*Server) Close

func (s *Server) Close() error

Close shuts the server down

func (*Server) Listen

func (s *Server) Listen() error

Listen begins listening for new socket connections and blocks until closed

type V2Context added in v1.1.2

type V2Context struct {
	*Context
	// contains filtered or unexported fields
}

func (*V2Context) ATxData added in v1.2.0

func (c *V2Context) ATxData(w web.ResponseWriter, r *web.Request)

func (*V2Context) AddressChains added in v1.1.2

func (c *V2Context) AddressChains(w web.ResponseWriter, r *web.Request)

func (*V2Context) AddressChainsPost added in v1.1.3

func (c *V2Context) AddressChainsPost(w web.ResponseWriter, r *web.Request)

func (*V2Context) Aggregate added in v1.1.2

func (c *V2Context) Aggregate(w web.ResponseWriter, r *web.Request)

func (*V2Context) CTxData added in v1.2.0

func (c *V2Context) CTxData(w web.ResponseWriter, r *web.Request)

func (*V2Context) CacheAddressCounts added in v1.3.2

func (c *V2Context) CacheAddressCounts(w web.ResponseWriter, r *web.Request)

func (*V2Context) CacheAggregates added in v1.2.3

func (c *V2Context) CacheAggregates(w web.ResponseWriter, r *web.Request)

func (*V2Context) CacheAssetAggregates added in v1.2.3

func (c *V2Context) CacheAssetAggregates(w web.ResponseWriter, r *web.Request)

func (*V2Context) CacheAssets added in v1.3.2

func (c *V2Context) CacheAssets(w web.ResponseWriter, r *web.Request)

func (*V2Context) CacheTxCounts added in v1.4.0

func (c *V2Context) CacheTxCounts(w web.ResponseWriter, r *web.Request)

func (*V2Context) ETxData added in v1.2.0

func (c *V2Context) ETxData(w web.ResponseWriter, r *web.Request)

func (*V2Context) GetAddress added in v1.1.2

func (c *V2Context) GetAddress(w web.ResponseWriter, r *web.Request)

func (*V2Context) GetAsset added in v1.1.2

func (c *V2Context) GetAsset(w web.ResponseWriter, r *web.Request)

func (*V2Context) GetBlock added in v1.1.2

func (c *V2Context) GetBlock(w web.ResponseWriter, r *web.Request)

func (*V2Context) GetOutput added in v1.1.2

func (c *V2Context) GetOutput(w web.ResponseWriter, r *web.Request)

func (*V2Context) GetTransaction added in v1.1.2

func (c *V2Context) GetTransaction(w web.ResponseWriter, r *web.Request)

func (*V2Context) ListAddresses added in v1.1.2

func (c *V2Context) ListAddresses(w web.ResponseWriter, r *web.Request)

func (*V2Context) ListAssets added in v1.1.2

func (c *V2Context) ListAssets(w web.ResponseWriter, r *web.Request)

func (*V2Context) ListBlocks added in v1.1.2

func (c *V2Context) ListBlocks(w web.ResponseWriter, r *web.Request)

PVM

func (*V2Context) ListCTransactions added in v1.2.3

func (c *V2Context) ListCTransactions(w web.ResponseWriter, r *web.Request)

func (*V2Context) ListOutputs added in v1.1.2

func (c *V2Context) ListOutputs(w web.ResponseWriter, r *web.Request)

func (*V2Context) ListTransactions added in v1.1.2

func (c *V2Context) ListTransactions(w web.ResponseWriter, r *web.Request)

func (*V2Context) ListTransactionsPost added in v1.1.3

func (c *V2Context) ListTransactionsPost(w web.ResponseWriter, r *web.Request)

func (*V2Context) PTxData added in v1.2.0

func (c *V2Context) PTxData(w web.ResponseWriter, r *web.Request)

func (*V2Context) RawTransaction added in v1.2.3

func (c *V2Context) RawTransaction(w web.ResponseWriter, r *web.Request)

func (*V2Context) Search added in v1.1.2

func (c *V2Context) Search(w web.ResponseWriter, r *web.Request)

func (*V2Context) TxfeeAggregate added in v1.1.2

func (c *V2Context) TxfeeAggregate(w web.ResponseWriter, r *web.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL