pub struct SwapRequestBody {
pub amount_type: Option<AmountType>,
pub base_amount: SwapRequestBodyBaseAmount,
pub destination: SwapDestination,
pub fee_configuration: Option<TotalFeeConfigurationBps>,
pub slippage_bps: Option<i64>,
pub source: SwapSource,
}Expand description
Input for executing a token swap.
JSON schema
{
"title": "SwapRequestBody",
"description": "Input for executing a token swap.",
"examples": [
{
"amount_type": "exact_input",
"base_amount": "1000000000000000000",
"destination": {
"asset_address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"caip2": "eip155:1"
},
"slippage_bps": 50,
"source": {
"asset_address": "native",
"caip2": "eip155:1"
}
}
],
"type": "object",
"required": [
"base_amount",
"destination",
"source"
],
"properties": {
"amount_type": {
"allOf": [
{
"$ref": "#/components/schemas/AmountType"
},
{
"description": "Whether the amount refers to the input token
(exact_input) or output token (exact_output).",
"default": "exact_input"
}
]
},
"base_amount": {
"description": "Amount in base units (e.g., wei for ETH). Must be a
non-negative integer string.",
"type": "string",
"maxLength": 78,
"minLength": 1,
"pattern": "^\\d+$"
},
"destination": {
"$ref": "#/components/schemas/SwapDestination"
},
"fee_configuration": {
"allOf": [
{
"$ref": "#/components/schemas/FeeConfiguration"
},
{
"description": "Optional fee configuration for cross-chain
swaps. If omitted, cross-chain swaps only charge provider fees."
}
]
},
"slippage_bps": {
"description": "Maximum slippage tolerance in basis points (e.g.,
50 for 0.5%).",
"type": "integer",
"maximum": 10000.0,
"minimum": 0.0
},
"source": {
"$ref": "#/components/schemas/SwapSource"
}
},
"x-stainless-model": "swaps.swap_request_body"
}Fields§
§amount_type: Option<AmountType>§base_amount: SwapRequestBodyBaseAmountAmount in base units (e.g., wei for ETH). Must be a non-negative integer string.
destination: SwapDestination§fee_configuration: Option<TotalFeeConfigurationBps>§slippage_bps: Option<i64>Maximum slippage tolerance in basis points (e.g., 50 for 0.5%).
source: SwapSourceTrait Implementations§
Source§impl Clone for SwapRequestBody
impl Clone for SwapRequestBody
Source§fn clone(&self) -> SwapRequestBody
fn clone(&self) -> SwapRequestBody
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SwapRequestBody
impl Debug for SwapRequestBody
Source§impl<'de> Deserialize<'de> for SwapRequestBody
impl<'de> Deserialize<'de> for SwapRequestBody
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<&SwapRequestBody> for SwapRequestBody
impl From<&SwapRequestBody> for SwapRequestBody
Source§fn from(value: &SwapRequestBody) -> Self
fn from(value: &SwapRequestBody) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for SwapRequestBody
impl RefUnwindSafe for SwapRequestBody
impl Send for SwapRequestBody
impl Sync for SwapRequestBody
impl Unpin for SwapRequestBody
impl UnsafeUnpin for SwapRequestBody
impl UnwindSafe for SwapRequestBody
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more