@glamsystems/glam-cli 0.1.1
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/README.md +162 -0
- package/main.js +5290 -0
- package/package.json +35 -0
package/README.md
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# GLAM CLI
|
|
2
|
+
|
|
3
|
+
A convenient way of interacting with the GLAM program.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @glamsystems/glam-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
After installation, you can use the CLI with the `glam-cli` command.
|
|
12
|
+
|
|
13
|
+
## Configure
|
|
14
|
+
|
|
15
|
+
The CLI expects a configuration file at `~/.config/glam/config.json`. The file should contain the following content:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"cluster": "",
|
|
20
|
+
"json_rpc_url": "",
|
|
21
|
+
"tx_rpc_url": "",
|
|
22
|
+
"keypair_path": "",
|
|
23
|
+
"priority_fee": {
|
|
24
|
+
"micro_lamports": 0,
|
|
25
|
+
"level": "",
|
|
26
|
+
"helius_api_key": ""
|
|
27
|
+
},
|
|
28
|
+
"glam_state": ""
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Here's a quick explanation of each field:
|
|
33
|
+
|
|
34
|
+
- `cluster`: Value must be one of `mainnet-beta`, `devnet`, or `localnet`.
|
|
35
|
+
- `json_rpc_url`: The URL of your preferred Solana JSON RPC endpoint.
|
|
36
|
+
- `tx_rpc_url`: Optional. If not set it will default to `json_rpc_url`. Use this to specify a separate RPC endpoint you want to use for sending transactions.
|
|
37
|
+
- `keypair_path`: Path to your keypair JSON file.
|
|
38
|
+
- `priority_fee`:
|
|
39
|
+
- `micro_lamports`: Optional (defaults to 0). If provided, `level` and `helius_api_key` will be ignored.
|
|
40
|
+
- `level`: Optional (defaults to `Min`). Only applied if cluster is `mainnet-beta`. Other options are `Min`, `Medium`, `High`, `VeryHigh`, `UnsafeMax`, `Default` (more info can be found [here](https://docs.helius.dev/solana-apis/priority-fee-api)).
|
|
41
|
+
- `helius_api_key`: Optional. Only applied if cluster is `mainnet-beta`. If not provided `level` will be ignored. The API key is needed to fetch the priority fee estimate from Helius.
|
|
42
|
+
- `glam_state`: Optional. If you want to set a default active GLAM state, you can do so here. Alternatively, you can use the `set` command to set the active GLAM state later on.
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
Run `glam-cli --help` to see all available commands. Here are the main command categories:
|
|
47
|
+
|
|
48
|
+
### General Commands
|
|
49
|
+
|
|
50
|
+
- `glam-cli env` - Show environment setup
|
|
51
|
+
- `glam-cli list` - List GLAM products the wallet has access to
|
|
52
|
+
- `-o, --owner-only` - Only list products the wallet owns
|
|
53
|
+
- `-a, --all` - List all GLAM products
|
|
54
|
+
|
|
55
|
+
### Product Management
|
|
56
|
+
|
|
57
|
+
- `glam-cli view [state]` - View a GLAM product by its state pubkey
|
|
58
|
+
- `-c, --compact` - Compact output
|
|
59
|
+
- `glam-cli set <state>` - Set active GLAM product
|
|
60
|
+
- `glam-cli create <path>` - Create a new GLAM product from a JSON file
|
|
61
|
+
- `glam-cli close [state]` - Close a GLAM product
|
|
62
|
+
- `-y, --yes` - Skip confirmation prompt
|
|
63
|
+
- `glam-cli update-owner <new-owner-pubkey>` - Update the owner of a GLAM product (**dangerous! may lead to loss of assets if you don't control the new owner wallet**)
|
|
64
|
+
- `-y, --yes` - Skip confirmation prompt
|
|
65
|
+
- `glam-cli withdraw <asset> <amount>` - Withdraw asset (mint address) from the vault
|
|
66
|
+
- `-y, --yes` - Skip confirmation prompt
|
|
67
|
+
|
|
68
|
+
### Delegate Management
|
|
69
|
+
|
|
70
|
+
- `glam-cli delegate list` - List delegates and permissions
|
|
71
|
+
- `glam-cli delegate set <pubkey> <permissions...>` - Set delegate permissions
|
|
72
|
+
- `glam-cli delegate delete <pubkey>` - Revoke all delegate permissions for a pubkey
|
|
73
|
+
|
|
74
|
+
### Integration Management
|
|
75
|
+
|
|
76
|
+
- `glam-cli integration list` - List all enabled integrations
|
|
77
|
+
- `glam-cli integration enable <name>` - Enable an integration
|
|
78
|
+
- `glam-cli integration disable <name>` - Disable an integration
|
|
79
|
+
|
|
80
|
+
### Token Operations
|
|
81
|
+
|
|
82
|
+
- `glam-cli swap <from> <to> <amount>` - Swap assets held in the vault
|
|
83
|
+
- `-m, --max-accounts <num>` - Specify max accounts allowed
|
|
84
|
+
- `-s, --slippage-bps <bps>` - Specify slippage bps
|
|
85
|
+
- `-d, --only-direct-routes` - Direct routes only
|
|
86
|
+
|
|
87
|
+
### Liquid Staking
|
|
88
|
+
|
|
89
|
+
- `glam-cli lst stake <stakepool> <amount>` - Stake `<amount>` SOL into `<stakepool>`
|
|
90
|
+
- `glam-cli lst unstake <asset> <amount>` - Unstake `<amount>` worth of `<asset>` (mint address)
|
|
91
|
+
- `glam-cli lst list` - List all stake accounts
|
|
92
|
+
- `glam-cli lst withdraw <accounts...>` - Withdraw staking accounts (space-separated pubkeys)
|
|
93
|
+
- `glam-cli lst marinade-list` - List all Marinade tickets
|
|
94
|
+
- `glam-cli lst marinade-claim <tickets...>` - Claim Marinade tickets (space-separated)
|
|
95
|
+
|
|
96
|
+
### Jupiter (JUP) Staking
|
|
97
|
+
|
|
98
|
+
- `glam-cli jup stake <amount>` - Stake JUP tokens
|
|
99
|
+
- `glam-cli jup unstake` - Unstake all JUP tokens
|
|
100
|
+
- `glam-cli jup withdraw` - Withdraw all unstaked JUP
|
|
101
|
+
|
|
102
|
+
### Governance
|
|
103
|
+
|
|
104
|
+
- `glam-cli vote <proposal> <side>` - Vote on a proposal
|
|
105
|
+
|
|
106
|
+
## Development
|
|
107
|
+
|
|
108
|
+
### Build from Source
|
|
109
|
+
|
|
110
|
+
Clone https://github.com/glamsystems/glam/, enter the repo and run:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
pnpm install && pnpm run cli-build
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Run in Development Mode
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx nx run cli:dev -- --args="command [options]"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Docker Support
|
|
123
|
+
|
|
124
|
+
### Build Docker Image
|
|
125
|
+
|
|
126
|
+
From the root of the repo:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
docker build -f ./cli/Dockerfile -t glam-cli .
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
We have a pre-built docker image available at https://github.com/glamsystems/glam/pkgs/container/glam-cli. To pull the latest image:
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
docker pull ghcr.io/glamsystems/glam-cli
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Run in Docker Container
|
|
139
|
+
|
|
140
|
+
Mount your configuration directory to the container's `/workspace`:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
docker run -v $HOME/.glam-cli-docker:/workspace glam-cli [command] [options]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The mounted directory should contain:
|
|
147
|
+
|
|
148
|
+
- `config.json` - CLI configuration file
|
|
149
|
+
- `keypair.json` - Your Solana keypair file
|
|
150
|
+
|
|
151
|
+
Example config for Docker:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"cluster": "mainnet-beta",
|
|
156
|
+
"json_rpc_url": "[your-rpc-url]",
|
|
157
|
+
"keypair_path": "/workspace/keypair.json",
|
|
158
|
+
"priority_fee": {
|
|
159
|
+
"micro_lamports": 0
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|