- Development Setup
- Building Contracts
- Running Tests
- Code Style & Linting
- Pull Request Workflow
- Snapshot Management
- Issue References
- Rust toolchain – Install via rustup. Minimum supported version: 1.70.0.
- Soroban CLI – Install with:
Or run
cargo install --locked stellar-cli rustup target add wasm32-unknown-unknown
./scripts/install-stellar-cli.shfor the automated setup. - Node.js (for frontend development) – Version 18+ recommended.
-
Clone the repository:
git clone https://github.com/Hub-of-Evolution/CraftNexus.git cd CraftNexus -
Verify the Rust toolchain:
rustup show
The smart contracts live in craft-nexus-contract/. See craft-nexus-contract/README.md for full contract documentation.
cd craft-nexus-contract
cargo build --target wasm32v1-none --release --locked./scripts/build.shThis runs an optimized release build, WASM size validation, and automated tests.
cd craft-nexus
npm install
npm run devcd craft-nexus-contract
cargo test -- --nocaptureRun a specific test module:
cargo test --lib onboarding
cargo test --lib test
cargo test expired_dispute_feeBefore submitting any PR, run:
cargo check --tests
cargo test --libBoth must pass with zero errors. The cargo check --tests command catches type and borrow-checker issues without running the full test suite, so use it for quick iteration.
cargo build --target wasm32-unknown-unknown --release- Rust code follows standard
rustfmtconventions. Format before committing:cargo fmt
- Run clippy for additional lint checks:
cargo clippy -- -D warnings
- Frontend code uses ESLint (config in
craft-nexus/eslint.config.mjs):cd craft-nexus && npm run lint
The Soroban SDK test framework generates snapshot files under craft-nexus-contract/test_snapshots/ on the first test run or when test inputs/outputs change.
- Commit snapshots when you intentionally change contract behavior that affects event output, storage layout, or invocation results.
- Do not commit snapshots that were generated from unrelated test changes — verify that snapshot diffs match your intended changes.
- To update all snapshots:
Then review the diff before committing.
cargo test -- --nocapture
-
Create a feature branch from
main:git checkout -b feat/my-change
-
Make your changes with clear, focused commits. Follow these conventions:
- Commit messages should be concise and descriptive.
- Reference issue numbers in commit messages where applicable (e.g.,
#621).
-
Run the verification checklist before pushing:
-
cargo check --tests— zero errors -
cargo test --lib— all suites pass -
cargo build --target wasm32-unknown-unknown --releasesucceeds - Snapshot files unchanged or updated intentionally
- PR description references the relevant issue number
-
-
Push and open a PR against
main:git push origin feat/my-change
Open a pull request on GitHub. Use the PR template and link the issue(s) your change addresses.
-
Address review feedback with additional commits. Squash if requested.
- Always reference the issue number in your PR description (e.g.,
Closes #621). - For partial fixes, use
Refs #621orPart of #621.