types

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

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

func ExpensesToBindings(expenses []Expense) []solvernet.Expense

Types

type AddrAmt added in v0.14.0

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

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 (u AddrAmt) MarshalJSON() ([]byte, error)

func (*AddrAmt) UnmarshalJSON added in v0.14.0

func (u *AddrAmt) UnmarshalJSON(bz []byte) error

type Call added in v0.14.0

type Call solvernet.Call

Call wraps solvernet.Call to provide custom json marshaling.

func (Call) MarshalJSON added in v0.14.0

func (c Call) MarshalJSON() ([]byte, error)

func (*Call) UnmarshalJSON added in v0.14.0

func (c *Call) UnmarshalJSON(bz []byte) error

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.

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

type Expense solvernet.Expense

Expense wraps solvernet.Expense to provide custom json marshaling.

func (Expense) MarshalJSON added in v0.14.0

func (e Expense) MarshalJSON() ([]byte, error)

func (*Expense) UnmarshalJSON added in v0.14.0

func (e *Expense) UnmarshalJSON(bz []byte) error

type JSONError added in v0.14.0

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

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

Jump to

Keyboard shortcuts

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