coreapi

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 37 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// RouteInfo is the route for getting the node info.
	// GET returns the node info.
	RouteInfo = "/info"

	// RouteTips is the route for getting tips.
	// GET returns the tips.
	RouteTips = "/tips"

	// RouteBlock is the route for getting a block by its blockID.
	// GET returns the block based on the given type in the request "Accept" header.
	// MIMEApplicationJSON => json.
	// MIMEVendorIOTASerializer => bytes.
	RouteBlock = "/blocks/:" + restapipkg.ParameterBlockID

	// RouteBlockMetadata is the route for getting block metadata by its blockID.
	// GET returns block metadata (including info about "promotion/reattachment needed").
	RouteBlockMetadata = "/blocks/:" + restapipkg.ParameterBlockID + "/metadata"

	// RouteBlocks is the route for creating new blocks.
	// POST creates a single new block and returns the new block ID.
	// The block is parsed based on the given type in the request "Content-Type" header.
	// MIMEApplicationJSON => json.
	// MIMEVendorIOTASerializer => bytes.
	RouteBlocks = "/blocks"

	// RouteTransactionsIncludedBlock is the route for getting the block that was included in the ledger for a given transaction ID.
	// GET returns the block based on the given type in the request "Accept" header.
	// MIMEApplicationJSON => json.
	// MIMEVendorIOTASerializer => bytes.
	RouteTransactionsIncludedBlock = "/transactions/:" + restapipkg.ParameterTransactionID + "/included-block"

	// RouteTransactionsIncludedBlockMetadata is the route for getting the block metadata that was included in the ledger for a given transaction ID.
	// GET returns block metadata (including info about "promotion/reattachment needed").
	RouteTransactionsIncludedBlockMetadata = "/transactions/:" + restapipkg.ParameterTransactionID + "/included-block/metadata"

	// RouteMilestoneByID is the route for getting a milestone by its ID.
	// GET returns the milestone.
	// MIMEApplicationJSON => json.
	// MIMEVendorIOTASerializer => bytes.
	RouteMilestoneByID = "/milestones/:" + restapipkg.ParameterMilestoneID

	// RouteMilestoneByIDUTXOChanges is the route for getting all UTXO changes of a milestone by its ID.
	// GET returns the output IDs of all UTXO changes.
	RouteMilestoneByIDUTXOChanges = "/milestones/:" + restapipkg.ParameterMilestoneID + "/utxo-changes"

	// RouteMilestoneByIndex is the route for getting a milestone by its milestoneIndex.
	// GET returns the milestone.
	// MIMEApplicationJSON => json.
	// MIMEVendorIOTASerializer => bytes.
	RouteMilestoneByIndex = "/milestones/by-index/:" + restapipkg.ParameterMilestoneIndex

	// RouteMilestoneByIndexUTXOChanges is the route for getting all UTXO changes of a milestone by its milestoneIndex.
	// GET returns the output IDs of all UTXO changes.
	RouteMilestoneByIndexUTXOChanges = "/milestones/by-index/:" + restapipkg.ParameterMilestoneIndex + "/utxo-changes"

	// RouteOutput is the route for getting an output by its outputID (transactionHash + outputIndex).
	// GET returns the output based on the given type in the request "Accept" header.
	// MIMEApplicationJSON => json.
	// MIMEVendorIOTASerializer => bytes.
	RouteOutput = "/outputs/:" + restapipkg.ParameterOutputID

	// RouteOutputMetadata is the route for getting output metadata by its outputID (transactionHash + outputIndex) without getting the data again.
	// GET returns the output metadata.
	RouteOutputMetadata = "/outputs/:" + restapipkg.ParameterOutputID + "/metadata"

	// RouteTreasury is the route for getting the current treasury output.
	// GET returns the treasury.
	RouteTreasury = "/treasury"

	// RouteReceipts is the route for getting all persisted receipts on a node.
	// GET returns the receipts.
	RouteReceipts = "/receipts"

	// RouteReceiptsMigratedAtIndex is the route for getting all persisted receipts for a given migrated at index on a node.
	// GET returns the receipts for the given migrated at index.
	RouteReceiptsMigratedAtIndex = "/receipts/:" + restapipkg.ParameterMilestoneIndex

	// RouteComputeWhiteFlagMutations is the route to compute the white flag mutations for the cone of the given parents.
	// POST computes the white flag mutations.
	RouteComputeWhiteFlagMutations = "/whiteflag"

	// RoutePeer is the route for getting peers by their peerID.
	// GET returns the peer
	// DELETE deletes the peer.
	RoutePeer = "/peers/:" + restapipkg.ParameterPeerID

	// RoutePeers is the route for getting all peers of the node.
	// GET returns a list of all peers.
	// POST adds a new peer.
	RoutePeers = "/peers"

	// RouteControlDatabasePrune is the control route to manually prune the database.
	// POST prunes the database.
	RouteControlDatabasePrune = "/control/database/prune"

	// RouteControlSnapshotsCreate is the control route to manually create a snapshot files.
	// POST creates a full snapshot.
	RouteControlSnapshotsCreate = "/control/snapshots/create"
)

