pub trait DexStableApiServer<BlockHash, CurrencyId, Balance, AccountId, PoolId>: Sized + Send + Sync + 'static {
Show 17 methods // Required methods fn get_virtual_price( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; fn get_a( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; fn get_a_precise( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; fn get_currencies( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<CurrencyId>>; fn get_currency( &self, pool_id: PoolId, index: u32, at: Option<BlockHash> ) -> RpcResult<CurrencyId>; fn get_lp_currency( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<CurrencyId>; fn get_currency_index( &self, pool_id: PoolId, currency: CurrencyId, at: Option<BlockHash> ) -> RpcResult<u32>; fn get_currency_precision_multipliers( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>; fn get_currency_balances( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>; fn get_number_of_currencies( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<u32>; fn get_admin_balances( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>; fn get_admin_balance( &self, pool_id: PoolId, index: u32, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; fn calculate_currency_amount( &self, pool_id: PoolId, amounts: Vec<Balance>, deposit: bool, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; fn calculate_swap( &self, pool_id: PoolId, in_index: u32, out_index: u32, in_amount: Balance, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; fn calculate_remove_liquidity( &self, pool_id: PoolId, amount: Balance, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>; fn calculate_remove_liquidity_one_currency( &self, pool_id: PoolId, amount: Balance, index: u32, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>; // Provided method fn into_rpc(self) -> RpcModule<Self> where BlockHash: Send + Sync + 'static + DeserializeOwned, CurrencyId: Send + Sync + 'static + DeserializeOwned + Serialize, Balance: Send + Sync + 'static + DeserializeOwned, AccountId: Send + Sync + 'static, PoolId: Send + Sync + 'static + DeserializeOwned { ... }
}
Expand description

Server trait implementation for the DexStableApi RPC API.

Required Methods§

source

fn get_virtual_price( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

source

fn get_a( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

source

fn get_a_precise( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

source

fn get_currencies( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<CurrencyId>>

source

fn get_currency( &self, pool_id: PoolId, index: u32, at: Option<BlockHash> ) -> RpcResult<CurrencyId>

source

fn get_lp_currency( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<CurrencyId>

source

fn get_currency_index( &self, pool_id: PoolId, currency: CurrencyId, at: Option<BlockHash> ) -> RpcResult<u32>

source

fn get_currency_precision_multipliers( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>

source

fn get_currency_balances( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>

source

fn get_number_of_currencies( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<u32>

source

fn get_admin_balances( &self, pool_id: PoolId, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>

source

fn get_admin_balance( &self, pool_id: PoolId, index: u32, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

source

fn calculate_currency_amount( &self, pool_id: PoolId, amounts: Vec<Balance>, deposit: bool, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

source

fn calculate_swap( &self, pool_id: PoolId, in_index: u32, out_index: u32, in_amount: Balance, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

source

fn calculate_remove_liquidity( &self, pool_id: PoolId, amount: Balance, at: Option<BlockHash> ) -> RpcResult<Vec<NumberOrHex>>

source

fn calculate_remove_liquidity_one_currency( &self, pool_id: PoolId, amount: Balance, index: u32, at: Option<BlockHash> ) -> RpcResult<NumberOrHex>

Provided Methods§

source

fn into_rpc(self) -> RpcModule<Self>where BlockHash: Send + Sync + 'static + DeserializeOwned, CurrencyId: Send + Sync + 'static + DeserializeOwned + Serialize, Balance: Send + Sync + 'static + DeserializeOwned, AccountId: Send + Sync + 'static, PoolId: Send + Sync + 'static + DeserializeOwned,

Collects all the methods and subscriptions defined in the trait and adds them into a single RpcModule.

Implementors§

source§

impl<C, Block, CurrencyId, Balance, AccountId, PoolId> DexStableApiServer<<Block as Block>::Hash, CurrencyId, Balance, AccountId, PoolId> for DexStable<C, Block>where Block: BlockT, CurrencyId: Codec + PartialEq, Balance: Codec + TryInto<NumberOrHex> + Debug + MaybeDisplay + Copy, AccountId: Codec, PoolId: Codec, C: Send + Sync + 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>, C::Api: DexStableRuntimeApi<Block, CurrencyId, Balance, AccountId, PoolId>,