models

package
v0.0.0-...-d09159b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package orderbook provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Package swap provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.16.2 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var ErrorFailWhenApprovalIsNeeded = errors.New("1inch router does not have approval for this token")

Functions

This section is empty.

Types

type AggregationControllerGetQuoteParams

type AggregationControllerGetQuoteParams struct {
	Src    string `url:"src" json:"src"`
	Dst    string `url:"dst" json:"dst"`
	Amount string `url:"amount" json:"amount"`

	// Protocols All supported liquidity sources by default
	Protocols string `url:"protocols,omitempty" json:"protocols,omitempty"`

	// Fee Partner fee. min: 0; max: 3 Should be the same for /quote and /swap
	Fee float32 `url:"fee,omitempty" json:"fee,omitempty"`

	// GasPrice Network price per gas in wei. By default fast network gas price
	GasPrice        string  `url:"gasPrice,omitempty" json:"gasPrice,omitempty"`
	ComplexityLevel float32 `url:"complexityLevel,omitempty" json:"complexityLevel,omitempty"`
	Parts           float32 `url:"parts,omitempty" json:"parts,omitempty"`
	MainRouteParts  float32 `url:"mainRouteParts,omitempty" json:"mainRouteParts,omitempty"`
	GasLimit        float32 `url:"gasLimit,omitempty" json:"gasLimit,omitempty"`

	// IncludeTokensInfo Return fromToken and toToken info in response
	IncludeTokensInfo bool `url:"includeTokensInfo,omitempty" json:"includeTokensInfo,omitempty"`

	// IncludeProtocols Return used swap protocols in response
	IncludeProtocols bool `url:"includeProtocols,omitempty" json:"includeProtocols,omitempty"`

	// IncludeGas Return approximated gas in response
	IncludeGas      bool   `url:"includeGas,omitempty" json:"includeGas,omitempty"`
	ConnectorTokens string `url:"connectorTokens,omitempty" json:"connectorTokens,omitempty"`
}

AggregationControllerGetQuoteParams defines parameters for AggregationControllerGetQuote.

type AggregationControllerGetSwapParams

type AggregationControllerGetSwapParams struct {
	Src    string `url:"src" json:"src"`
	Dst    string `url:"dst" json:"dst"`
	Amount string `url:"amount" json:"amount"`

	// From The address that calls the 1inch contract
	From string `url:"from" json:"from"`

	// Slippage min: 0; max: 50
	Slippage float32 `url:"slippage" json:"slippage"`

	// Protocols All supported liquidity sources by default
	Protocols string `url:"protocols,omitempty" json:"protocols,omitempty"`

	// Fee Partner fee. min: 0; max: 3 Should be the same for /quote and /swap
	Fee float32 `url:"fee,omitempty" json:"fee,omitempty"`

	// GasPrice Network price per gas in wei. By default fast network gas price
	GasPrice        string  `url:"gasPrice,omitempty" json:"gasPrice,omitempty"`
	ComplexityLevel float32 `url:"complexityLevel,omitempty" json:"complexityLevel,omitempty"`
	Parts           float32 `url:"parts,omitempty" json:"parts,omitempty"`
	MainRouteParts  float32 `url:"mainRouteParts,omitempty" json:"mainRouteParts,omitempty"`
	GasLimit        float32 `url:"gasLimit,omitempty" json:"gasLimit,omitempty"`

	// IncludeTokensInfo Return fromToken and toToken info in response
	IncludeTokensInfo bool `url:"includeTokensInfo,omitempty" json:"includeTokensInfo,omitempty"`

	// IncludeProtocols Return used swap protocols in response
	IncludeProtocols bool `url:"includeProtocols,omitempty" json:"includeProtocols,omitempty"`

	// IncludeGas Return approximated gas in response
	IncludeGas      bool   `url:"includeGas,omitempty" json:"includeGas,omitempty"`
	ConnectorTokens string `url:"connectorTokens,omitempty" json:"connectorTokens,omitempty"`

	// Permit https://eips.ethereum.org/EIPS/eip-2612
	Permit string `url:"permit,omitempty" json:"permit,omitempty"`

	// Receiver This address will receive funds after the swap. By default same address as "from" param
	Receiver string `url:"receiver,omitempty" json:"receiver,omitempty"`
	Referrer string `url:"referrer,omitempty" json:"referrer,omitempty"`

	// AllowPartialFill By default set to false
	AllowPartialFill bool `url:"allowPartialFill,omitempty" json:"allowPartialFill,omitempty"`

	// DisableEstimate Enable this flag to disable onchain simulation
	DisableEstimate bool `url:"disableEstimate,omitempty" json:"disableEstimate,omitempty"`
}

