Trait serai_dex_pallet::DexApi
source · pub trait DexApi<Block: BlockT>: Core<Block> {
// Provided methods
fn quote_price_tokens_for_exact_tokens(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
coin1: Coin,
coin2: Coin,
amount: SubstrateAmount,
include_fee: bool,
) -> Result<Option<SubstrateAmount>, ApiError> { ... }
fn quote_price_exact_tokens_for_tokens(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
coin1: Coin,
coin2: Coin,
amount: SubstrateAmount,
include_fee: bool,
) -> Result<Option<SubstrateAmount>, ApiError> { ... }
fn get_reserves(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
coin1: Coin,
coin2: Coin,
) -> Result<Option<(SubstrateAmount, SubstrateAmount)>, ApiError> { ... }
}
Expand description
This runtime api allows people to query the size of the liquidity pools and quote prices for swaps.
Provided Methods§
sourcefn quote_price_tokens_for_exact_tokens(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
coin1: Coin,
coin2: Coin,
amount: SubstrateAmount,
include_fee: bool,
) -> Result<Option<SubstrateAmount>, ApiError>
fn quote_price_tokens_for_exact_tokens( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, coin1: Coin, coin2: Coin, amount: SubstrateAmount, include_fee: bool, ) -> Result<Option<SubstrateAmount>, ApiError>
Provides a quote for Pallet::swap_tokens_for_exact_tokens
.
Note that the price may have changed by the time the transaction is executed.
(Use amount_in_max
to control slippage.)
sourcefn quote_price_exact_tokens_for_tokens(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
coin1: Coin,
coin2: Coin,
amount: SubstrateAmount,
include_fee: bool,
) -> Result<Option<SubstrateAmount>, ApiError>
fn quote_price_exact_tokens_for_tokens( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, coin1: Coin, coin2: Coin, amount: SubstrateAmount, include_fee: bool, ) -> Result<Option<SubstrateAmount>, ApiError>
Provides a quote for Pallet::swap_exact_tokens_for_tokens
.
Note that the price may have changed by the time the transaction is executed.
(Use amount_out_min
to control slippage.)
sourcefn get_reserves(
&self,
__runtime_api_at_param__: <Block as BlockT>::Hash,
coin1: Coin,
coin2: Coin,
) -> Result<Option<(SubstrateAmount, SubstrateAmount)>, ApiError>
fn get_reserves( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, coin1: Coin, coin2: Coin, ) -> Result<Option<(SubstrateAmount, SubstrateAmount)>, ApiError>
Returns the size of the liquidity pool for the given coin pair.