MutinyWallet / mutiny-node

SDK behind Mutiny Wallet
https://mutinywallet.com
MIT License
187 stars 36 forks source link
bdk bitcoin ldk lightning nostr rust wasm webassembly

mutiny-node

MIT licensed mutiny-core on crates.io mutiny-core on docs.rs npm version

The mutiny node that powers the mutiny web frontend.

The frontend for Mutiny Wallet is here.

Importing

The web front end imports the NPM package that this project creates here.

Development

Nixos

A flake.nix file has been added for easier nix development and testing. Pretty much all cargo / wasm commands work, though right now optimized for aarch64-unknown-linux-gnu and wasm32-unknown-unknown compilation in the nix shell.

To start:

nix develop

Then the following just examples that work:

just clippy-nix
just test-nix
just pack
just release

Building on the mac

See the discussion here: https://github.com/rust-bitcoin/rust-secp256k1/issues/283

You may have to either prefix some environment variables or set them in your env or shell file:

AR=/opt/homebrew/opt/llvm/bin/llvm-ar CC=/opt/homebrew/opt/llvm/bin/clang

Dependencies

cargo install wasm-pack
brew install chromedriver

Build

Get all the dependencies above first.

Build the rust wasm stuff:

just pack

Testing

To run the local tests you can simply use

just test

To test running mutiny with mutiny-web you'll need to run the following:

just pack
just link

Then in the mutiny-web repo:

just local

Then you can run the mutiny-web project and it will use the locally built mutiny-node instead of the published npm package.

You only need to run just link once, but you'll need to run just pack every time you make changes to the rust code. just link creates a symlink in the mutiny-web project to the mutiny-node project. This allows you to make changes to the mutiny-node project and see them reflected in the mutiny-web project without having to publish the npm package. just pack builds the wasm binary and needs to be run every time you make changes to the rust code.

Publishing

The mutiny-core rust library and mutiny-wasm typescript packages are published when new github releases are created. Just bump both of those cargo.toml package numbers and create release just publish.