routes

package
v1.99.99 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 36 Imported by: 1

Documentation

Index

Constants

View Source
const (
	EndpointResultOK                 = 0
	EndpointResultFail               = 1001
	EndpointResultTxAlreadyCommitted = 1002
)

Endpoint result codes.

View Source
const MaximumRange = 100

MaximumRange is the maximum amount of blocks able to be returned.

Variables

This section is empty.

Functions

func GetABCIInfo

func GetABCIInfo(cf cfg.Cfg) http.HandlerFunc

GetABCIInfo proxies tendermint's ABCIInfo

func GetDumpConsensusState

func GetDumpConsensusState(cf cfg.Cfg) http.HandlerFunc

GetDumpConsensusState returns the current consensus state.

func GetEAIRate

func GetEAIRate(cf cfg.Cfg) http.HandlerFunc

GetEAIRate returns the EAI rates for a collection of rate requests, each of which has an address (merely a string that is not examined, simply copied to the output), a weighted average age, and optional lock information (if the account is locked)

func GetGenesis

func GetGenesis(cf cfg.Cfg) http.HandlerFunc

GetGenesis returns the genesis doc from tendermint.

func GetHealth

func GetHealth(cf cfg.Cfg) http.HandlerFunc

GetHealth returns health indicators from Tendermint.

func GetNetInfo

func GetNetInfo(cf cfg.Cfg) http.HandlerFunc

GetNetInfo returns information about this node's network.

func GetNode

func GetNode(cf cfg.Cfg) http.HandlerFunc

GetNode returns a list of nodes, including this one.

func GetNodeList

func GetNodeList(cf cfg.Cfg) http.HandlerFunc

GetNodeList returns a list of nodes, including this one.

func GetOrderData

func GetOrderData(cf cfg.Cfg) http.HandlerFunc

GetOrderData returns a block of price information, but converts it to a format that is compatible with the old /order/current API. This is for use while v1.8 of the wallet is still extant.

func GetPriceData

func GetPriceData(cf cfg.Cfg) http.HandlerFunc

GetPriceData returns a block of price information

func GetRegisteredNodes

func GetRegisteredNodes(cf cfg.Cfg) http.HandlerFunc

GetRegisteredNodes gets the list of registered nodes in the network

func GetStatus

func GetStatus(cf cfg.Cfg) http.HandlerFunc

GetStatus returns this node's current status.

func HandleAccount

func HandleAccount(cf cfg.Cfg) http.HandlerFunc

HandleAccount returns a HandlerFunc that returns information about a single account specified in the URL.

func HandleAccountCurrencySeats

func HandleAccountCurrencySeats(cf cfg.Cfg) http.HandlerFunc

HandleAccountCurrencySeats returns a HandlerFunc that returns all the accounts in the system that exceed 1000 ndau; they are sorted in order from oldest to newest. It accepts a single parameter for the maximum number of accounts to return (default 3000).

func HandleAccountHistory

func HandleAccountHistory(cf cfg.Cfg) http.HandlerFunc

HandleAccountHistory returns a HandlerFunc that returns balance history about a single account specified in the URL.

func HandleAccountList

func HandleAccountList(cf cfg.Cfg) http.HandlerFunc

HandleAccountList returns a HandlerFunc that returns all the accounts in the system

func HandleAccountVotes added in v0.28.8

func HandleAccountVotes(cf cfg.Cfg) http.HandlerFunc

HandleVotes returns a HandlerFunc that returns information about the votes belonging to a single account ast a specified DAO date.

func HandleAccounts

func HandleAccounts(cf cfg.Cfg) http.HandlerFunc

HandleAccounts returns a HandlerFunc that returns a collection of account data based on a POSTed list of account IDs.

func HandleBlockBefore

func HandleBlockBefore(cf cfg.Cfg) http.HandlerFunc

HandleBlockBefore handles requests for blocks on or before a given height, and manages filtering better than HandleBlockRange.

func HandleBlockDateRange

func HandleBlockDateRange(cf cfg.Cfg) http.HandlerFunc

HandleBlockDateRange handles requests for a range of blocks

func HandleBlockHash

func HandleBlockHash(cf cfg.Cfg) http.HandlerFunc

HandleBlockHash delivers a block matching a hash

func HandleBlockHeight

func HandleBlockHeight(cf cfg.Cfg) http.HandlerFunc

HandleBlockHeight returns data for a single block; if height is 0, it's the current block

func HandleBlockRange

func HandleBlockRange(cf cfg.Cfg) http.HandlerFunc

