You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: src/pages/atomicdex/tutorials/using-komodefi-cli-in-console/index.mdx
+143-3
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,158 @@ export const description = "This guide details the configuration and usage of th
3
3
4
4
# Using KomoDeFi CLI in Console
5
5
6
-
For convenience, the KomoDeFi CLI is provided as a standalone binary that can be used to interact with the KomoDeFi network from the command line.
6
+
For convenience, the standalone `komodefi-cli`binary is provided to be used for interacting with the KomoDeFi network from the command line.
7
7
8
8
## Building KomoDeFi CLI
9
9
10
10
Refer to [https://github.com/KomodoPlatform/komodo-defi-framework?tab=readme-ov-file#building-from-source](https://github.com/KomodoPlatform/komodo-defi-framework?tab=readme-ov-file#building-from-source) for instructions on installing dependencies and preparing your build environment.
11
11
12
-
Once it is ready, you can build the komodefi-cli binary by running the following command:
12
+
Once it is ready, you can build the komodefi-cli binary by running the following command from the root folder of the project repository:
We also add the `bin` directory to the `PATH` environment variable so that the `komodefi-cli` binary can be executed from any location.
19
+
20
+
```bash
21
+
export PATH=${PATH}:$(pwd)/bin
16
22
```
17
23
18
24
## Configuration
19
25
26
+
#### Setting Default CLI Root Path
27
+
28
+
You can customize the default root directory for `komodefi-cli` by setting the `KOMODEFI_CLI_ROOT` environment variable. This allows you to specify a location for saving configuration files, binaries, and other related data.
29
+
30
+
```bash
31
+
export KOMODEFI_CLI_ROOT=$HOME/komodefi-cli
32
+
```
33
+
34
+
#### Downloading the Core API binary
35
+
36
+
Before using the `komodefi-cli` binary, you need to download the Core API binary. Running the following command to download the latest release:
37
+
38
+
```bash
39
+
komodefi-cli mm2 download
40
+
```
41
+
42
+
#### Configuring the Core API
43
+
44
+
For the `komodefi-cli` to work, you need to configure the Core API by setting the `coins` data and the information required for an [MM2.json](/atomicdex/tutorials/atomicdex-walkthrough/#launching-the-atomic-dex-api) file. For more information, run the following command:
45
+
46
+
```bash
47
+
komodefi-cli init --help
48
+
```
49
+
50
+
Which will return
51
+
52
+
```
53
+
54
+
Config is not set
55
+
Initialize a predefined coin set and configuration to start mm2 instance with
56
+
57
+
Usage: komodefi-cli init [OPTIONS]
58
+
59
+
Options:
60
+
--mm-coins-path <MM_COINS_PATH> Coin set file path [default: coins] [aliases: coins]
If you have an existing coins file and/or MM2.json file, you can use the `--mm-coins-path` and `--mm-conf-path` options to specify the file paths, as below.
Alternatively, run `komodefi-cli init` without any options to create the `coins` and `MM2.json` files interactively. Pressing enter for each option will use the default values. In the case of the mnemonic phrase, you can enter your own mnemonic phrase or press enter to use a newly generated one.
After the configuration is set, you can start the Core API by running `komodefi-cli mm2 start`. You can also use the `--help` option to see the available options for this command:
--mm-coins-path <MM_COINS_PATH> Coin set file path [aliases: coins]
112
+
--mm-log <MM_LOG> Log file path [aliases: log]
113
+
-h, --help Print help
114
+
```
115
+
116
+
For example, to start the Core API and save its runtime logs to \~/logs/mm2.log, you can run the following command:
117
+
118
+
```bash
119
+
$ komodefi-cli mm2 start --mm-log ~/logs/mm2.log
120
+
> Set env MM_LOG as: ~/logs/mm2.log
121
+
> Started child process: "mm2", pid: 459264
122
+
```
123
+
20
124
## Usage
125
+
126
+
From here, you are ready to use the `komodefi-cli` binary to interact with the KomoDeFi network. You can use the `--help` option to see the available commands and options.
127
+
128
+
```bash
129
+
modefi-cli --help
130
+
Config is not set
131
+
Provides a CLI interface and facilitates interoperating to komodo defi platform through the mm2 service
132
+
133
+
Usage: komodefi-cli <COMMAND>
134
+
135
+
Commands:
136
+
init Initialize a predefined coin set and configuration to start mm2 instance with
137
+
config Manage rpc_password and mm2 RPC URL
138
+
mm2 Manage mm2 instance commands
139
+
coin Coin commands: enable, disable etc.
140
+
wallet Wallet commands: balance, withdraw etc.
141
+
sell Put a selling request
142
+
buy Put a buying request
143
+
set-price Place an order on the orderbook. The setprice order is always considered a sell
144
+
update-maker-order Update order on the orderbook [aliases: update]
145
+
order Order listing commands: book, history, depth etc. [aliases: orders]
version-stat Version statistic commands [aliases: stat, vstat]
152
+
task Tracking the status of long-running commands
153
+
help Print this message or the help of the given subcommand(s)
154
+
155
+
Options:
156
+
-h, --help Print help
157
+
-V, --version Print version
158
+
```
159
+
160
+
For more deatils and examples of commands available in `komodefi-cli`, refer to the [komodefi-cli documentation](https://github.com/KomodoPlatform/komodo-defi-framework/blob/1799-swap-commands/mm2src/komodefi_cli/src/doc/CLI_REFERENCE.md) within the [Komodo DeFi Framework](https://github.com/KomodoPlatform/komodo-defi-framework) repository.
0 commit comments