AggregationControllerGetSwapParams defines parameters for AggregationControllerGetSwap.

func (*AggregationControllerGetSwapParams) Validate

func (params *AggregationControllerGetSwapParams) Validate() error

type AllowanceResponse

type AllowanceResponse struct {
	// Allowance Allowance amount
	Allowance string `json:"allowance"`
}

AllowanceResponse defines model for AllowanceResponse.

type ApproveAllowanceParams

type ApproveAllowanceParams struct {
	ChainId int
	ApproveControllerGetAllowanceParams
}

func (*ApproveAllowanceParams) Validate

func (params *ApproveAllowanceParams) Validate() error

type ApproveCallDataResponse

type ApproveCallDataResponse struct {
	// Data The encoded data to call the approve method on the swapped token contract
	Data string `json:"data"`

	// GasPrice Network high gas price in wei
	GasPrice string `json:"gasPrice"`

	// To Token address that will be allowed to exchange through 1inch Router
	To string `json:"to"`

	// Value Native token value in wei (for approve is always 0)
	Value string `json:"value"`
}

ApproveCallDataResponse defines model for ApproveCallDataResponse.

type ApproveControllerGetAllowanceParams

type ApproveControllerGetAllowanceParams struct {
	// TokenAddress Token address you want to swap
	TokenAddress string `url:"tokenAddress" json:"tokenAddress"`

	// WalletAddress Wallet address for which you want to check
	WalletAddress string `url:"walletAddress" json:"walletAddress"`
}

ApproveControllerGetAllowanceParams defines parameters for ApproveControllerGetAllowance.

func (*ApproveControllerGetAllowanceParams) Validate

func (params *ApproveControllerGetAllowanceParams) Validate() error

type ApproveControllerGetCallDataParams

type ApproveControllerGetCallDataParams struct {
	// TokenAddress Token address you want to swap
	TokenAddress string `url:"tokenAddress" json:"tokenAddress"`

	// Amount The number of tokens that the 1inch Router is allowed to swap.If not specified, it will be allowed to spend an infinite amount of tokens.
	Amount string `url:"amount,omitempty" json:"amount,omitempty"`
}

ApproveControllerGetCallDataParams defines parameters for ApproveControllerGetCallData.

func (*ApproveControllerGetCallDataParams) Validate

func (params *ApproveControllerGetCallDataParams) Validate() error

type ApproveSpenderParams

type ApproveSpenderParams struct {
	ChainId int
}

func (*ApproveSpenderParams) Validate

func (params *ApproveSpenderParams) Validate() error

type ApproveTransactionParams

type ApproveTransactionParams struct {
	ChainId int
	ApproveControllerGetCallDataParams
}

func (*ApproveTransactionParams) Validate

func (params *ApproveTransactionParams) Validate() error

type CountResponse

type CountResponse struct {
	Count int `json:"count"`
}

type CreateOrderParams

type CreateOrderParams struct {
	ApprovalType                   onchain.ApprovalType
	ChainId                        int
	PrivateKey                     string
	ExpireAfter                    int64
	Maker                          string
	MakerAsset                     string
	TakerAsset                     string
	TakingAmount                   string
	MakingAmount                   string
	Taker                          string
	SkipWarnings                   bool
	EnableOnchainApprovalsIfNeeded bool
}

func (*CreateOrderParams) Validate

func (params *CreateOrderParams) Validate() error

type CreateOrderResponse

type CreateOrderResponse struct {
	Success bool `json:"success"`
}

type EventResponse

