saber-hq / anchor-gen

Generates an Anchor CPI crate from a JSON IDL.
https://crates.io/crates/anchor-gen
Apache License 2.0
108 stars 63 forks source link

Change Result type to ProgramResult for before v0.22.0 #9

Closed everlastingsong closed 2 years ago

everlastingsong commented 2 years ago

Memo To use anchor-gen with anchor v0.20.x and v0.21.0, the return type of instruction must be ProgramResult (not Result<()>) The type changed at v0.22.0 as breaking change. https://github.com/coral-xyz/anchor/blob/master/CHANGELOG.md#breaking-3

Implementation Consideration I thought about making it a feature of Cargo.toml, but since GeneratorOptions already existed, I implemented it as target_anchor_version. By receiving the version, it is easier to respond to future breaking changes.

everlastingsong commented 2 years ago

Additional commitments to pass all checks. Thanks.

everlastingsong commented 2 years ago

This PR is withdrawn because it has been decided to address this issue through "feature". New PR is here: https://github.com/saber-hq/anchor-gen/pull/10