This is follow on question not the answer. I am looking for the similar issue, I have everything setup and no errors in the code. I doubles check the idl file exist and I am using the
import { UserGMarket } from "../target/types/user_g_market";
and the file exist and when I run cursor on it, giving me the same file, but when I run anchor test --skip-local-validator, its giving me this error
Error: target/idl/user_g_markets.json doesn't exist. Did you run `anchor build`?
and I run many times
anchor clean and anchor build
But facing the same issue. Here is my cargo.toml file
[package]
name = "user-g-markets"
version = "0.1.0"
description = "Created with Anchor"
edition = "2021"
[lib]
crate-type = ["cdylib", "lib"]
name = "user_g_market"
[features]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
[dependencies]
anchor-lang = "0.29.0"
anchor-spl = "0.29.0"
and here is my lib.rs file
#[program]
pub mod user_g_market {
use super::*;
// Initialize a new market (can be called by any user)
pub fn initialize_market(
ctx: Context<InitializeMarket>,
id: u64,
merkle_root: [u8; 32],
end_time: i64,
) -> Result<()> {
let market = &mut ctx.accounts.market;
market.id = id;
market.merkle_root = merkle_root;
market.token_vault = ctx.accounts.token_vault.key();
market.is_finalized = false;
market.end_time = end_time;
market.creator = *ctx.accounts.creator.key; // Store the creator's public key
Ok(())
}