server

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ParameterAddress         = "address"
	ParameterTransactionHash = "txHash"
	ParameterMilestoneIndex  = "index"

	QueryParameterBundle     = "bundle"
	QueryParameterAddress    = "address"
	QueryParameterTag        = "tag"
	QueryParameterApprovee   = "approvee"
	QueryParameterMaxResults = "maxResults"
)
View Source
const (
	// RouteRPCEndpoint is the route for sending RPC requests to the API.
	// POST sends an IOTA legacy API request and returns the results.
	RouteRPCEndpoint = "/"

	// RouteInfo is the route for getting the node info.
	// GET returns the node info.
	RouteInfo = "/info"

	// RouteMilestoneByIndex is the route for getting a milestone by its milestoneIndex.
	// GET will return the milestone.
	RouteMilestoneByIndex = "/milestones/by-index/:" + ParameterMilestoneIndex

	// RouteTransactions is the route for getting transactions filtered by the given parameters.
	// GET with query parameter returns all txHashes that fit these filter criteria.
	// Query parameters: "bundle", "address", "tag", "approvee", "maxResults"
	// Returns an empty list if no results are found.
	RouteTransactions = "/transactions" // former findTransactions

	// RouteTransaction is the route for getting a transaction.
	// GET will return the transaction.
	RouteTransaction = "/transactions/:" + ParameterTransactionHash

	// RouteTransactionTrytes is the route for getting the trytes of a transaction.
	// GET will return the transaction trytes.
	RouteTransactionTrytes = "/transactions/:" + ParameterTransactionHash + "/trytes" // former getTrytes

	// RouteTransactionMetadata is the route for getting the metadata of a transaction.
	// GET will return the metadata.
	RouteTransactionMetadata = "/transactions/:" + ParameterTransactionHash + "/metadata" // former getInclusionStates

	// RouteAddressBalance is the route for getting the balance of an address.
	// GET will return the balance.
	RouteAddressBalance = "/addresses/:" + ParameterAddress + "/balance" // former getBalances

	// RouteAddressBalance is the route to check whether an address was already spent or not.
	// GET will return true if the address was already spent.
	RouteAddressWasSpent = "/addresses/:" + ParameterAddress + "/was-spent" // former wereAddressesSpentFrom

	// RouteAddressDiffs is the route for getting all diffs of an address.
	// GET will return all diffs of the address per milestone.
	RouteAddressDiffs = "/addresses/:" + ParameterAddress + "/diffs"

	// RouteLedgerState is the route to return the current ledger state.
	// GET will return all addresses with their balances.
	RouteLedgerState = "/ledger/state" // former getLedgerState

	// RouteLedgerStateByIndex is the route to return the ledger state of a given ledger index.
	// GET will return all addresses with their balances.
	RouteLedgerStateByIndex = "/ledger/state/by-index/:" + ParameterMilestoneIndex // former getLedgerState

	// RouteLedgerDiffByIndex is the route to return the ledger diff of a given ledger index.
	// GET will return all addresses with their diffs.
	RouteLedgerDiffByIndex = "/ledger/diff/by-index/:" + ParameterMilestoneIndex // former getLedgerDiff

	// RouteLedgerDiffExtendedByIndex is the route to return the ledger diff of a given ledger index with extended informations.
	// GET will return all addresses with their diffs, the confirmed transactions and the confirmed bundles.
	RouteLedgerDiffExtendedByIndex = "/ledger/diff-extended/by-index/:" + ParameterMilestoneIndex // former getLedgerDiffExt
)
View Source
const (
	APIRoute = "/api/core/v0"
)

Variables

This section is empty.

Functions

func CreateEchoSwagger

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

Types

type BundleWithValue

type BundleWithValue struct {
	BundleHash trinary.Hash   `json:"bundleHash"`
	TailTxHash trinary.Hash   `json:"tailTxHash"`
	LastIndex  uint64         `json:"lastIndex"`
	Txs        []*TxWithValue `json:"txs"`
}

BundleWithValue struct.

func (*BundleWithValue) Item

func (b *BundleWithValue) Item() Container

type Container

type Container interface {
	Item() Container
}

Container holds an object.

type DatabaseServer

type DatabaseServer struct {
	AppInfo                 *app.Info
	Database                *database.Database
	RestAPILimitsMaxResults int
	RPCEndpoints            map[string]rpcEndpoint
}

func NewDatabaseServer

func NewDatabaseServer(swagger echoswagger.ApiRoot, appInfo *app.Info, db *database.Database, maxResults int) *DatabaseServer

type ErrorReturn

type ErrorReturn struct {
	Error string `json:"error"`
}

ErrorReturn struct.

type FindTransactions

type FindTransactions struct {
	Bundles    []trinary.Hash `json:"bundles"`
	Addresses  []trinary.Hash `json:"addresses"`
	Tags       []trinary.Hash `json:"tags"`
	Approvees  []trinary.Hash `json:"approvees"`
	MaxResults int            `json:"maxresults"`
	ValueOnly  bool           `json:"valueOnly"`
}

FindTransactions struct.

type FindTransactionsResponse

type FindTransactionsResponse struct {
	Hashes   []trinary.Hash `json:"hashes"`
	Duration int            `json:"duration"`
}

FindTransactionsResponse struct.

type GetBalances

type GetBalances struct {
	Addresses []trinary.Hash `json:"addresses"`
}

