diff --git a/package-lock.json b/package-lock.json index e1048d8..03ff2a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "minara", - "version": "0.4.6", + "version": "0.4.7", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "minara", - "version": "0.4.6", + "version": "0.4.7", "license": "MIT", "dependencies": { "@inquirer/prompts": "^7.0.0", diff --git a/src/commands/perps.ts b/src/commands/perps.ts index 48a9076..d74776c 100644 --- a/src/commands/perps.ts +++ b/src/commands/perps.ts @@ -753,7 +753,7 @@ const orderCmd = new Command('order') r: reduceOnly, t: orderType === 'limit' ? { limit: { tif: 'Gtc' } } - : { trigger: { triggerPx: String(marketPx ?? limitPx), tpsl: opts.tpsl ?? 'tp', isMarket: true } }, + : { limit: { tif: 'Ioc' } }, }; const priceLabel = orderType === 'market' ? `Market (~$${marketPx ?? limitPx})` : `$${limitPx}`; @@ -941,7 +941,7 @@ const closeCmd = new Command('close') p: limitPx, s: sz, r: true, - t: { trigger: { triggerPx: String(marketPx), tpsl: 'tp', isMarket: true } }, + t: { limit: { tif: 'Ioc' } }, }; try { @@ -1052,7 +1052,7 @@ const closeCmd = new Command('close') p: limitPx, s: sz, r: true, - t: { trigger: { triggerPx: String(marketPx), tpsl: 'tp', isMarket: true } }, + t: { limit: { tif: 'Ioc' } }, }; const sideLabel = isLong ? 'LONG' : 'SHORT'; diff --git a/src/formatters.ts b/src/formatters.ts index 446377c..84a8030 100644 --- a/src/formatters.ts +++ b/src/formatters.ts @@ -55,7 +55,7 @@ export function isRawJson(): boolean { return _rawJson; } * Keys matching this pattern are hidden from printKV / auto-detected table * columns. They are still included in --json raw output. */ -const HIDDEN_KEYS = /^_?id$|^_id$|^__v$/i; +const HIDDEN_KEYS = /^_?id$|^_id$|^__v$|^raw_data$/i; // ─── Per-context key exclusions (non-regex, for specific commands) ─────── @@ -137,12 +137,12 @@ export function formatValue(value: unknown, key?: string): string { if (typeof value === 'object') { // Shallow nested — show as inline key=value const entries = Object.entries(value as Record).filter( - ([, v]) => v !== null && v !== undefined, + ([k, v]) => v !== null && v !== undefined && v !== '' && !HIDDEN_KEYS.test(k), ); if (entries.length <= 3) { - return entries.map(([k, v]) => `${k}=${typeof v === 'string' ? v : JSON.stringify(v)}`).join(' '); + return entries.map(([k, v]) => `${k}=${typeof v === 'string' ? v : formatValue(v, k)}`).join(' '); } - return chalk.dim(JSON.stringify(value)); + return entries.map(([k, v]) => `${k}=${typeof v === 'string' ? v : formatValue(v, k)}`).join(' '); } return String(value); @@ -301,9 +301,18 @@ export function printTxResult(data: unknown): void { return; } - const obj = data as Record; console.log(''); - printKV(obj); + if (Array.isArray(data)) { + for (const item of data) { + if (typeof item === 'object' && item !== null) { + printKV(item as Record); + } else { + console.log(chalk.dim(` ${item}`)); + } + } + } else { + printKV(data as Record); + } } // ═══════════════════════════════════════════════════════════════════════════