Before submitting a contribution, please take a moment to review this document to ensure that your contribution follows our guidelines.
If you're new to contributing to open source projects, you may find it helpful to read GitHub's Guide to Contributing to Open Source.
To contribute to EvmosJS, follow these steps:
- Fork the repository.
- Clone the forked repository onto your local machine.
- Create a new branch for your changes. We recommend that you name the branch according to the issue you are addressing (e.g. issue-123).
- Make your changes to the code.
- Ensure that your changes pass the existing tests by running
npm test
(see testing). - Commit your changes with a descriptive commit message.
- Push your changes to your forked repository.
- Open a pull request to the original repository, explaining the changes you've made and referencing the issue number(s) the changes relate to.
EvmosJS contains a total of 6 different packages:
- address-converter
- Convert address encodings, e.g. from Ethereum hex addresses to Evmos Bech32 addresses and vice-versa
- provider
- Create endpoints from which to query nodes for information or broadcast transactions
- eip712
- Create signable low-level EIP-712 TypedData Payloads, to be used to sign Cosmos transactions from Ethereum signers
- proto
- Create signable low-level Protobuf Payloads,
to be used to sign native Cosmos transactions using
SignDirect
, and access Protobuf types used by Evmos
- Create signable low-level Protobuf Payloads,
to be used to sign native Cosmos transactions using
- transactions
- Create signable high-level payloads that include both Protobuf- and EIP-712-signable transactions
- evmosjs
- Import the above packages from a single dependency
Depending on the issue you are contributing to, you will likely need to make changes in one or more of these.
EvmosJS uses commitlint to enforce consistent commit message styling.
In general, the commit message should describe the action performed by the commit, e.g. "test: add unit tests for proto MsgSend."
Pull requests should include a description that covers:
- Purpose of the PR
- Solution by the PR
- Relevant Context and Considerations
Simply, it should be simple for someone with working knowledge of the repository to understand what the PR changes and why.
There are certain changes that are commonly made to EvmosJS, and as a result, have a specific workflow for convenience.
To add a new Cosmos transaction interface to EvmosJS, be sure to include the following:
- Add a new EIP-712 interface in
eip712
with unit tests- Example: Implementation, Unit Tests
- Add a new Protobuf interface in
proto
with unit tests- Example: Implementation, Unit Tests
- Add a new Transaction interface in
transactions
with unit tests, using theeip712
andproto
implementations- Example: Implementation, Unit Tests
- Add documentation for the new message in the Transaction Docs for the given module
- Example: Documentation
EvmosJS uses Jest and ts-jest to run both unit and end-to-end tests. Run:
npm run test
from the base repository in order to execute the test suite.
In addition, these tests are run as part of the CI/CD cycle on each pull request that modifies the codebase.
EvmosJS enforces lint settings on each commit and as part of CI/CD. To check the lint settings, run:
npm run lint
from the base repository to lint the code.