@byreal-io/byreal-cli-realclaw 0.4.4 → 0.4.5
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/dist/index.cjs +33 -13
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3573,7 +3573,7 @@ var INJECTED_VERSION, VERSION, CLI_NAME, NPM_PACKAGE, API_BASE_URL, API_ENDPOINT
|
|
|
3573
3573
|
var init_constants = __esm({
|
|
3574
3574
|
"src/core/constants.ts"() {
|
|
3575
3575
|
"use strict";
|
|
3576
|
-
INJECTED_VERSION = true ? "0.4.
|
|
3576
|
+
INJECTED_VERSION = true ? "0.4.5" : void 0;
|
|
3577
3577
|
VERSION = INJECTED_VERSION ?? process.env.npm_package_version ?? "0.0.0";
|
|
3578
3578
|
CLI_NAME = "byreal-cli";
|
|
3579
3579
|
NPM_PACKAGE = "@byreal-io/byreal-cli-realclaw";
|
|
@@ -92113,6 +92113,19 @@ The multi-step flow is the default for backward compatibility; if Privy is confi
|
|
|
92113
92113
|
### Balance Check on Dry-run
|
|
92114
92114
|
\`positions open --dry-run\` and \`positions increase --dry-run\` automatically check wallet balance. If insufficient, response includes \`balanceWarnings\` (deficit) and \`walletBalances\` (all available tokens) \u2014 no need to run \`wallet balance\` separately.
|
|
92115
92115
|
|
|
92116
|
+
**Important caveat:** the dry-run balance check does NOT subtract the SOL fee/rent buffer (see "SOL Buffer for CLMM Position Ops" below). When SOL is one of the deposit tokens, dry-run reporting "sufficient" is necessary-but-not-sufficient \u2014 always size the SOL leg against \`sol_balance \u2212 buffer\`, not the full balance.
|
|
92117
|
+
|
|
92118
|
+
### SOL Buffer for CLMM Position Ops
|
|
92119
|
+
Opening or increasing a CLMM position consumes SOL **on top of** the SOL you deposit, to pay for account rent + tx + priority fee. The dry-run balance check does not deduct this for you \u2014 you must size the deposit yourself.
|
|
92120
|
+
|
|
92121
|
+
| Operation | Reserve at least | What the buffer pays for |
|
|
92122
|
+
| -------------------------- | ---------------- | ------------------------------------------------------------------- |
|
|
92123
|
+
| \`positions open\` | **0.03 SOL** | Position NFT mint + position account rent + tick-array init + fees |
|
|
92124
|
+
| \`positions increase\` | **0.01 SOL** | Tx + priority fee only (no new accounts) |
|
|
92125
|
+
| \`swap execute\` | **0.01 SOL** | Tx + priority fee (+ ATA creation if first time for output mint) |
|
|
92126
|
+
|
|
92127
|
+
When SOL is one of the deposit tokens, compute \`usable_sol = sol_balance \u2212 buffer\` and size the SOL leg against \`usable_sol\`. For \`--amount-usd\`, cap so the SOL leg's USD value \u2264 \`usable_sol \xD7 sol_price\`. **Never put 100% of SOL into a position.**
|
|
92128
|
+
|
|
92116
92129
|
### Config Keys
|
|
92117
92130
|
Supported keys for \`config get/set\`: rpc_url, cluster, defaults.slippage_bps, defaults.priority_fee_micro_lamports, privy_proxy_url, privy_api_base_path
|
|
92118
92131
|
|
|
@@ -92128,11 +92141,12 @@ When the user asks about investment opportunities, potential pools, or yield far
|
|
|
92128
92141
|
|
|
92129
92142
|
1. **Analyze pool**: \`byreal-cli pools analyze <pool-id> -o json\`
|
|
92130
92143
|
2. **Choose range** from rangeAnalysis (Conservative \xB130%, Balanced \xB115%, Aggressive \xB15%)
|
|
92131
|
-
3. **
|
|
92144
|
+
3. **Reserve SOL buffer FIRST**: read SOL balance, compute \`usable_sol = sol_balance \u2212 0.03\`. If the pool's token pair includes SOL, size the SOL leg against \`usable_sol\`, never against the full balance. For \`--amount-usd\`, cap so the SOL leg \u2264 \`usable_sol \xD7 sol_price\`. (See "SOL Buffer for CLMM Position Ops".)
|
|
92145
|
+
4. **Preview**:
|
|
92132
92146
|
- USD budget: \`positions open --pool <id> --price-lower <p> --price-upper <p> --amount-usd <usd> --dry-run -o json\`
|
|
92133
92147
|
- Token amount: \`positions open --pool <id> --price-lower <p> --price-upper <p> --base MintA --amount <amt> --dry-run -o json\`
|
|
92134
|
-
|
|
92135
|
-
|
|
92148
|
+
5. **If insufficient balance**: dry-run response includes \`balanceWarnings\` (deficit) + \`walletBalances\` (all tokens). Pick a swap source from ANY token in the wallet (prefer highest USD balance, stablecoins/SOL for lower slippage), swap to cover the deficit. **Wait 3-5 seconds** after swap before re-running dry-run (RPC propagation delay). **Do not swap repeatedly \u2014 recompute the position math first** (see "Position Math Sanity Check" in Troubleshooting).
|
|
92149
|
+
6. **Run for real**: drop \`--dry-run\` (keep \`--wallet-address <addr>\`). The default emits an unsigned base64 transaction \`{ unsignedTransactions: [...] }\` for an external signer (back-compat). Add \`--execute\` to sign + broadcast via Privy directly \u2192 \`{ signature, explorer }\`.
|
|
92136
92150
|
|
|
92137
92151
|
## Workflow: Increase/Decrease Liquidity
|
|
92138
92152
|
|
|
@@ -92140,9 +92154,10 @@ When user wants to add more liquidity to an existing position or partially withd
|
|
|
92140
92154
|
|
|
92141
92155
|
**Increase liquidity**:
|
|
92142
92156
|
1. \`byreal-cli positions list -o json\` \u2014 find the position's NFT mint address
|
|
92143
|
-
2.
|
|
92144
|
-
3.
|
|
92145
|
-
4.
|
|
92157
|
+
2. Reserve **0.01 SOL** buffer; if the pool includes SOL, size the SOL leg against \`sol_balance \u2212 0.01\`.
|
|
92158
|
+
3. \`byreal-cli positions increase --nft-mint <nft-mint> --amount-usd <usd> --dry-run -o json\` \u2014 preview (includes balance check; remember it does NOT deduct the SOL buffer)
|
|
92159
|
+
4. If insufficient balance \u2192 swap to get required tokens (see "Insufficient Balance" workflow). Re-run dry-run after the swap settles \u2014 don't assume the prior deficit number still applies.
|
|
92160
|
+
5. \`byreal-cli positions increase --nft-mint <nft-mint> --amount-usd <usd> --wallet-address <addr> -o json\` \u2014 emit unsigned tx (default). Add \`--execute\` to sign + broadcast via Privy.
|
|
92146
92161
|
|
|
92147
92162
|
**Decrease liquidity** (partial withdrawal):
|
|
92148
92163
|
1. \`byreal-cli positions list -o json\` \u2014 find the position's NFT mint address
|
|
@@ -92265,12 +92280,17 @@ Always read \`error.message\` carefully \u2014 it contains the specific cause. D
|
|
|
92265
92280
|
4. **Increase slippage**: \`--slippage 300\` for volatile tokens
|
|
92266
92281
|
|
|
92267
92282
|
### Positions
|
|
92268
|
-
1. **Insufficient balance
|
|
92269
|
-
2. **
|
|
92270
|
-
3. **Position
|
|
92271
|
-
4. **
|
|
92272
|
-
5. **
|
|
92273
|
-
6. **
|
|
92283
|
+
1. **Insufficient balance** (dry-run): \`deficit\` is the **slippage-padded upper bound** (non-base leg uses \`otherAmountMax = otherAmount \xD7 (1 + slippage)\`), not the exact amount that will be consumed. Before swapping, **first try a tighter \`--slippage\` and re-run dry-run** \u2014 the warning often disappears. If you still must swap, do not over-swap the full \`deficit\`; re-run dry-run after the swap settles.
|
|
92284
|
+
2. **Insufficient funds at \`--execute\` despite dry-run "sufficient"**: this is **almost always a missing SOL buffer**, not a stale RPC / cache / indexer issue. The dry-run check does NOT deduct the ~0.03 SOL needed for new-position rent + fees (see "SOL Buffer for CLMM Position Ops"). Resize the SOL leg against \`sol_balance \u2212 0.03\` and retry. **Do not** start swapping to "balance" the wallet before doing this math \u2014 that path burned real money in past incidents.
|
|
92285
|
+
3. **Position Math Sanity Check** (before any swap to "cover a deficit"): for a CLMM position at current price \`p\`, lower \`pL\`, upper \`pU\`, the deposit split is **not 50/50**. Required amounts: \`USDC \u221D \u221Ap \u2212 \u221ApL\`, \`SOL \u221D (\u221ApU \u2212 \u221Ap) / (\u221Ap \xB7 \u221ApU)\`. Always recompute from a fresh \`--dry-run\` after any swap; do not assume the previous deficit number still applies. Ping-ponging swaps without re-running dry-run is the failure mode that wastes gas.
|
|
92286
|
+
4. **Slippage exceeded**: Price moved during execution. Increase \`--slippage\` (e.g., 200-300 bps) or re-run \`--dry-run\` to get updated prices.
|
|
92287
|
+
5. **Position already closed**: Check \`positions list --status 0\` \u2014 the NFT is burned after close.
|
|
92288
|
+
6. **No fees to claim**: Position may be out-of-range (not earning fees) or fees already claimed.
|
|
92289
|
+
7. **Wrong NFT mint**: Ensure you use the NFT mint address from \`positions list\`, not the pool address or position PDA.
|
|
92290
|
+
8. **Stale state after tx**: After any on-chain operation, wait 3-5 seconds before the next query \u2014 RPC propagation delay (seconds, not minutes).
|
|
92291
|
+
|
|
92292
|
+
### What \`--execute\` actually does (don't misdiagnose)
|
|
92293
|
+
\`--execute\` flow: CLI builds unsigned tx \u2192 Privy proxy \u2192 \`signAndBroadcast\` \u2192 Solana RPC \`simulateTransaction\` against **live chain state**. There is **no Privy indexer and no cached balance** in this path. If you see "insufficient funds" from \`--execute\`, treat it as a real on-chain shortfall (almost always the SOL buffer \u2014 see Positions #2), not as stale data. RPC nodes can lag by **seconds** after a fresh swap, not minutes \u2014 if a retry is needed, one 3-5s wait is enough. If three retries still fail, **stop** and re-run the math; do not keep retrying.
|
|
92274
92294
|
|
|
92275
92295
|
`;
|
|
92276
92296
|
function createSkillCommand() {
|