Documentation ¶
Index ¶
- Constants
- Variables
- func BlockForBlockID(ctx context.Context, blockID iotago.BlockID) (*participation.ParticipationBlock, error)
- func EventIDFromHex(hexString string) (participation.EventID, error)
- func LedgerUpdates(ctx context.Context, startIndex iotago.MilestoneIndex, ...) error
- func NodeStatus() (confirmedIndex iotago.MilestoneIndex, pruningIndex iotago.MilestoneIndex)
- func OutputForOutputID(ctx context.Context, outputID iotago.OutputID) (*participation.ParticipationOutput, error)
- func ParseBech32AddressParam(c echo.Context, prefix iotago.NetworkPrefix) (iotago.Address, error)
- type AddressOutputsResponse
- type CreateEventResponse
- type EventsResponse
- type OutputStatusResponse
- type ParametersParticipation
- type ParametersRestAPI
- type ParticipationsResponse
- type TrackedParticipation
Constants ¶
const ( APIRoute = "/api/participation/v1" // RouteParticipationEvents is the route to list all events, returning their ID, the event name and status. // GET returns a list of all events known to the node. Optional query parameter returns filters events by type (query parameters: "type"). RouteParticipationEvents = "/events" // RouteParticipationEvent is the route to access a single participation by its ID. // GET gives a quick overview of the participation. This does not include the current standings. RouteParticipationEvent = "/events/:" + ParameterParticipationEventID // RouteParticipationEventStatus is the route to access the status of a single participation by its ID. // GET returns the amount of tokens participating and accumulated votes for the ballot if the event contains a ballot. Optional query parameter returns the status for the given milestone index (query parameters: "milestoneIndex"). RouteParticipationEventStatus = "/events/:" + ParameterParticipationEventID + "/status" // RouteOutputStatus is the route to get the vote status for a given outputID. // GET returns the blockID the participation was included, the starting and ending milestone index this participation was tracked. RouteOutputStatus = "/outputs/:" + ParameterOutputID // RouteAddressBech32Status is the route to get the staking rewards for the given bech32 address. RouteAddressBech32Status = "/addresses/:" + ParameterAddress // RouteAddressBech32Outputs is the route to get the outputs for the given bech32 address. RouteAddressBech32Outputs = "/addresses/:" + ParameterAddress + "/outputs" // RouteAdminCreateEvent is the route the node operator can use to add events. // POST creates a new event to track. RouteAdminCreateEvent = "/admin/events" // RouteAdminDeleteEvent is the route the node operator can use to remove events. // DELETE removes a tracked participation. RouteAdminDeleteEvent = "/admin/events/:" + ParameterParticipationEventID // RouteAdminActiveParticipations is the route the node operator can use to get all the active participations for a certain event. // GET returns a list of all active participations. RouteAdminActiveParticipations = "/admin/events/:" + ParameterParticipationEventID + "/active" // RouteAdminPastParticipations is the route the node operator can use to get all the past participations for a certain event. // GET returns a list of all past participations. RouteAdminPastParticipations = "/admin/events/:" + ParameterParticipationEventID + "/past" // RouteAdminRewards is the route the node operator can use to get the rewards for a staking event. // GET retrieves the staking event rewards. RouteAdminRewards = "/admin/events/:" + ParameterParticipationEventID + "/rewards" // ParameterParticipationEventID is used to identify an event by its ID. ParameterParticipationEventID = "eventID" // ParameterAddress is used to identify an address. ParameterAddress = "address" // ParameterOutputID is used to identify an output ID. ParameterOutputID = "outputID" // ParameterMilestoneIndex is used to identify a milestone by index. ParameterMilestoneIndex = "milestoneIndex" )
Variables ¶
var ( AllowedEnginesStorage = []hivedb.Engine{ hivedb.EnginePebble, hivedb.EngineRocksDB, } AllowedEnginesStorageAuto = append(AllowedEnginesStorage, hivedb.EngineAuto) )
var (
Component *app.Component
)
var ParamsParticipation = &ParametersParticipation{}
var ParamsRestAPI = &ParametersRestAPI{}
Functions ¶
func BlockForBlockID ¶
func BlockForBlockID(ctx context.Context, blockID iotago.BlockID) (*participation.ParticipationBlock, error)
func EventIDFromHex ¶
func EventIDFromHex(hexString string) (participation.EventID, error)
EventIDFromHex creates a EventID from a hex string representation.
func LedgerUpdates ¶
func LedgerUpdates(ctx context.Context, startIndex iotago.MilestoneIndex, endIndex iotago.MilestoneIndex, handler func(index iotago.MilestoneIndex, created []*participation.ParticipationOutput, consumed []*participation.ParticipationOutput) error) error
func NodeStatus ¶
func NodeStatus() (confirmedIndex iotago.MilestoneIndex, pruningIndex iotago.MilestoneIndex)
func OutputForOutputID ¶
func OutputForOutputID(ctx context.Context, outputID iotago.OutputID) (*participation.ParticipationOutput, error)
func ParseBech32AddressParam ¶
func ParseBech32AddressParam(c echo.Context, prefix iotago.NetworkPrefix) (iotago.Address, error)
Types ¶
type AddressOutputsResponse ¶
type AddressOutputsResponse struct { // Outputs is a map of output status per outputID. Outputs map[string]*OutputStatusResponse `json:"outputs"` }
AddressOutputsResponse defines the response of a GET RouteAddressBech32Outputs REST API call.
type CreateEventResponse ¶
type CreateEventResponse struct { // The hex encoded ID of the created participation event. EventID string `json:"eventId"` }
CreateEventResponse defines the response of a POST RouteParticipationEvents REST API call.
type EventsResponse ¶
type EventsResponse struct { // The hex encoded IDs of the found events. EventIDs []string `json:"eventIds"` }
EventsResponse defines the response of a GET RouteParticipationEvents REST API call.
type OutputStatusResponse ¶
type OutputStatusResponse struct { // Participations holds the participations that were created in the output. Participations map[string]*TrackedParticipation `json:"participations"` }
OutputStatusResponse defines the response of a GET RouteOutputStatus REST API call.
type ParametersParticipation ¶
type ParametersParticipation struct { Database struct { // Engine defines the used database engine (pebble/rocksdb/mapdb). Engine string `default:"rocksdb" usage:"the used database engine (pebble/rocksdb/mapdb)"` // Path defines the path to the database folder. Path string `default:"database" usage:"the path to the database folder"` } `name:"db"` }
type ParametersRestAPI ¶
type ParametersRestAPI struct { // BindAddress defines the bind address on which the Participation HTTP server listens. BindAddress string `default:"localhost:9892" usage:"the bind address on which the Participation HTTP server listens"` // AdvertiseAddress defines the address of the Participation HTTP server which is advertised to the INX Server (optional). AdvertiseAddress string `default:"" usage:"the address of the Participation HTTP server which is advertised to the INX Server (optional)"` // DebugRequestLoggerEnabled defines whether the debug logging for requests should be enabled DebugRequestLoggerEnabled bool `default:"false" usage:"whether the debug logging for requests should be enabled"` }
ParametersRestAPI contains the definition of the parameters used by the Participation HTTP server.
type ParticipationsResponse ¶
type ParticipationsResponse struct { // Participations holds the participations that are/were tracked. Participations map[string]*TrackedParticipation `json:"participations"` }
ParticipationsResponse defines the response of a GET RouteAdminActiveParticipations or RouteAdminPastParticipations REST API call.
type TrackedParticipation ¶
type TrackedParticipation struct { // BlockID is the ID of the block that included the transaction that created the output the participation was made. BlockID string `json:"blockId"` // Amount is the amount of tokens that were included in the output the participation was made. Amount uint64 `json:"amount"` // StartMilestoneIndex is the milestone index the participation started. StartMilestoneIndex iotago.MilestoneIndex `json:"startMilestoneIndex"` // EndMilestoneIndex is the milestone index the participation ended. 0 if the participation is still active. EndMilestoneIndex iotago.MilestoneIndex `json:"endMilestoneIndex"` // Answers holds the IDs of the answers to the questions of a ballot. Answers []int `json:"answers,omitempty"` }
TrackedParticipation holds the information for each tracked participation.