Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/commands/perps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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';
Expand Down
21 changes: 15 additions & 6 deletions src/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) ───────

Expand Down Expand Up @@ -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<string, unknown>).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);
Expand Down Expand Up @@ -301,9 +301,18 @@ export function printTxResult(data: unknown): void {
return;
}

const obj = data as Record<string, unknown>;
console.log('');
printKV(obj);
if (Array.isArray(data)) {
for (const item of data) {
if (typeof item === 'object' && item !== null) {
printKV(item as Record<string, unknown>);
} else {
console.log(chalk.dim(` ${item}`));
}
}
} else {
printKV(data as Record<string, unknown>);
}
}

// ═══════════════════════════════════════════════════════════════════════════
Expand Down