HandleBlockRange handles requests for a range of blocks

func HandleBlockTransactions

func HandleBlockTransactions(cf cfg.Cfg) http.HandlerFunc

HandleBlockTransactions delivers the transactions contained within the block specified by the given blockhash.

func HandleNumUnconfirmedTxs

func HandleNumUnconfirmedTxs(cf cfg.Cfg) http.HandlerFunc

HandleNumUnconfirmedTxs func

func HandlePrevalidateTx

func HandlePrevalidateTx(cf cfg.Cfg) http.HandlerFunc

HandlePrevalidateTx generates a handler that implements the /tx/prevalidate endpoint

func HandlePriceMarketHistory

func HandlePriceMarketHistory(cf cfg.Cfg) http.HandlerFunc

HandlePriceMarketHistory handles price market history

func HandlePriceTargetHistory

func HandlePriceTargetHistory(cf cfg.Cfg) http.HandlerFunc

HandlePriceTargetHistory handles price target history

func HandleStateDelegates

func HandleStateDelegates(cf cfg.Cfg) http.HandlerFunc

HandleStateDelegates returns a HandlerFunc that returns all the delegates in the system

func HandleSubmitTx

func HandleSubmitTx(cf cfg.Cfg) http.HandlerFunc

HandleSubmitTx generates a handler that implements the /tx/submit endpoint

func HandleSystemAll

func HandleSystemAll(cf cfg.Cfg) http.HandlerFunc

HandleSystemAll retrieves all the system keys at the current block height.

func HandleSystemGet

func HandleSystemGet(cf cfg.Cfg) http.HandlerFunc

HandleSystemGet retrieves a comma-separated list of system keys at the current block height.

func HandleSystemHistory

func HandleSystemHistory(cf cfg.Cfg) http.HandlerFunc

HandleSystemHistory returns the history of a given system variable.

func HandleSystemSet

func HandleSystemSet(cf cfg.Cfg) http.HandlerFunc

HandleSystemSet constructs and returns an unsigned SetSysvar transaction

This is a convenience intended to simplify sysvar handling, so that humans don't always need to deal with the internal msgpack encoding.

func HandleTransactionBefore

func HandleTransactionBefore(cf cfg.Cfg) http.HandlerFunc

HandleTransactionBefore handles requests for transactions on or before a given tx hash.

func HandleTransactionFetch

func HandleTransactionFetch(cf cfg.Cfg) http.HandlerFunc

HandleTransactionFetch gets called by the svc for the /transaction endpoint.

func HandleTransactionFetchDeprecated

func HandleTransactionFetchDeprecated(cf cfg.Cfg) http.HandlerFunc

HandleTransactionFetchDeprecated gets called by the svc for the /transaction endpoint.

func HandleVersion

func HandleVersion(cf cfg.Cfg) http.HandlerFunc

HandleVersion is an http handler for version info

func TxNames

func TxNames() []string

TxNames returns a list of all of the valid transaction names, plus some synonyms.

func TxUnmarshal

func TxUnmarshal(txtype string, r io.Reader) (metatx.Transactable, error)

TxUnmarshal constructs an object containing transaction data. Given the name of a transaction type and a reader containing the JSON for a transaction (usually the request Body from a POST), this constructs a new object containing that transactions's data.

Types

type AccountHistoryItem

type AccountHistoryItem struct {
	Balance   types.Ndau
	Timestamp string
	TxHash    string
	Height    int64
}

AccountHistoryItem is used by the account history endpoint to return balance historical data.

type AccountHistoryItems

type AccountHistoryItems struct {
	Items []AccountHistoryItem
	Next  string
}

AccountHistoryItems is used by the account history endpoint to return balance historical data.

type AccountVotes added in v0.28.8

type AccountVotes struct {
	Address address.Address
	Votes   int64
}

type BlockchainDateRequest

type BlockchainDateRequest struct {
	// contains filtered or unexported fields
}

BlockchainDateRequest represents a blockchain date request.

type BlockchainRequest

type BlockchainRequest struct {
	// contains filtered or unexported fields
}

BlockchainRequest represents a blockchain request. first and last are the range of blocks to inspect, and limit is the maximum number of blocks to return (which is advisory -- the actual quantity may be more).

type EAIRateRequest

type EAIRateRequest struct {
	Address string          `json:"address"`
	WAA     types.Duration  `json:"weightedAverageAge"`
	Lock    backing.Lock    `json:"lock"`
	At      types.Timestamp `json:"at"`
}

