handlers

package
v0.0.0-...-15eb78e Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: AGPL-3.0 Imports: 26 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccountInformation

func AccountInformation(ctx lib.ReqContext, context echo.Context)

AccountInformation is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]{KeyLength}}

func AssetInformation

func AssetInformation(ctx lib.ReqContext, context echo.Context)

AssetInformation is an httpHandler for route GET /v1/asset/{index:[0-9]+}

func Assets

func Assets(ctx lib.ReqContext, context echo.Context)

Assets is an httpHandler for route GET /v1/assets

func GetBlock

func GetBlock(ctx lib.ReqContext, context echo.Context)

GetBlock is an httpHandler for route GET /v1/block/{round}

func GetPendingTransactions

func GetPendingTransactions(ctx lib.ReqContext, context echo.Context)

GetPendingTransactions is an httpHandler for route GET /v1/transactions/pending.

func GetPendingTransactionsByAddress

func GetPendingTransactionsByAddress(ctx lib.ReqContext, context echo.Context)

GetPendingTransactionsByAddress is an httpHandler for route GET /v1/account/addr:[A-Z0-9]{KeyLength}}/transactions/pending.

func GetSupply

func GetSupply(ctx lib.ReqContext, context echo.Context)

GetSupply is an httpHandler for route GET /v1/ledger/supply

func GetTransactionByID

func GetTransactionByID(ctx lib.ReqContext, context echo.Context)

GetTransactionByID is an httpHandler for route GET /v1/transaction/{txid}

func PendingTransactionInformation

func PendingTransactionInformation(ctx lib.ReqContext, context echo.Context)

PendingTransactionInformation is an httpHandler for route GET /v1/transactions/pending/{txid:[A-Z0-9]+}

func RawTransaction

func RawTransaction(ctx lib.ReqContext, context echo.Context)

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, context echo.Context)

Status is an httpHandler for route GET /v1/status

func SuggestedFee

func SuggestedFee(ctx lib.ReqContext, context echo.Context)

SuggestedFee is an httpHandler for route GET /v1/transactions/fee

func SuggestedParams

func SuggestedParams(ctx lib.ReqContext, context echo.Context)

SuggestedParams is an httpHandler for route GET /v1/transactions/params

func TransactionInformation

func TransactionInformation(ctx lib.ReqContext, context echo.Context)

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, context echo.Context)

Transactions is an httpHandler for route GET /v1/account/{addr:[A-Z0-9]+}/transactions

func WaitForBlock

func WaitForBlock(ctx lib.ReqContext, context echo.Context)

WaitForBlock is an httpHandler for route GET /v1/status/wait-for-block-after/{round:[0-9]+}

Types

type AccountInformationResponse

type AccountInformationResponse struct {
	// in: body
	Body *v1.Account
}

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 AssetsResponse

type AssetsResponse struct {
	// in: body
	Body *v1.AssetList
}

AssetsResponse contains a list of assets

swagger:response AssetsResponse

type BlockResponse

type BlockResponse struct {
	// in: body
	Body *v1.Block
}

BlockResponse contains block information

swagger:response BlockResponse

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 RawBlockResponse

type RawBlockResponse struct {
	// in: body
	Body *v1.RawBlock
}

RawBlockResponse contains encoded, raw block information

swagger:ignore

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

type SupplyResponse struct {
	// in: body
	Body *v1.Supply
}

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

Jump to

Keyboard shortcuts

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