Documentation ¶
Index ¶
- func CorsMiddleware(next http.Handler) http.Handler
- func EncodeJSONResponse(i interface{}, status int, w http.ResponseWriter)
- func LoggerMiddleware(inner http.Handler) http.Handler
- func NewRouter(routers ...Router) http.Handler
- type AccountAPIController
- type AccountAPIRouter
- type AccountAPIServicer
- type BlockAPIController
- type BlockAPIRouter
- type BlockAPIServicer
- type ConstructionAPIController
- func (c *ConstructionAPIController) ConstructionCombine(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionDerive(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionHash(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionMetadata(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionParse(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionPayloads(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionPreprocess(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) ConstructionSubmit(w http.ResponseWriter, r *http.Request)
- func (c *ConstructionAPIController) Routes() Routes
- type ConstructionAPIRouter
- type ConstructionAPIServicer
- type MempoolAPIController
- type MempoolAPIRouter
- type MempoolAPIServicer
- type NetworkAPIController
- func (c *NetworkAPIController) NetworkList(w http.ResponseWriter, r *http.Request)
- func (c *NetworkAPIController) NetworkOptions(w http.ResponseWriter, r *http.Request)
- func (c *NetworkAPIController) NetworkStatus(w http.ResponseWriter, r *http.Request)
- func (c *NetworkAPIController) Routes() Routes
- type NetworkAPIRouter
- type NetworkAPIServicer
- type Route
- type Router
- func NewAccountAPIController(s AccountAPIServicer, asserter *asserter.Asserter) Router
- func NewBlockAPIController(s BlockAPIServicer, asserter *asserter.Asserter) Router
- func NewConstructionAPIController(s ConstructionAPIServicer, asserter *asserter.Asserter) Router
- func NewMempoolAPIController(s MempoolAPIServicer, asserter *asserter.Asserter) Router
- func NewNetworkAPIController(s NetworkAPIServicer, asserter *asserter.Asserter) Router
- type Routes
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CorsMiddleware ¶
CorsMiddleware handles CORS and ensures OPTIONS requests are handled properly.
This may be used to expose a Rosetta server instance to requests made by web apps served over a different domain. Note that his currently allows _all_ third party domains so callers might want to adapt this middleware for their own use-cases.
func EncodeJSONResponse ¶
func EncodeJSONResponse(i interface{}, status int, w http.ResponseWriter)
EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code
func LoggerMiddleware ¶
LoggerMiddleware is a simple logger middleware that prints the requests in an ad-hoc fashion to the stdlib's log.
Types ¶
type AccountAPIController ¶
type AccountAPIController struct {
// contains filtered or unexported fields
}
A AccountAPIController binds http requests to an api service and writes the service results to the http response
func (*AccountAPIController) AccountBalance ¶
func (c *AccountAPIController) AccountBalance(w http.ResponseWriter, r *http.Request)
AccountBalance - Get an Account Balance
func (*AccountAPIController) Routes ¶
func (c *AccountAPIController) Routes() Routes
Routes returns all of the api route for the AccountAPIController
type AccountAPIRouter ¶
type AccountAPIRouter interface {
AccountBalance(http.ResponseWriter, *http.Request)
}
AccountAPIRouter defines the required methods for binding the api requests to a responses for the AccountAPI The AccountAPIRouter implementation should parse necessary information from the http request, pass the data to a AccountAPIServicer to perform the required actions, then write the service results to the http response.
type AccountAPIServicer ¶
type AccountAPIServicer interface { AccountBalance( context.Context, *types.AccountBalanceRequest, ) (*types.AccountBalanceResponse, *types.Error) }
AccountAPIServicer defines the api actions for the AccountAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type BlockAPIController ¶
type BlockAPIController struct {
// contains filtered or unexported fields
}
A BlockAPIController binds http requests to an api service and writes the service results to the http response
func (*BlockAPIController) Block ¶
func (c *BlockAPIController) Block(w http.ResponseWriter, r *http.Request)
Block - Get a Block
func (*BlockAPIController) BlockTransaction ¶
func (c *BlockAPIController) BlockTransaction(w http.ResponseWriter, r *http.Request)
BlockTransaction - Get a Block Transaction
func (*BlockAPIController) Routes ¶
func (c *BlockAPIController) Routes() Routes
Routes returns all of the api route for the BlockAPIController
type BlockAPIRouter ¶
type BlockAPIRouter interface { Block(http.ResponseWriter, *http.Request) BlockTransaction(http.ResponseWriter, *http.Request) }
BlockAPIRouter defines the required methods for binding the api requests to a responses for the BlockAPI The BlockAPIRouter implementation should parse necessary information from the http request, pass the data to a BlockAPIServicer to perform the required actions, then write the service results to the http response.
type BlockAPIServicer ¶
type BlockAPIServicer interface { Block(context.Context, *types.BlockRequest) (*types.BlockResponse, *types.Error) BlockTransaction( context.Context, *types.BlockTransactionRequest, ) (*types.BlockTransactionResponse, *types.Error) }
BlockAPIServicer defines the api actions for the BlockAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type ConstructionAPIController ¶
type ConstructionAPIController struct {
// contains filtered or unexported fields
}
A ConstructionAPIController binds http requests to an api service and writes the service results to the http response
func (*ConstructionAPIController) ConstructionCombine ¶
func (c *ConstructionAPIController) ConstructionCombine(w http.ResponseWriter, r *http.Request)
ConstructionCombine - Create Network Transaction from Signatures
func (*ConstructionAPIController) ConstructionDerive ¶
func (c *ConstructionAPIController) ConstructionDerive(w http.ResponseWriter, r *http.Request)
ConstructionDerive - Derive an Address from a PublicKey
func (*ConstructionAPIController) ConstructionHash ¶
func (c *ConstructionAPIController) ConstructionHash(w http.ResponseWriter, r *http.Request)
ConstructionHash - Get the Hash of a Signed Transaction
func (*ConstructionAPIController) ConstructionMetadata ¶
func (c *ConstructionAPIController) ConstructionMetadata(w http.ResponseWriter, r *http.Request)
ConstructionMetadata - Get Metadata for Transaction Construction
func (*ConstructionAPIController) ConstructionParse ¶
func (c *ConstructionAPIController) ConstructionParse(w http.ResponseWriter, r *http.Request)
ConstructionParse - Parse a Transaction
func (*ConstructionAPIController) ConstructionPayloads ¶
func (c *ConstructionAPIController) ConstructionPayloads(w http.ResponseWriter, r *http.Request)
ConstructionPayloads - Generate an Unsigned Transaction and Signing Payloads
func (*ConstructionAPIController) ConstructionPreprocess ¶
func (c *ConstructionAPIController) ConstructionPreprocess(w http.ResponseWriter, r *http.Request)
ConstructionPreprocess - Create a Request to Fetch Metadata
func (*ConstructionAPIController) ConstructionSubmit ¶
func (c *ConstructionAPIController) ConstructionSubmit(w http.ResponseWriter, r *http.Request)
ConstructionSubmit - Submit a Signed Transaction
func (*ConstructionAPIController) Routes ¶
func (c *ConstructionAPIController) Routes() Routes
Routes returns all of the api route for the ConstructionAPIController
type ConstructionAPIRouter ¶
type ConstructionAPIRouter interface { ConstructionCombine(http.ResponseWriter, *http.Request) ConstructionDerive(http.ResponseWriter, *http.Request) ConstructionHash(http.ResponseWriter, *http.Request) ConstructionMetadata(http.ResponseWriter, *http.Request) ConstructionParse(http.ResponseWriter, *http.Request) ConstructionPayloads(http.ResponseWriter, *http.Request) ConstructionPreprocess(http.ResponseWriter, *http.Request) ConstructionSubmit(http.ResponseWriter, *http.Request) }
ConstructionAPIRouter defines the required methods for binding the api requests to a responses for the ConstructionAPI The ConstructionAPIRouter implementation should parse necessary information from the http request, pass the data to a ConstructionAPIServicer to perform the required actions, then write the service results to the http response.
type ConstructionAPIServicer ¶
type ConstructionAPIServicer interface { ConstructionCombine( context.Context, *types.ConstructionCombineRequest, ) (*types.ConstructionCombineResponse, *types.Error) ConstructionDerive( context.Context, *types.ConstructionDeriveRequest, ) (*types.ConstructionDeriveResponse, *types.Error) ConstructionHash( context.Context, *types.ConstructionHashRequest, ) (*types.TransactionIdentifierResponse, *types.Error) ConstructionMetadata( context.Context, *types.ConstructionMetadataRequest, ) (*types.ConstructionMetadataResponse, *types.Error) ConstructionParse( context.Context, *types.ConstructionParseRequest, ) (*types.ConstructionParseResponse, *types.Error) ConstructionPayloads( context.Context, *types.ConstructionPayloadsRequest, ) (*types.ConstructionPayloadsResponse, *types.Error) ConstructionPreprocess( context.Context, *types.ConstructionPreprocessRequest, ) (*types.ConstructionPreprocessResponse, *types.Error) ConstructionSubmit( context.Context, *types.ConstructionSubmitRequest, ) (*types.TransactionIdentifierResponse, *types.Error) }
ConstructionAPIServicer defines the api actions for the ConstructionAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type MempoolAPIController ¶
type MempoolAPIController struct {
// contains filtered or unexported fields
}
A MempoolAPIController binds http requests to an api service and writes the service results to the http response
func (*MempoolAPIController) Mempool ¶
func (c *MempoolAPIController) Mempool(w http.ResponseWriter, r *http.Request)
Mempool - Get All Mempool Transactions
func (*MempoolAPIController) MempoolTransaction ¶
func (c *MempoolAPIController) MempoolTransaction(w http.ResponseWriter, r *http.Request)
MempoolTransaction - Get a Mempool Transaction
func (*MempoolAPIController) Routes ¶
func (c *MempoolAPIController) Routes() Routes
Routes returns all of the api route for the MempoolAPIController
type MempoolAPIRouter ¶
type MempoolAPIRouter interface { Mempool(http.ResponseWriter, *http.Request) MempoolTransaction(http.ResponseWriter, *http.Request) }
MempoolAPIRouter defines the required methods for binding the api requests to a responses for the MempoolAPI The MempoolAPIRouter implementation should parse necessary information from the http request, pass the data to a MempoolAPIServicer to perform the required actions, then write the service results to the http response.
type MempoolAPIServicer ¶
type MempoolAPIServicer interface { Mempool(context.Context, *types.NetworkRequest) (*types.MempoolResponse, *types.Error) MempoolTransaction( context.Context, *types.MempoolTransactionRequest, ) (*types.MempoolTransactionResponse, *types.Error) }
MempoolAPIServicer defines the api actions for the MempoolAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type NetworkAPIController ¶
type NetworkAPIController struct {
// contains filtered or unexported fields
}
A NetworkAPIController binds http requests to an api service and writes the service results to the http response
func (*NetworkAPIController) NetworkList ¶
func (c *NetworkAPIController) NetworkList(w http.ResponseWriter, r *http.Request)
NetworkList - Get List of Available Networks
func (*NetworkAPIController) NetworkOptions ¶
func (c *NetworkAPIController) NetworkOptions(w http.ResponseWriter, r *http.Request)
NetworkOptions - Get Network Options
func (*NetworkAPIController) NetworkStatus ¶
func (c *NetworkAPIController) NetworkStatus(w http.ResponseWriter, r *http.Request)
NetworkStatus - Get Network Status
func (*NetworkAPIController) Routes ¶
func (c *NetworkAPIController) Routes() Routes
Routes returns all of the api route for the NetworkAPIController
type NetworkAPIRouter ¶
type NetworkAPIRouter interface { NetworkList(http.ResponseWriter, *http.Request) NetworkOptions(http.ResponseWriter, *http.Request) NetworkStatus(http.ResponseWriter, *http.Request) }
NetworkAPIRouter defines the required methods for binding the api requests to a responses for the NetworkAPI The NetworkAPIRouter implementation should parse necessary information from the http request, pass the data to a NetworkAPIServicer to perform the required actions, then write the service results to the http response.
type NetworkAPIServicer ¶
type NetworkAPIServicer interface { NetworkList(context.Context, *types.MetadataRequest) (*types.NetworkListResponse, *types.Error) NetworkOptions( context.Context, *types.NetworkRequest, ) (*types.NetworkOptionsResponse, *types.Error) NetworkStatus( context.Context, *types.NetworkRequest, ) (*types.NetworkStatusResponse, *types.Error) }
NetworkAPIServicer defines the api actions for the NetworkAPI service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.
type Route ¶
type Route struct { Name string Method string Pattern string HandlerFunc http.HandlerFunc }
A Route defines the parameters for an api endpoint
type Router ¶
type Router interface {
Routes() Routes
}
Router defines the required methods for retrieving api routes
func NewAccountAPIController ¶
func NewAccountAPIController( s AccountAPIServicer, asserter *asserter.Asserter, ) Router
NewAccountAPIController creates a default api controller
func NewBlockAPIController ¶
func NewBlockAPIController( s BlockAPIServicer, asserter *asserter.Asserter, ) Router
NewBlockAPIController creates a default api controller
func NewConstructionAPIController ¶
func NewConstructionAPIController( s ConstructionAPIServicer, asserter *asserter.Asserter, ) Router
NewConstructionAPIController creates a default api controller
func NewMempoolAPIController ¶
func NewMempoolAPIController( s MempoolAPIServicer, asserter *asserter.Asserter, ) Router
NewMempoolAPIController creates a default api controller
func NewNetworkAPIController ¶
func NewNetworkAPIController( s NetworkAPIServicer, asserter *asserter.Asserter, ) Router
NewNetworkAPIController creates a default api controller