Documentation
¶
Index ¶
- func CallsToBindings(calls []Call) []bindings.SolverNetCall
- func ExpensesToBindings(expenses []Expense) []solvernet.Expense
- type AddrAmt
- type Call
- type CallTrace
- 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 RelayError
- type RelayRequest
- type RelayResponse
- 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 CallTrace ¶ added in v0.16.0
type CallTrace struct {
From string `json:"from"`
To string `json:"to"`
Data string `json:"data"`
Value string `json:"value"`
Type string `json:"type"`
Gas string `json:"gas"`
GasUsed string `json:"gasUsed"`
Input string `json:"input"`
Output string `json:"output"`
Error string `json:"error"`
Calls []CallTrace `json:"calls,omitempty"`
}
CallTrace is the result of debug_traceCall. Types kept to strings for simplicity. TODO(kevin): move to lib/ethclient.
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"`
Debug bool `json:"debug"`
}
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"`
Trace map[string]any `json:"trace"` // If debug is true, result of debug_traceCall
}
CheckResponse is the response json for the /check endpoint.
type ContractsResponse ¶ added in v0.13.0
type ContractsResponse struct {
Portal uni.Address `json:"portal"`
Inbox uni.Address `json:"inbox"`
Outbox uni.Address `json:"outbox"`
Middleman uni.Address `json:"middleman"`
Executor uni.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 PriceRequest struct {
SourceChainID uint64 `json:"sourceChainId"`
DestinationChainID uint64 `json:"destChainId"`
DepositToken uni.Address `json:"depositToken"`
ExpenseToken uni.Address `json:"expenseToken"`
IncludeFees bool `json:"includeFees"` // If true, include fees in the price calculation
}
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 RejectExpenseOverMax RejectReason = 11 RejectExpenseUnderMin RejectReason = 12 RejectCallNotAllowed RejectReason = 13 )
func (RejectReason) String ¶ added in v0.13.0
func (i RejectReason) String() string
type RelayError ¶ added in v0.16.0
type RelayError struct {
Code string `json:"code"`
Message string `json:"message"`
Description string `json:"description,omitempty"`
}
RelayError represents an error in relay submission.
type RelayRequest ¶ added in v0.16.0
type RelayRequest struct {
// The gasless cross-chain order to be submitted
Order bindings.IERC7683GaslessCrossChainOrder `json:"order"`
// User's signature authorizing the order
Signature hexutil.Bytes `json:"signature"`
// Optional filler-specific data (currently unused but part of ERC7683 spec)
OriginFillerData hexutil.Bytes `json:"originFillerData,omitempty"`
}
RelayRequest is the expected request body for the /api/v1/relay endpoint. This endpoint accepts gasless orders with user signatures and submits them on behalf of users.
type RelayResponse ¶ added in v0.16.0
type RelayResponse struct {
// Whether the order was successfully submitted
Success bool `json:"success"`
// Transaction hash of the submitted openFor transaction
TxHash common.Hash `json:"txHash,omitempty"`
// Order ID that was created
OrderID common.Hash `json:"orderId,omitempty"`
// Error details if submission failed
Error *RelayError `json:"error,omitempty"`
}
RelayResponse is the response json for the /relay endpoint.
type TokenResponse ¶ added in v0.15.0
type TokenResponse struct {
Enabled bool `json:"enabled"` // Deprecated, use ExpenseEnabled instead
ExpenseEnabled bool `json:"expenseEnabled"`
DepositEnabled bool `json:"depositEnabled"`
Name string `json:"name"`
Symbol string `json:"symbol"`
ChainID uint64 `json:"chainId"`
Address uni.Address `json:"address"`
Decimals uint `json:"decimals"`
ExpenseMin *hexutil.Big `json:"expenseMin"`
ExpenseMax *hexutil.Big `json:"expenseMax"`
ExpenseInventory *hexutil.Big `json:"expenseInventory"`
}
type TokensResponse ¶ added in v0.15.0
type TokensResponse struct {
Tokens []TokenResponse `json:"tokens"`
}