mschneider / solcpp

A fast Solana and Mango Markets C++ SDK
Other
40 stars 13 forks source link

Create example of how to parse a mango account #13

Closed mschneider closed 2 years ago

mschneider commented 2 years ago

There's a good reference implementation in mango-client-v3, toPrettyString pretty much implements all that is needed. https://github.com/blockworks-foundation/mango-client-v3/blob/main/src/MangoAccount.ts#L933

It can be invoked for any mainnet account from the cli using ACC=mainnetpk yarn ts-node src/scripts/positions.ts

To ensure the math checks out for the different calculations, there's a test-suite with fixtures, which should be ported to solcpp: https://github.com/blockworks-foundation/mango-client-v3/pull/50