referrerpolicy=no-referrer-when-downgrade
pallet_asset_conversion

Trait AssetConversionApi

Source
pub trait AssetConversionApi<Block: BlockT, Balance, AssetId>: Core<Block>
where Balance: Balance + MaybeDisplay, AssetId: Codec,
{ // Provided methods fn quote_price_tokens_for_exact_tokens( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, asset1: AssetId, asset2: AssetId, amount: Balance, include_fee: bool, ) -> Result<Option<Balance>, ApiError> { ... } fn quote_price_exact_tokens_for_tokens( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, asset1: AssetId, asset2: AssetId, amount: Balance, include_fee: bool, ) -> Result<Option<Balance>, ApiError> { ... } fn get_reserves( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, asset1: AssetId, asset2: AssetId, ) -> Result<Option<(Balance, Balance)>, ApiError> { ... } }
Expand description

This runtime api allows people to query the size of the liquidity pools and quote prices for swaps.

Provided Methods§

Source

fn quote_price_tokens_for_exact_tokens( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, asset1: AssetId, asset2: AssetId, amount: Balance, include_fee: bool, ) -> Result<Option<Balance>, 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.)

Source

fn quote_price_exact_tokens_for_tokens( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, asset1: AssetId, asset2: AssetId, amount: Balance, include_fee: bool, ) -> Result<Option<Balance>, 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.)

Source

fn get_reserves( &self, __runtime_api_at_param__: <Block as BlockT>::Hash, asset1: AssetId, asset2: AssetId, ) -> Result<Option<(Balance, Balance)>, ApiError>

Returns the size of the liquidity pool for the given asset pair.

Trait Implementations§

Source§

impl<Block: BlockT, Balance, AssetId> RuntimeApiInfo for dyn AssetConversionApi<Block, Balance, AssetId>

Source§

const ID: [u8; 8] = _

The identifier of the runtime api.
Source§

const VERSION: u32 = 1u32

The version of the runtime api.

Implementors§

impl<__SrApiBlock__: BlockT, RuntimeApiImplCall: CallApiAt<__SrApiBlock__> + 'static> AssetConversionApi<__SrApiBlock__, u128, Location> for RuntimeApiImpl<__SrApiBlock__, RuntimeApiImplCall>
where RuntimeApiImplCall::StateBackend: StateBackend<HashingFor<__SrApiBlock__>>, &'static RuntimeApiImplCall: Send,

impl<__SrApiBlock__: BlockT, RuntimeApiImplCall: CallApiAt<__SrApiBlock__> + 'static> AssetConversionApi<__SrApiBlock__, u128, Location> for RuntimeApiImpl<__SrApiBlock__, RuntimeApiImplCall>
where RuntimeApiImplCall::StateBackend: StateBackend<HashingFor<__SrApiBlock__>>, &'static RuntimeApiImplCall: Send,

impl<__SrApiBlock__: BlockT, RuntimeApiImplCall: CallApiAt<__SrApiBlock__> + 'static> AssetConversionApi<__SrApiBlock__, u128, NativeOrWithId<u32>> for RuntimeApiImpl<__SrApiBlock__, RuntimeApiImplCall>
where RuntimeApiImplCall::StateBackend: StateBackend<HashingFor<__SrApiBlock__>>, &'static RuntimeApiImplCall: Send,

impl<__SrApiBlock__: BlockT, RuntimeApiImplCall: CallApiAt<__SrApiBlock__> + 'static> AssetConversionApi<__SrApiBlock__, u128, Location> for RuntimeApiImpl<__SrApiBlock__, RuntimeApiImplCall>
where RuntimeApiImplCall::StateBackend: StateBackend<HashingFor<__SrApiBlock__>>, &'static RuntimeApiImplCall: Send,