1

Im trying to CPI into marinade finance, but their codebase is in anchor 0.14, and im using anchor 0.24, so I cannot import the crate to get anything. I was able to find workarounds for everything else, but I cant find a workaround to get the Data part of the CPI

marinade_finance::instruction::Deposit { lamports };

How do I get this without importing the crate?

2 Answers 2

3

If you build the crate with anchor-gen before importing it, this should clear up your issues. As noted in another question about CPIing to older client versions

  1. use anchor-gen on the program
  2. import the resulting crate in your cargo.toml file

This should clear up any errors

2

If you have access to the repo, you can build it with cargo build-bpf, copy the .so file that the build generates, and add it as a dependency to your Cargo.toml:

marinade = { path = "./dependencies/marinade/program", features=["no-entrypoint"] }

2
  • How would that even work? The path there is a folder, not the file, and if I make a folder for the file, it will complain that it cannot find a cargo.toml for the workspace Commented Jul 22, 2022 at 10:09
  • the bit about building and copying the shared object is extraneous. you only need to redirect cargo to a different source, be it a local directory or forked git repo. specification of dependencies in Cargo.toml is documented here
    – trent.sol
    Commented Jul 24, 2022 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.