Documentation ¶
Index ¶
- Constants
- Variables
- func EventIDFromHex(hexString string) (participation.EventID, error)
- type AddressOutputsResponse
- type AddressReward
- type AddressRewardsResponse
- type CreateEventResponse
- type EventsResponse
- type OutputStatusResponse
- type ParticipationsResponse
- type RewardsResponse
- type TrackedParticipation
Constants ¶
const ( // 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 messageID the participation was included, the starting and ending milestone index this participation was tracked. RouteOutputStatus = "/outputs/:" + restapi.ParameterOutputID // RouteAddressBech32Status is the route to get the staking rewards for the given bech32 address. RouteAddressBech32Status = "/addresses/:" + restapi.ParameterAddress // RouteAddressBech32Outputs is the route to get the outputs for the given bech32 address. RouteAddressBech32Outputs = "/addresses/:" + restapi.ParameterAddress + "/outputs" // RouteAddressEd25519Status is the route to get the staking rewards for the given ed25519 address. RouteAddressEd25519Status = "/addresses/ed25519/:" + restapi.ParameterAddress // RouteAddressEd25519Outputs is the route to get the outputs for the given ed25519 address. RouteAddressEd25519Outputs = "/addresses/ed25519/:" + restapi.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" )
const (
// ParameterParticipationEventID is used to identify an event by its ID.
ParameterParticipationEventID = "eventID"
)
Variables ¶
var (
Plugin *node.Plugin
)
Functions ¶
func EventIDFromHex ¶
func EventIDFromHex(hexString string) (participation.EventID, error)
EventIDFromHex creates a EventID from a hex string representation.
Types ¶
type AddressOutputsResponse ¶ added in v1.2.0
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 or RouteAddressEd25519Outputs REST API call.
type AddressReward ¶
type AddressReward struct { // Amount is the staking reward. Amount uint64 `json:"amount"` // Symbol is the symbol of the rewarded tokens. Symbol string `json:"symbol"` // MinimumReached tells whether the minimum rewards required to be included in the staking results are reached. MinimumReached bool `json:"minimumReached"` }
AddressReward holds the amount and token symbol for a certain reward.
type AddressRewardsResponse ¶
type AddressRewardsResponse struct { // Rewards is a map of rewards per event. Rewards map[string]*AddressReward `json:"rewards"` // MilestoneIndex is the milestone index the rewards were calculated for. MilestoneIndex milestone.Index `json:"milestoneIndex"` }
AddressRewardsResponse defines the response of a GET RouteAddressBech32Status or RouteAddressEd25519Status 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 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 RewardsResponse ¶
type RewardsResponse struct { // Symbol is the symbol of the rewarded tokens. Symbol string `json:"symbol"` // MilestoneIndex is the milestone index the rewards were calculated for. MilestoneIndex milestone.Index `json:"milestoneIndex"` // TotalRewards is the total reward. TotalRewards uint64 `json:"totalRewards"` // Checksum is the SHA256 checksum of the staking amount and rewards calculated for this MilestoneIndex. Checksum string `json:"checksum"` // Rewards is a map of rewards per address. Rewards map[string]uint64 `json:"rewards"` }
RewardsResponse defines the response of a GET RouteAdminRewards REST API call and contains the rewards for each address.
type TrackedParticipation ¶
type TrackedParticipation struct { // MessageID is the ID of the message that included the transaction that created the output the participation was made. MessageID string `json:"messageId"` // 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 milestone.Index `json:"startMilestoneIndex"` // EndMilestoneIndex is the milestone index the participation ended. 0 if the participation is still active. EndMilestoneIndex milestone.Index `json:"endMilestoneIndex"` }
TrackedParticipation holds the information for each tracked participation.