Documentation ¶
Overview ¶
Package handlers handles and helps specify the algod/api
Currently, server implementation annotations serve as the API ground truth. From that, we use go-swagger to generate a swagger spec.
IF YOU MODIFY THIS PACKAGE: IMPORTANT MAKE SURE YOU REGENERATE THE SWAGGER SPEC (using go:generate) MAKE SURE IT VALIDATES
Index ¶
- func AccountInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func AssetInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func Assets(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func GetBlock(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func GetPendingTransactions(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func GetPendingTransactionsByAddress(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func GetSupply(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func GetTransactionByID(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func PendingTransactionInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func RawTransaction(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func SendJSON(obj Response, w http.ResponseWriter, log logging.Logger)
- func Status(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func SuggestedFee(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func SuggestedParams(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func TransactionInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func Transactions(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- func WaitForBlock(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
- type AccountInformationResponse
- type AssetInformationResponse
- type AssetsResponse
- type BlockResponse
- type PendingTransactionsResponse
- type Response
- type StatusResponse
- type SupplyResponse
- type TransactionFeeResponse
- type TransactionIDResponse
- type TransactionParamsResponse
- type TransactionResponse
- type TransactionsResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AccountInformation ¶
func AccountInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
AccountInformation is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]{KeyLength}}
func AssetInformation ¶
func AssetInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
AssetInformation is an httpHandler for route GET /v1/asset/{index:[0-9]+}
func Assets ¶
func Assets(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
Assets is an httpHandler for route GET /v1/assets
func GetBlock ¶
func GetBlock(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
GetBlock is an httpHandler for route GET /v1/block/{round}
func GetPendingTransactions ¶
func GetPendingTransactions(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
GetPendingTransactions is an httpHandler for route GET /v1/transactions/pending.
func GetPendingTransactionsByAddress ¶
func GetPendingTransactionsByAddress(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
GetPendingTransactionsByAddress is an httpHandler for route GET /v1/account/addr:[A-Z0-9]{KeyLength}}/transactions/pending.
func GetSupply ¶
func GetSupply(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
GetSupply is an httpHandler for route GET /v1/ledger/supply
func GetTransactionByID ¶
func GetTransactionByID(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
GetTransactionByID is an httpHandler for route GET /v1/transaction/{txid}
func PendingTransactionInformation ¶
func PendingTransactionInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
PendingTransactionInformation is an httpHandler for route GET /v1/transactions/pending/{txid:[A-Z0-9]+}
func RawTransaction ¶
func RawTransaction(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
RawTransaction is an httpHandler for route POST /v1/transactions
func SendJSON ¶
func SendJSON(obj Response, w http.ResponseWriter, log logging.Logger)
SendJSON is like writeJSON, but it writes to the log instead of returning an error. The caller must ensure that no writes to w happen after this function is called. Unwraps a Response object and converts it to an HTTP Response.
func Status ¶
func Status(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
Status is an httpHandler for route GET /v1/status
func SuggestedFee ¶
func SuggestedFee(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
SuggestedFee is an httpHandler for route GET /v1/transactions/fee
func SuggestedParams ¶
func SuggestedParams(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
SuggestedParams is an httpHandler for route GET /v1/transactions/params
func TransactionInformation ¶
func TransactionInformation(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
TransactionInformation is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]{KeyLength}}/transaction/{txid:[A-Z0-9]+}
func Transactions ¶
func Transactions(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
Transactions is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]+}/transactions
func WaitForBlock ¶
func WaitForBlock(ctx lib.ReqContext, w http.ResponseWriter, r *http.Request)
WaitForBlock is an httpHandler for route GET /v1/status/wait-for-block-after/{round:[0-9]+}
Types ¶
type AccountInformationResponse ¶
AccountInformationResponse contains an account information
swagger:response AccountInformationResponse
type AssetInformationResponse ¶
type AssetInformationResponse struct { // in: body Body *v1.AssetParams }
AssetInformationResponse contains asset information
swagger:response AssetInformationResponse
type PendingTransactionsResponse ¶
type PendingTransactionsResponse struct { // in: body Body *v1.PendingTransactions }
PendingTransactionsResponse contains a (potentially truncated) list of transactions and the total number of transactions currently in the pool.
swagger:response PendingTransactionsResponse
type Response ¶
type Response interface {
// contains filtered or unexported methods
}
Response is a generic interface wrapping any data returned by the server. We wrap every type in a Response type so that we can swagger annotate them.
Each response must have a Body (a payload). We write an interface for this because it better mirrors the go-swagger annotation style (which requires swagger colon responses to have an embedded body struct of the actual data to be sent. of course, they can also have headers and the sort.) Anything implementing the Response interface will naturally be able to be annotated by swagger:response. This also allows package functions to naturally unwrap Response types and send the underlying Body through another interface (e.g. an http.ResponseWriter)
type StatusResponse ¶
type StatusResponse struct { // in: body Body *v1.NodeStatus }
StatusResponse contains the node's status information
swagger:response StatusResponse
type SupplyResponse ¶
SupplyResponse contains the ledger supply information
swagger:response SupplyResponse
type TransactionFeeResponse ¶
type TransactionFeeResponse struct { // in: body Body *v1.TransactionFee }
TransactionFeeResponse contains a suggested fee
swagger:response TransactionFeeResponse
type TransactionIDResponse ¶
type TransactionIDResponse struct { // in: body Body *v1.TransactionID }
TransactionIDResponse contains a transaction information
swagger:response TransactionIDResponse
type TransactionParamsResponse ¶
type TransactionParamsResponse struct { // in: body Body *v1.TransactionParams }
TransactionParamsResponse contains the parameters for constructing a new transaction.
swagger:response TransactionParamsResponse
type TransactionResponse ¶
type TransactionResponse struct { // in: body Body *v1.Transaction }
TransactionResponse contains a transaction information
swagger:response TransactionResponse
type TransactionsResponse ¶
type TransactionsResponse struct { // in: body Body *v1.TransactionList }
TransactionsResponse contains a list of transactions
swagger:response TransactionsResponse