Skip to content

htlabs-xyz/nocturne

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Midnight Wallet SDK

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

Modules structure

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 variant
  • wallet - 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 itself
  • address-format - implementation of Bech32m formatting for Midnight keys and addresses
  • hd - implementation of HD-wallet API for Midnight
  • capabilities - shared and universal definitions and implementations for capabilities. E.g. balancing or coin selection
  • wallet-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

Development setup

Tools

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 enable

Another 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.

Internal private registry and credentials

Follow all authentication steps from the Authentication setup document.

Install dependencies

Install all project dependencies using Yarn.

yarn

Build

Build the projects once, generated Javascript code is written to the project's dist directory.

turbo dist

Build and watch

Build the project and watch for changes to automatically rebuild. Generated Javascript code is written to the project's dist directory

turbo watch dist

Clean

Clean exiting dist directories.

turbo clean

Format

Formats source code.

turbo format

Test

Environment Setup

Tests 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:

  1. Copy .env.example to .env:

    cp .env.example .env
  2. Edit .env and fill in the required values for your environment (see .env.example for 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.

Unit tests

turbo test

Integration tests

sbt integrationTests/test

CI verification

To run the same checks as CI does, run

turbo verify

It runs across all workspaces:

  • necessary builds and typechecking
  • lints
  • unit tests
  • integration tests

Contributing

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.

Release a new version

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.

LICENSE

Apache 2.0.

README.md

Provides a brief description for users and developers who want to understand the purpose, setup, and usage of the repository.

SECURITY.md

Provides a brief description of the Midnight Foundation's security policy and how to properly disclose security issues.

CONTRIBUTING.md

Provides guidelines for how people can contribute to the Midnight project.

CODEOWNERS

Defines repository ownership rules.

ISSUE_TEMPLATE

Provides templates for reporting various types of issues, such as: bug report, documentation improvement and feature request.

PULL_REQUEST_TEMPLATE

Provides a template for a pull request.

CLA Assistant

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.

Dependabot

The Midnight Foundation uses GitHub Dependabot feature to keep our projects dependencies up-to-date and address potential security vulnerabilities.

Checkmarx

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).

Unito

Facilitates two-way data synchronization, automated workflows and streamline processes between: Jira, GitHub issues and Github project Kanban board.

About

Midnight's wallet core development

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 99.5%
  • Other 0.5%