Skip to content

cli: Add version name from programs Cargo.toml to IDL - #1061

Merged
armaniferrante merged 5 commits into
otter-sec:masterfrom
tomlinton:tomlinton/program-version-in-idl
Nov 27, 2021
Merged

cli: Add version name from programs Cargo.toml to IDL#1061
armaniferrante merged 5 commits into
otter-sec:masterfrom
tomlinton:tomlinton/program-version-in-idl

Conversation

@tomlinton

Copy link
Copy Markdown
Contributor

This required some changes to the manifest discovery code because anchor idl parse doesn't necessarily execute from within the program directory like the anchor build does.

It might be cleaner to do this all in lang/syn/src/idl/file.rs but it probably requires duplicating that manifest discovery code rather than just passing the version as an arg.

Closes #349

Example:

anchor idl parse --file programs/basic-0/src/lib.rs
{
  "version": "0.1.0",
  "name": "basic_0",
  "instructions": [
    {
      "name": "initialize",
      "accounts": [],
      "args": []
    }
  ]
}

@armaniferrante
armaniferrante merged commit 1c5f503 into otter-sec:master Nov 27, 2021
@fanatid

fanatid commented Nov 27, 2021

Copy link
Copy Markdown
Contributor

Any chance to add a test for this feature? Or we do not need it?

@tomlinton

Copy link
Copy Markdown
Contributor Author

Sure, happy to add a test!

akash-osec pushed a commit to akash-osec/anchor that referenced this pull request Mar 25, 2026
@jamie-osec jamie-osec added this to the Pre-1.0 milestone Jun 24, 2026
akash-osec pushed a commit to akash-osec/anchor that referenced this pull request Jul 25, 2026
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

Successfully merging this pull request may close these issues.

cli: Generating idl should use the program's current version

4 participants