relapi

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: MIT Imports: 22 Imported by: 1

Documentation

Overview

Package relapi provides RESTful API services for the RFQ relayer

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetQuoteRequestStatusResponse

type GetQuoteRequestStatusResponse struct {
	Status        string `json:"status"`
	TxID          string `json:"tx_id"`
	OriginTxHash  string `json:"origin_tx_hash"`
	OriginChainID uint32 `json:"origin_chain_id"`
	DestTxHash    string `json:"dest_tx_hash"`
	DestChainID   uint32 `json:"dest_chain_id"`
}

GetQuoteRequestStatusResponse contains the schema for a GET /quote response.

type GetTxRetryResponse

type GetTxRetryResponse struct {
	TxID      string `json:"tx_id"`
	ChainID   uint32 `json:"chain_id"`
	Nonce     uint64 `json:"nonce"`
	GasAmount string `json:"gas_amount"`
}

GetTxRetryResponse contains the schema for a PUT /tx/retry response.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is the REST API handler.

func NewHandler

func NewHandler(db reldb.Service, chains map[uint32]*chain.Chain) *Handler

NewHandler creates a new REST API handler.

func (*Handler) GetHealth

func (h *Handler) GetHealth(c *gin.Context)

GetHealth returns a successful response to signify the API is up and running.

func (*Handler) GetQuoteRequestStatusByTxHash

func (h *Handler) GetQuoteRequestStatusByTxHash(c *gin.Context)

GetQuoteRequestStatusByTxHash gets the status of a quote request, given an origin tx hash.

func (*Handler) GetQuoteRequestStatusByTxID

func (h *Handler) GetQuoteRequestStatusByTxID(c *gin.Context)

GetQuoteRequestStatusByTxID gets the status of a quote request, given a tx id.

func (*Handler) GetTxRetry

func (h *Handler) GetTxRetry(c *gin.Context)

GetTxRetry retries a transaction based on tx hash.

type PutRelayAckResponse added in v0.22.0

type PutRelayAckResponse struct {
	TxID           string `json:"tx_id"`
	ShouldRelay    bool   `json:"should_relay"`
	RelayerAddress string `json:"relayer_address"`
}

PutRelayAckResponse contains the schema for a POST /relay/ack response.

type RelayerAPIServer

type RelayerAPIServer struct {
	// contains filtered or unexported fields
}

RelayerAPIServer 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 NewRelayerAPI

func NewRelayerAPI(
	ctx context.Context,
	cfg relconfig.Config,
	handler metrics.Handler,
	omniRPCClient omniClient.RPCClient,
	store reldb.Service,
	submitter submitter.TransactionSubmitter,
) (*RelayerAPIServer, error)

NewRelayerAPI 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 (*RelayerAPIServer) Run

func (r *RelayerAPIServer) Run(ctx context.Context) error

Run runs the rest api server.

type RelayerClient added in v0.25.7

type RelayerClient interface {
	Health(ctx context.Context) (ok bool, err error)
	GetQuoteRequestStatusByTxHash(ctx context.Context, hash string) (*GetQuoteRequestStatusResponse, error)
	GetQuoteRequestStatusByTxID(ctx context.Context, hash string) (*GetQuoteRequestStatusResponse, error)
	RetryTransaction(ctx context.Context, txhash string) (*GetTxRetryResponse, error)
}

RelayerClient is the interface for the relayer client.

func NewRelayerClient added in v0.25.7

func NewRelayerClient(handler metrics.Handler, url string) RelayerClient

NewRelayerClient creates a new RelayerClient.

Jump to

Keyboard shortcuts

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