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) GetFilteredQuotes ¶
GetFilteredQuotes retrieves filtered quotes from the database. GET /quotes?destChainId=&destTokenAddr=&destAmount=.
func (*Handler) GetQuotes ¶
GetQuotes retrieves all quotes from the database. GET /quotes. nolint: cyclop
func (*Handler) ModifyQuote ¶
ModifyQuote upserts a quote
PUT /quotes @dev Protected Method: Authentication is handled through middleware in server.go.
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.