@mangrovedao/mangrove.js
This repo contains the SDK for developing TypeScript (and JavaScript) apps using the Mangrove.
The core contracts for Mangrove with example Solidity offer logics live in the mangrove-core repo.
Documentation
If you are looking for the Mangrove developer documentation, the main site to go to is docs.mangrove.exchange.
Prerequisites
For Linux or macOS everything should work out of the box, if you are using Windows, then we recommend installing everything from within WSL2 and expect some quirks.
Node.js 18+, we recommend installation through nvm, e.g.:
$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
# Reopen shell
$ nvm install --ltsEnable Yarn 2:
$ corepack enable
$ curl -L https://foundry.paradigm.xyz | bash
# Reopen shell
$ foundryupClone the git repo with sub-modules
$ git clone --recurse-submodules https://github.com/mangrovedao/mangrove.js.git
# Or set the global git config once: git config --global submodule.recurse true
Usage
The following sections describe the most common use cases in this repo.
Initial setupβ
After first cloning the repo, you should run yarn install
in the root folder.
$ yarn install
Then you need to setup the local environment (still in the root folder):
$ cp .env.local.example .env.test.local
Then open .env.test.local
in your favorite editor and put in settings for, e.g., node urls, pointing to a node provider, like, for instance, Alchemy.
Buildβ
To build, run
$ yarn build
If you encounter issues with JavaScript memory consumption, then try increasing the max available space for heap, and try again:
$ export NODE_OPTIONS="$NODE_OPTIONS --max_old_space_size=4096"
$ yarn build
Testβ
To run tests, run
$ yarn test
Yarn usage detailsβ
β οΈΒ Be aware that when googling Yarn commands, it's often not clear whether the results pertain to Yarn 1 (aka 'Classic') or Yarn 2+. Many examples online and a considerable amount of tool support is still implicitly engineered towards Yarn 1.
Lifecycle scripts and Yarn 2β
Yarn 2 deliberately only supports a subset of the lifecycle scripts supported by npm. So when adding/modifying lifecycle scripts, you should consult Yarn 2's documentation on the subject: https://yarnpkg.com/advanced/lifecycle-scripts#gatsby-focus-wrapper .
Git hooks and Husky
We use Husky to manage our Git hooks.
The Git hook scripts are in the .husky/
folder.