I am using the Anchor Framework to build Solana Programs. I haven't had this issue until now:
When running anchor build
to generate my ../target
folder, usually, my ../tests/program-name.ts
file is able to locate and read my ../target/types/program_name
. However, this time when I run anchor build
in my terminal, the ../target/types/program_name
file won't generate automatically.
As far as I understand, this is the anchor IDL being generated. Is it how my solana_rust_program communicates with the ../tests/program-name.ts
file or am I wrong here?
Regardless, this file is necessary in order for me to run my tests in typescript.
Here is what I have tried so far:
anchor keys sync
to generate a new program ID/pubkey for both theAnchor.toml
andlib.rs
file.- Deleted the previous
../target
folder - run
anchor build
while in the correct directory - Anchor successfully builds, no errors.
- run
anchor deploy
to deploy the program. Anchor deploys and punches out the same program ID as provided in Step 1. - I go to the
../tests/program-name.ts
file to implement my program tests and Iimport { ProgramName } from "../target/types/program_name";
- I get the error:
Cannot find module '../target/types/single_vault_program' or its corresponding type declarations.ts(2307)
Not sure what else to do. Perhaps I am searching the wrong information online to find the right answer for this? This is a crucial step in developing programs.
My current cli versions:
anchor-cli 0.30.0
solana-cli 1.18.14