Skip to content

bmresearch/Solnet.Mango

Repository files navigation

Build .NET6 Release .NET6
Build .NET5 Release .NET5 Coverage Status
Code License Follow on Twitter Discord

What is Solnet.Mango?

Solnet is Solana's .NET integration library, a number of packages that implement features to interact with Solana from .Net applications.

Solnet.Mango is a package within the same Solnet. namespace that implements a Client for Mango Markets, this project is in a separate repository so it is contained, as the goal for Solnet was to be a core SDK.

Features

  • Decoding of Mango data structures:
    • MangoGroup
    • MangoCache
    • MangoAccount
    • AdvancedOrdersAccount
    • PerpMarket
    • PerpAccount
    • RootBank
    • NodeBank
    • OrderBookSide (Nodes are decoded and processed into a friendlier structure)
    • EventQueue
    • ReferrerMemoryAccount
    • ReferrerIdRecordAccount
  • MangoProgram instructions implemented:
    • InitMangoAccount
    • Deposit
    • Withdraw
    • PlaceSpotOrder
    • PlaceSpotOrder2
    • PlacePerpOrder
    • CancelPerpOrderByClientId
    • CancelPerpOrder
    • SettleFunds
    • CancelSpotOrder
    • SettleProfitAndLoss
    • SettleFees
    • InitSpotOpenOrders
    • RedeemMango
    • AddMangoAccountInfo
    • CancelAllPerpOrders
    • InitAdvancedOrders
    • AddPerpTriggerOrder
    • RemoveAdvancedOrder
    • CloseMangoAccount
    • CloseSpotOpenOrders
    • CloseAdvancedOrders
    • CreateMangoAccount
    • UpgradeMangoAccountV0V1
    • CancelPerpOrdersSide
    • SetDelegate
    • SetReferralMemory
    • RegisterReferralId
  • MangoClient class which allows to:
    • Get these structures and decode them only by having their address
    • Subscribing to these accounts in real time, getting notifications with their decoded structures
  • MangoHistoricalDataService class which allows to:
    • Get historical deposits and borrows
    • Get historical funding rates on Mango's perpetual markets
    • Get volume of Mango's perpetual markets
    • Get candlesticks of both Mango's spot and perpetual markets
    • Get recent trades of both Mango's spot and perpetual markets

Requirements

  • net 5.0

Dependencies

  • BlockMountain.TradingView v1.0.0
  • Solnet.Serum v6.0.13
  • Solnet.Wallet v6.0.13
  • Solnet.Rpc v6.0.13
  • Solnet.Programs v6.0.13

Examples

The Solnet.Mango.Examples project features some examples on how to use the IMangoClient, these examples include:

  • Getting all mango accounts owned by a specific address
  • Streaming market data and various structures
  • Submitting orders (spot, perps)
  • Cancelling orders (spot, perps)
  • Creating new mango accounts

Support

If you use this library, or any other adjacent libraries please consider using our Mango ref link or the referrer id MangoSharp.

Contribution

We encourage everyone to contribute, submit issues, PRs, discuss. Every kind of help is welcome.

Contributors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details