mercurial-finance / mercurial-dynamic-amm-sdk

An SDK for building applications on top of Mercurial Dynamic AMM
22 stars 15 forks source link

Provide swap calc fn #78

Closed gitmalong closed 1 year ago

gitmalong commented 1 year ago

Could you provide a Rust fn that calculates the swap amount out?

andrewsource147 commented 1 year ago

Okay, it is ready in the PR https://github.com/mercurial-finance/mercurial-dynamic-amm-sdk/pull/79

gitmalong commented 1 year ago

Thank you @andrewsource147 , that's awesome. Could you also re-export the anchor_spl and anchor-lang dependencies? I am running into version mismatches because in my app I am using v0.25 of these that I can't update. So in my custom code I would just like to use the re-exported version. (I have some custom code to load account states).

mismatched types
struct `anchor_spl::token::TokenAccount` and struct `anchor_spl::token::TokenAccount` have similar names, but are actually distinct types
perhaps two different versions of crate `anchor_spl` are being used?
gitmalong commented 1 year ago

Seems I could work around that by adding

anchor_spl_0_26 = { package = "anchor-spl", version = "0.26.0" }
anchor_lang_0_26 = { package = "anchor-lang", version = "0.26.0" }