Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fetch IDL for external programs from the chain using fetchIdl #798

Open
bytemanxie opened this issue Dec 11, 2024 · 0 comments
Open

Comments

@bytemanxie
Copy link

I am trying to fetch IDL files for two external programs (message_transmitter and token_messenger_minter) using the fetchIdl function in my script. However, the call to anchor.Program.fetchIdl() fails and no .json files are downloaded. I need guidance on how to properly retrieve the IDL for these programs or alternative solutions to manually obtain their IDLs.
Steps to Reproduce:
1. Set RPC_URL = "https://api.devnet.solana.com".
2. Run the following code:

const externalPrograms = [
  { name: "message_transmitter", id: "CCTPmbSD7gX1bxKPAmg77w8oFzNFpaQiQUWD43TKaecd" },
  { name: "token_messenger_minter", id: "CCTPiPYPc6AsJuwueEnWgSgucamXDZwBd53dQ11YiKX3" },
];

const main = async () => {
  for (const program of externalPrograms) {
    await fetchIdl(program.name, program.id);
    await convertIdl(program.name);
    await generateType(program.name);
    await copyIdls(program.name);
  }
};

main().catch(console.error);
3.	Observe the error when fetchIdl is called.

Expected Behavior:
• The fetchIdl function successfully retrieves the IDL from the chain and writes the .json files to the target/idl directory.

Actual Behavior:
• The script fails to fetch the IDL, resulting in errors and no .json files being generated.

Additional Details:
• Checked that the programs are visible on Devnet using solana program show <PROGRAM_ID>.
• Verified cluster and wallet settings in Anchor.toml.
• Attempted anchor idl fetch <PROGRAM_ID> from the command line, which also failed due to format or missing IDL issues.

Questions / Requests for Help:
• Are these programs’ IDLs actually registered on-chain?
• If the IDL is not available on-chain, what’s the recommended way to obtain it?
• How can I manually create or integrate the IDL file if I cannot fetch it via fetchIdl?

Please let me know if I need to provide additional information or logs. Any guidance or solutions would be greatly appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant