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§

source

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>

source

fn can_exchange( &self, dex_id: DEXId, liquidity_source_type: LiquiditySourceType, input_asset_id: AssetId, output_asset_id: AssetId, at: Option<BlockHash> ) -> Result<bool>

source

fn list_supported_sources( &self, at: Option<BlockHash> ) -> Result<Vec<LiquiditySourceType>>

Provided Methods§

source

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.

Implementors§

source§

impl<C, Block, AssetId, DEXId, Balance, LiquiditySourceType, SwapVariant> DEXAPIServer<<Block as Block>::Hash, AssetId, DEXId, Balance, LiquiditySourceType, SwapVariant, Option<SwapOutcomeInfo<Balance>>> for DEX<C, Block>where Block: BlockT, C: Send + Sync + 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>, C::Api: DEXRuntimeAPI<Block, AssetId, DEXId, Balance, LiquiditySourceType, SwapVariant>, AssetId: Codec, DEXId: Codec, Balance: Codec + MaybeFromStr + MaybeDisplay, SwapVariant: Codec, LiquiditySourceType: Codec,