server

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ParameterFoundryID is used to identify a foundry by its ID.
	ParameterFoundryID = "foundryID"

	// ParameterAliasID is used to identify an alias by its ID.
	ParameterAliasID = "aliasID"

	// ParameterNFTID is used to identify a nft by its ID.
	ParameterNFTID = "nftID"

	// QueryParameterAddress is used to filter for a certain address.
	QueryParameterAddress = "address"

	// QueryParameterAliasAddress is used to filter for a certain alias address.
	QueryParameterAliasAddress = "aliasAddress"

	// QueryParameterIssuer is used to filter for a certain issuer.
	QueryParameterIssuer = "issuer"

	// QueryParameterSender is used to filter for a certain sender.
	QueryParameterSender = "sender"

	// QueryParameterTag is used to filter for a certain tag.
	QueryParameterTag = "tag"

	// QueryParameterHasStorageReturnCondition is used to filter for outputs having a storage deposit return unlock condition.
	QueryParameterHasStorageReturnCondition = "hasStorageReturnCondition"

	// QueryParameterStorageReturnAddress is used to filter for outputs with a certain storage deposit return address.
	QueryParameterStorageReturnAddress = "storageReturnAddress"

	// QueryParameterHasExpirationCondition is used to filter for outputs having an expiration unlock condition.
	QueryParameterHasExpirationCondition = "hasExpirationCondition"

	// QueryParameterExpiresBefore is used to filter for outputs that expire before a certain unix time.
	QueryParameterExpiresBefore = "expiresBefore"

	// QueryParameterExpiresAfter is used to filter for outputs that expire after a certain unix time.
	QueryParameterExpiresAfter = "expiresAfter"

	// QueryParameterExpiresBeforeMilestone is used to filter for outputs that expire before a certain milestone index.
	QueryParameterExpiresBeforeMilestone = "expiresBeforeMilestone"

	// QueryParameterExpiresAfterMilestone is used to filter for outputs that expire after a certain milestone index.
	QueryParameterExpiresAfterMilestone = "expiresAfterMilestone"

	// QueryParameterExpirationReturnAddress is used to filter for outputs with a certain expiration return address.
	QueryParameterExpirationReturnAddress = "expirationReturnAddress"

	// QueryParameterHasTimelockCondition is used to filter for outputs having a timelock unlock condition.
	QueryParameterHasTimelockCondition = "hasTimelockCondition"

	// QueryParameterTimelockedBefore is used to filter for outputs that are timelocked before a certain unix time.
	QueryParameterTimelockedBefore = "timelockedBefore"

	// QueryParameterTimelockedAfter is used to filter for outputs that are timelocked after a certain unix time.
	QueryParameterTimelockedAfter = "timelockedAfter"

	// QueryParameterTimelockedBeforeMilestone is used to filter for outputs that are timelocked before a certain milestone index.
	QueryParameterTimelockedBeforeMilestone = "timelockedBeforeMilestone"

	// QueryParameterTimelockedAfterMilestone is used to filter for outputs that are timelocked after a certain milestone index.
	QueryParameterTimelockedAfterMilestone = "timelockedAfterMilestone"

	// QueryParameterStateController is used to filter for a certain state controller address.
	QueryParameterStateController = "stateController"

	// QueryParameterGovernor is used to filter for a certain governance controller address.
	QueryParameterGovernor = "governor"

	// QueryParameterPageSize is used to define the page size for the results.
	QueryParameterPageSize = "pageSize"

	// QueryParameterCursor is used to pass the offset we want to start the next results from.
	QueryParameterCursor = "cursor"

	// QueryParameterCreatedBefore is used to filter for outputs that were created before the given time.
	QueryParameterCreatedBefore = "createdBefore"

	// QueryParameterCreatedAfter is used to filter for outputs that were created after the given time.
	QueryParameterCreatedAfter = "createdAfter"

	// QueryParameterHasNativeTokens is used to filter for outputs that have native tokens.
	QueryParameterHasNativeTokens = "hasNativeTokens"

	// QueryParameterMinNativeTokenCount is used to filter for outputs that have at least an amount of native tokens.
	QueryParameterMinNativeTokenCount = "minNativeTokenCount"

	// QueryParameterMaxNativeTokenCount is used to filter for outputs that have at the most an amount of native tokens.
	QueryParameterMaxNativeTokenCount = "maxNativeTokenCount"
)
View Source
const (

	// RouteOutputsBasic is the route for getting basic outputs filtered by the given parameters.
	// GET with query parameter returns all outputIDs that fit these filter criteria.
	// Query parameters: "address", "hasStorageReturnCondition", "storageReturnAddress", "hasExpirationCondition",
	//					 "expiresBefore", "expiresAfter", "expiresBeforeMilestone", "expiresAfterMilestone",
	//					 "hasTimelockCondition", "timelockedBefore", "timelockedAfter", "timelockedBeforeMilestone",
	//					 "timelockedAfterMilestone", "sender", "tag", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsBasic = "/outputs/basic"

	// RouteOutputsAliases is the route for getting aliases filtered by the given parameters.
	// GET with query parameter returns all outputIDs that fit these filter criteria.
	// Query parameters: "stateController", "governor", "issuer", "sender", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsAliases = "/outputs/alias"

	// RouteOutputsAliasByID is the route for getting aliases by their aliasID.
	// GET returns the outputIDs or 404 if no record is found.
	RouteOutputsAliasByID = "/outputs/alias/:" + ParameterAliasID

	// RouteOutputsNFTs is the route for getting NFT filtered by the given parameters.
	// Query parameters: "address", "hasStorageReturnCondition", "storageReturnAddress", "hasExpirationCondition",
	//					 "expiresBefore", "expiresAfter", "expiresBeforeMilestone", "expiresAfterMilestone",
	//					 "hasTimelockCondition", "timelockedBefore", "timelockedAfter", "timelockedBeforeMilestone",
	//					 "timelockedAfterMilestone", "issuer", "sender", "tag", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsNFTs = "/outputs/nft"

	// RouteOutputsNFTByID is the route for getting NFT by their nftID.
	// GET returns the outputIDs or 404 if no record is found.
	RouteOutputsNFTByID = "/outputs/nft/:" + ParameterNFTID

	// RouteOutputsFoundries is the route for getting foundries filtered by the given parameters.
	// GET with query parameter returns all outputIDs that fit these filter criteria.
	// Query parameters: "aliasAddress", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsFoundries = "/outputs/foundry"

	// RouteOutputsFoundryByID is the route for getting foundries by their foundryID.
	// GET returns the outputIDs or 404 if no record is found.
	RouteOutputsFoundryByID = "/outputs/foundry/:" + ParameterFoundryID
)

