Skip to content

Contributing

Samarth Patel edited this page Jan 27, 2026 · 1 revision

🀝 Contributing to validator0x

Thank you for your interest in contributing to validator0x! This guide will help you get started with contributing to the project.


🌟 Ways to Contribute

There are many ways you can contribute to validator0x:

  • πŸ› Report bugs - Help us identify and fix issues
  • πŸ’‘ Suggest features - Share ideas for new functionality
  • πŸ“– Improve documentation - Make our docs clearer and more helpful
  • πŸ”§ Submit bug fixes - Fix issues you've encountered
  • ✨ Add blockchain support - Implement validation for new chains
  • πŸ§ͺ Write tests - Improve test coverage
  • 🎨 Improve code quality - Refactor and optimize existing code
  • 🌍 Translate documentation - Help make validator0x accessible globally

πŸš€ Getting Started

Prerequisites

  • Node.js 16+ and npm/yarn/pnpm
  • Git
  • TypeScript knowledge (for code contributions)
  • Understanding of blockchain address formats (for validation logic)

1. Fork the Repository

Click the "Fork" button at the top of the validator0x repository to create your own copy.

2. Clone Your Fork

git clone https://github.com/YOUR_USERNAME/validator0x.git
cd validator0x

3. Add Upstream Remote

git remote add upstream https://github.com/Samarth208P/validator0x.git

4. Install Dependencies

npm install

5. Create a Branch

git checkout -b feature/your-feature-name
# or
git checkout -b fix/bug-description

Branch Naming Convention:

  • feature/ - New features
  • fix/ - Bug fixes
  • docs/ - Documentation updates
  • test/ - Test additions/modifications
  • refactor/ - Code refactoring

πŸ’» Development Workflow

Project Structure

validator0x/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ index.ts          # Main exports
β”‚   β”œβ”€β”€ validators/       # Chain-specific validators
β”‚   β”œβ”€β”€ formatters/       # Address formatting utilities
β”‚   β”œβ”€β”€ types/            # TypeScript type definitions
β”‚   └── utils/            # Helper functions
β”œβ”€β”€ tests/                # Test files
β”œβ”€β”€ docs/                 # Documentation
└── examples/             # Usage examples

Running Tests

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

Building the Project

# Build TypeScript
npm run build

# Build and watch for changes
npm run build:watch

Linting and Formatting

# Run linter
npm run lint

# Fix linting issues
npm run lint:fix

# Format code
npm run format

πŸ“ Coding Standards

TypeScript Style

  • Use TypeScript for all new code
  • Include proper type annotations
  • Avoid any type unless absolutely necessary
  • Use interfaces for object shapes
  • Export types for public APIs

Example:

interface ValidationOptions {
  strict?: boolean;
  network?: 'mainnet' | 'testnet';
}

export function validateAddress(
  address: string,
  blockchain: BlockchainType,
  options?: ValidationOptions
): ValidationResult {
  // Implementation
}