type EventResponse struct {
	Id                   int       `json:"id"`
	Network              int       `json:"network"`
	LogId                string    `json:"logId"`
	Version              int       `json:"version"`
	Action               string    `json:"action"`
	OrderHash            string    `json:"orderHash"`
	Taker                string    `json:"taker"`
	RemainingMakerAmount string    `json:"remainingMakerAmount"`
	TransactionHash      string    `json:"transactionHash"`
	BlockNumber          int       `json:"blockNumber"`
	CreateDateTime       time.Time `json:"createDateTime"`
}

type ExecuteSwapConfig

type ExecuteSwapConfig struct {
	WalletKey          string
	ChainId            int
	PublicAddress      string
	FromToken          *TokenInfo
	ToToken            *TokenInfo
	Amount             string
	Slippage           float32
	EstimatedAmountOut string
	TransactionData    string
	IsPermitSwap       bool
	SkipWarnings       bool
}

type GetActiveOrdersWithPermitParams

type GetActiveOrdersWithPermitParams struct {
	ChainId int
	Wallet  string
	Token   string
}

func (*GetActiveOrdersWithPermitParams) Validate

func (params *GetActiveOrdersWithPermitParams) Validate() error

type GetAllOrdersParams

type GetAllOrdersParams struct {
	ChainId int
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams
}

func (*GetAllOrdersParams) Validate

func (params *GetAllOrdersParams) Validate() error

type GetCountParams

type GetCountParams struct {
	ChainId int
	LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams
}

func (*GetCountParams) Validate

func (params *GetCountParams) Validate() error

type GetEventParams

type GetEventParams struct {
	ChainId   int
	OrderHash string
}

func (*GetEventParams) Validate

func (params *GetEventParams) Validate() error

type GetEventsParams

type GetEventsParams struct {
	ChainId int
	LimitOrderV3SubscribedApiControllerGetEventsParams
}

func (*GetEventsParams) Validate

func (params *GetEventsParams) Validate() error

type GetLiquiditySourcesParams

type GetLiquiditySourcesParams struct {
	ChainId int
}

func (*GetLiquiditySourcesParams) Validate

func (params *GetLiquiditySourcesParams) Validate() error

type GetOrdersByCreatorAddressParams

type GetOrdersByCreatorAddressParams struct {
	ChainId        int
	CreatorAddress string
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams
}

func (*GetOrdersByCreatorAddressParams) Validate

func (params *GetOrdersByCreatorAddressParams) Validate() error

type GetQuoteParams

type GetQuoteParams struct {
	ChainId int
	AggregationControllerGetQuoteParams
}

func (*GetQuoteParams) Validate

func (params *GetQuoteParams) Validate() error

type GetSwapParams

type GetSwapParams struct {
	ChainId      int
	SkipWarnings bool
	AggregationControllerGetSwapParams
}

func (*GetSwapParams) Validate

func (params *GetSwapParams) Validate() error

type GetTokensParams

type GetTokensParams struct {
	ChainId int
}

func (*GetTokensParams) Validate

func (params *GetTokensParams) Validate() error

type HttpExceptionMeta

type HttpExceptionMeta struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

HttpExceptionMeta defines model for HttpExceptionMeta.

type LimitOrderV3Data

type LimitOrderV3Data struct {
	// AllowedSender An address of the wallet or contract who will be able to fill this order (equals to Zero address on public orders)
	AllowedSender string `json:"allowedSender,omitempty"`

	// Interactions Merged offsets of each field in interactions
	Interactions string `json:"interactions,omitempty"`

	// Maker An address of the maker (wallet or contract address)
	Maker string `json:"maker"`

	// MakerAsset Address of the maker asset
	MakerAsset string `json:"makerAsset"`

	// MakingAmount Order maker's token amount
	MakingAmount string `json:"makingAmount"`

	// Offsets An interaction call data. ABI encoded set of makerAssetData, takerAssetData, getMakingAmount, getTakingAmount, predicate, permit, preInteraction, postInteraction
	Offsets string `json:"offsets,omitempty"`

	// Receiver An address of the wallet or contract who will receive filled amount (equals to Zero address for receiver == makerAddress)
	Receiver string `json:"receiver,omitempty"`

	// Salt Some unique value. It is necessary to be able to create limit orders with the same parameters (so that they have a different hash)
	Salt string `json:"salt"`

	// TakerAsset Address of the taker asset
	TakerAsset string `json:"takerAsset"`

	// TakingAmount Order taker's token amount
	TakingAmount string `json:"takingAmount"`
}