GetBalances struct.

type GetBalancesResponse

type GetBalancesResponse struct {
	Balances       []string        `json:"balances"`
	References     []trinary.Hash  `json:"references"`
	MilestoneIndex milestone.Index `json:"milestoneIndex"`
	Duration       int             `json:"duration"`
}

GetBalancesResponse struct.

type GetInclusionStates

type GetInclusionStates struct {
	Transactions []trinary.Hash `json:"transactions"`
}

GetInclusionStates struct.

type GetInclusionStatesResponse

type GetInclusionStatesResponse struct {
	States   []bool `json:"states"`
	Duration int    `json:"duration"`
}

GetInclusionStatesResponse struct.

type GetLedgerDiff

type GetLedgerDiff struct {
	MilestoneIndex milestone.Index `json:"milestoneIndex"`
}

GetLedgerDiff struct.

type GetLedgerDiffExt

type GetLedgerDiffExt struct {
	MilestoneIndex milestone.Index `json:"milestoneIndex"`
}

GetLedgerDiffExt struct.

type GetLedgerDiffExtResponse

type GetLedgerDiffExtResponse struct {
	ConfirmedTxWithValue      []*TxHashWithValue     `json:"confirmedTxWithValue"`
	ConfirmedBundlesWithValue []*BundleWithValue     `json:"confirmedBundlesWithValue"`
	Diff                      map[trinary.Hash]int64 `json:"diff"`
	MilestoneIndex            milestone.Index        `json:"milestoneIndex"`
	Duration                  int                    `json:"duration"`
}

GetLedgerDiffExtResponse struct.

type GetLedgerDiffResponse

type GetLedgerDiffResponse struct {
	Diff           map[trinary.Hash]int64 `json:"diff"`
	MilestoneIndex milestone.Index        `json:"milestoneIndex"`
	Duration       int                    `json:"duration"`
}

GetLedgerDiffResponse struct.

type GetLedgerState

type GetLedgerState struct {
	TargetIndex milestone.Index `json:"targetIndex,omitempty"`
}

GetLedgerState struct.

type GetLedgerStateResponse

type GetLedgerStateResponse struct {
	Balances       map[trinary.Hash]uint64 `json:"balances"`
	MilestoneIndex milestone.Index         `json:"milestoneIndex"`
	Duration       int                     `json:"duration"`
}

GetLedgerStateResponse struct.

type GetNodeInfoResponse

type GetNodeInfoResponse struct {
	AppName                            string          `json:"appName"`
	AppVersion                         string          `json:"appVersion"`
	LatestMilestone                    trinary.Hash    `json:"latestMilestone"`
	LatestMilestoneIndex               milestone.Index `json:"latestMilestoneIndex"`
	LatestSolidSubtangleMilestone      trinary.Hash    `json:"latestSolidSubtangleMilestone"`
	LatestSolidSubtangleMilestoneIndex milestone.Index `json:"latestSolidSubtangleMilestoneIndex"`
	IsSynced                           bool            `json:"isSynced"`
	Health                             bool            `json:"isHealthy"`
	MilestoneStartIndex                milestone.Index `json:"milestoneStartIndex"`
	LastSnapshottedMilestoneIndex      milestone.Index `json:"lastSnapshottedMilestoneIndex"`
	Neighbors                          uint            `json:"neighbors"`
	Time                               int64           `json:"time"`
	Tips                               uint32          `json:"tips"`
	TransactionsToRequest              int             `json:"transactionsToRequest"`
	Features                           []string        `json:"features"`
	CoordinatorAddress                 trinary.Hash    `json:"coordinatorAddress"`
	Duration                           int             `json:"duration"`
}

GetNodeInfoResponse struct.

type GetTrytes

type GetTrytes struct {
	Hashes []trinary.Hash `json:"hashes"`
}

GetTrytes struct.

type GetTrytesResponse

type GetTrytesResponse struct {
	Trytes     []trinary.Trytes `json:"trytes"`
	Milestones []uint32         `json:"milestones"`
	Duration   int              `json:"duration"`
}

GetTrytesResponse struct.

type Request

type Request struct {
	Command string `json:"command"`
}

Request struct.

type TxHashWithValue

type TxHashWithValue struct {
	TxHash     trinary.Hash `json:"txHash"`
	TailTxHash trinary.Hash `json:"tailTxHash"`
	BundleHash trinary.Hash `json:"bundleHash"`
	Address    trinary.Hash `json:"address"`
	Value      int64        `json:"value"`
}

TxHashWithValue struct.

func (*TxHashWithValue) Item

func (tx *TxHashWithValue) Item() Container

type TxWithValue

type TxWithValue struct {
	TxHash  trinary.Hash `json:"txHash"`
	Address trinary.Hash `json:"address"`
	Index   uint64       `json:"index"`
	Value   int64        `json:"value"`
}

TxWithValue struct.

func (*TxWithValue) Item

func (tx *TxWithValue) Item() Container

type WereAddressesSpentFrom

type WereAddressesSpentFrom struct {
	Addresses []trinary.Hash `json:"addresses"`
}

WereAddressesSpentFrom struct.

type WereAddressesSpentFromResponse

type WereAddressesSpentFromResponse struct {
	States   []bool `json:"states"`
	Duration int    `json:"duration"`
}

WereAddressesSpentFromResponse struct.

Jump to

Keyboard shortcuts

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