|
| 1 | +# Lending |
| 2 | + |
| 3 | +Requires: an active key for `deposit` and `withdraw` commands. See [setup](setup.md). |
| 4 | + |
| 5 | +## Commands |
| 6 | + |
| 7 | +### View available tokens |
| 8 | + |
| 9 | +```bash |
| 10 | +jup lend earn tokens |
| 11 | +``` |
| 12 | + |
| 13 | +- Shows all tokens available for lending with APY, TVL, and withdrawable liquidity |
| 14 | + |
| 15 | +```js |
| 16 | +// Example JSON response: |
| 17 | +{ |
| 18 | + "tokens": [ |
| 19 | + { |
| 20 | + "token": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 }, // underlying token |
| 21 | + "jlToken": { "id": "jl1U...xxx", "symbol": "jlUSDC", "decimals": 6 }, // lending token |
| 22 | + "apyPct": 5.97, // total APY; 5.97 means 5.97% |
| 23 | + "supplyApyPct": 4.50, // supply rate portion |
| 24 | + "rewardsApyPct": 1.47, // rewards rate portion |
| 25 | + "totalTvlUsd": 125000000, // total TVL in USD |
| 26 | + "withdrawableUsd": 80000000, // available withdrawable liquidity in USD |
| 27 | + "priceUsd": 1.00 // underlying token price |
| 28 | + } |
| 29 | + ] |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +### View positions |
| 34 | + |
| 35 | +```bash |
| 36 | +jup lend earn positions |
| 37 | +jup lend earn positions --key mykey |
| 38 | +jup lend earn positions --address <wallet-address> |
| 39 | +jup lend earn positions --token USDC |
| 40 | +``` |
| 41 | + |
| 42 | +- With no options, uses the active key's wallet |
| 43 | +- `--address` looks up any wallet without needing a key |
| 44 | +- `--token` filters by underlying token (symbol or mint address) |
| 45 | + |
| 46 | +```js |
| 47 | +// Example JSON response: |
| 48 | +{ |
| 49 | + "positions": [ |
| 50 | + { |
| 51 | + "token": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 }, // underlying token |
| 52 | + "jlToken": { "id": "jl1U...xxx", "symbol": "jlUSDC", "decimals": 6 }, // derivative token |
| 53 | + "positionAmount": 1025.30, // current position value in underlying token units, including earnings |
| 54 | + "positionUsd": 1025.30, // current position value in USD |
| 55 | + "earningsAmount": 24.80, // accrued interest in underlying token units |
| 56 | + "earningsUsd": 24.80, // accrued interest in USD |
| 57 | + "apyPct": 5.97 // current APY; 5.97 means 5.97% |
| 58 | + } |
| 59 | + ] |
| 60 | +} |
| 61 | +``` |
| 62 | + |
| 63 | +### Deposit |
| 64 | + |
| 65 | +```bash |
| 66 | +jup lend earn deposit --token USDC --amount 100 |
| 67 | +jup lend earn deposit --token SOL --amount 1.5 --key mykey |
| 68 | +jup lend earn deposit --token USDC --raw-amount 100000000 |
| 69 | +``` |
| 70 | + |
| 71 | +- `--token` (required) — underlying token to deposit (symbol or mint address) |
| 72 | +- `--amount` uses human-readable units (e.g. `100` USDC = 100 USDC) |
| 73 | +- `--raw-amount` uses on-chain units (e.g. `100000000` = 100 USDC) |
| 74 | +- Exactly one of `--amount` or `--raw-amount` is required |
| 75 | +- `--key` overrides the active key for this transaction |
| 76 | + |
| 77 | +```js |
| 78 | +// Example JSON response: |
| 79 | +{ |
| 80 | + "token": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 }, |
| 81 | + "depositedAmount": "100", // human-readable amount just deposited |
| 82 | + "depositedUsd": 100.00, // USD value of deposit |
| 83 | + "positionAmount": 1125.30, // total position after deposit |
| 84 | + "positionUsd": 1125.30, // total position USD value |
| 85 | + "apyPct": 5.97, // current APY; 5.97 means 5.97% |
| 86 | + "signature": "3dV9...8zG1" // tx signature |
| 87 | +} |
| 88 | +``` |
| 89 | + |
| 90 | +### Withdraw |
| 91 | + |
| 92 | +```bash |
| 93 | +jup lend earn withdraw --token USDC --amount 50 |
| 94 | +jup lend earn withdraw --token USDC # withdraw entire position |
| 95 | +jup lend earn withdraw --token jlUSDC --amount 50 # also accepts jlToken directly |
| 96 | +jup lend earn withdraw --token USDC --raw-amount 50000000 |
| 97 | +``` |
| 98 | + |
| 99 | +- `--token` (required) — token to withdraw (accepts underlying symbol/address or jlToken symbol/address) |
| 100 | +- `--amount` in human-readable units of the underlying token |
| 101 | +- `--raw-amount` in on-chain units of the jlToken |
| 102 | +- When neither `--amount` nor `--raw-amount` is provided, withdraws the entire position |
| 103 | +- `--key` overrides the active key for this transaction |
| 104 | + |
| 105 | +```js |
| 106 | +// Example JSON response: |
| 107 | +{ |
| 108 | + "token": { "id": "EPjF...USDC", "symbol": "USDC", "decimals": 6 }, |
| 109 | + "withdrawnAmount": "50", // human-readable amount just withdrawn |
| 110 | + "withdrawnUsd": 50.00, // USD value of withdrawal |
| 111 | + "positionAmount": 975.30, // remaining position after withdrawal (0 if fully withdrawn) |
| 112 | + "positionUsd": 975.30, // remaining position USD value |
| 113 | + "apyPct": 5.97, // current APY; 5.97 means 5.97% |
| 114 | + "signature": "5YhT...9AKU" // tx signature |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +## Workflows |
| 119 | + |
| 120 | +### Check available tokens then deposit |
| 121 | + |
| 122 | +```bash |
| 123 | +jup lend earn tokens |
| 124 | +# Pick a token with good APY |
| 125 | +jup lend earn deposit --token USDC --amount 100 |
| 126 | +``` |
| 127 | + |
| 128 | +### Check positions then withdraw |
| 129 | + |
| 130 | +```bash |
| 131 | +jup lend earn positions |
| 132 | +# Review current value and earnings |
| 133 | +jup lend earn withdraw --token USDC --amount 50 |
| 134 | +``` |
| 135 | + |
| 136 | +### Withdraw entire position |
| 137 | + |
| 138 | +```bash |
| 139 | +jup lend earn withdraw --token USDC |
| 140 | +``` |
0 commit comments