LimitOrderV3Data defines model for LimitOrderV3Data.

type LimitOrderV3Request

type LimitOrderV3Request struct {
	// Data Limit order data
	Data LimitOrderV3Data `json:"data"`

	// OrderHash Hash of the limit order typed data
	OrderHash string `json:"orderHash"`

	// Signature Signature of the limit order typed data (using signTypedData_v4)
	Signature string `json:"signature"`
}

LimitOrderV3Request defines model for LimitOrderV3Request.

type LimitOrderV3SubscribedApiControllerCreateLimitOrderJSONRequestBody

type LimitOrderV3SubscribedApiControllerCreateLimitOrderJSONRequestBody = LimitOrderV3Request

LimitOrderV3SubscribedApiControllerCreateLimitOrderJSONRequestBody defines body for LimitOrderV3SubscribedApiControllerCreateLimitOrder for application/json ContentType.

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams struct {
	// Page Pagination step, default: 1 (page = offset / limit)
	Page float32 `url:"page,omitempty" json:"page,omitempty"`

	// Limit Number of limit orders to receive (default: 100, max: 500)
	Limit float32 `url:"limit,omitempty" json:"limit,omitempty"`

	// Statuses JSON an array of statuses by which limit orders will be filtered: 1 - valid limit orders, 2 - temporary invalid limit orders, 3 - invalid limit orders
	Statuses []float32                                                        `url:"statuses,omitempty" json:"statuses,omitempty"`
	SortBy   LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy `url:"sortBy,omitempty" json:"sortBy,omitempty"`

	// TakerAsset Address of the maker asset
	TakerAsset string `url:"takerAsset,omitempty" json:"takerAsset,omitempty"`

	// MakerAsset Address of the maker asset
	MakerAsset string `url:"makerAsset,omitempty" json:"makerAsset,omitempty"`
}

LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParams defines parameters for LimitOrderV3SubscribedApiControllerGetAllLimitOrders.

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy

type LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy string

LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy defines parameters for LimitOrderV3SubscribedApiControllerGetAllLimitOrders.

const (
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByCreateDateTime LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "createDateTime"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByMakerAmount    LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "makerAmount"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByMakerRate      LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "makerRate"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByTakerAmount    LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "takerAmount"
	LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortByTakerRate      LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy = "takerRate"
)

Defines values for LimitOrderV3SubscribedApiControllerGetAllLimitOrdersParamsSortBy.

type LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams

type LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams struct {
	Statuses []string `url:"statuses" json:"statuses"`
}

LimitOrderV3SubscribedApiControllerGetAllOrdersCountParams defines parameters for LimitOrderV3SubscribedApiControllerGetAllOrdersCount.

type LimitOrderV3SubscribedApiControllerGetEventsParams

type LimitOrderV3SubscribedApiControllerGetEventsParams struct {
	Limit float32 `url:"limit" json:"limit"`
}

LimitOrderV3SubscribedApiControllerGetEventsParams defines parameters for LimitOrderV3SubscribedApiControllerGetEvents.

type LimitOrderV3SubscribedApiControllerGetLimitOrderParams

type LimitOrderV3SubscribedApiControllerGetLimitOrderParams struct {
	// Page Pagination step, default: 1 (page = offset / limit)
	Page float32 `url:"page,omitempty" json:"page,omitempty"`

	// Limit Number of limit orders to receive (default: 100, max: 500)
	Limit float32 `url:"limit,omitempty" json:"limit,omitempty"`

	// Statuses JSON an array of statuses by which limit orders will be filtered: 1 - valid limit orders, 2 - temporary invalid limit orders, 3 - invalid limit orders
	Statuses []float32                                                    `url:"statuses,omitempty" json:"statuses,omitempty"`
	SortBy   LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy `url:"sortBy,omitempty" json:"sortBy,omitempty"`

	// TakerAsset Address of the taker asset
	TakerAsset string `url:"takerAsset,omitempty" json:"takerAsset,omitempty"`

	// MakerAsset Address of the maker asset
	MakerAsset string `url:"makerAsset,omitempty" json:"makerAsset,omitempty"`
}