Variables

View Source
var (
	Component *app.Component
)

Functions

func AddFeature

func AddFeature(feature string)

AddFeature adds a feature to the RouteInfo endpoint.

Types

type ComputeWhiteFlagMutationsRequest

type ComputeWhiteFlagMutationsRequest struct {
	// The index of the milestone.
	Index iotago.MilestoneIndex `json:"index"`
	// The timestamp of the milestone.
	Timestamp uint32 `json:"timestamp"`
	// The hex encoded block IDs of the parents the milestone references.
	Parents []string `json:"parents"`
	// The hex encoded milestone ID of the previous milestone.
	PreviousMilestoneID string `json:"previousMilestoneId"`
}

ComputeWhiteFlagMutationsRequest defines the request for a POST debugComputeWhiteFlagMutations REST API call.

type ComputeWhiteFlagMutationsResponse

type ComputeWhiteFlagMutationsResponse struct {
	// The hex encoded inclusion merkle tree root as a result of the white flag computation.
	InclusionMerkleRoot string `json:"inclusionMerkleRoot"`
	// The hex encoded applied merkle tree root as a result of the white flag computation.
	AppliedMerkleRoot string `json:"appliedMerkleRoot"`
}

ComputeWhiteFlagMutationsResponse defines the response for a POST debugComputeWhiteFlagMutations REST API call.

type OutputMetadataResponse

type OutputMetadataResponse struct {
	// The hex encoded block ID of the block.
	BlockID string `json:"blockId"`
	// The hex encoded transaction id from which this output originated.
	TransactionID string `json:"transactionId"`
	// The index of the output.
	OutputIndex uint16 `json:"outputIndex"`
	// Whether this output is spent.
	Spent bool `json:"isSpent"`
	// The milestone index at which this output was spent.
	MilestoneIndexSpent iotago.MilestoneIndex `json:"milestoneIndexSpent,omitempty"`
	// The milestone timestamp this output was spent.
	MilestoneTimestampSpent uint32 `json:"milestoneTimestampSpent,omitempty"`
	// The transaction this output was spent with.
	TransactionIDSpent string `json:"transactionIdSpent,omitempty"`
	// The milestone index at which this output was booked into the ledger.
	MilestoneIndexBooked iotago.MilestoneIndex `json:"milestoneIndexBooked"`
	// The milestone timestamp this output was booked in the ledger.
	MilestoneTimestampBooked uint32 `json:"milestoneTimestampBooked"`
	// The ledger index at which this output was available at.
	LedgerIndex iotago.MilestoneIndex `json:"ledgerIndex"`
}

OutputMetadataResponse defines the response of a GET outputs metadata REST API call.

func NewOutputMetadataResponse

func NewOutputMetadataResponse(output *utxo.Output, ledgerIndex iotago.MilestoneIndex) *OutputMetadataResponse

func NewSpentMetadataResponse

func NewSpentMetadataResponse(spent *utxo.Spent, ledgerIndex iotago.MilestoneIndex) *OutputMetadataResponse

type OutputResponse

type OutputResponse struct {
	Metadata *OutputMetadataResponse `json:"metadata"`
	// The output in its serialized form.
	RawOutput *json.RawMessage `json:"output"`
}

OutputResponse defines the response of a GET outputs REST API call.

func NewOutputResponse

func NewOutputResponse(output *utxo.Output, ledgerIndex iotago.MilestoneIndex) (*OutputResponse, error)

func NewSpentResponse

func NewSpentResponse(spent *utxo.Spent, ledgerIndex iotago.MilestoneIndex) (*OutputResponse, error)

type PeerResponse

type PeerResponse struct {
	// The libp2p identifier of the peer.
	ID string `json:"id"`
	// The libp2p multi addresses of the peer.
	MultiAddresses []string `json:"multiAddresses"`
	// The alias of the peer.
	Alias *string `json:"alias,omitempty"`
	// The relation (static, autopeered) of the peer.
	Relation string `json:"relation"`
	// Whether the peer is connected.
	Connected bool `json:"connected"`
	// The gossip protocol information of the peer.
	Gossip *gossip.Info `json:"gossip,omitempty"`
}

PeerResponse defines the response of a GET peer REST API call.

func WrapInfoSnapshot

func WrapInfoSnapshot(info *p2p.PeerInfoSnapshot) *PeerResponse

WrapInfoSnapshot wraps the given peer info snapshot with additional metadata, such as gossip protocol information.

Jump to

Keyboard shortcuts

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