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

lang: Fix using defined types in instruction parameters with declare_program! #2959

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.

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 coral-xyz:master May 11, 2024
48 of 49 checks passed
@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