LimitOrderV3SubscribedApiControllerGetLimitOrderParams defines parameters for LimitOrderV3SubscribedApiControllerGetLimitOrder.

type LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy

type LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy string

LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy defines parameters for LimitOrderV3SubscribedApiControllerGetLimitOrder.

const (
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByCreateDateTime LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "createDateTime"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByMakerAmount    LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "makerAmount"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByMakerRate      LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "makerRate"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByTakerAmount    LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "takerAmount"
	LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortByTakerRate      LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy = "takerRate"
)

Defines values for LimitOrderV3SubscribedApiControllerGetLimitOrderParamsSortBy.

type Order

type Order struct {
	OrderHash string    `json:"orderHash"`
	Signature string    `json:"signature"`
	Data      OrderData `json:"data"`
}

type OrderData

type OrderData struct {
	MakerAsset    string `json:"makerAsset"`
	TakerAsset    string `json:"takerAsset"`
	MakingAmount  string `json:"makingAmount"`
	TakingAmount  string `json:"takingAmount"`
	Salt          string `json:"salt"`
	Maker         string `json:"maker"`
	AllowedSender string `json:"allowedSender"`
	Receiver      string `json:"receiver"`
	Offsets       string `json:"offsets"`
	Interactions  string `json:"interactions"`
}

type OrderResponse

type OrderResponse struct {
	Signature            string    `json:"signature"`
	OrderHash            string    `json:"orderHash"`
	CreateDateTime       time.Time `json:"createDateTime"`
	RemainingMakerAmount string    `json:"remainingMakerAmount"`
	MakerBalance         string    `json:"makerBalance"`
	MakerAllowance       string    `json:"makerAllowance"`
	Data                 struct {
		MakerAsset    string `json:"makerAsset"`
		TakerAsset    string `json:"takerAsset"`
		Salt          string `json:"salt"`
		Receiver      string `json:"receiver"`
		AllowedSender string `json:"allowedSender"`
		MakingAmount  string `json:"makingAmount"`
		TakingAmount  string `json:"takingAmount"`
		Maker         string `json:"maker"`
		Interactions  string `json:"interactions"`
		Offsets       string `json:"offsets"`
	} `json:"data"`
	MakerRate          string      `json:"makerRate"`
	TakerRate          string      `json:"takerRate"`
	IsMakerContract    bool        `json:"isMakerContract"`
	OrderInvalidReason interface{} `json:"orderInvalidReason"`
}

type ProtocolImage

type ProtocolImage struct {
	// Id Protocol id
	Id string `json:"id"`

	// Img Protocol logo image
	Img string `json:"img"`

	// ImgColor Protocol logo image in color
	ImgColor string `json:"img_color"`

	// Title Protocol title
	Title string `json:"title"`
}

ProtocolImage defines model for ProtocolImage.

type ProtocolsResponse

type ProtocolsResponse struct {
	// Protocols List of protocols that are available for routing in the 1inch Aggregation Protocol
	Protocols []ProtocolImage `json:"protocols"`
}

ProtocolsResponse defines model for ProtocolsResponse.

type QuoteRequestError

type QuoteRequestError struct {
	// Description Error description
	Description string `json:"description"`

	// Error Error code description
	Error string `json:"error"`

	// Meta Meta information
	Meta []HttpExceptionMeta `json:"meta"`

	// RequestId Request id
	RequestId string `json:"requestId"`

	// StatusCode HTTP code
	StatusCode QuoteRequestErrorStatusCode `json:"statusCode"`
}

QuoteRequestError defines model for QuoteRequestError.

type QuoteRequestErrorStatusCode

type QuoteRequestErrorStatusCode float32

QuoteRequestErrorStatusCode HTTP code

const (
	QuoteRequestErrorStatusCodeN400 QuoteRequestErrorStatusCode = 400
	QuoteRequestErrorStatusCodeN500 QuoteRequestErrorStatusCode = 500
)

