This repository contains a program that composes Jupiter's DCA program via CPI.
anchor-lang = { version = "0.28.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.28.0" }
jupiter-dca = { git = "https://github.com/jup-ag/dca-cpi", rev = "545c5ee" }
This repo works out-of-the-box but if you are building a new project from scratch referencing the code here and using Solana v1.16, you may get errors like
Invoked an instruction with data that is too large
This is a known issue and not specific to Jupiter DCA program or the jupiter-dca
crate. Read more for details:
solana-labs/solana#31960 (comment)
Every project will have different dependencies so there is no specific guide that can resolve the error.
The approach to take, as of August 2023, is to downgrade your Solana CLI to 1.14 (we built this project against 1.14.19). You may face issues with building. You can resolve the issue by repeatedly running:
anchor build
cargo update -p <dependency> --precise <lower-version> # based on the error, downgrade the dependencies' versions
# e.g.
# cargo update -p solana-zk-token-sdk --precise 1.14.19
# cargo update -p borsh@0.10.3 --precise 0.9.3
# cargo update -p solana-program@1.16.9 --precise 1.14.24
Do this until you build successfully while making sure all your tests still passes.
anchor build # dont forget to change the program id if necessary
anchor deploy # or anchor run deploy-mainnet (see `Anchor.toml` to know what it does)
See /app
directory.
There are examples on
- Setting up DCA via your program's escrow vault
- Closing DCA Escrow (and getting the tokens back)
- Querying data on the DCA progress (this is more specific to Jupiter's DCA itself and you may refer to https://www.npmjs.com/package/@jup-ag/dca-sdk)
You'll need to make changes to the code
- Set environment variables in .env for
RPC
andUSER_PRIVATE_KEY
- Set the input and output mint as well as amount of input mint
- DCA parameters like cycle frequencies as well as amount of input mint per cycle
cd app
npm run example