Thank you for your interest in contributing to the Snap Solana 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.17.0as specified in.nvmrc - Yarn
3.8.6is required due to MetaMask package compatibility
# Clone and setup
git clone git@github.com:MetaMask/snap-solana-wallet.git
cd snap-solana-wallet
nvm use
yarn
# Configure environment
cp packages/snap/.env.sample packages/snap/.env
cp packages/site/.env.development.sample packages/site/.env.development
# 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:
- Locate the directory
./metamask-extension-overrides - Copy all files from there to the corresponding locations in your
metamask-extensionrepository. Make sure you remove the.txtextension from the file name. These overrides are for local development only - do not commit them. - Start MetaMask Flask with
yarn:start:flaskin your localmetamask-extensionrepository - Install the development version in your browser
- Ensure your snap
.envfile is configured withENVIRONMENT=local - Start both the snap and test dapp with
yarn start - Make your code changes
- Wait for the snap to rebuild (you'll see
[@metamask/solana-wallet-snap]: [0] ✔ Done!in the console) - Open the test dapp in your browser at http://localhost:3000/
- Click the
Reconnectbutton to install the locally running snap into MetaMask Flask. This overrides the preinstalled Solana snap.
🎉 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.
- Configure your snap
.envfile withENVIRONMENT=test - Ensure the snap is running with
yarn start - Run the test suite with
yarn test
- Use the "Create branch" feature in Jira to generate properly named branches
- Branch names should include the ticket ID (e.g.,
SOL-10) and a brief description
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
To create a successful PR:
- Configure your snap
.envfile withENVIRONMENT=production - Re-start the snap by killing your currently running
yarn start, and running it again - Ensure all automated checks pass
- Write a clear and detailed description
- Link the PR to a Jira ticket (use the "Create branch" feature from Jira)
- Include appropriate tests for your changes