You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| deadlineSecs |`--deadline-secs`| Seconds until deadline (default 300) |
199
-
| dryRun |`--dry-run`| Preview calldata only, no broadcast |
252
+
| amountIn |`--amount-in`| Input amount as a human-readable decimal (e.g. 100, 1.5, 0.001)|
253
+
| slippageBps |`--slippage-bps`| Slippage in basis points (default 50 = 0.5%) — global flag |
254
+
| deadlineSecs |`--deadline-secs`| Seconds until deadline (default 300) — global flag |
255
+
| dryRun |`--dry-run`| Preview calldata only, no broadcast — **global flag, place before subcommand**|
200
256
201
257
**Execution flow:**
202
-
1. Run `--dry-run` to preview the swap calldata and expected output
258
+
1. Run `pancakeswap-v2 --dry-run --chain 56 swap ...` to preview the swap calldata and expected output
203
259
2. **Ask user to confirm** the swap details (tokenIn, tokenOut, amountIn, amountOutMin, slippage)
204
260
3. If tokenIn is an ERC-20 and allowance is insufficient, first submit an exact-amount approve tx via `onchainos wallet contract-call`;**ask user to confirm** the approval
205
261
4. Submit swap via `onchainos wallet contract-call`
| liquidity |`--liquidity`| LP tokens to burn as a human-readable decimal (e.g. 1.0). Omit to remove all |
337
+
| slippageBps |`--slippage-bps`| Slippage tolerance (default 50 = 0.5%) — global flag |
338
+
| dryRun |`--dry-run`| Preview only — **global flag, place before subcommand**|
280
339
281
340
**Execution flow:**
282
341
1. Fetch LP balance and compute expected token withdrawals
283
342
2. Display summary: LP amount, expected tokenA and tokenB out
284
-
3. Run `--dry-run` to preview calldata
343
+
3. Run `pancakeswap-v2 --dry-run --chain 56 remove-liquidity ...` to preview calldata
285
344
4. **Ask user to confirm** the removal details before proceeding
286
345
5. Approve LP tokens to Router02 via `onchainos wallet contract-call`;**ask user to confirm**
287
346
6. Submit `removeLiquidity` or `removeLiquidityETH` via `onchainos wallet contract-call`
@@ -360,6 +419,20 @@ For Arbitrum One (42161): WETH `0x82aF49447D8a07e3bd95BD0d56f35241523fBab1`, USD
360
419
361
420
## Changelog
362
421
422
+
### v0.2.3 (2026-04-11)
423
+
424
+
- **fix**: `--amount-in`, `--amount-a`, `--amount-b`, and `--liquidity` now accept human-readable decimal input (e.g. `1.5`, `100`, `0.001`). Previously clap rejected decimal values at parse time with "invalid digit found in string" because those args were typed `u128`. Changed to `String` and added `parse_human_amount()` which resolves each token's ERC-20 `decimals()` on-chain and converts to raw units.
425
+
- **feat**: `pancakeswap-v2 --version` now works (added `version` to `#[command(...)]` attribute)
426
+
- **fix**: `.gitignore` uses `/target/` (anchored) instead of `target/`
427
+
- **fix**: consolidate duplicate `erc20_decimals` / `get_erc20_decimals` into single function in `rpc.rs`
428
+
- **docs**: Added Global Flags section explaining that `--dry-run`, `--chain`, `--slippage-bps`, `--deadline-secs`, `--from`, `--rpc-url` are root-level flags and must be placed **before** the subcommand
429
+
- **docs**: Updated Usage examples for `swap`, `add-liquidity`, and `remove-liquidity` to show correct `--dry-run` placement
430
+
431
+
### v0.2.2 (2026-04-11)
432
+
433
+
- **fix**: `remove-liquidity` overflow protection upgraded from pure f64 to `safe_mul_div` — tries `checked_mul` first (exact integer arithmetic for small pools), falls back to f64 only when `reserve × lp_balance` would overflow u128 (e.g. BSC BNB/USDT ~$17M TVL). Behavior is identical for all affected pools; change improves precision for pools below the overflow threshold.
434
+
- **fix**: Exact-amount ERC-20 approvals (not unlimited) — approves the exact swap/LP amount rather than `uint256.max`
435
+
363
436
### v0.2.1 (2026-04-11)
364
437
365
438
- **fix**: Arbitrum RPC URL updated from `arb1.arbitrum.io/rpc` to `arbitrum-one-rpc.publicnode.com` for consistency with BSC/Base (both use publicnode endpoints)
0 commit comments