Documentation
¶
Index ¶
- func CallsToBindings(calls []Call) []bindings.SolverNetCall
- func ExpensesToBindings(expenses []Expense) []solvernet.Expense
- type AddrAmt
- type Call
- type CheckRequest
- type CheckResponse
- type ContractsResponse
- type Expense
- type JSONError
- type JSONErrorResponse
- type Price
- func (p Price) F64() float64
- func (p Price) FormatF64() string
- func (p Price) FormatPair() string
- func (p Price) Inverse() Price
- func (p Price) MarshalJSON() ([]byte, error)
- func (p Price) String() string
- func (p Price) ToDeposit(expenseAmount *big.Int) *big.Int
- func (p Price) ToExpense(depositAmount *big.Int) *big.Int
- func (p *Price) UnmarshalJSON(data []byte) error
- func (p Price) WithFeeBips(fee int64) Price
- type PriceRequest
- type QuoteRequest
- type QuoteResponse
- type RejectReason
- type TokenResponse
- type TokensResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallsToBindings ¶ added in v0.14.0
func CallsToBindings(calls []Call) []bindings.SolverNetCall
func ExpensesToBindings ¶ added in v0.14.0
Types ¶
type AddrAmt ¶ added in v0.14.0
AddrAmt represents a token address and amount pair, with the amount being optional. If amount is nil or zero, quote response should inform the amount.
func (AddrAmt) MarshalJSON ¶ added in v0.14.0
func (*AddrAmt) UnmarshalJSON ¶ added in v0.14.0
type Call ¶ added in v0.14.0
Call wraps solvernet.Call to provide custom json marshaling.
func CallsFromBindings ¶ added in v0.15.0
func CallsFromBindings(calls []bindings.SolverNetCall) []Call
func (Call) MarshalJSON ¶ added in v0.14.0
func (*Call) UnmarshalJSON ¶ added in v0.14.0
type CheckRequest ¶ added in v0.13.0
type CheckRequest struct {
SourceChainID uint64 `json:"sourceChainId"`
DestinationChainID uint64 `json:"destChainId"`
FillDeadline uint32 `json:"fillDeadline"`
Calls []Call `json:"calls"`
Expenses []Expense `json:"expenses"`
Deposit AddrAmt `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.
func CheckRequestFromOrderData ¶ added in v0.15.0
func CheckRequestFromOrderData(srcChainID uint64, data bindings.SolverNetOrderData) (CheckRequest, error)
type CheckResponse ¶ added in v0.13.0
type CheckResponse struct {
Accepted bool `json:"accepted"`
Rejected bool `json:"rejected"`
RejectCode RejectReason `json:"rejectCode"`
RejectReason string `json:"rejectReason"`
RejectDescription string `json:"rejectDescription"`
}
CheckResponse is the response json for the /check endpoint.
type ContractsResponse ¶ added in v0.13.0
type ContractsResponse struct {
Portal common.Address `json:"portal"`
Inbox common.Address `json:"inbox"`
Outbox common.Address `json:"outbox"`
Middleman common.Address `json:"middleman"`
Executor common.Address `json:"executor"`
}
ContractsResponse is the response json for the /api/vi/contracts endpoint.
type Expense ¶ added in v0.14.0
Expense wraps solvernet.Expense to provide custom json marshaling.
func ExpensesFromBindings ¶ added in v0.15.0
func (Expense) MarshalJSON ¶ added in v0.14.0
func (*Expense) UnmarshalJSON ¶ added in v0.14.0
type JSONErrorResponse ¶ added in v0.13.0
type JSONErrorResponse struct {
Error JSONError `json:"error"`
}
JSONErrorResponse is a json response for http errors (e.g 4xx, 5xx), not used for rejections.
type Price ¶ added in v0.15.0
Price represents the canonical solver price. It is 1 unit of deposit token denominated in expense tokens. A valid price is always > 0.
Given a price of 800 OMNI/ETH, when depositing 1 ETH the expense amount is 800 OMNI.
expense amount = deposit amount * price deposit amount = expense amount / price
func (Price) FormatPair ¶ added in v0.15.0
func (Price) MarshalJSON ¶ added in v0.15.0
MarshalJSON implements the json.Marshaler interface.
func (Price) ToDeposit ¶ added in v0.15.0
ToDeposit converts an expense amount to a deposit amount using the price. It also rebases to the correct token decimals.
func (Price) ToExpense ¶ added in v0.15.0
ToExpense converts a deposit amount to an expense amount using the price. It also rebases to the correct token decimals.
func (*Price) UnmarshalJSON ¶ added in v0.15.0
UnmarshalJSON implements the json.Unmarshaler interface.
func (Price) WithFeeBips ¶ added in v0.15.0
WithFeeBips returns a new price with the fee in basis points subtracted from the price.
Fees decrease the expense tokens received So it decreases the price (since price denominated in expense tokens). E.g. given a real price (pre-fees) of 800 OMNI/ETH, when depositing 1 ETH the expense amount (post-fees) is less than 800 OMNI.
type PriceRequest ¶ added in v0.15.0
type QuoteRequest ¶ added in v0.13.0
type QuoteRequest struct {
SourceChainID uint64 `json:"sourceChainId"`
DestinationChainID uint64 `json:"destChainId"`
Deposit AddrAmt `json:"deposit"`
Expense AddrAmt `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 AddrAmt `json:"deposit"`
Expense AddrAmt `json:"expense"`
Rejected bool `json:"rejected"`
RejectCode RejectReason `json:"rejectCode"`
RejectReason string `json:"rejectReason"`
RejectDescription string `json:"rejectDescription"`
}
QuoteResponse is the response json for the /api/v1/quote endpoint.
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 RejectCallNotAllowed RejectReason = 13 )
func (RejectReason) String ¶ added in v0.13.0
func (i RejectReason) String() string
type TokenResponse ¶ added in v0.15.0
type TokenResponse struct {
Enabled bool `json:"enabled"`
Name string `json:"name"`
Symbol string `json:"symbol"`
ChainID uint64 `json:"chainId"`
Address common.Address `json:"address"`
Decimals uint `json:"decimals"`
ExpenseMin *hexutil.Big `json:"expenseMin"`
ExpenseMax *hexutil.Big `json:"expenseMax"`
}
type TokensResponse ¶ added in v0.15.0
type TokensResponse struct {
Tokens []TokenResponse `json:"tokens"`
}