Closed bdhobare closed 2 years ago
Hey @mschneider , I might be missing something here:
decoded.size() == 4296
sizeof T == 4264
MangoAccount
and PerpAccount
are getting parsed right and I can cross-check with the Typescript results they match, but I don't understand the size mismatch. Should there be an extra field am missing (Included all the fields from MangoAccountLayout
) or should I assume the extra 32 bytes are unneeded info for now?
bool[15] array in rust might not be a char[15] array in c++ but u16 with bit shifts. also the struct alignment is sometimes different, noticed that with the order book and event queue structs previously.
I'd recommend to double check the values for a few accounts, you can visit https://trade.mango.markets/accounts?pubkey=ID
Also recommend to generate a few test fixtures you can modify this script, that I wrote to inspect any account and dump them as base64 or binary:
env ACC=ID yarn ts-node src/scripts/positions.ts
in mango-client-v3
To get a look at some interesting accounts, use the following IDs:
GR8wiP7NfHR8nihLjiADRoRM7V7aUvtTfUnkBy8Zkd5T CGcrpkxyx92vjyQApsr1jTN6M5PeERKSEaH1zskzccRG F3TTrgxjrkAHdS9zEidtwU5VXyvMgr5poii4HYatZheH
bool[15] array in rust might not be a char[15] array in c++ but u16 with bit shifts
Found that I missed the delegate
member(which is why actually it was 32 bytes missing :) ) . Added it and the sizes match now fine. Will add these tests in separate PR to test this struct or operations on it.
Issue #13
MangoAccount
andPerpAccount
structs. Added simple example fetching theMangoAccount
.MangoAccount
as in MangoAccount.ts.Tests