Fetch the true price of mSOL
It is important to note that mSOL has a true price, guaranteed in our protocol, but can have a different price on DEXs and exchanges when the mSOL/XXX pair becomes unbalanced.
This situation is often quickly fixed by arbitrage. Nonetheless, we invite our users to compare the price of mSOL on Marinade to the one on DEXs in your trades and choose the most profitable for you.
Using the SDK, you should try something like the following (not tested code):
export const getMarinade = (
cxn: Connection,
publicKey?: PublicKey,
referralCode?: PublicKey
) => {
const config = new MarinadeConfig({
connection: cxn,
publicKey,
referralCode,
});
return new Marinade(config);
};
const marinadeState = await getMarinade(cxn).getMarinadeState();
console.log(marinadeState.mSolPrice)