Documentation ¶
Index ¶
- type ActorHandler
- type ActorNonceHandler
- type ActorsHandler
- type BlockHandler
- type Callbacks
- type CreateMessageHandler
- type DefaultHandler
- type HelloHandler
- type MessageHandler
- type NodeHandler
- type SignedMessageHandler
- type WaitForMessageHandler
- type WaitForMessageHandlerCb
- type WaitForMessageParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActorHandler ¶
ActorHandler is a handler for the actors/{actorId} endpoint
func (*ActorHandler) ServeHTTP ¶
func (a *ActorHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type ActorNonceHandler ¶
ActorNonceHandler is the handler for the GET /actors/{actorID}/nonce endpoint.
func (*ActorNonceHandler) ServeHTTP ¶
func (anh *ActorNonceHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type ActorsHandler ¶
ActorsHandler is the handler for the actors endpoint
func (*ActorsHandler) ServeHTTP ¶
func (a *ActorsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type BlockHandler ¶
BlockHandler is a handler for the blockheader endpoint
func (*BlockHandler) ServeHTTP ¶
func (bhh *BlockHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type Callbacks ¶
type Callbacks struct { // GetActorByID retrieves an Actor by its ID GetActorByID func(string) (*types.Actor, error) // GetActorNonce is specifically for retrieving the actor nonce in preparation for sending a signed message. GetActorNonce func(string) (*big.Int, error) // GetActors retrieves known information about all Actors of the node GetActors func() ([]*types.Actor, error) // GetBlockByID retrieves the BlockHeader, Messages and Receipts for the Block GetBlockByID func(string) (*types.Block, error) // CreateMessage creates and sends an unsigned Message CreateMessage func(*types.Message) (*types.SignedMessage, error) // CreateSignedMessage creates and sends a SignedMessage using the node's default // account CreateSignedMessage func(*types.SignedMessage) (*types.SignedMessage, error) // GetMessageByID fetches a Message by its CID GetMessageByID func(string) (*types.SignedMessage, error) // GetNode gets information about the node that implements this API GetNode func() (*types.Node, error) // SendSignedMessage posts an already signed message to the message pool. // Since actor Nonce is required to sign a message, the caller must first // know the actor nonce. See GetActorNonce SendSignedMessage func(*types.SignedMessage) (*types.SignedMessage, error) // WaitForMessage waits for a message to appear on chain until the given block height. WaitForMessage func(*cid.Cid, *big.Int) (*types.SignedMessage, error) }
Callbacks is a struct for callbacks to be used for an API endpoint. This is a struct rather than an interface so implementers do not have to write their own version of every callback. Missing callbacks will cause a DefaultHandler to be used. To add a new endpoint:
- Write a new handler to use a new V1Callback, with tests
- Add a new callback name/signature to Callbacks
- Add a case to BuildHandlers that uses the callback
type CreateMessageHandler ¶
type CreateMessageHandler struct {
Callback func(*types.Message) (*types.SignedMessage, error)
}
CreateMessageHandler is a handler for the /chain/messages endpoint
func (*CreateMessageHandler) ServeHTTP ¶
func (cmh *CreateMessageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type DefaultHandler ¶
type DefaultHandler struct{}
DefaultHandler is a fallback handler for a supported API endpoint that was not provided a callback when the API was created. Note this is distinct from 404 Not Found which is the response to a request for a non-existent, unsupported endpoint.
func (*DefaultHandler) ServeHTTP ¶
func (hh *DefaultHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type HelloHandler ¶
type HelloHandler struct { }
HelloHandler is a handler for the hello endpoint. It is intended to test connection to the API
func (*HelloHandler) ServeHTTP ¶
func (hh *HelloHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type MessageHandler ¶
type MessageHandler struct {
Callback func(string) (*types.SignedMessage, error)
}
MessageHandler is the handler for the /chain/executed-messages/{executedMessageId} endpoint
func (*MessageHandler) ServeHTTP ¶
func (mh *MessageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type NodeHandler ¶
NodeHandler is the handler for the control/node endpoint
func (*NodeHandler) ServeHTTP ¶
func (nid *NodeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type SignedMessageHandler ¶
type SignedMessageHandler struct {
Callback func(*types.SignedMessage) (*types.SignedMessage, error)
}
SignedMessageHandler is the handler for the POST /chain/messages/ endpoint
func (*SignedMessageHandler) ServeHTTP ¶
func (ssmh *SignedMessageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type WaitForMessageHandler ¶
type WaitForMessageHandler struct {
Callback WaitForMessageHandlerCb
}
WaitForMessageHandler is the handler for the GET /chain/messages/{messageID}/wait
func NewWaitForMessageHandler ¶
func NewWaitForMessageHandler(cb WaitForMessageHandlerCb) *WaitForMessageHandler
NewWaitForMessageHandler creates a new WaitForMessageHandler with the provided Filecoin Callback func
func (*WaitForMessageHandler) ServeHTTP ¶
func (wfmh *WaitForMessageHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles an HTTP request.
type WaitForMessageHandlerCb ¶
type WaitForMessageHandlerCb func(*cid.Cid, *big.Int) (*types.SignedMessage, error)
WaitForMessageHandlerCb defines a function that calls the API implementer's WaitForMesssageHandler callback
type WaitForMessageParams ¶
type WaitForMessageParams struct { MsgCid *cid.Cid `json:"msgCid"` // message Cid BlockHeight *big.Int `json:"blockHeight"` // block height at which to stop waiting for the message }
WaitForMessageParams holds the params parsed from the incoming http.Request