Defines values for QuoteRequestErrorStatusCode.

type QuoteResponse

type QuoteResponse struct {
	// FromToken Source token info
	FromToken *TokenInfo `json:"fromToken,omitempty"`

	// Gas Estimated gas
	Gas float32 `json:"gas,omitempty"`

	// Protocols Selected protocols in a path
	Protocols [][][]SelectedProtocol `json:"protocols,omitempty"`

	// ToAmount Expected amount of destination token
	ToAmount string `json:"toAmount"`

	// ToToken Destination token info
	ToToken *TokenInfo `json:"toToken,omitempty"`
}

QuoteResponse defines model for QuoteResponse.

type SelectedProtocol

type SelectedProtocol struct {
	// FromTokenAddress Source token to swap on protocol
	FromTokenAddress string `json:"fromTokenAddress"`

	// Name Protocol id
	Name string `json:"name"`

	// Part Protocol share
	Part float32 `json:"part"`

	// ToTokenAddress Destination token to swap on protocol
	ToTokenAddress string `json:"toTokenAddress"`
}

SelectedProtocol defines model for SelectedProtocol.

type SpenderResponse

type SpenderResponse struct {
	// Address Address of the 1inch Router that is trusted to spend funds for the swap
	Address string `json:"address"`
}

SpenderResponse defines model for SpenderResponse.

type SwapRequestError

type SwapRequestError struct {
	// Description Error description
	Description string `json:"description"`

	// Error Error code description
	Error string `json:"error"`

	// Meta Meta information
	Meta []HttpExceptionMeta `json:"meta"`

	// RequestId Request id
	RequestId string `json:"requestId"`

	// StatusCode HTTP code
	StatusCode SwapRequestErrorStatusCode `json:"statusCode"`
}

SwapRequestError defines model for SwapRequestError.

type SwapRequestErrorStatusCode

type SwapRequestErrorStatusCode float32

SwapRequestErrorStatusCode HTTP code

const (
	SwapRequestErrorStatusCodeN400 SwapRequestErrorStatusCode = 400
	SwapRequestErrorStatusCodeN500 SwapRequestErrorStatusCode = 500
)

Defines values for SwapRequestErrorStatusCode.

type SwapResponse

type SwapResponse struct {
	// FromToken Source token info
	FromToken *TokenInfo `json:"fromToken,omitempty"`

	// Protocols Selected protocols in a path
	Protocols [][][]SelectedProtocol `json:"protocols,omitempty"`

	// ToAmount Expected amount of destination token
	ToAmount string `json:"toAmount"`

	// ToToken Destination token info
	ToToken *TokenInfo `json:"toToken,omitempty"`

	// Tx Transaction object
	Tx TransactionData `json:"tx"`
}

SwapResponse defines model for SwapResponse.

type SwapTokensParams

type SwapTokensParams struct {
	ApprovalType  onchain.ApprovalType
	ChainId       int
	SkipWarnings  bool
	PublicAddress string
	WalletKey     string
	AggregationControllerGetSwapParams
}

func (*SwapTokensParams) Validate

func (params *SwapTokensParams) Validate() error

type TokenInfo

type TokenInfo struct {
	Address       string   `json:"address"`
	Decimals      float32  `json:"decimals"`
	DomainVersion string   `json:"domainVersion,omitempty"`
	Eip2612       bool     `json:"eip2612,omitempty"`
	IsFoT         bool     `json:"isFoT,omitempty"`
	LogoURI       string   `json:"logoURI"`
	Name          string   `json:"name"`
	Symbol        string   `json:"symbol"`
	Tags          []string `json:"tags,omitempty"`
}

TokenInfo defines model for TokenInfo.

type TokensResponse

type TokensResponse struct {
	Tokens map[string]TokenInfo `json:"tokens"`
}

TokensResponse defines model for TokensResponse.

type TransactionData

type TransactionData struct {
	Data     string  `json:"data"`
	From     string  `json:"from"`
	Gas      float32 `json:"gas"`
	GasPrice string  `json:"gasPrice"`
	To       string  `json:"to"`
	Value    string  `json:"value"`
}

TransactionData defines model for TransactionData.

Jump to

Keyboard shortcuts

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