Documentation ¶
Overview ¶
Package aggregation 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 ¶
- type AllowanceResponse
- type ApproveCallDataResponse
- type ApproveCallDataResponseExtended
- type Client
- func (api *Client) GetApproveAllowance(ctx context.Context, params GetAllowanceParams) (*AllowanceResponse, error)
- func (api *Client) GetApproveSpender(ctx context.Context) (*SpenderResponse, error)
- func (api *Client) GetApproveTransaction(ctx context.Context, params GetApproveParams) (*ApproveCallDataResponseExtended, error)
- func (api *Client) GetLiquiditySources(ctx context.Context) (*ProtocolsResponse, error)
- func (api *Client) GetQuote(ctx context.Context, params GetQuoteParams) (*QuoteResponse, error)
- func (api *Client) GetSwap(ctx context.Context, params GetSwapParams) (*SwapResponseExtended, error)
- func (api *Client) GetTokens(ctx context.Context) (*TokensResponse, error)
- type ClientOnlyAPI
- func (api *ClientOnlyAPI) GetApproveAllowance(ctx context.Context, params GetAllowanceParams) (*AllowanceResponse, error)
- func (api *ClientOnlyAPI) GetApproveSpender(ctx context.Context) (*SpenderResponse, error)
- func (api *ClientOnlyAPI) GetApproveTransaction(ctx context.Context, params GetApproveParams) (*ApproveCallDataResponseExtended, error)
- func (api *ClientOnlyAPI) GetLiquiditySources(ctx context.Context) (*ProtocolsResponse, error)
- func (api *ClientOnlyAPI) GetQuote(ctx context.Context, params GetQuoteParams) (*QuoteResponse, error)
- func (api *ClientOnlyAPI) GetSwap(ctx context.Context, params GetSwapParams) (*SwapResponseExtended, error)
- func (api *ClientOnlyAPI) GetTokens(ctx context.Context) (*TokensResponse, error)
- type Configuration
- type ConfigurationAPI
- type ConfigurationParams
- type ConfigurationWallet
- type GetAllowanceParams
- type GetApproveParams
- type GetQuoteParams
- type GetSwapParams
- type HttpExceptionMeta
- type NormalizedTransactionData
- type ProtocolImage
- type ProtocolsResponse
- type QuoteRequestError
- type QuoteRequestErrorStatusCode
- type QuoteResponse
- type SelectedProtocol
- type SpenderResponse
- type SwapRequestError
- type SwapRequestErrorStatusCode
- type SwapResponse
- type SwapResponseExtended
- type TokenInfo
- type TokensResponse
- type TransactionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowanceResponse ¶
type AllowanceResponse struct { // Allowance Allowance amount Allowance string `json:"allowance"` }
AllowanceResponse defines model for AllowanceResponse.
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 ApproveCallDataResponseExtended ¶
type ApproveCallDataResponseExtended struct { ApproveCallDataResponse TxNormalized NormalizedTransactionData }
type Client ¶
type Client struct { Wallet common.Wallet TxBuilder common.TransactionBuilderFactory // contains filtered or unexported fields }
func NewClient ¶
func NewClient(cfg *Configuration) (*Client, error)
func (*Client) GetApproveAllowance ¶
func (api *Client) GetApproveAllowance(ctx context.Context, params GetAllowanceParams) (*AllowanceResponse, error)
GetApproveAllowance returns the allowance the 1inch router has to spend a token on behalf of a wallet
func (*Client) GetApproveSpender ¶
func (api *Client) GetApproveSpender(ctx context.Context) (*SpenderResponse, error)
GetApproveSpender returns the address of the 1inch router contract
func (*Client) GetApproveTransaction ¶
func (api *Client) GetApproveTransaction(ctx context.Context, params GetApproveParams) (*ApproveCallDataResponseExtended, error)
GetApproveTransaction returns the transaction data for approving the 1inch router to spend a token on behalf of a wallet
func (*Client) GetLiquiditySources ¶
func (api *Client) GetLiquiditySources(ctx context.Context) (*ProtocolsResponse, error)
GetLiquiditySources returns all liquidity sources tracked by the 1inch Aggregation Protocol for a given chain
func (*Client) GetQuote ¶
func (api *Client) GetQuote(ctx context.Context, params GetQuoteParams) (*QuoteResponse, error)
GetQuote returns the quote for a potential swap through the Aggregation Protocol
func (*Client) GetSwap ¶
func (api *Client) GetSwap(ctx context.Context, params GetSwapParams) (*SwapResponseExtended, error)
GetSwap returns a swap quote with transaction data that can be used to execute a swap through the Aggregation Protocol
type ClientOnlyAPI ¶
type ClientOnlyAPI struct {
// contains filtered or unexported fields
}
func NewClientOnlyAPI ¶
func NewClientOnlyAPI(cfg *ConfigurationAPI) (*ClientOnlyAPI, error)
func (*ClientOnlyAPI) GetApproveAllowance ¶
func (api *ClientOnlyAPI) GetApproveAllowance(ctx context.Context, params GetAllowanceParams) (*AllowanceResponse, error)
GetApproveAllowance returns the allowance the 1inch router has to spend a token on behalf of a wallet
func (*ClientOnlyAPI) GetApproveSpender ¶
func (api *ClientOnlyAPI) GetApproveSpender(ctx context.Context) (*SpenderResponse, error)
GetApproveSpender returns the address of the 1inch router contract
func (*ClientOnlyAPI) GetApproveTransaction ¶
func (api *ClientOnlyAPI) GetApproveTransaction(ctx context.Context, params GetApproveParams) (*ApproveCallDataResponseExtended, error)
GetApproveTransaction returns the transaction data for approving the 1inch router to spend a token on behalf of a wallet
func (*ClientOnlyAPI) GetLiquiditySources ¶
func (api *ClientOnlyAPI) GetLiquiditySources(ctx context.Context) (*ProtocolsResponse, error)
GetLiquiditySources returns all liquidity sources tracked by the 1inch Aggregation Protocol for a given chain
func (*ClientOnlyAPI) GetQuote ¶
func (api *ClientOnlyAPI) GetQuote(ctx context.Context, params GetQuoteParams) (*QuoteResponse, error)
GetQuote returns the quote for a potential swap through the Aggregation Protocol
func (*ClientOnlyAPI) GetSwap ¶
func (api *ClientOnlyAPI) GetSwap(ctx context.Context, params GetSwapParams) (*SwapResponseExtended, error)
GetSwap returns a swap quote with transaction data that can be used to execute a swap through the Aggregation Protocol
type Configuration ¶
type Configuration struct { WalletConfiguration *ConfigurationWallet APIConfiguration *ConfigurationAPI }
func NewConfiguration ¶
func NewConfiguration(params ConfigurationParams) (*Configuration, error)
type ConfigurationAPI ¶
func NewConfigurationAPI ¶
func NewConfigurationAPI(chainId uint64, apiUrl string, apiKey string) (*ConfigurationAPI, error)
type ConfigurationParams ¶
type ConfigurationWallet ¶
type ConfigurationWallet struct { PrivateKey string NodeURL string Wallet common.Wallet TxBuilder common.TransactionBuilderFactory }
func NewConfigurationWallet ¶
func NewConfigurationWallet(nodeUrl string, privateKey string, chainId uint64) (*ConfigurationWallet, error)
type GetAllowanceParams ¶
type GetAllowanceParams 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"` }
GetAllowanceParams defines parameters for GetAllowance.
func (*GetAllowanceParams) Validate ¶
func (params *GetAllowanceParams) Validate() error
type GetApproveParams ¶
type GetApproveParams 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"` }
GetApproveParams defines parameters for GetApprove.
func (*GetApproveParams) Validate ¶
func (params *GetApproveParams) Validate() error
type GetQuoteParams ¶
type GetQuoteParams 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"` }
GetQuoteParams defines parameters for GetQuote.
func (*GetQuoteParams) Validate ¶
func (params *GetQuoteParams) Validate() error
type GetSwapParams ¶
type GetSwapParams 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"` }
GetSwapParams defines parameters for GetSwap.
func (*GetSwapParams) Validate ¶
func (params *GetSwapParams) Validate() error
type HttpExceptionMeta ¶
HttpExceptionMeta defines model for HttpExceptionMeta.
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 *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 *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 *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 *TokenInfo `json:"toToken,omitempty"` Tx TransactionData `json:"tx"` }
SwapResponse defines model for SwapResponse.
type SwapResponseExtended ¶
type SwapResponseExtended struct { SwapResponse TxNormalized NormalizedTransactionData `json:"txNormalized"` }
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 ¶
TokensResponse defines model for TokensResponse.