pub struct CreateSwapQuoteResponse {
pub block_number: CreateSwapQuoteResponseBlockNumber,
pub fees: CreateSwapQuoteResponseFees,
pub from_amount: CreateSwapQuoteResponseFromAmount,
pub from_token: CreateSwapQuoteResponseFromToken,
pub issues: CreateSwapQuoteResponseIssues,
pub liquidity_available: bool,
pub min_to_amount: CreateSwapQuoteResponseMinToAmount,
pub permit2: Option<CreateSwapQuoteResponsePermit2>,
pub to_amount: CreateSwapQuoteResponseToAmount,
pub to_token: CreateSwapQuoteResponseToToken,
pub transaction: CreateSwapQuoteResponseTransaction,
}
Expand description
CreateSwapQuoteResponse
JSON schema
{
"title": "CreateSwapQuoteResponse",
"allOf": [
{
"type": "object",
"required": [
"permit2",
"transaction"
],
"properties": {
"permit2": {
"description": "The approval object which contains the necessary fields to submit an approval for this transaction. Null if the `fromToken` is the native token or the transaction is a native token wrap / unwrap.",
"type": [
"object",
"null"
],
"required": [
"eip712",
"hash"
],
"properties": {
"eip712": {
"$ref": "#/components/schemas/EIP712Message"
},
"hash": {
"description": "The hash for the approval according to [EIP-712](https://eips.ethereum.org/EIPS/eip-712). Computing the hash of the `eip712` field should match the value of this field.",
"examples": [
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
],
"type": "string",
"pattern": "^0x[a-fA-F0-9]{64}$"
}
}
},
"transaction": {
"description": "The details of the transaction to be signed and submitted to execute the swap.",
"type": "object",
"required": [
"data",
"gas",
"gasPrice",
"to",
"value"
],
"properties": {
"data": {
"description": "The hex-encoded call data to send to the contract.",
"examples": [
"0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef"
],
"type": "string"
},
"gas": {
"description": "The estimated gas limit that should be used to send the transaction to guarantee settlement.",
"examples": [
"100000"
],
"type": "string",
"pattern": "^\\d+$"
},
"gasPrice": {
"description": "The gas price, in Wei, that should be used to send the transaction. For EIP-1559 transactions, this value should be seen as the `maxFeePerGas` value. The transaction should be sent with this gas price to guarantee settlement.",
"examples": [
"1000000000"
],
"type": "string",
"pattern": "^\\d+$"
},
"to": {
"description": "The 0x-prefixed address of the contract to call.",
"examples": [
"0x000000000022D473030F116dDEE9F6B43aC78BA3"
],
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
"value": {
"description": "The value of the transaction in Wei.",
"examples": [
"1000000000000000000"
],
"type": "string",
"pattern": "^\\d+$"
}
}
}
}
},
{
"$ref": "#/components/schemas/CommonSwapResponse"
}
]
}
Fields§
§block_number: CreateSwapQuoteResponseBlockNumber
The block number at which the liquidity conditions were examined.
fees: CreateSwapQuoteResponseFees
§from_amount: CreateSwapQuoteResponseFromAmount
The amount of the fromToken
that will be sent in this swap, in atomic units of the fromToken
. For example, 1000000000000000000
when sending ETH equates to 1 ETH, 1000000
when sending USDC equates to 1 USDC, etc.
from_token: CreateSwapQuoteResponseFromToken
The 0x-prefixed contract address of the token that will be sent.
issues: CreateSwapQuoteResponseIssues
§liquidity_available: bool
Whether sufficient liquidity is available to settle the swap. All other fields in the response will be empty if this is false.
min_to_amount: CreateSwapQuoteResponseMinToAmount
The minimum amount of the toToken
that must be received for the swap to succeed, in atomic units of the toToken
. For example, 1000000000000000000
when receiving ETH equates to 1 ETH, 1000000
when receiving USDC equates to 1 USDC, etc. This value is influenced by the slippageBps
parameter.
permit2: Option<CreateSwapQuoteResponsePermit2>
The approval object which contains the necessary fields to submit an approval for this transaction. Null if the fromToken
is the native token or the transaction is a native token wrap / unwrap.
to_amount: CreateSwapQuoteResponseToAmount
The amount of the toToken
that will be received in atomic units of the toToken
. For example, 1000000000000000000
when receiving ETH equates to 1 ETH, 1000000
when receiving USDC equates to 1 USDC, etc.
to_token: CreateSwapQuoteResponseToToken
The 0x-prefixed contract address of the token that will be received.
transaction: CreateSwapQuoteResponseTransaction
Implementations§
Source§impl CreateSwapQuoteResponse
impl CreateSwapQuoteResponse
pub fn builder() -> CreateSwapQuoteResponse
Trait Implementations§
Source§impl Clone for CreateSwapQuoteResponse
impl Clone for CreateSwapQuoteResponse
Source§fn clone(&self) -> CreateSwapQuoteResponse
fn clone(&self) -> CreateSwapQuoteResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more