Trait dex_api_rpc::DEXAPIServer
source · pub trait DEXAPIServer<BlockHash, AssetId, DEXId, Balance, LiquiditySourceType, SwapVariant, SwapResponse>: Sized + Send + Sync + 'static {
// Required methods
fn quote(
&self,
dex_id: DEXId,
liquidity_source_type: LiquiditySourceType,
input_asset_id: AssetId,
output_asset_id: AssetId,
amount: BalanceWrapper,
swap_variant: SwapVariant,
at: Option<BlockHash>
) -> Result<SwapResponse>;
fn can_exchange(
&self,
dex_id: DEXId,
liquidity_source_type: LiquiditySourceType,
input_asset_id: AssetId,
output_asset_id: AssetId,
at: Option<BlockHash>
) -> Result<bool>;
fn list_supported_sources(
&self,
at: Option<BlockHash>
) -> Result<Vec<LiquiditySourceType>>;
// Provided method
fn into_rpc(self) -> RpcModule<Self>
where BlockHash: Send + Sync + 'static + DeserializeOwned,
AssetId: Send + Sync + 'static + DeserializeOwned,
DEXId: Send + Sync + 'static + DeserializeOwned,
Balance: Send + Sync + 'static,
LiquiditySourceType: Send + Sync + 'static + DeserializeOwned + Serialize,
SwapVariant: Send + Sync + 'static + DeserializeOwned,
SwapResponse: Send + Sync + 'static + Serialize { ... }
}
Expand description
Server trait implementation for the DEXAPI
RPC API.
Required Methods§
fn quote( &self, dex_id: DEXId, liquidity_source_type: LiquiditySourceType, input_asset_id: AssetId, output_asset_id: AssetId, amount: BalanceWrapper, swap_variant: SwapVariant, at: Option<BlockHash> ) -> Result<SwapResponse>
fn can_exchange( &self, dex_id: DEXId, liquidity_source_type: LiquiditySourceType, input_asset_id: AssetId, output_asset_id: AssetId, at: Option<BlockHash> ) -> Result<bool>
fn list_supported_sources( &self, at: Option<BlockHash> ) -> Result<Vec<LiquiditySourceType>>
Provided Methods§
sourcefn into_rpc(self) -> RpcModule<Self>where
BlockHash: Send + Sync + 'static + DeserializeOwned,
AssetId: Send + Sync + 'static + DeserializeOwned,
DEXId: Send + Sync + 'static + DeserializeOwned,
Balance: Send + Sync + 'static,
LiquiditySourceType: Send + Sync + 'static + DeserializeOwned + Serialize,
SwapVariant: Send + Sync + 'static + DeserializeOwned,
SwapResponse: Send + Sync + 'static + Serialize,
fn into_rpc(self) -> RpcModule<Self>where BlockHash: Send + Sync + 'static + DeserializeOwned, AssetId: Send + Sync + 'static + DeserializeOwned, DEXId: Send + Sync + 'static + DeserializeOwned, Balance: Send + Sync + 'static, LiquiditySourceType: Send + Sync + 'static + DeserializeOwned + Serialize, SwapVariant: Send + Sync + 'static + DeserializeOwned, SwapResponse: Send + Sync + 'static + Serialize,
Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule
.