Skip to content

Conversation

@acheroncrypto
Copy link
Collaborator

Problem

Using the generated IDL from the following instruction

pub fn defined(ctx: Context<Defined>, my_type: MyType) -> Result<()> {
    Ok(())
}

with declare_program! results in a compilation error due to MyType not being imported in the generated cpi module.

Summary of changes

Globally import accounts, events and types modules in necessary places to not run into compilation errors which are difficult to debug.

@vercel
Copy link

vercel bot commented May 11, 2024

@acheroncrypto is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added lang fix Bug fix PR labels May 11, 2024
@acheroncrypto acheroncrypto merged commit 460a161 into solana-foundation:master May 11, 2024
@cryptopapi997
Copy link
Contributor

Thank you for this PR! This is a blocker for us, as it means we can't use declare_program! in our codebase even though we'd love to. Do you plan to release this patch as a minor release? Or will we have to wait for the next major release for this?

@acheroncrypto
Copy link
Collaborator Author

We'll most likely make a patch release, but there are a couple more fixes/improvements queued up that I'd like to get in before then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix PR lang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants