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 GetQuoteRequestResponse ¶ added in v0.29.14
type GetQuoteRequestResponse struct { Sender string `json:"sender"` Status string `json:"status"` TxID string `json:"tx_id"` QuoteRequestRaw string `json:"quote_request"` OriginTxHash string `json:"origin_tx_hash"` DestTxHash string `json:"dest_tx_hash"` OriginChainID uint32 `json:"origin_chain_id"` DestChainID uint32 `json:"dest_chain_id"` OriginToken string `json:"origin_token"` DestToken string `json:"dest_token"` }
GetQuoteRequestResponse is the response to a get quote request.
type GetTxByNonceRequest ¶ added in v0.30.0
GetTxByNonceRequest is the request for getting a transaction hash by nonce.
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(metricsHelper metrics.Handler, db reldb.Service, chains map[uint32]*chain.Chain, cfg relconfig.Config, txSubmitter submitter.TransactionSubmitter) *Handler
NewHandler creates a new REST API handler.
func (*Handler) GetHealth ¶
GetHealth returns a successful response to signify the API is up and running.
func (*Handler) GetQuoteRequestByTxHash ¶ added in v1.13.0
GetQuoteRequestByTxHash gets the quote request by tx hash.
func (*Handler) GetQuoteRequestByTxID ¶ added in v0.29.14
GetQuoteRequestByTxID gets the quote request by tx id.
func (*Handler) GetTxHashByNonce ¶ added in v0.30.0
GetTxHashByNonce gets the transaction hash by submitter nonce.
func (*Handler) GetTxRetry ¶
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.
type RelayerClient ¶ added in v0.25.7
type RelayerClient interface { Health(ctx context.Context) (ok bool, err error) RetryTransaction(ctx context.Context, txhash string) (*GetTxRetryResponse, error) Withdraw(ctx context.Context, req *WithdrawRequest) (*WithdrawResponse, error) GetTxHashByNonce(ctx context.Context, req *GetTxByNonceRequest) (*TxHashByNonceResponse, error) GetQuoteRequestByTXID(ctx context.Context, txid string) (*GetQuoteRequestResponse, error) GetQuoteRequestByTxHash(ctx context.Context, txhash string) (*GetQuoteRequestResponse, 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.
type TxHashByNonceResponse ¶ added in v0.30.0
type TxHashByNonceResponse struct {
Hash string `json:"withdrawTxHash"`
}
TxHashByNonceResponse is the request for getting a transaction hash by nonce.
type WithdrawRequest ¶ added in v0.29.11
type WithdrawRequest struct { // ChainID is the chain ID of the chain to withdraw from. ChainID uint32 `json:"chain_id"` // Amount is the amount to withdraw, in wei. Amount string `json:"amount"` // TokenAddress is the address of the token to withdraw. TokenAddress common.Address `json:"token_address"` // To is the address to withdraw to. To common.Address `json:"to"` }
WithdrawRequest is the request to withdraw tokens from the relayer.
func (*WithdrawRequest) MarshalJSON ¶ added in v0.29.11
func (wr *WithdrawRequest) MarshalJSON() ([]byte, error)
MarshalJSON handles JSON marshaling for WithdrawRequest.
func (*WithdrawRequest) UnmarshalJSON ¶ added in v0.29.11
func (wr *WithdrawRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON has JSON unmarshalling for WithdrawRequest.
type WithdrawResponse ¶ added in v0.29.11
type WithdrawResponse struct {
Nonce uint64 `json:"nonce"`
}
WithdrawResponse is the response for the withdraw request.