Add simplex new and simplex example commands, improve generated t…#40
Open
stringhandler wants to merge 1 commit intoBlockstreamResearch:masterfrom
Open
Add simplex new and simplex example commands, improve generated t…#40stringhandler wants to merge 1 commit intoBlockstreamResearch:masterfrom
simplex new and simplex example commands, improve generated t…#40stringhandler wants to merge 1 commit intoBlockstreamResearch:masterfrom
Conversation
…est template, and expand README docs New commands ------------ simplex new <name> Creates a complete Simplex project scaffold in a new <name>/ directory. Equivalent to running `simplex init --lib` in a freshly created directory, but with a better UX — errors immediately if the target directory already exists rather than clobbering existing files. simplex example <name> Scaffolds a full example project into a new directory. Currently supports `simplex example basic`, which writes all files from the examples/basic/ template (including the options, option_offer, array_tr_storage, bytes32_tr_storage, and dual_currency_deposit contracts) using include_str! so the content is embedded in the binary at compile time. The Cargo.toml is generated dynamically to pin to the latest published smplx-std version from crates.io, consistent with how `simplex new` works. Improved generated test template --------------------------------- The default test file produced by `simplex new` and `simplex init --lib` was previously a non-compiling todo!() stub. It is now a working end-to-end p2pk integration test that demonstrates: - Instantiating a program with typed arguments (P2pkArguments) - Deriving a script pubkey from the program - Funding the script via FinalTransaction + PartialOutput - Spending the script by supplying a P2pkWitness with DUMMY_SIGNATURE and RequiredSignature::Witness so the signer fills in the real signature The crate name (simplex_<project_name>) is substituted at generation time so the artifact imports resolve correctly for any project name. anyhow is now also added to the generated Cargo.toml to support the -> anyhow::Result<()> return type. README ------ - Replaced the `cargo add smplx-std` getting-started flow with `simplex new` as the primary entry point - Added `simplex new` and `simplex example` to the CLI command reference - Added a "Typical workflow" section showing the new -> build -> test flow - Added a "Using smplx-std as a library" section covering: dependency setup, how generated artifacts are structured, instantiating a program with arguments, funding and spending scripts with FinalTransaction, a key types reference table, and the #[simplex::test] macro - Updated the future work checklist to mark `simplex new` and `simplex example` as complete
e68c480 to
039b2d6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
…est template, and expand README docs
New commands
Creates a complete Simplex project scaffold in a new / directory. Equivalent to running
simplex init --libin a freshly created directory, but with a better UX — errors immediately if the target directory already exists rather than clobbering existing files.Scaffolds a full example project into a new directory. Currently supports
simplex example basic, which writes all files from the examples/basic/ template (including the options, option_offer, array_tr_storage, bytes32_tr_storage, and dual_currency_deposit contracts) using include_str! so the content is embedded in the binary at compile time. The Cargo.toml is generated dynamically to pin to the latest published smplx-std version from crates.io, consistent with howsimplex newworks.Improved generated test template
The default test file produced by
simplex newandsimplex init --libwas previously a non-compiling todo!() stub. It is now a working end-to-end p2pk integration test that demonstrates:The crate name (simplex_<project_name>) is substituted at generation time so the artifact imports resolve correctly for any project name. anyhow is now also added to the generated Cargo.toml to support the -> anyhow::Result<()> return type.
README
cargo add smplx-stdgetting-started flow withsimplex newas the primary entry pointsimplex newandsimplex exampleto the CLI command referencesimplex newandsimplex exampleas complete