@jup-ag/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 +674 -0
- package/README.md +47 -0
- package/dist/index.js +2091 -0
- package/docs/config.md +22 -0
- package/docs/keys.md +64 -0
- package/docs/setup.md +41 -0
- package/docs/spot.md +151 -0
- package/llms.txt +17 -0
- package/package.json +43 -0
package/docs/config.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Config
|
|
2
|
+
|
|
3
|
+
Settings are stored at `~/.config/jup/settings.json`.
|
|
4
|
+
|
|
5
|
+
## View current settings
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
jup config list
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Set output format
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
jup config set --output json
|
|
15
|
+
jup config set --output table
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Set active key
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
jup config set --active-key <name>
|
|
22
|
+
```
|
package/docs/keys.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Keys
|
|
2
|
+
|
|
3
|
+
A key is required for signing transactions (swaps, transfers). Keys are stored locally at `~/.config/jup/keys/`.
|
|
4
|
+
|
|
5
|
+
## Generate a new key
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
jup keys add <name>
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Import a Solana CLI keypair
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
jup keys solana-import
|
|
15
|
+
jup keys solana-import --name mykey --path ~/.config/solana/id.json
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Recover from seed phrase or private key
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
jup keys add <name> --recover --seed-phrase "word1 word2 ..."
|
|
22
|
+
jup keys add <name> --recover --private-key <key>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`--private-key` accepts hex, base58, base64, or a JSON byte array.
|
|
26
|
+
|
|
27
|
+
## List keys
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
jup keys list
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
// Example JSON response:
|
|
35
|
+
[
|
|
36
|
+
{
|
|
37
|
+
"name": "default",
|
|
38
|
+
"address": "ABC1...xyz", // Solana wallet address
|
|
39
|
+
"active": true // if true, key is used by default for signing transactions
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Set the active key
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
jup keys use <name>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Edit a key
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
jup keys edit <name> --name <new-name>
|
|
54
|
+
jup keys edit <name> --seed-phrase "word1 word2 ..."
|
|
55
|
+
jup keys edit <name> --private-key <key>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Rename a key and/or replace its credentials. Options can be combined. `--seed-phrase` and `--private-key` are mutually exclusive.
|
|
59
|
+
|
|
60
|
+
## Delete a key
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
jup keys delete <name>
|
|
64
|
+
```
|
package/docs/setup.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Setup
|
|
2
|
+
|
|
3
|
+
## Install
|
|
4
|
+
|
|
5
|
+
### Option 1: npm (recommended if npm is available)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i -g @jup-ag/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Option 2: Install script
|
|
12
|
+
|
|
13
|
+
Auto-detects the best install method (volta > npm > standalone binary):
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl -fsSL https://raw.githubusercontent.com/jup-ag/cli/main/scripts/install.sh | bash
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Option 3: Standalone binary
|
|
20
|
+
|
|
21
|
+
Download the latest binary from GitHub releases:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
curl -fsSL https://github.com/jup-ag/cli/releases/latest/download/jup-linux-x64 -o jup
|
|
25
|
+
chmod +x jup
|
|
26
|
+
sudo mv jup /usr/local/bin/
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Replace `jup-linux-x64` with the appropriate binary for your platform (`jup-darwin-arm64`, `jup-darwin-x64`, etc.).
|
|
30
|
+
|
|
31
|
+
### Option 4: Build from source
|
|
32
|
+
|
|
33
|
+
Requires [Bun](https://bun.sh).
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
git clone https://github.com/jup-ag/cli.git
|
|
37
|
+
cd cli
|
|
38
|
+
bun install
|
|
39
|
+
bun build src/index.ts --compile --outfile jup
|
|
40
|
+
sudo mv jup /usr/local/bin/
|
|
41
|
+
```
|
package/docs/spot.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Spot Trading
|
|
2
|
+
|
|
3
|
+
Requires: an active key for swap and transfer commands. See [setup](setup.md).
|
|
4
|
+
|
|
5
|
+
## Token resolution
|
|
6
|
+
|
|
7
|
+
Anywhere a token is specified (`--from`, `--to`, `--token`, `--search`), you can use either:
|
|
8
|
+
|
|
9
|
+
- **Symbol** (e.g. `SOL`, `USDC`, `JUP`) — the CLI auto-resolves to the best-matching token
|
|
10
|
+
- **Mint address** (e.g. `So11111111111111111111111111111111111111112`) — exact match
|
|
11
|
+
|
|
12
|
+
When using a symbol, the CLI picks the top result from Jupiter's token search. Use a mint address when you need to target a specific token (e.g. to disambiguate tokens with the same symbol).
|
|
13
|
+
|
|
14
|
+
## Commands
|
|
15
|
+
|
|
16
|
+
### Search tokens
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
jup spot tokens --search <query>
|
|
20
|
+
jup spot tokens --search <query> --limit 5
|
|
21
|
+
jup spot tokens --search <mint-address>
|
|
22
|
+
jup spot tokens --search "<mint1>,<mint2>"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Get a swap quote
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
jup spot quote --from SOL --to USDC --amount 1
|
|
29
|
+
jup spot quote --from <mint> --to <mint> --raw-amount 1000000000
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
- `--amount` uses human-readable units (e.g. `1` SOL = 1 SOL)
|
|
33
|
+
- `--raw-amount` uses on-chain units (e.g. `1000000000` lamports = 1 SOL)
|
|
34
|
+
- Exactly one of `--amount` or `--raw-amount` is required
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
// Example JSON response:
|
|
38
|
+
{
|
|
39
|
+
"inputToken": { "id": "So11...1112", "symbol": "SOL", "decimals": 9 },
|
|
40
|
+
"outputToken": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 },
|
|
41
|
+
"inAmount": "1", // human-readable decimal amount
|
|
42
|
+
"outAmount": "84.994059", // human-readable decimal amount
|
|
43
|
+
"inUsdValue": 84.98, // USD value
|
|
44
|
+
"outUsdValue": 84.99,
|
|
45
|
+
"priceImpact": 0.005 // max value of 1; 0.005 means 0.5%
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Execute a swap
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
jup spot swap --from SOL --to USDC --amount 1
|
|
53
|
+
jup spot swap --from SOL --to USDC --amount 1 --key mykey
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- `--key` overrides the active key for this transaction
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
// Example JSON response:
|
|
60
|
+
{
|
|
61
|
+
"trader": "ABC1...xyz", // trader address
|
|
62
|
+
"signature": "3dV98zG...", // tx signature viewable on an explorer
|
|
63
|
+
"inputToken": { "id": "So11...1112", "symbol": "SOL", "decimals": 9 },
|
|
64
|
+
"outputToken": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 },
|
|
65
|
+
"inAmount": "1", // human-readable decimal amount
|
|
66
|
+
"outAmount": "84.95", // human-readable decimal amount
|
|
67
|
+
"inUsdValue": 84.98,
|
|
68
|
+
"outUsdValue": 84.95,
|
|
69
|
+
"priceImpact": 0.005, // max value of 1; 0.005 means 0.5%
|
|
70
|
+
"networkFeeLamports": 5000 // divide by 10^9 for SOL fee
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### View portfolio
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
jup spot portfolio
|
|
78
|
+
jup spot portfolio --key mykey
|
|
79
|
+
jup spot portfolio --address <wallet-address>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- With no options, uses the active key's wallet
|
|
83
|
+
- `--address` looks up any wallet without needing a key
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
// Example JSON response:
|
|
87
|
+
{
|
|
88
|
+
"totalValue": 1250.50, // total USD net worth
|
|
89
|
+
"tokens": [
|
|
90
|
+
{
|
|
91
|
+
"id": "So11...1112", // mint address
|
|
92
|
+
"symbol": "SOL",
|
|
93
|
+
"decimals": 9,
|
|
94
|
+
"amount": 10.5, // human-readable decimal balance
|
|
95
|
+
"rawAmount": "10500000000", // on-chain integer balance
|
|
96
|
+
"value": 892.50, // USD value of holdings
|
|
97
|
+
"price": 85.00, // current token USD price
|
|
98
|
+
"priceChange": 0.032, // 24h price change; 0.032 means 3.2%
|
|
99
|
+
"isVerified": true
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Transfer tokens
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
jup spot transfer --token SOL --to <recipient-address> --amount 1
|
|
109
|
+
jup spot transfer --token USDC --to <recipient-address> --amount 50
|
|
110
|
+
jup spot transfer --token <mint> --to <recipient-address> --raw-amount 1000000000
|
|
111
|
+
jup spot transfer --token SOL --to <recipient-address> --amount 1 --key mykey
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
- Works with both SOL and any SPL token
|
|
115
|
+
- `--token` accepts a symbol or mint address
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
// Example JSON response:
|
|
119
|
+
{
|
|
120
|
+
"sender": "ABC1...xyz", // sender address
|
|
121
|
+
"recipient": "DEF2...abc",
|
|
122
|
+
"token": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 },
|
|
123
|
+
"amount": "50", // human-readable decimal amount
|
|
124
|
+
"value": 50.00, // USD value of transfer
|
|
125
|
+
"networkFeeLamports": 5000, // divide by 10^9 for SOL fee
|
|
126
|
+
"signature": "4xK29zH..." // tx signature viewable on an explorer
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Workflows
|
|
131
|
+
|
|
132
|
+
### Check price then swap
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
jup spot quote --from SOL --to USDC --amount 1
|
|
136
|
+
# Review the quoted output and price impact
|
|
137
|
+
jup spot swap --from SOL --to USDC --amount 1
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Look up a token by mint address
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
jup spot tokens --search <mint-address>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Check holdings then transfer
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
jup spot portfolio
|
|
150
|
+
jup spot transfer --token USDC --to <recipient-address> --amount 50
|
|
151
|
+
```
|
package/llms.txt
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Jupiter CLI (`jup`)
|
|
2
|
+
|
|
3
|
+
CLI for interacting with Jupiter's products on Solana: Spot, Perps, Lend, Prediction Markets and more.
|
|
4
|
+
|
|
5
|
+
## Error handling
|
|
6
|
+
|
|
7
|
+
On failure, commands exit with non-zero code with an error message. In JSON mode (`--format json`), errors are returned as `{ "error": "<message>" }`.
|
|
8
|
+
|
|
9
|
+
## Skills
|
|
10
|
+
|
|
11
|
+
- [Setup](docs/setup.md): Installation of the CLI
|
|
12
|
+
- [Config](docs/config.md): CLI settings and configurations
|
|
13
|
+
- [Keys](docs/keys.md): Private key management
|
|
14
|
+
- [Spot](docs/spot.md): Swaps, transfers, token and portfolio data
|
|
15
|
+
- Perps: Perpetual futures (coming soon)
|
|
16
|
+
- Lend: Lending and borrowing (coming soon)
|
|
17
|
+
- Predictions: Create and trade prediction markets (coming soon)
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jup-ag/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "GPL-3.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"jup": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/index.js",
|
|
11
|
+
"docs",
|
|
12
|
+
"llms.txt",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"dev": "bun run src/index.ts",
|
|
17
|
+
"build": "bun build src/index.ts --outdir dist --target node --format esm --minify",
|
|
18
|
+
"build:binary": "bash scripts/build.sh",
|
|
19
|
+
"typecheck": "bunx tsc --noEmit",
|
|
20
|
+
"lint": "bunx oxlint src",
|
|
21
|
+
"test": "bun test",
|
|
22
|
+
"ci": "bun run lint && bun run typecheck && bun run test",
|
|
23
|
+
"prepublishOnly": "bun run build"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/bun": "latest",
|
|
27
|
+
"oxlint": "^1.53.0",
|
|
28
|
+
"prettier": "^3.8.1"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"typescript": "^5"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@scure/bip32": "^2.0.1",
|
|
35
|
+
"@scure/bip39": "^2.0.1",
|
|
36
|
+
"@solana-program/token": "^0.12.0",
|
|
37
|
+
"@solana/kit": "^6.2.0",
|
|
38
|
+
"chalk": "^5.6.2",
|
|
39
|
+
"cli-table3": "^0.6.5",
|
|
40
|
+
"commander": "^14.0.3",
|
|
41
|
+
"ky": "^1.14.3"
|
|
42
|
+
}
|
|
43
|
+
}
|