Skip to content

Commit 396357b

Browse files
feat: add proxy support (#682)
* feat: add proxy support * add tests and cleanup * add tests * add browser tests * update ci for chromium test * add browser testing scripts * make tests more reliable * prettier * lint and fix config * increase timeout * remove browser tests from ci * update readme * add contributing instructions * add example * update readme * update readme --------- Co-authored-by: carlosmiei <43336371+carlosmiei@users.noreply.github.com>
1 parent cdff6bd commit 396357b

37 files changed

Lines changed: 8150 additions & 1005 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,11 @@ jobs:
2020
- name: Install dependencies
2121
run: npm install
2222

23-
- name: Install OpenVPN
24-
run: |
25-
sudo apt-get update
26-
sudo apt-get install -y openvpn
27-
28-
- name: Download IVPN config
29-
run: |
30-
wget -O ivpn-config.zip "https://api.ivpn.net/v5/config/ivpn-openvpn-config.zip?country=NL&city=Amsterdam&proto=udp&port=2049"
31-
unzip ivpn-config.zip
32-
33-
- name: Start IVPN connection
34-
run: |
35-
echo "${{ secrets.IVPN_ACCOUNT_NUMBER }}" > auth.txt
36-
echo "${{ secrets.IVPN_ACCOUNT_NUMBER }}" >> auth.txt
37-
sudo openvpn --config Netherlands-Amsterdam.ovpn --auth-user-pass auth.txt &
38-
sleep 10 # Wait for VPN to establish
39-
4023
- name: Run typecheck
4124
run: npm run typecheck
4225
- name: Lint and Prettier
4326
run: npm run lint && npm run prettier:check
4427
- name: Static Tests
4528
run: npm run static-tests
4629
- name: All Tests
47-
run: npm test
48-
49-
# - name: Run checks
50-
# run: npm run ci
51-
52-
- name: Cleanup VPN
53-
if: always()
54-
run: |
55-
sudo killall openvpn || true
56-
rm -f auth.txt
30+
run: npm run test:ava

CONTRIBUTING.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Contributing to binance-api-node
2+
3+
Thank you for your interest in contributing to binance-api-node! This document provides guidelines and instructions for contributing to the project.
4+
5+
## Getting Started
6+
7+
1. Fork the repository
8+
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/binance-api-node.git`
9+
3. Install dependencies: `npm install`
10+
4. Create a new branch for your feature or fix: `git checkout -b feature/your-feature-name`
11+
12+
## Development Setup
13+
14+
This project uses:
15+
- **Babel** for transpiling ES6+ code to CommonJS
16+
- **AVA** for testing
17+
- **ESLint** for linting
18+
- **Prettier** for code formatting
19+
20+
## Available Scripts
21+
22+
The following npm scripts are available for development and testing:
23+
24+
### Building
25+
26+
- `npm run build` - Removes the `dist` folder and transpiles the `src` directory to `dist` using Babel
27+
- `npm run prepare` - Automatically runs the build script (triggered on npm install)
28+
29+
### Testing
30+
31+
- `npm test` - Runs all tests (AVA tests + browser tests)
32+
- `npm run test:ava` - Runs AVA tests with a 10-second timeout and verbose output
33+
- `npm run test:browser` - Runs all browser tests (signature, crypto, and WebSocket tests)
34+
- `npm run test:browser:signature` - Runs browser signature tests specifically
35+
- `npm run test:browser:websocket` - Runs WebSocket tests in the browser environment
36+
- `npm run test:browser:crypto` - Runs cryptography tests in the browser environment
37+
- `npm run static-tests` - Runs static tests only
38+
39+
### Code Quality
40+
41+
- `npm run lint` - Lints the `src` directory using ESLint
42+
- `npm run prettier` - Formats code in `src` and `test` directories
43+
- `npm run prettier:check` - Checks code formatting without making changes
44+
- `npm run typecheck` - Runs TypeScript type checking without emitting files
45+
46+
### Coverage
47+
48+
- `npm run cover` - Runs tests with coverage using nyc
49+
- `npm run report` - Generates coverage report and sends it to Coveralls
50+
51+
### CI
52+
53+
- `npm run ci` - Runs the full CI pipeline (lint, prettier check, and all tests)
54+
55+
## Making Changes
56+
57+
1. Make your changes in the `src` directory
58+
2. Add tests for any new functionality in the `test` directory
59+
3. Run `npm run lint` to ensure code quality
60+
4. Run `npm run prettier` to format your code
61+
5. Run `npm test` to ensure all tests pass
62+
6. Commit your changes with a clear commit message
63+
64+
## Code Style
65+
66+
This project uses ESLint and Prettier to maintain consistent code style. Before submitting a PR:
67+
68+
1. Run `npm run prettier` to format your code
69+
2. Run `npm run lint` to check for linting errors
70+
3. Fix any issues that arise
71+
72+
## Testing Guidelines
73+
74+
- Write tests for all new features and bug fixes
75+
- Ensure all tests pass before submitting a PR
76+
- Tests should be placed in the `test` directory
77+
- Browser-specific tests go in `test/browser`
78+
- Use AVA's timeout option for tests that make API calls
79+
80+
## Pull Request Process
81+
82+
1. Update the README.md if you're adding new features or changing functionality
83+
2. Ensure all tests pass and code is properly formatted
84+
3. Update the documentation if necessary
85+
4. Submit a pull request with a clear description of your changes
86+
5. Reference any related issues in your PR description
87+
88+
## Testing with API Keys
89+
90+
Some tests require Binance API keys. You can:
91+
- Create a `.env` file in the root directory
92+
- Add your API keys:
93+
```
94+
BINANCE_API_KEY=your_api_key_here
95+
BINANCE_API_SECRET=your_api_secret_here
96+
```
97+
- Never commit your `.env` file or API keys to the repository
98+
99+
## Questions?
100+
101+
If you have questions about contributing, feel free to:
102+
- Open an issue for discussion
103+
- Check existing issues and pull requests for similar topics
104+
- Review the [README](README.md) for API documentation and usage examples
105+
106+
## License
107+
108+
By contributing to binance-api-node, you agree that your contributions will be licensed under the MIT License.

0 commit comments

Comments
 (0)