Documentation
¶
Overview ¶
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 ¶
- func ConfirmApprovalWithUser(ethClient *ethclient.Client, publicAddress string, tokenAddress string) (bool, error)
- func ConfirmExecuteSwapWithUser(config *ExecuteSwapConfig) (bool, error)
- func ConfirmSwapDataWithUser(swapResponse *SwapResponse, fromAmount string, slippage float32) error
- type AggregationControllerGetQuoteParams
- type AggregationControllerGetSwapParams
- type AllowanceResponse
- type ApproveAllowanceParams
- type ApproveCallDataResponse
- type ApproveControllerGetAllowanceParams
- type ApproveControllerGetCallDataParams
- type ApproveSpenderParams
- type ApproveTransactionParams
- type ExecuteSwapConfig
- type GetLiquiditySourcesParams
- type GetQuoteParams
- type GetSwapDataParams
- type GetTokensParams
- type HttpExceptionMeta
- type ProtocolImage
- type ProtocolsResponse
- type QuoteRequestError
- type QuoteRequestErrorStatusCode
- type QuoteResponse
- type SelectedProtocol
- type SpenderResponse
- type SwapRequestError
- type SwapRequestErrorStatusCode
- type SwapResponse
- type SwapTokensParams
- type TokenInfo
- type TokensResponse
- type TransactionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfirmApprovalWithUser ¶
func ConfirmExecuteSwapWithUser ¶
func ConfirmExecuteSwapWithUser(config *ExecuteSwapConfig) (bool, error)
func ConfirmSwapDataWithUser ¶
func ConfirmSwapDataWithUser(swapResponse *SwapResponse, fromAmount string, slippage float32) error
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 ExecuteSwapConfig ¶
type GetLiquiditySourcesParams ¶
type GetLiquiditySourcesParams struct {
ChainId int
}
func (*GetLiquiditySourcesParams) Validate ¶
func (params *GetLiquiditySourcesParams) Validate() error
type GetQuoteParams ¶
type GetQuoteParams struct { ChainId int AggregationControllerGetQuoteParams }
func (*GetQuoteParams) Validate ¶
func (params *GetQuoteParams) Validate() error
type GetSwapDataParams ¶
type GetSwapDataParams struct { ChainId int SkipWarnings bool AggregationControllerGetSwapParams }
func (*GetSwapDataParams) Validate ¶
func (params *GetSwapDataParams) Validate() error
type GetTokensParams ¶
type GetTokensParams struct {
ChainId int
}
func (*GetTokensParams) Validate ¶
func (params *GetTokensParams) 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 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 ¶
TokensResponse defines model for TokensResponse.