server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

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

	// RouteMessageData is the route for getting message data by its messageID.
	// GET returns message data (json).
	RouteMessageData = "/messages/:" + restapipkg.ParameterMessageID

	// RouteMessageMetadata is the route for getting message metadata by its messageID.
	// GET returns message metadata (including info about "promotion/reattachment needed").
	RouteMessageMetadata = RouteMessageData + "/metadata"

	// RouteMessageBytes is the route for getting message raw data by it's messageID.
	// GET returns raw message data (bytes).
	RouteMessageBytes = RouteMessageData + "/raw"

	// RouteMessageChildren is the route for getting message IDs of the children of a message, identified by its messageID.
	// GET returns the message IDs of all children.
	RouteMessageChildren = RouteMessageData + "/children"

	// RouteMessages is the route for getting message IDs or creating new messages.
	// GET with query parameter (mandatory) returns all message IDs that fit these filter criteria (query parameters: "index").
	// POST creates a single new message and returns the new message ID.
	RouteMessages = "/messages"

	// RouteTransactionsIncludedMessageData is the route for getting the message that was included in the ledger for a given transaction ID.
	// GET returns message data (json).
	RouteTransactionsIncludedMessageData = "/transactions/:" + restapipkg.ParameterTransactionID + "/included-message"

	// RouteTransactionsIncludedMessageMetadata is the route for getting the message metadata that was included in the ledger for a given transaction ID.
	// GET returns message metadata (including info about "promotion/reattachment needed").
	RouteTransactionsIncludedMessageMetadata = RouteTransactionsIncludedMessageData + "/metadata"

	// RouteTransactionsIncludedMessageBytes is the route for getting the message raw data that was included in the ledger for a given transaction ID.
	// GET returns raw message data (bytes).
	RouteTransactionsIncludedMessageBytes = RouteTransactionsIncludedMessageData + "/raw"

	// RouteTransactionsIncludedMessageChildren is the route for getting the message IDs of the children of the message that was included in the ledger for a given transaction ID.
	// GET returns the message IDs of all children.
	RouteTransactionsIncludedMessageChildren = RouteTransactionsIncludedMessageData + "/children"

	// RouteMilestone is the route for getting a milestone by it's milestoneIndex.
	// GET returns the milestone.
	RouteMilestone = "/milestones/:" + restapipkg.ParameterMilestoneIndex

	// RouteMilestoneUTXOChanges is the route for getting all UTXO changes of a milestone by its milestoneIndex.
	// GET returns the output IDs of all UTXO changes.
	RouteMilestoneUTXOChanges = RouteMilestone + "/utxo-changes"

	// RouteOutput is the route for getting outputs by their outputID (transactionHash + outputIndex).
	// GET returns the output.
	RouteOutput = "/outputs/:" + restapipkg.ParameterOutputID

	// RouteAddressBech32Balance is the route for getting the total balance of all unspent outputs of an address.
	// The address must be encoded in bech32.
	// GET returns the balance of all unspent outputs of this address.
	RouteAddressBech32Balance = "/addresses/:" + restapipkg.ParameterAddress

	// RouteAddressEd25519Balance is the route for getting the total balance of all unspent outputs of an ed25519 address.
	// The ed25519 address must be encoded in hex.
	// GET returns the balance of all unspent outputs of this address.
	RouteAddressEd25519Balance = "/addresses/ed25519/:" + restapipkg.ParameterAddress

	// RouteAddressBech32Outputs is the route for getting all output IDs for an address.
	// The address must be encoded in bech32.
	// GET returns the outputIDs for all outputs of this address (optional query parameters: "include-spent").
	RouteAddressBech32Outputs = "/addresses/:" + restapipkg.ParameterAddress + "/outputs"

	// RouteAddressEd25519Outputs is the route for getting all output IDs for an ed25519 address.
	// The ed25519 address must be encoded in hex.
	// GET returns the outputIDs for all outputs of this address (optional query parameters: "include-spent").
	RouteAddressEd25519Outputs = "/addresses/ed25519/:" + restapipkg.ParameterAddress + "/outputs"

	// RouteAddressBech32History is the route for getting the transaction history of an address.
	// The address must be encoded in bech32.
	// GET returns the tx-history of this address.
	RouteAddressBech32History = "/addresses/:" + restapipkg.ParameterAddress + "/tx-history"

	// RouteAddressEd25519History is the route for getting the transaction history of an ed25519 address.
	// The ed25519 address must be encoded in hex.
	// GET returns the tx-history of this address.
	RouteAddressEd25519History = "/addresses/ed25519/:" + restapipkg.ParameterAddress + "/tx-history"

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

	// RouteReceipts is the route for getting all stored receipts.
	RouteReceipts = "/receipts"

	// RouteReceiptsMigratedAtIndex is the route for getting all receipts for a given migrated at index.
	RouteReceiptsMigratedAtIndex = "/receipts/:" + restapipkg.ParameterMilestoneIndex
)
View Source
const (
	APIRoute    = "/api/core/v1"
	MIMETextCSV = "text/csv"
)

Variables

This section is empty.

Functions

func CreateEchoSwagger

func CreateEchoSwagger(e *echo.Echo, version string, enabled bool) echoswagger.ApiRoot

Types

type DatabaseServer

type DatabaseServer struct {
	AppInfo                 *app.Info
	Database                *database.Database
	UTXOManager             *utxo.Manager
	NetworkIDName           string
	Bech32HRP               iotago.NetworkPrefix
	RestAPILimitsMaxResults int
	// contains filtered or unexported fields
}

func NewDatabaseServer

func NewDatabaseServer(swagger echoswagger.ApiRoot, appInfo *app.Info, db *database.Database, utxoManager *utxo.Manager, networkIDName string, bech32HRP iotago.NetworkPrefix, maxResults int, txHistoryCacheSize int) *DatabaseServer

type OutputResponse

type OutputResponse struct {
	// The hex encoded message ID of the message.
	MessageID string `json:"messageId"`
	// 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 milestone.Index `json:"milestoneIndexSpent,omitempty"`
	// The transaction this output was spent with.
	TransactionIDSpent string `json:"transactionIdSpent,omitempty"`
	// The ledger index at which this output was queried at.
	LedgerIndex milestone.Index `json:"ledgerIndex"`
	// The output in its serialized form.
	RawOutput *json.RawMessage `json:"output"`
}

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

Jump to

Keyboard shortcuts

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