pub struct SwapNode<T: AddressLike> {
pub pool_id: PoolAddressBase<T>,
pub ask_asset: AssetInfoBase<T>,
}Expand description
Swap node for swap route
Fields§
§pool_id: PoolAddressBase<T>Pool id of the swap
ask_asset: AssetInfoBase<T>Asset in return from the swap
Implementations§
Source§impl SwapNode<String>
impl SwapNode<String>
Sourcepub fn check(self, api: &dyn Api) -> AbstractResult<SwapNode<Addr>>
pub fn check(self, api: &dyn Api) -> AbstractResult<SwapNode<Addr>>
Validate data contained in an unchecked swap node instance; return a new checked swap node instance:
- For Contract addresses, assert its address is valid
use cosmwasm_std::{Addr, Api};
use abstract_dex_standard::msg::SwapNode;
use abstract_std::AbstractResult;
fn validate_swap_node(api: &dyn Api, swap_node_unchecked: SwapNode<String>) {
match swap_node_unchecked.check(api) {
Ok(info) => println!("swap node is valid: {}", info.pool_id.to_string()),
Err(err) => println!("swap node is invalid! reason: {:?}", err),
}
}Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for SwapNode<T>where
T: Deserialize<'de> + AddressLike,
impl<'de, T> Deserialize<'de> for SwapNode<T>where
T: Deserialize<'de> + AddressLike,
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<T: AddressLike + JsonSchema> JsonSchema for SwapNode<T>
impl<T: AddressLike + JsonSchema> JsonSchema for SwapNode<T>
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreimpl<T: AddressLike> StructuralPartialEq for SwapNode<T>
Auto Trait Implementations§
impl<T> Freeze for SwapNode<T>where
T: Freeze,
impl<T> RefUnwindSafe for SwapNode<T>where
T: RefUnwindSafe,
impl<T> Send for SwapNode<T>where
T: Send,
impl<T> Sync for SwapNode<T>where
T: Sync,
impl<T> Unpin for SwapNode<T>where
T: Unpin,
impl<T> UnwindSafe for SwapNode<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more