@morpho-org/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +93 -0
- package/dist/bundle.js +549 -0
- package/package.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Morpho Association
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# @morpho-org/cli
|
|
2
|
+
|
|
3
|
+
Command-line interface for the [Morpho](https://morpho.org) protocol. Query vaults, markets, and positions, prepare transactions, and simulate execution -- all from your terminal.
|
|
4
|
+
|
|
5
|
+
Supports **Ethereum** and **Base**.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @morpho-org/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# List vaults on Base sorted by APY
|
|
17
|
+
morpho query-vaults --chain base --sort apy_desc --limit 5
|
|
18
|
+
|
|
19
|
+
# Get a specific vault
|
|
20
|
+
morpho get-vault --chain base --address 0x...
|
|
21
|
+
|
|
22
|
+
# Check a user's positions
|
|
23
|
+
morpho get-positions --chain base --user-address 0x...
|
|
24
|
+
|
|
25
|
+
# Prepare a deposit (returns unsigned transactions)
|
|
26
|
+
morpho prepare-deposit \
|
|
27
|
+
--chain base \
|
|
28
|
+
--vault-address 0x... \
|
|
29
|
+
--user-address 0x... \
|
|
30
|
+
--amount 1000
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
All commands output JSON to stdout, making them easy to pipe into `jq` or other tools.
|
|
34
|
+
|
|
35
|
+
## Commands
|
|
36
|
+
|
|
37
|
+
### Read
|
|
38
|
+
|
|
39
|
+
| Command | Description |
|
|
40
|
+
|---------|-------------|
|
|
41
|
+
| `health-check` | Check the health status of connected services |
|
|
42
|
+
| `get-supported-chains` | List supported blockchain networks |
|
|
43
|
+
| `query-vaults` | Query vaults with optional filtering and sorting |
|
|
44
|
+
| `get-vault` | Get details of a specific vault |
|
|
45
|
+
| `query-markets` | Query markets with optional filtering |
|
|
46
|
+
| `get-market` | Get details of a specific market |
|
|
47
|
+
| `get-positions` | Get all positions for a user |
|
|
48
|
+
| `get-position` | Get a specific position for a user |
|
|
49
|
+
| `get-token-balance` | Get token balance and Morpho-related approval state |
|
|
50
|
+
|
|
51
|
+
### Write
|
|
52
|
+
|
|
53
|
+
| Command | Description |
|
|
54
|
+
|---------|-------------|
|
|
55
|
+
| `prepare-deposit` | Prepare a vault deposit with approval handling |
|
|
56
|
+
| `prepare-withdraw` | Prepare a vault withdrawal (supports `max`) |
|
|
57
|
+
| `prepare-supply` | Prepare a market supply with approval handling |
|
|
58
|
+
| `prepare-borrow` | Prepare a market borrow with health factor check |
|
|
59
|
+
| `prepare-repay` | Prepare a market repay (supports `max`) |
|
|
60
|
+
| `prepare-supply-collateral` | Prepare a collateral supply with approval handling |
|
|
61
|
+
| `prepare-withdraw-collateral` | Prepare a collateral withdrawal (supports `max`) |
|
|
62
|
+
|
|
63
|
+
### Simulate
|
|
64
|
+
|
|
65
|
+
| Command | Description |
|
|
66
|
+
|---------|-------------|
|
|
67
|
+
| `simulate-transactions` | Simulate unsigned transactions with optional Morpho post-state analysis |
|
|
68
|
+
|
|
69
|
+
## Common options
|
|
70
|
+
|
|
71
|
+
Most commands accept:
|
|
72
|
+
|
|
73
|
+
- `--chain <base|ethereum>` -- Target chain (required for most commands)
|
|
74
|
+
- `--limit <number>` -- Maximum number of results (1-100)
|
|
75
|
+
- `--skip <number>` -- Pagination offset
|
|
76
|
+
- `--fields <f1,f2,...>` -- Comma-separated list of fields to include in output
|
|
77
|
+
- `--no-simulate` -- Skip transaction simulation (write commands)
|
|
78
|
+
|
|
79
|
+
Run `morpho <command> --help` for the full option list of any command.
|
|
80
|
+
|
|
81
|
+
## Write commands
|
|
82
|
+
|
|
83
|
+
Write commands (`prepare-*`) return an array of unsigned transactions ready for signing and submission. They handle:
|
|
84
|
+
|
|
85
|
+
- **ERC-20 approvals** -- includes approval transactions when the user's allowance is insufficient
|
|
86
|
+
- **USDT reset-to-zero** -- automatically prepends a zero-approval when required by USDT's non-standard behavior
|
|
87
|
+
- **DAI permit** -- handles DAI's non-standard approval interface
|
|
88
|
+
- **Health factor checks** -- validates borrow/withdrawal safety against existing positions
|
|
89
|
+
- **Max amounts** -- pass `--amount max` to withdraw or repay the full balance
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|