interface: Introduce lightweight crate for instruction + id #200
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
In order to publish the v3 SDK crates and have them usable in Agave, we also need to have SPL crates using the v3 SDK crates. However, we have a circular dependency between Agave and SPL which currently makes this impossible.
The overall plan is to have Agave only use "interface" crates from SPL, which have no dependencies on Agave crates.
You can see more info about the project at https://github.com/orgs/anza-xyz/projects/27
Memo is very simple, since it just exposes an instruction creator and id to Agave.
Summary of changes
Create the new interface crate with the instruction and id.
The Rust scripts needed to be adapted to having more than one crate, so I copied all the scripts from token-2022 and updated the commands in package.json accordingly.
NOTE: There is a difference in the
build_memoinstruction creator. In the interface crate, it accepts any program id, whereas the program crate hardcodes the v3 id. Since we're planning on deploying p-memo soon under a new program id, this new function will be easier to use.Also, there were some additional changes needed. The new scripts only build one program at a time, so I had to change things to explicitly build and test p-memo.