types

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRequest added in v0.13.0

type CheckRequest struct {
	SourceChainID      uint64       `json:"sourceChainId"`
	DestinationChainID uint64       `json:"destChainId"`
	FillDeadline       uint32       `json:"fillDeadline"`
	Calls              JSONCalls    `json:"calls"`
	Expenses           JSONExpenses `json:"expenses"`
	Deposit            JSONDeposit  `json:"deposit"`
}

CheckRequest is the expected request body for the /api/v1/check endpoint.

NOTE: Check request / response types mirror SolvertNet.OrderData, built specifically for EVM -> EVM orders via SolverNetInbox / Outbox contracts, with ERC7683 type hash matching SolverNetInbox.ORDERDATA_TYPEHASH.

To support multiple order types with this api (e.g. EVM -> Solana, Solana -> EVM) we'd need a more generic request / response format that discriminates on order type hash.

type CheckResponse added in v0.13.0

type CheckResponse struct {
	Accepted          bool               `json:"accepted,omitempty"`
	Rejected          bool               `json:"rejected,omitempty"`
	RejectReason      string             `json:"rejectReason,omitempty"`
	RejectDescription string             `json:"rejectDescription,omitempty"`
	Error             *JSONErrorResponse `json:"error,omitempty"`
}

CheckResponse is the response json for the /check endpoint.

func (CheckResponse) StatusCode added in v0.13.0

func (r CheckResponse) StatusCode() int

type ContractsResponse added in v0.13.0

type ContractsResponse struct {
	Portal    string             `json:"portal,omitempty"`
	Inbox     string             `json:"inbox,omitempty"`
	Outbox    string             `json:"outbox,omitempty"`
	Middleman string             `json:"middleman,omitempty"`
	Error     *JSONErrorResponse `json:"error,omitempty"`
}

ContractsResponse is the response json for the /api/vi/contracts endpoint.

func (ContractsResponse) StatusCode added in v0.13.0

func (r ContractsResponse) StatusCode() int

type JSONCall added in v0.13.0

type JSONCall struct {
	Target common.Address `json:"target"`
	Data   *hexutil.Bytes `json:"data"`
	Value  *hexutil.Big   `json:"value"`
}

JSONCall is a json marshal-able solvernet.Call.

type JSONCalls added in v0.13.0

type JSONCalls []JSONCall

func ToJSONCalls added in v0.13.0

func ToJSONCalls(calls []solvernet.Call) JSONCalls

func (JSONCalls) Parse added in v0.13.0

func (cs JSONCalls) Parse() solvernet.Calls

type JSONDeposit added in v0.13.0

type JSONDeposit struct {
	Token  common.Address `json:"token"`
	Amount *hexutil.Big   `json:"amount"`
}

JSONDeposit is a json marshal-able solvernet.Deposit.

func ToJSONDeposit added in v0.13.0

func ToJSONDeposit(deposit solvernet.Deposit) JSONDeposit

func (JSONDeposit) Parse added in v0.13.0

func (d JSONDeposit) Parse() solvernet.Deposit

type JSONErrorResponse added in v0.13.0

type JSONErrorResponse struct {
	Code    int    `json:"code"`
	Status  string `json:"status"`
	Message string `json:"message"`
}

JSONErrorResponse is a json response for http errors (e.g 4xx, 5xx), not used for rejections.

type JSONExpense added in v0.13.0

type JSONExpense struct {
	Spender common.Address `json:"spender"`
	Token   common.Address `json:"token"`
	Amount  *hexutil.Big   `json:"amount"`
}

JSONExpense is a json marshal-able solvernt.Expense.

type JSONExpenses added in v0.13.0

type JSONExpenses []JSONExpense

func ToJSONExpenses added in v0.13.0

func ToJSONExpenses(expenses []solvernet.Expense) JSONExpenses

func (JSONExpenses) Parse added in v0.13.0

func (es JSONExpenses) Parse() solvernet.Expenses

type JSONQuoteUnit added in v0.13.0

type JSONQuoteUnit struct {
	Token  common.Address `json:"token"`
	Amount *hexutil.Big   `json:"amount,omitempty"`
}

JSONQuoteUnit is a json marshal-able QuoteUnit.

func (JSONQuoteUnit) Parse added in v0.13.0

func (qu JSONQuoteUnit) Parse() QuoteUnit

type JSONResponse added in v0.13.0

type JSONResponse interface {
	StatusCode() int
}

type QuoteRequest added in v0.13.0

type QuoteRequest struct {
	SourceChainID      uint64        `json:"sourceChainId"`
	DestinationChainID uint64        `json:"destChainId"`
	Deposit            JSONQuoteUnit `json:"deposit"`
	Expense            JSONQuoteUnit `json:"expense"`
}

QuoteRequest is the expected request body for the /api/v1/quote endpoint. If deposit amount is omitted, the response will include the required deposit amount. If expense amount is omitted, the response will include the required expense amount.

type QuoteResponse added in v0.13.0

type QuoteResponse struct {
	Deposit JSONQuoteUnit      `json:"deposit"`
	Expense JSONQuoteUnit      `json:"expense"`
	Error   *JSONErrorResponse `json:"error,omitempty"`
}

QuoteResponse is the response json for the /api/v1/quote endpoint.

func (QuoteResponse) StatusCode added in v0.13.0

func (r QuoteResponse) StatusCode() int

type QuoteUnit added in v0.13.0

type QuoteUnit struct {
	Token  common.Address
	Amount *big.Int
}

QuoteUnit represents a token and amount pair, with the amount being optional. If amount is nil or zero, quote response should inform the amount.

func (QuoteUnit) ToJSON added in v0.13.0

func (qu QuoteUnit) ToJSON() JSONQuoteUnit

type RejectReason added in v0.13.0

type RejectReason uint8
const (
	RejectNone                  RejectReason = 0
	RejectDestCallReverts       RejectReason = 1
	RejectInvalidDeposit        RejectReason = 2
	RejectInvalidExpense        RejectReason = 3
	RejectInsufficientDeposit   RejectReason = 4
	RejectInsufficientInventory RejectReason = 5
	RejectUnsupportedDeposit    RejectReason = 6
	RejectUnsupportedExpense    RejectReason = 7
	RejectUnsupportedDestChain  RejectReason = 8
	RejectUnsupportedSrcChain   RejectReason = 9
	RejectSameChain             RejectReason = 10
	RejectExpenseOverMax        RejectReason = 11
	RejectExpenseUnderMin       RejectReason = 12
)

func (RejectReason) String added in v0.13.0

func (i RejectReason) String() string

Jump to

Keyboard shortcuts

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