EAIRateRequest is the type of a single instance of the rate request (the API takes an array).

type EAIRateResponse

type EAIRateResponse struct {
	Address string `json:"address"`
	EAIRate uint64 `json:"eairate"`
}

EAIRateResponse is a single instance of a rate response (it returns an array of them)

type HealthResponse

type HealthResponse struct {
	Ndau HealthStatus
}

HealthResponse is the response from the /health endpoint.

type HealthStatus

type HealthStatus struct {
	Status string
}

HealthStatus gives us the ability to add more status information later without messing up clients

type NodeInfo

type NodeInfo struct {
	Moniker   string `json:"moniker"`
	NdauIndex int    `json:"ndau_index"`
}

NodeInfo is used for sorting node pairs.

type OrderChainInfo

type OrderChainInfo struct {
	MarketPrice float64    `json:"marketPrice"`
	TargetPrice float64    `json:"targetPrice"`
	FloorPrice  float64    `json:"floorPrice"`
	TotalIssued types.Ndau `json:"totalIssued"`
	TotalNdau   types.Ndau `json:"totalNdau"`
	SIB         float64    `json:"sib"`
	PriceUnits  string     `json:"priceUnit"`
}

OrderChainInfo is the old structure returned by /order/price. We only need it as long as we keep the deprecated function below.

type PrevalidateResult

type PrevalidateResult struct {
	FeeNapu int64  `json:"fee_napu"`
	SibNapu int64  `json:"sib_napu"`
	Err     string `json:"err,omitempty"`
	ErrCode int    `json:"err_code,omitempty"`
	TxHash  string `json:"hash"`
	Msg     string `json:"msg,omitempty"`
	Code    int    `json:"code"`
}

PrevalidateResult returns the prevalidation status of a transaction without attempting to commit it.

type PriceHistoryResults

type PriceHistoryResults struct {
	Items []srch.PriceQueryResult `json:"items"`
	Next  string                  `json:"next"`
}

PriceHistoryResults encapsulates a set of price history data in a json-friendly way

type PriceInfo

type PriceInfo struct {
	MarketPrice pricecurve.Nanocent `json:"marketPrice"`
	TargetPrice pricecurve.Nanocent `json:"targetPrice"`
	FloorPrice  pricecurve.Nanocent `json:"floorPrice"`
	TotalRFE    types.Ndau          `json:"totalReleased"`
	TotalIssued types.Ndau          `json:"totalIssued"`
	TotalNdau   types.Ndau          `json:"totalNdau"`
	TotalBurned types.Ndau          `json:"totalBurned"`
	CurrentSIB  eai.Rate            `json:"sib"`
}

PriceInfo returns data about some direct and derived quantities of ndau price information.

type ResultNodeList

type ResultNodeList struct {
	Nodes []p2p.DefaultNodeInfo `json:"nodes"`
}

ResultNodeList represents a list of nodes.

type SubmitResult

type SubmitResult struct {
	TxHash string `json:"hash"`
	Msg    string `json:"msg,omitempty"`
	Code   int    `json:"code"`
}

SubmitResult is returned by the submit endpoint after the tx has been processed by a node. If the transaction was valid and posted to the blockchain, a TxHash is returned (and http status will be 200). If the included POST body is missing, incorrectly formatted, or cannot be submitted to the blockchain as a transaction, this function will return 400 as the http status and the SubmitResult return object will not be included. If the transaction parses correctly but is determined by the blockchain to be invalid, If there was some internal processing error not related to the validity of the request or transaction, then http status will be 5xx.

type TransactionData

type TransactionData struct {
	BlockHeight int64
	TxOffset    int
	Fee         uint64
	SIB         uint64
	TxHash      string
	TxType      string
	TxData      metatx.Transactable
	Timestamp   string
}

TransactionData is the format we use when writing the result of the transaction route.

type TransactionDataDeprecated

type TransactionDataDeprecated struct {
	BlockHeight int64
	TxOffset    int
	Fee         uint64
	SIB         uint64
	Tx          *metatx.Transaction
	TxBytes     []byte
}

TransactionDataDeprecated is the format we use when writing the result of the transaction route.

type TransactionList

type TransactionList struct {
	Txs        []TransactionData
	NextTxHash string
}

TransactionList is the format we use when writing the result of the transaction list route.

type VersionResult

type VersionResult struct {
	NdauVersion string
	NdauSha     string
	Network     string
}

VersionResult is returned from the /version request; it retrieves information from the ndau chain

Jump to

Keyboard shortcuts

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