Full source code for this example can be found here:
To interact with mangrove in javascript, it is preferred to use with the sdk that was built on top of it.
To get started with a project (using ) type the following commands:
bun init
Then add viem and mgv as dependencies to your project:
bun add viem @mangrovedao/mgv
Before starting we will define our client and config.
For the config, you have to define the mangrove addresses needed for your chains. Here is an example of the config for mangrove base addresses (All addresses can be found in the docs or requested to the mangrove team):