Struct mango_v4_client::MangoClient
source · pub struct MangoClient {
pub client: Client,
pub account_fetcher: Arc<dyn AccountFetcher>,
pub owner: Arc<Keypair>,
pub mango_account_address: Pubkey,
pub context: MangoGroupContext,
pub http_client: Client,
}
Fields§
§client: Client
§account_fetcher: Arc<dyn AccountFetcher>
§owner: Arc<Keypair>
§mango_account_address: Pubkey
§context: MangoGroupContext
§http_client: Client
Implementations§
source§impl MangoClient
impl MangoClient
pub fn group_for_admin(admin: Pubkey, num: u32) -> Pubkey
pub async fn find_accounts( client: &Client, group: Pubkey, owner: &Keypair ) -> Result<Vec<(Pubkey, MangoAccountValue)>>
pub async fn find_or_create_account( client: &Client, group: Pubkey, owner: &Keypair, payer: &Keypair, mango_account_name: &str ) -> Result<Pubkey>
pub async fn create_account( client: &Client, group: Pubkey, owner: &Keypair, payer: &Keypair, account_num: u32, mango_account_name: &str ) -> Result<(Pubkey, Signature)>
sourcepub async fn new_for_existing_account(
client: Client,
account: Pubkey,
owner: Arc<Keypair>
) -> Result<Self>
pub async fn new_for_existing_account( client: Client, account: Pubkey, owner: Arc<Keypair> ) -> Result<Self>
Conveniently creates a RPC based client
sourcepub fn new_detail(
client: Client,
account: Pubkey,
owner: Arc<Keypair>,
group_context: MangoGroupContext,
account_fetcher: Arc<dyn AccountFetcher>
) -> Result<Self>
pub fn new_detail( client: Client, account: Pubkey, owner: Arc<Keypair>, group_context: MangoGroupContext, account_fetcher: Arc<dyn AccountFetcher> ) -> Result<Self>
Allows control of AccountFetcher and externally created MangoGroupContext
pub fn owner(&self) -> Pubkey
pub fn group(&self) -> Pubkey
pub async fn mango_account(&self) -> Result<MangoAccountValue>
pub async fn first_bank(&self, token_index: TokenIndex) -> Result<Bank>
pub async fn derive_health_check_remaining_account_metas( &self, affected_tokens: Vec<TokenIndex>, writable_banks: Vec<TokenIndex>, affected_perp_markets: Vec<PerpMarketIndex> ) -> Result<Vec<AccountMeta>>
pub async fn derive_liquidation_health_check_remaining_account_metas( &self, liqee: &MangoAccountValue, affected_tokens: Vec<u16>, writable_banks: &[TokenIndex] ) -> Result<Vec<AccountMeta>>
pub async fn token_deposit( &self, mint: Pubkey, amount: u64, reduce_only: bool ) -> Result<Signature>
pub async fn token_withdraw( &self, mint: Pubkey, amount: u64, allow_borrow: bool ) -> Result<Signature>
pub async fn get_oracle_price(&self, token_name: &str) -> Result<Price, Error>
pub async fn serum3_create_open_orders(&self, name: &str) -> Result<Signature>
pub async fn serum3_place_order( &self, name: &str, side: Serum3Side, price: f64, size: f64, self_trade_behavior: Serum3SelfTradeBehavior, order_type: Serum3OrderType, client_order_id: u64, limit: u16 ) -> Result<Signature>
pub async fn serum3_settle_funds(&self, name: &str) -> Result<Signature>
pub async fn serum3_cancel_all_orders( &self, market_name: &str ) -> Result<Vec<u128>, Error>
pub async fn serum3_liq_force_cancel_orders( &self, liqee: (&Pubkey, &MangoAccountValue), market_index: Serum3MarketIndex, open_orders: &Pubkey ) -> Result<Signature>
pub async fn serum3_cancel_order( &self, market_name: &str, side: Serum3Side, order_id: u128 ) -> Result<Signature>
pub async fn perp_place_order( &self, market_index: PerpMarketIndex, side: Side, price_lots: i64, max_base_lots: i64, max_quote_lots: i64, client_order_id: u64, order_type: PlaceOrderType, reduce_only: bool, expiry_timestamp: u64, limit: u8 ) -> Result<Signature>
pub async fn perp_deactivate_position( &self, market_index: PerpMarketIndex ) -> Result<Signature>
pub fn perp_settle_pnl_instruction( &self, market_index: PerpMarketIndex, account_a: (&Pubkey, &MangoAccountValue), account_b: (&Pubkey, &MangoAccountValue) ) -> Result<Instruction>
pub async fn perp_settle_pnl( &self, market_index: PerpMarketIndex, account_a: (&Pubkey, &MangoAccountValue), account_b: (&Pubkey, &MangoAccountValue) ) -> Result<Signature>
pub async fn perp_liq_force_cancel_orders( &self, liqee: (&Pubkey, &MangoAccountValue), market_index: PerpMarketIndex ) -> Result<Signature>
pub async fn perp_liq_base_or_positive_pnl( &self, liqee: (&Pubkey, &MangoAccountValue), market_index: PerpMarketIndex, max_base_transfer: i64, max_pnl_transfer: u64 ) -> Result<Signature>
pub async fn perp_liq_negative_pnl_or_bankruptcy( &self, liqee: (&Pubkey, &MangoAccountValue), market_index: PerpMarketIndex, max_liab_transfer: u64 ) -> Result<Signature>
pub async fn token_liq_with_token( &self, liqee: (&Pubkey, &MangoAccountValue), asset_token_index: TokenIndex, liab_token_index: TokenIndex, max_liab_transfer: I80F48 ) -> Result<Signature>
pub async fn token_liq_bankruptcy( &self, liqee: (&Pubkey, &MangoAccountValue), liab_token_index: TokenIndex, max_liab_transfer: I80F48 ) -> Result<Signature>
pub async fn jupiter_route( &self, input_mint: Pubkey, output_mint: Pubkey, amount: u64, slippage: u64, swap_mode: JupiterSwapMode ) -> Result<QueryRoute>
pub async fn jupiter_swap( &self, input_mint: Pubkey, output_mint: Pubkey, amount: u64, slippage: u64, swap_mode: JupiterSwapMode ) -> Result<Signature>
pub async fn mango_address_lookup_tables( &self ) -> Result<Vec<AddressLookupTableAccount>>
pub async fn send_and_confirm_owner_tx( &self, instructions: Vec<Instruction> ) -> Result<Signature>
pub async fn send_and_confirm_permissionless_tx( &self, instructions: Vec<Instruction> ) -> Result<Signature>
Auto Trait Implementations§
impl !RefUnwindSafe for MangoClient
impl Send for MangoClient
impl Sync for MangoClient
impl Unpin for MangoClient
impl !UnwindSafe for MangoClient
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> DerefOrBorrow<T> for Twhere
T: ?Sized,
impl<T> DerefOrBorrow<T> for Twhere T: ?Sized,
fn deref_or_borrow(&self) -> &T
source§impl<T> DerefOrBorrowMut<T> for Twhere
T: ?Sized,
impl<T> DerefOrBorrowMut<T> for Twhere T: ?Sized,
fn deref_or_borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request
source§impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
§impl<T> TupleTree<T, ()> for T
impl<T> TupleTree<T, ()> for T
const SIZE: Size = Size{ degree: 0, descendants: 0,}
fn descendants(_indirect_level: usize) -> usize
fn height() -> usize
fn preorder(self, f: &mut impl FnMut(Visit<T>))
fn preorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))
fn postorder(self, f: &mut impl FnMut(Visit<T>))
fn postorder_with_size_hint(self, f: &mut impl FnMut(Visit<T>, Size))
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,
source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.