Documentation ¶
Overview ¶
Package rest provides RESTful API services for RFQ
Index ¶
Constants ¶
const (
QuoteRoute = "/quotes"
)
QuoteRoute is the API endpoint for handling quote related requests.
Variables ¶
This section is empty.
Functions ¶
func EIP191Auth ¶
EIP191Auth implements ethereum signed message authentication middleware for gin rest api For auth, relayer should pass in eth signed message following eip-191 with the message as the current unix timestamp in seconds i.e. signature (hex encoded) = keccak(bytes.concat("\x19Ethereum Signed Message:\n", len(strconv.Itoa(time.Now().Unix()), strconv.Itoa(time.Now().Unix()))) so that full auth header string: auth = strconv.Itoa(time.Now().Unix()) + ":" + signature see: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sign
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler is the REST API handler.
func (*Handler) GetQuotes ¶
GetQuotes retrieves all quotes from the database. GET /quotes. nolint: cyclop PingExample godoc @Summary get quotes from all relayers. @Schemes @Param originChainID path int true "origin chain id to filter quotes by" @Param originTokenAddr path string true "origin chain id to filter quotes by" @Param destChainID path int true "destination chain id to filter quotes by" @Param destTokenAddr path string true "destination token address to filter quotes by" @Param relayerAddr path string true "relayer address to filter quotes by" @Description get quotes from all relayers. @Tags quotes @Accept json @Produce json @Success 200 {array} model.GetQuoteResponse @Router /quotes [get].
func (*Handler) ModifyQuote ¶
ModifyQuote upserts a quote
PUT /quotes @dev Protected Method: Authentication is handled through middleware in server.go. nolint: cyclop @Summary get quotes from all relayers. @Schemes @Description upsert a quote from relayer. @Param request body model.PutQuoteRequest true "query params" @Tags quotes @Accept json @Produce json @Success 200 @Router /quotes [put].
type QuoterAPIServer ¶ added in v0.0.15
type QuoterAPIServer struct {
// contains filtered or unexported fields
}
QuoterAPIServer is a struct that holds the configuration, database connection, gin engine, RPC client, metrics handler, and fast bridge contracts. It is used to initialize and run the API server.
func NewAPI ¶
func NewAPI( ctx context.Context, cfg config.Config, handler metrics.Handler, omniRPCClient omniClient.RPCClient, store db.APIDB, ) (*QuoterAPIServer, error)
NewAPI holds the configuration, database connection, gin engine, RPC client, metrics handler, and fast bridge contracts. It is used to initialize and run the API server.
func (*QuoterAPIServer) AuthMiddleware ¶ added in v0.0.15
func (r *QuoterAPIServer) AuthMiddleware() gin.HandlerFunc
AuthMiddleware is the Gin authentication middleware that authenticates requests using EIP191.