Thank you for your interest in contributing to the Polymarket API npm package! This document provides guidelines and instructions for contributing.
We welcome contributions of all kinds, including:
- Bug fixes
- New features
- Documentation improvements
- Code optimizations
- Test coverage
- Examples and use cases
- Node.js (v14 or higher)
- npm or yarn
- Git
-
Fork the repository
-
Clone your fork
git clone https://github.com/bitquery/polymarket-api cd polymarket-api -
Install dependencies
npm install
-
Create a branch
git checkout -b feature/your-feature-name # or git checkout -b fix/your-bug-fix
- Follow existing code style and formatting
- Use ES6+ features where appropriate
- Add JSDoc comments for all functions
- Keep functions focused and single-purpose
- Use meaningful variable and function names
All functions must include JSDoc comments following this format:
/**
* functionName
* Brief description of what the function does
* @param {type} paramName - parameter description
* @param {type} [optionalParam] - optional parameter description
* @returns {type} - return value description
*/- Always use try-catch blocks for async operations
- Provide meaningful error messages
- Re-throw errors to allow caller handling
- Document potential errors in JSDoc comments
- Add tests for new features
- Ensure existing tests pass
- Test error cases and edge conditions
- Test with different parameter combinations
Use clear, descriptive commit messages:
feat: add function to get market prices
fix: handle null responses in getNewQuestions
docs: update README with new examples
refactor: simplify query construction
test: add tests for streaming functions
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
-
Update Documentation
- Update README.md if adding new features
- Add JSDoc comments for new functions
- Update examples if API changes
-
Test Your Changes
- Test all new functionality
- Ensure existing functionality still works
- Test error cases
-
Create Pull Request
- Use a clear, descriptive title
- Provide a detailed description of changes
- Reference any related issues
- Include examples of how to use new features
-
PR Checklist
- Code follows project style guidelines
- All functions have JSDoc comments
- Error handling is implemented
- Documentation is updated
- Tests pass (if applicable)
- No console.log or debug code left
When adding a new query function:
- Create the query file in
queries/directory - Export both query and stream versions
- Add the function to
index.jswith:- Try-catch error handling
- JSDoc documentation
- Export in the export statement
Example structure:
// queries/newFeatureQuery.js
export const newFeatureQuery = (params) => {
// GraphQL query
};
export const newFeatureStream = {
// Stream configuration
};// index.js
/**
* getNewFeature
* Description of the new feature
* @param {string} token - your Bitquery OAuth token
* @param {type} param - parameter description
* @returns {Promise<Array>} - return description
*/
const getNewFeature = async (token, param) => {
try {
const result = await queryRunner(newFeatureQuery(param), token);
return result.data.EVM.Events;
} catch (error) {
throw error;
}
}When adding streaming functionality:
- Ensure the stream query is exported from the query file
- Add streaming function with proper options handling
- Include error handling and documentation
- Check if the bug has already been reported
- Verify it's not a configuration issue
- Test with the latest version
**Describe the bug**
A clear description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Call function '...'
2. With parameters '...'
3. See error
**Expected behavior**
What you expected to happen.
**Error message**
Full error message if applicable.
**Environment:**
- Node.js version:
- Package version:
- Bitquery token status:
**Additional context**
Any other relevant information.We welcome feature requests! When suggesting a feature:
- Check existing issues - Your feature might already be requested
- Describe the use case - Explain why this feature would be useful
- Provide examples - Show how you'd use the feature
- Consider implementation - If possible, suggest how it might work
Documentation improvements are highly valued:
- Fix typos and grammar
- Improve clarity and examples
- Add use cases and tutorials
- Translate documentation (if applicable)
- Update outdated information
All contributions go through code review:
- Be open to feedback and suggestions
- Respond to review comments promptly
- Make requested changes or discuss alternatives
- Be respectful and constructive in discussions
By contributing, you agree that your contributions will be licensed under the same license as the project (ISC).
Contributors will be recognized in:
- README.md contributors section (if added)
- Release notes for significant contributions
- Project documentation
If you have questions about contributing:
- Check existing issues and discussions
- Review the codebase and examples
- Open an issue with your question
- Reach out to maintainers
Your contributions make this project better for everyone. Thank you for taking the time to contribute!
Remember: Good contributions are not just about code - they're about making the project more useful, reliable, and accessible for all users.