Thanks for your interest in contributing to sorokit-core. This document provides guidelines and instructions for contributing to the project.
Be respectful and constructive. We're building a framework for the Stellar ecosystem, and we want everyone to feel welcome contributing.
- Node.js 18+
- npm or yarn
- Git
-
Fork and clone the repository
git clone https://github.com/YOUR-USERNAME/sorokit-core.git cd sorokit-core -
Install dependencies
npm install
-
Verify the setup
npm run typecheck npm run test npm run lint
- Check existing issues to see if the work is already in progress
- For large changes, open a discussion or issue first to get feedback
- Ensure you're working against the latest
mainbranch
-
Create a branch
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix-nameUse descriptive branch names:
feature/add-contract-deploymentfor new featuresfix/handle-network-errorsfor bug fixesdocs/update-readmefor documentationchore/upgrade-dependenciesfor maintenance
-
Write or update code
- Follow the existing code style (enforced by ESLint)
- Add tests for new functionality
- Update TypeScript types as needed
- Keep functions pure and stateless where possible (aligns with sorokit-core's design)
-
Run checks locally
npm run typecheck # Check TypeScript types npm run lint # Run ESLint npm run test # Run tests with vitest
All checks must pass before opening a PR.
-
Commit your changes
git add src/... git commit -m "Description of changes"Keep commits focused and descriptive. Use imperative mood: "Add feature" not "Added feature".
-
Push and open a pull request
git push origin feature/your-feature-name
Then open a PR on GitHub with a clear title and description.
CRITICAL: Keep your branch up to date with main
Before pushing, always rebase/merge the latest main:
git fetch origin main
git rebase origin/main
# or if conflicts exist, resolve and commit
npm run typecheck && npm run lint && npm run test
git push origin your-branchThis prevents conflicts during merge and ensures CI passes on the merge commit.
Keep titles concise and under 70 characters:
- ✅
Add Soroban contract reader - ✅
Fix network error handling - ❌
Fix a bug that occurs when you try to read a Soroban contract and the network times out
Include:
- What — A clear summary of the changes
- Why — Motivation for the change (fixes issue #X, implements feature Y)
- Testing — What you tested and how
- Blockers — Any known issues or limitations
Template:
## Summary
Brief description of changes
## Motivation
Fixes #123 / Implements feature X
## Testing
- [ ] Added unit tests
- [ ] Manual testing on testnet
- [ ] Verified types with `npm run typecheck`
## Checklist
- [ ] Code follows project style
- [ ] Tests pass locally
- [ ] No breaking changes (or documented breaking change)PR Merge Requirements:
Your PR can only be merged if ALL of the following are true:
- ✅ All CI checks pass — type-check, lint, test, build
- ✅ At least 1 reviewer approval — code review complete
- ✅ No unresolved conversations — feedback addressed
- ✅ Branch is up to date with main — enforced by GitHub, use "Update branch" button if needed
- ✅ No merge conflicts — resolved before merge attempt
Process:
- Address feedback promptly
- Respond to comments even if you disagree
- Use "Update branch" button to sync with main if needed
- CI will re-run after update to verify everything still passes
- If a PR becomes stale (inactive for 2+ weeks), it may be closed
# Run all tests once
npm run test
# Run in watch mode for development
npm run test:watch
# Run specific test file
npm run test -- account.test.ts- Use
vitest(already configured) - Place tests alongside source in
src/tests/ - Test both happy paths and error cases
- Use the
SorokitResulttype for assertion clarity
Example:
import { describe, it, expect } from "vitest";
import { createSorokitClient } from "../client";
describe("account", () => {
it("returns error when account not found", async () => {
const client = createSorokitClient({ network: "testnet" });
if (client.status === "error") throw new Error("Client failed");
const result = await client.data.account.get("INVALID");
expect(result.status).toBe("error");
});
});The project uses ESLint. Run npm run lint to check and fix issues automatically where possible:
npm run lint -- --fix- Modules — Organize code into focused modules (e.g.,
wallet/,account/) - Exports — Use barrel exports (
index.ts) to control public API surface - Types — Keep types alongside implementation, or in
src/types/for shared types - Naming — Use clear, descriptive names; avoid abbreviations except for well-known terms
- Comments — Document complex logic and non-obvious design decisions
- Result Type — Every async function returns
SorokitResult<T>; no try/catch patterns
When adding new features, keep these principles in mind:
- Stateless — No persistent state in the client; side effects only for network calls
- No-throw — Use
SorokitResult<T>for error handling - Framework-agnostic — No dependency on React, Vue, or other frameworks
- Type-safe — Leverage TypeScript for compile-time safety
TypeScript types must be valid. Run:
npm run typecheckNo any without justification. If you must use any, add a comment explaining why.
- Update the README if you add or change public APIs
- Add inline comments for complex logic
- Include JSDoc comments for exported functions and types
- Update the CHANGELOG for user-facing changes (if applicable)
- Avoid new dependencies unless absolutely necessary
- Peer dependencies go in
peerDependencies(e.g., Stellar Wallets Kit, vitest) - Dev dependencies go in
devDependencies(e.g., build tools, linters) - Runtime dependencies go in
dependencies(currently only@stellar/stellar-sdk) - Pin versions in package.json for stability
This project follows Semantic Versioning:
MAJOR— Breaking changesMINOR— New backward-compatible featuresPATCH— Bug fixes
Bump the version in package.json for releases (maintainers handle this).
- Check if it's already reported in issues
- If not, open a new issue with:
- Clear title
- Minimal reproduction code
- Expected vs. actual behavior
- Environment (Node version, OS, etc.)
- Open a discussion or issue describing the feature
- Explain the use case and why it's needed
- Propose an API design (or ask for suggestions)
- Wait for feedback before starting work
- Build:
npm run build— Outputs todist/(ESM and CJS) - Clean:
npm run clean— Removesdist/ - Dev:
npm run dev— Watch mode for development
Releases are handled by maintainers and published to npm.
- Open a discussion if you have questions
- Tag maintainers in issues if you need clarification
- Check existing docs and code before asking (good learning opportunity!)
Contributors will be recognized in the project. Significant contributions may be mentioned in the README and CHANGELOG.
By contributing, you agree that your contributions are licensed under the MIT license (same as the project).
Thank you for contributing to sorokit-core. Happy coding!