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.
If you are looking for the Mangrove developer documentation, the main site to go to is docs.mangrove.exchange.
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 --lts
-
Enable Yarn 2:
$ corepack enable
-
$ curl -L https://foundry.paradigm.xyz | bash # Reopen shell $ foundryup
-
Clone 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
The following sections describe the most common use cases in this repo.
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.
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
To run tests, run
$ yarn test
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 .
We use Husky to manage our Git hooks.
The Git hook scripts are in the .husky/
folder.