Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request bumps the package version to 0.4.7 in package-lock.json and updates the order parameters in src/commands/perps.ts for the closeCmd command. Specifically, it replaces the trigger-based order type with a limit order using an Immediate-or-Cancel (IOC) time-in-force option. There are no review comments to address, and I have no further feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…ults Market orders, closes and the ask quick order priced the IOC limit with `(mark * 1.01).toPrecision(5)`. That gives "3535.0" (a trailing zero changes the signed payload) and "1.0201e+5" once a price passes 100,000, and it ignored the `6 - szDecimals` decimal limit. Hyperliquid also answers status "ok" when an individual order is rejected, so an IOC that found no liquidity was reported as "submitted" / "closed" (the original symptom in #13). - new src/hl-format.ts: price formatting per the official SDK (5 significant figures, then 6 - szDecimals decimals, plain decimal string), size formatting, user price/size validation, and a parser for per-order statuses wherever the backend nests them - order / close / ask use it; user-entered --price / --size are checked against the asset's tick and lot size before anything is sent (with the nearest valid price as a hint) and sent without trailing zeros - new orders under Hyperliquid's $10 minimum are refused up front - after submitting, the CLI reports the filled size and average price, warns on partial fills, and exits non-zero when Hyperliquid rejected the order; `perps close --all/--symbol` lists partial or rejected closes as failures and sets exit code 1 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
… balance - close: read positions through normalizeWalletSummary(), so sub-account summaries in Hyperliquid's raw shape (marginSummary + assetPositions) are recognised instead of reporting "No open positions" (M-172) - market open / close / ask quick order: send an IOC limit order at the slippage-bounded price instead of a TP trigger order, which only fires once the trigger price is crossed, so "closed" positions could stay open (based on Minara-AI#13 by @tae9898) - order: --tpsl is now rejected with a clear error rather than silently turning an intended stop-loss into an immediate market fill - sweep: check and display the selected wallet's live withdrawable balance instead of the cached equityValue; explain when funds are locked as margin Co-authored-by: tae_98 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7
…checks, December bounty fixes; release v0.5.2 (#20) * ci: harden the npm release workflow and add PR checks publish.yml - pin actions/checkout (v7.0.1) and actions/setup-node (v7.1.0) to full commit SHAs instead of movable tags - empty workflow-level permissions; the job gets contents:read + id-token:write only - run in a protected `npm-publish` environment (add required reviewers in repo settings so a release can't publish on its own) - Node 24 with an npm >= 11.5.1 check, so npm trusted publishing (OIDC) works as soon as it is configured on npmjs.com; until then npm falls back to NPM_TOKEN - `npm publish --provenance --access public` - fail if the release tag doesn't match package.json version - `npm ci --ignore-scripts` (no dependency needs install scripts), no dependency cache and no persisted git credentials in the release job ci.yml (new) - type check, tests, build and production `npm audit` on Node 20/22/24 for every pull request and push to main; read-only token, no secrets (pull_request, not pull_request_target), so fork PRs are safe Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * build: publish npm-shrinkwrap.json so installs use pinned dependencies `npm i -g minara` used to resolve chalk / commander / inquirer / ora / cli-table3 and their dependencies fresh at install time, so a compromised upstream release could reach users without any change in this repo. `npm shrinkwrap` turns package-lock.json into npm-shrinkwrap.json, which npm honours for consumers. It is added to `files` so it ships in the tarball (verified: a packed install gets exactly the pinned versions). `npm ci` in CI keeps working unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * fix(output): sanitize every API response at the boundary - move sanitizeTerminal / sanitizeDeep to a dependency-free src/sanitize.ts (re-exported from utils.ts, so imports are unchanged); sanitizeDeep gains a `multiline` option - the API client now strips terminal control sequences, C1 and bidi override characters from every string in every response (JSON and non-JSON, success and error), keeping line breaks; Hyperliquid public API responses (coin names, leverage, fills, orders) get the same treatment. Display paths can no longer forget to sanitize server data. - names shown on a single line (wallets, strategies, subscription plans, checkout URLs, order errors, token address in limit-order) are also sanitized in single-line mode so a newline can't fake extra rows Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * docs: document pinned dependencies, provenance, boundary sanitization and client-side limits Also drops the stale note about the OAuth callback server (removed in #17). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * fix(perps): follow Hyperliquid tick/lot rules and check per-order results Market orders, closes and the ask quick order priced the IOC limit with `(mark * 1.01).toPrecision(5)`. That gives "3535.0" (a trailing zero changes the signed payload) and "1.0201e+5" once a price passes 100,000, and it ignored the `6 - szDecimals` decimal limit. Hyperliquid also answers status "ok" when an individual order is rejected, so an IOC that found no liquidity was reported as "submitted" / "closed" (the original symptom in #13). - new src/hl-format.ts: price formatting per the official SDK (5 significant figures, then 6 - szDecimals decimals, plain decimal string), size formatting, user price/size validation, and a parser for per-order statuses wherever the backend nests them - order / close / ask use it; user-entered --price / --size are checked against the asset's tick and lot size before anything is sent (with the nearest valid price as a hint) and sent without trailing zeros - new orders under Hyperliquid's $10 minimum are refused up front - after submitting, the CLI reports the filled size and average price, warns on partial fills, and exits non-zero when Hyperliquid rejected the order; `perps close --all/--symbol` lists partial or rejected closes as failures and sets exit code 1 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * chore: release v0.5.2 Ships #19 (perps execution and token lookup fixes) together with this PR's release hardening, pinned dependencies, response sanitization and Hyperliquid order formatting / result checks. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * ci: publish from the tag-only "release" environment Folds in #21. NPM_TOKEN moves to an environment secret of "release", which only v* tags may deploy to (tags are admin-only), so a workflow pushed on a branch can no longer read it. The trusted-publisher setup on npmjs.com should name this environment too. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 * fix: close the remaining CLI findings from the December bounty table - perps cancel / limit-order cancel (M-316): cancelling may remove a stop-loss or take-profit, so both now use the transaction confirmation (single prompt, full order details) and Touch ID like placing an order; perps cancel reads frontendOpenOrders and warns when the order is reduce-only or a TP/SL trigger - perps order on a sub-wallet: leverage is read from that wallet's address, never the default wallet's; the preview and confirmation show the wallet and its leverage - damaged config.json (M-353): an unreadable or non-object config no longer falls back to defaults silently; fund operations fail closed until it is fixed or rewritten via `minara config`. Config and credentials are written atomically (temp file + rename) - logout (M-352): a failed server-side revocation is reported as a failure and local credentials are kept so it can be retried; `--local` clears them anyway; a 401 counts as already logged out and no longer triggers the re-login flow - swap (M-333 / M-337 / M-348): the quote is always fetched and shown, also with -y (not printed with -y --json); quotes with slippage tolerance or price impact above 10% are refused (--max-slippage / --max-price-impact); an unattended -y swap is never sent without a quote - Solana recipients (M-351): must base58-decode to a 32-byte key; off-curve (non-wallet) keys get a warning - terminal sanitization (M-332): also strips zero-width characters, soft hyphen, BOM, word joiner, variation selectors, Unicode tag characters and other invisible format characters, and treats U+2028/U+2029/NEL as line breaks; token picker addresses are sanitized explicitly too - base URL (M-316): loopback hosts are only accepted with MINARA_DEV=1, so a development base URL left in the config cannot send the token to whatever later listens on that local port Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0133E5DCA8sK7CJ7WWWrb2P7 --------- Co-authored-by: Claude <[email protected]>
|
Thank you @tae9898 for tracking this down and sending the fix! We reworked it in #19, with you credited as co-author on the commit (d139239), and it shipped in v0.5.2 (
Closing this as superseded. Thanks again, and feel free to open an issue if you still see anything off with 0.5.2. Generated by Claude Code |
##Problem
minara perps close returns success but positions remain open on Hyperliquid.
##Cause
Close order uses trigger (take-profit) type which Hyperliquid doesn't execute:
t: { trigger: { triggerPx: String(marketPx), tpsl: 'tp', isMarket: true } }
Fix
Changed to limit IOC (Immediate or Cancel) in src/commands/perps.ts (lines 944, 1055):
t: { limit: { tif: 'Ioc' } }
This fills immediately at market price