Variables

View Source
var (
	// ErrInvalidParameter defines the invalid parameter error.
	ErrInvalidParameter = echo.NewHTTPError(http.StatusBadRequest, "invalid parameter")
)

Functions

func ErrorHandler

func ErrorHandler() func(error, echo.Context)

func ParseAliasIDParam

func ParseAliasIDParam(c echo.Context) (*iotago.AliasID, error)

func ParseBech32AddressQueryParam

func ParseBech32AddressQueryParam(c echo.Context, prefix iotago.NetworkPrefix, paramName string) (iotago.Address, error)

func ParseBoolQueryParam

func ParseBoolQueryParam(c echo.Context, paramName string) (bool, error)

func ParseFoundryIDParam

func ParseFoundryIDParam(c echo.Context) (*iotago.FoundryID, error)

func ParseHexQueryParam

func ParseHexQueryParam(c echo.Context, paramName string, maxLen int) ([]byte, error)

func ParseNFTIDParam

func ParseNFTIDParam(c echo.Context) (*iotago.NFTID, error)

func ParseUint32QueryParam

func ParseUint32QueryParam(c echo.Context, paramName string, maxValue ...uint32) (uint32, error)

func ParseUnixTimestampQueryParam

func ParseUnixTimestampQueryParam(c echo.Context, paramName string) (time.Time, error)

Types

type HTTPErrorResponse

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

HTTPErrorResponse defines the error struct for the HTTPErrorResponseEnvelope.

type HTTPErrorResponseEnvelope

type HTTPErrorResponseEnvelope struct {
	Error HTTPErrorResponse `json:"error"`
}

HTTPErrorResponseEnvelope defines the error response schema for node API responses.

type IndexerServer

type IndexerServer struct {
	Indexer                 *indexer.Indexer
	Bech32HRP               iotago.NetworkPrefix
	RestAPILimitsMaxResults int
}

func NewIndexerServer

func NewIndexerServer(indexer *indexer.Indexer, group *echo.Group, prefix iotago.NetworkPrefix, maxPageSize int) *IndexerServer

Jump to

Keyboard shortcuts

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