Skip to content

Latest commit

 

History

History
167 lines (101 loc) · 4.11 KB

CONTRIBUTING.md

File metadata and controls

167 lines (101 loc) · 4.11 KB

Contributing to Dex-Toolkit

Thank you for your interest in contributing to Dex-Toolkit! We appreciate all contributions, big or small.


Table of Contents

  1. Getting Started
  2. How to Contribute
  3. Code Style
  4. Pre Commit
  5. Need Help?

Getting Started

  1. Fork the repository: Click the "Fork" button in the top-right corner of the repository page.

  2. Clone your fork:

    git clone https://github.com/niZmosis/dex-toolkit.git
  3. Create a branch:

    git checkout -b my-new-branch
  4. Run the following command to set up the project:

    pnpm setup:initial
  5. Start watching all packages:

    pnpm start
  6. Make your changes:

    • Follow the code style guidelines.
    • Write clear commit messages.
  7. Push your changes:

    git push origin my-new-branch
  8. Open a pull request: Go to the original repository and click "New pull request."


How to Contribute

Check the TODO.md file to see the current list of tasks.

Adding Network Configurations

  1. Add the Chain ID to chainIds.ts

  2. Add the Network Config to networks

    • Ensure to add the Network config to getChainConfig at the bottom of the file.
    • If adding a new DEX, export it in the barrel file.
  3. Add the Network Icon to images

  4. Add the created Network Config to getChainConfig in chainConfigs

  5. Run Tests:

    pnpm test:utils:networks
  6. Update the compatibility table in the README.md README.md


Adding DEX Configurations

  1. Add the DEX Type to dex.types.ts.

  2. Add the DEX Type to the Map in dex.utils.ts.

  3. Add the DEX Config to configs/index.ts:

    • Ensure to add the DEX config to getDexConfig and getAllDexConfigs at the bottom of the file.
    • If adding a new DEX, export it in the barrel file.
  4. Check contracts for method names and map them if needed. See traderJoeSwap.dex.ts for reference.

  5. Run Tests:

    pnpm test:utils:dexs
  6. Update the compatibility table in the README.md README.md.


Adding Token Configurations

  1. Add the Token Config to configs/index.ts:

    • Ensure the token config is added to getTokenForChainId at the bottom of the file.
    • If adding a new token, export it in the barrel file.
  2. Add the Token Config to tokenClasses in tokenConfigs.ts.

  3. Run Tests:

    pnpm test:utils:tokens
  4. Update the compatibility table in the README.md README.md.


Adding Contracts

  1. Add ABI files to abis:

    • Files can be either .json or .ts exporting a JSONFragment array.
  2. Generate ABI typings and classes:

    cd packages/utils && pnpm gen:abis
    • Typings output: packages/types/src/abis/types.
    • Classes output: packages/contract/src.

Code Style

  • Keep items in alphabetical order where applicable.

Pre Commit

Before committing, run

pnpm precommit

to preform all linting, formatting, docs, and tests.

Need Help?

If you have any questions or need help getting started, feel free to open an issue or contact us on [communication channel, e.g., Discord].