Implementation of Midnight Wallet Specification. It provides components for:
- generating keys and addresses
- formatting keys and addresses
- building transactions
- submitting transactions to a node
- handling swaps
- syncing state with indexer
- testing without external infrastructure
This project is a yarn workspaces combined with Turborepo. In many of them package.json files can be found and they
are registered as workspaces in yarn, so yarn can resolve the dependencies. Main packages/sub-projects are:
wallet/v1- the shielded wallet variantwallet- wallet runtime and builder - allows orchestrating variants of a wallet across migration points (most importantly - hard-forks)abstractions- common abstractions and definitions - variants need to implement specific interfaces to be used through wallet builder, but can't depend on the builder itselfaddress-format- implementation of Bech32m formatting for Midnight keys and addresseshd- implementation of HD-wallet API for Midnightcapabilities- shared and universal definitions and implementations for capabilities. E.g. balancing or coin selectionwallet-integration-tests- tests examining public APIs
Note
Packaging for web requires polyfills for Node's Buffer and assert.
For a reference about structure and internal rules to follow, consult Design Doc and IcePanel component diagram
We use nvm to manage the node version and the version of yarn is managed by .yarnrc.yml.
To start development from a new machine it is recommended to run the following
nvm use
corepack enableAnother option is to use Nix. This project provides a flake with a devshell definition. In such case direnv is strongly recommended.
Environment Variables: Environment variables can be configured via a .env file in the repository root for local
test execution.
We also support loading environment variables via direnv.
See the Test Environment Setup section below for setup instructions.
Additionally, it is worth installing turborepo as a global npm package (npm install -g turbo), for easier access for
turbo command.
Follow all authentication steps from the Authentication setup document.
Install all project dependencies using Yarn.
yarnBuild the projects once, generated Javascript code is written to the project's dist directory.
turbo distBuild the project and watch for changes to automatically rebuild. Generated Javascript code is written to the project's
dist directory
turbo watch distClean exiting dist directories.
turbo cleanFormats source code.
turbo formatTests that require environment variables (such as those using Docker Compose for local infrastructure) need to be
configured. The repository includes a .env.example file that serves as a template showing all available configuration
options. To configure your environment:
-
Copy
.env.exampleto.env:cp .env.example .env
-
Edit
.envand fill in the required values for your environment (see.env.examplefor descriptions of each variable).
The .env file is automatically loaded by test setup files for tests that require environment variables (such as those
using Docker Compose).
If you're using direnv, the .env file will also be loaded into your shell environment when you
enter the directory, making the variables available to any commands you run in that shell.
turbo testsbt integrationTests/testTo run the same checks as CI does, run
turbo verifyIt runs across all workspaces:
- necessary builds and typechecking
- lints
- unit tests
- integration tests
All new features must branch off the default branch main.
It's recommended to enable automatic scalafmt formatting in your text editor upon save, in order to avoid CI errors due to incorrect format.
To execute the same verifications that are enabled on the CI, you should run CI Verifications as documented above.
Please read our git workflow for how to branch and tag releases.
After that, use the Releases feature from GitHub to
create a tag with a name following the pattern vX.Y.Z. A GitHub action will automatically build and publish the new
version.
Apache 2.0.
Provides a brief description for users and developers who want to understand the purpose, setup, and usage of the repository.
Provides a brief description of the Midnight Foundation's security policy and how to properly disclose security issues.
Provides guidelines for how people can contribute to the Midnight project.
Defines repository ownership rules.
Provides templates for reporting various types of issues, such as: bug report, documentation improvement and feature request.
Provides a template for a pull request.
The Midnight Foundation appreciates contributions, and like many other open source projects asks contributors to sign a contributor License Agreement before accepting contributions. We use CLA assistant (https://github.com/cla-assistant/cla-assistant) to streamline the CLA signing process, enabling contributors to sign our CLAs directly within a GitHub pull request.
The Midnight Foundation uses GitHub Dependabot feature to keep our projects dependencies up-to-date and address potential security vulnerabilities.
The Midnight Foundation uses Checkmarx for application security (AppSec) to identify and fix security vulnerabilities. All repositories are scanned with Checkmarx's suite of tools including: Static Application Security Testing (SAST), Infrastructure as Code (IaC), Software Composition Analysis (SCA), API Security, Container Security and Supply Chain Scans (SCS).
Facilitates two-way data synchronization, automated workflows and streamline processes between: Jira, GitHub issues and Github project Kanban board.