Code Quality

  • Write self-documenting code
  • Keep functions small and focused
  • Use meaningful variable names
  • Add comments for complex logic only
  • Follow DRY (Don't Repeat Yourself) principle

Documentation

  • Add JSDoc comments for public APIs
  • Update README.md if adding new features
  • Update wiki documentation when needed
  • Include code examples in docs

Example:

/**
 * Validates a blockchain wallet address.
 * 
 * @param address - The wallet address string to validate
 * @param blockchain - The blockchain type (ethereum, solana, bitcoin, polygon)
 * @param options - Optional validation settings
 * @returns ValidationResult object with validation details
 * 
 * @example
 * ```typescript
 * const result = validateAddress('0x742d35Cc...', 'ethereum');
 * console.log(result.valid); // true or false
 * ```
 */

πŸ§ͺ Testing Guidelines

Writing Tests

  • Write tests for all new features
  • Aim for >90% code coverage
  • Use descriptive test names
  • Test both success and failure cases
  • Include edge cases

Example:

describe('validateAddress', () => {
  describe('Ethereum', () => {
    it('should validate correct Ethereum address', () => {
      const result = validateAddress(
        '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb',
        'ethereum'
      );
      expect(result.valid).toBe(true);
    });

    it('should reject invalid Ethereum address', () => {
      const result = validateAddress('invalid', 'ethereum');
      expect(result.valid).toBe(false);
      expect(result.error).toBeDefined();
    });

    it('should enforce checksum in strict mode', () => {
      const result = validateAddress(
        '0x742d35cc6634c0532925a3b844bc9e7595f0beb',
        'ethereum',
        { strict: true }
      );
      expect(result.valid).toBe(false);
    });
  });
});

πŸ”„ Pull Request Process

Before Submitting

  1. Sync with upstream

    git fetch upstream
    git rebase upstream/main
  2. Run all checks

    npm run lint
    npm test
    npm run build
  3. Commit your changes

    git add .
    git commit -m "feat: add support for XYZ blockchain"

    Commit Message Format:

    • feat: - New feature
    • fix: - Bug fix
    • docs: - Documentation changes
    • test: - Test additions/changes
    • refactor: - Code refactoring
    • chore: - Build/tooling changes
  4. Push to your fork

    git push origin feature/your-feature-name

Creating the Pull Request

  1. Go to your fork on GitHub
  2. Click "New Pull Request"
  3. Select your branch
  4. Fill out the PR template:
    • Clear description of changes
    • Related issue number (if applicable)
    • Screenshots (for UI changes)
    • Testing steps

PR Template

## Description
Brief description of what this PR does

## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update

## Related Issue
Fixes #(issue number)

## Testing
- [ ] Tests pass locally
- [ ] New tests added (if applicable)
- [ ] Manual testing completed

## Screenshots (if applicable)
Add screenshots here

## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex code
- [ ] Documentation updated
- [ ] No new warnings generated

PR Review Process

  • Maintainers will review your PR
  • Address any requested changes
  • Once approved, your PR will be merged
  • Your contribution will be credited in the changelog

πŸ†• Adding a New Blockchain

Want to add support for a new blockchain? Follow these steps:

1. Research the Address Format

  • Understand the address structure
  • Identify validation rules
  • Check for checksum algorithms
  • Find testnet formats

2. Create Validator Function

Create a new file in src/validators/:

// src/validators/yourchain.ts
export function validateYourChain(address: string): boolean {
  // Validation logic
  return true;
}

3. Add Tests

Create test file in tests/:

// tests/yourchain.test.ts
describe('YourChain Validation', () => {
  it('should validate valid addresses', () => {
    // Test cases
  });
});

4. Update Types

Add to BlockchainType in src/types/index.ts:

export type BlockchainType = 
  | 'ethereum'
  | 'solana'
  | 'bitcoin'
  | 'polygon'
  | 'yourchain'; // Add this

5. Update Documentation

  • Update README.md supported chains list
  • Add examples to wiki
  • Update API documentation

πŸ› Reporting Bugs

Before Reporting

  1. Check if the issue already exists
  2. Verify you're using the latest version
  3. Test with minimal code to isolate the issue

Bug Report Template

**Describe the bug**
Clear description of what the bug is

**To Reproduce**
Steps to reproduce the behavior:
1. Call function with '...'
2. See error

**Expected behavior**
What you expected to happen

**Actual behavior**
What actually happened

**Code sample**
\`\`\`typescript
// Your code here
\`\`\`

**Environment:**
 - validator0x version: [e.g., 0.1.0]
 - Node.js version: [e.g., 18.0.0]
 - TypeScript version: [e.g., 5.0.0]
 - OS: [e.g., Ubuntu 22.04]

**Additional context**
Any other relevant information

Open a bug report


πŸ’‘ Feature Requests

Feature Request Template

**Is your feature request related to a problem?**
Description of the problem

**Describe the solution you'd like**
Clear description of what you want to happen

**Describe alternatives you've considered**
Other solutions you've thought about

**Use case**
Real-world scenario where this would be useful

**Additional context**
Screenshots, examples, or other context

Request a feature


πŸ“œ Code of Conduct

Our Pledge

We are committed to providing a welcoming and inclusive environment for all contributors.

Our Standards

Positive behavior:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints
  • Gracefully accepting constructive criticism
  • Focusing on what's best for the community
  • Showing empathy towards other community members

Unacceptable behavior:

  • Trolling, insulting/derogatory comments
  • Public or private harassment
  • Publishing others' private information
  • Any conduct inappropriate in a professional setting

Enforcement

Violations of the code of conduct may result in:

  • Warning
  • Temporary ban
  • Permanent ban

Report violations to: samarth208p@gmail.com


πŸ† Recognition

Contributors will be recognized in:

  • README.md contributors section
  • Release notes
  • Project changelog

Top contributors may receive:

  • Collaborator access
  • Special mentions
  • Swag (when available)

πŸ“ž Getting Help

Questions?

Resources


πŸ“„ License

By contributing to validator0x, you agree that your contributions will be licensed under the project's MIT License.


Thank you for contributing to validator0x! Your efforts help make Web3 development better for everyone. πŸš€

← Back to Home

validator0x

npm


⚑ Quick Start

npm install validator0x

πŸ’– Support


v0.1.1 | MIT License

Clone this wiki locally