Thank you for your interest in contributing to the Snap Bitcoin Wallet project! This guide will help you get started with development and understand our contribution workflow.
- MetaMask Flask is required for testing the snap locally
- NVM to manage Node.js and avoid compatibility issues between different projects
- Node.js
v22.14as specified in.nvmrc - Yarn
4.9.1is required due to MetaMask package compatibility
# Clone and setup
git clone https://github.com/MetaMask/snap-bitcoin-wallet.git
cd snap-bitcoin-wallet
nvm use
yarn
# Configure environment
cp packages/snap/.env.example packages/snap/.env
cp packages/site/.env.example packages/site/.env
# Start development servers
yarn start # Runs snap server on local port `8080` and the test dapp at http://localhost:3000
# Lastly, install the snap in MetaMask Flask by following the steps below.To test the snap manually, you will need to install it in MetaMask Flask. Follow these steps to set up MetaMask Flask:
- Download and install MetaMask Flask from the official website or build it from source if needed.
- Enable it in your browser.
- Ensure your snap
.envfile is configured with appropriate values for local development. - Start the snap watcher and dapp with
yarn start - Make your code changes
- Wait for the snap to rebuild (you'll see a confirmation in the console)
- Open the test dapp in your browser at http://localhost:3000/
- Click the
Connect/Reconnectbutton (or equivalent) to install the locally running snap into MetaMask Flask.
π Congratulations, you're now ready to test your changes locally! You can interact with your snap through the test dapp and through the extension, and verify that everything works as expected.
- Ensure the snap is running with
yarn start - Run the test suite with
yarn test
For specific tests, prefer running individual files, e.g., yarn test MyTest
Run integration tests with yarn test:integration. This will start a docker-compose with an Esplora test network (regression test, aka regtest)
We use commitlint to enforce the Conventional Commits format. This helps maintain a clean changelog and consistent commit history. For a clean changelog, prefer using feat and fix commit types.
Git hooks are configured to automatically:
- Lint your commit messages
- Fix formatting and linting issues with
yarn lint:fix
To create a successful PR:
- Ensure all automated checks pass
- Write a clear and detailed description
- Include appropriate tests for your changes