We love pull requests. And following these guidelines will make your pull request easier to merge.
If you want to contribute but don’t know what to do, take a look at these two labels: help wanted and good first issue.
Use the GitHub interface for simple documentation changes, otherwise follow the steps below.
⚠️ IMPORTANT NOTE⚠️ All contributions are expected to be of the highest possible quality! That means the PR is thoroughly tested and documented, without relying on blindly generated AI code and documentation. We will not consider or merge PRs that do not comply with these rules! A single typo PR would be automatically closed, except for major refactoring for the latest or next versions.
-
If it’s your first pull request, watch this amazing course by Kent C. Dodds
-
Fork the repository and clone your fork
-
Checkout the
developbranch (ornext-versionif it was more recently updated) -
To install dependencies, run:
npm install
-
To build your changes, run:
npm run build
-
Don’t forget to add tests and update the documentation for your changes.
-
Please update the npm lock file (
package-lock.json) if you add or update dependencies.
Run linters and tests:
npm testOr run tests in watch mode:
npm test --watchBy default, the tests are executed in your local Devnet, and everything should run automatically.
If you want to use a specific RPC node, you have to set some global variables before executing the tests:
export TEST_RPC_URL=http://192.168.1.44:9545/rpc/v0_9 # example of a Pathfinder node located in your local network
export TEST_RPC_URL=https://starknet-sepolia.public.blastapi.io/rpc/v0_9 # example of a public Sepolia testnet node
export TEST_ACCOUNT_ADDRESS=0x065A822f0000000000000000000000000c26641
export TEST_ACCOUNT_PRIVATE_KEY=0x02a80000000000000000000000001754438aThe global variables above will only be valid for some of the tests. The recommended and more straightforward approach is to use Docker. Do the following steps:
- Install Docker (it can also be installed via a package manager, e.g.,
brewfor Mac) - Run
Dockeron your machine (open the application) - Run
docker pull shardlabs/starknet-devnet-rs:latestin your terminal, or go to starknet-devnet-rs, copy and run thedocker pullcommand from the appropriate tag - Run the tests
For commit messages use Conventional Commits, like so: feat(scope): topic
Note that the feat and fix commit messages are used for compiling the changelog. They should be relative to the current state of the target branch they should be merged into, and not the feature branch where committed.
Example of incorrect commit messages:
fix: repair some bug
fix: rectify failing test
fix: adjust formatting
fix: add comments
fix: repair some other bug
Example of correct commit messages:
fix: repair some bug
test: rectify failing test
chore: adjust formatting
chore: add comments
fix: repair some other bug
| Branch | NPM Tag | PR Target |
|---|---|---|
develop |
next |
For the most common pull requests, such as bug fixes, feature additions, documentation changes, etc., target the develop branch. |
beta |
beta |
For major changes that markedly transform the existing API or significantly alter the behavior of some functionality, ensure that the corresponding commits contain appropriate Conventional Commits breaking change notations, and as the pull request target, select the beta branch. |
main |
latest |
Should only be used by maintainers. After a develop/next version has proven to be stable, it is promoted to latest by merging into main. |
maintenance/x.y maintenance/x.y.z |
maintenance |
Should only be used by maintainers. Branches with the maintenance prefix are used for applying adjustments to versions that have been merged into main but are no longer the latest release. They should be created from the corresponding Git tag and can have either minor or patch version specificity. |
- If you have commit access to the repository and want to make a big change or are unsure about something, make a new branch and open a pull request.
- We’re using Prettier to format code, so don’t worry much about code formatting.
- Don’t commit generated files, like minified JavaScript.
- Don’t change the version number or changelog.
- Use
npm run test:coveragefor a complete project test coverage. - Use, for example,
npm run test:coverage __tests__/utils/uint256.test.tsfor a single file coverage. - Use
npm run ts:coverageto check the global type coverage rate andnpm run ts:coverage:reportto generate a complete report (summary displayed in the console, full HTML report available in thecoverage-tsfolder by launching./coverage-ts/index.htmlin your browser) and find files having low coverage.
If you want to contribute but have any questions, concerns, or doubts, feel free to ping maintainers. Ideally, create a pull request with WIP (Work in progress) in its title and ask questions in the pull request description.
You can also ask your query on our dedicated channel for Starknet.js on the Starknet Discord