@palmyr/cli 1.3.0 → 1.3.1
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/cli.js +25 -24
- package/dist/cli.js.map +1 -1
- package/dist/wallet-brief-llm.js +5 -3
- package/dist/wallet-brief-llm.js.map +1 -1
- package/dist/wallet-daemon.js +7 -3
- package/dist/wallet-daemon.js.map +1 -1
- package/dist/wallet-trading.d.ts +48 -44
- package/dist/wallet-trading.js +64 -68
- package/dist/wallet-trading.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2501,9 +2501,12 @@ async function main() {
|
|
|
2501
2501
|
: (readPosition('solana', ca) ?? readPosition('base', ca));
|
|
2502
2502
|
if (!p)
|
|
2503
2503
|
err(`Position not found: ${ca}`, EXIT.NOT_FOUND);
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2504
|
+
// Canonical asset-tagged PnL — reflects what the position was
|
|
2505
|
+
// actually funded in (USDC-funded positions report USDC, not the
|
|
2506
|
+
// chain native asset).
|
|
2507
|
+
const unit = p.pnl.realized?.asset ?? (p.chain === 'solana' ? 'SOL' : 'ETH');
|
|
2508
|
+
const realized = p.pnl.realized?.amount ?? 0;
|
|
2509
|
+
const unrealized = p.pnl.unrealized?.amount ?? 0;
|
|
2507
2510
|
if (!AGENT_MODE) {
|
|
2508
2511
|
console.log();
|
|
2509
2512
|
section('Position');
|
|
@@ -2548,15 +2551,11 @@ async function main() {
|
|
|
2548
2551
|
if (p.sells.length > 0) {
|
|
2549
2552
|
console.log();
|
|
2550
2553
|
section(`Sells (${p.sells.length})`);
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
else {
|
|
2557
|
-
for (const s of p.sells) {
|
|
2558
|
-
console.log(` ${t.muted}${s.time}${t.reset} ${s.tokensIn} → ${s.ethOut} (realized ${s.realizedEth >= 0 ? '+' : ''}${s.realizedEth.toFixed(6)} ETH) — ${s.reason}`);
|
|
2559
|
-
}
|
|
2554
|
+
for (const s of p.sells) {
|
|
2555
|
+
const outDisplay = s.output?.display ?? '?';
|
|
2556
|
+
const r = s.realized?.amount ?? 0;
|
|
2557
|
+
const ru = s.realized?.asset ?? unit;
|
|
2558
|
+
console.log(` ${t.muted}${s.time}${t.reset} ${s.tokensIn} → ${outDisplay} (realized ${r >= 0 ? '+' : ''}${r.toFixed(6)} ${ru}) — ${s.reason}`);
|
|
2560
2559
|
}
|
|
2561
2560
|
}
|
|
2562
2561
|
console.log();
|
|
@@ -2623,7 +2622,8 @@ async function main() {
|
|
|
2623
2622
|
if (!AGENT_MODE) {
|
|
2624
2623
|
const tag = baseResult.dryRun ? `${t.warn}[dry-run]${t.reset} ` : '';
|
|
2625
2624
|
const protTag = baseResult.protectedExec ? ` ${t.accent}[protected]${t.reset}` : '';
|
|
2626
|
-
const
|
|
2625
|
+
const realizedAmt = baseResult.realized.amount;
|
|
2626
|
+
const pnlColor = realizedAmt >= 0 ? t.success : t.error;
|
|
2627
2627
|
const closedTag = baseResult.positionStatus === 'closed' ? ` ${t.muted}[closed]${t.reset}` : '';
|
|
2628
2628
|
console.log(`\n ${t.success}${icon.success} ${tag}Base sell executed${protTag}${closedTag}${t.reset}`);
|
|
2629
2629
|
if (baseResult.approvalTxHash) {
|
|
@@ -2631,11 +2631,11 @@ async function main() {
|
|
|
2631
2631
|
}
|
|
2632
2632
|
console.log(` ${t.muted}tx:${t.reset} ${baseResult.txHash}`);
|
|
2633
2633
|
console.log(` ${t.muted}sold:${t.reset} ${baseResult.tokensIn} tokens (${percent}%)`);
|
|
2634
|
-
console.log(` ${t.muted}received:${t.reset} ${baseResult.
|
|
2634
|
+
console.log(` ${t.muted}received:${t.reset} ${baseResult.output.display}`);
|
|
2635
2635
|
{
|
|
2636
|
-
const unit = baseResult.
|
|
2636
|
+
const unit = baseResult.realized.asset;
|
|
2637
2637
|
const decimals = unit === 'USDC' ? 2 : 6;
|
|
2638
|
-
console.log(` ${t.muted}realized:${t.reset} ${pnlColor}${
|
|
2638
|
+
console.log(` ${t.muted}realized:${t.reset} ${pnlColor}${realizedAmt >= 0 ? '+' : ''}${realizedAmt.toFixed(decimals)} ${unit}${t.reset}`);
|
|
2639
2639
|
}
|
|
2640
2640
|
console.log(` ${t.muted}reason:${t.reset} ${reason}`);
|
|
2641
2641
|
if (baseResult.protectedExec) {
|
|
@@ -2672,21 +2672,22 @@ async function main() {
|
|
|
2672
2672
|
if (!AGENT_MODE) {
|
|
2673
2673
|
const tag = result.dryRun ? `${t.warn}[dry-run]${t.reset} ` : '';
|
|
2674
2674
|
const protTag = result.protectedExec ? ` ${t.accent}[protected]${t.reset}` : '';
|
|
2675
|
-
const
|
|
2675
|
+
const realizedAmt = result.realized.amount;
|
|
2676
|
+
const pnlColor = realizedAmt >= 0 ? t.success : t.error;
|
|
2676
2677
|
const closedTag = result.positionStatus === 'closed' ? ` ${t.muted}[closed]${t.reset}` : '';
|
|
2677
2678
|
console.log(`\n ${t.success}${icon.success} ${tag}Sell executed${protTag}${closedTag}${t.reset}`);
|
|
2678
2679
|
console.log(` ${t.muted}tx:${t.reset} ${result.txSignature}`);
|
|
2679
2680
|
console.log(` ${t.muted}sold:${t.reset} ${result.tokensIn} tokens (${percent}%)`);
|
|
2680
|
-
console.log(` ${t.muted}received:${t.reset} ${result.
|
|
2681
|
+
console.log(` ${t.muted}received:${t.reset} ${result.output.display}`);
|
|
2681
2682
|
console.log(` ${t.muted}slippage:${t.reset} ${result.slippageBpsUsed}bps (${result.slippageSource})`);
|
|
2682
2683
|
if (result.protectedExec) {
|
|
2683
2684
|
console.log(` ${t.muted}tip:${t.reset} ${result.tipLamports} lamports (Jito)`);
|
|
2684
2685
|
}
|
|
2685
2686
|
console.log(` ${t.muted}fee:${t.reset} ${result.feeLamports} lamports`);
|
|
2686
2687
|
{
|
|
2687
|
-
const unit = result.
|
|
2688
|
+
const unit = result.realized.asset;
|
|
2688
2689
|
const decimals = unit === 'USDC' ? 2 : 6;
|
|
2689
|
-
console.log(` ${t.muted}realized:${t.reset} ${pnlColor}${
|
|
2690
|
+
console.log(` ${t.muted}realized:${t.reset} ${pnlColor}${realizedAmt >= 0 ? '+' : ''}${realizedAmt.toFixed(decimals)} ${unit}${t.reset}`);
|
|
2690
2691
|
}
|
|
2691
2692
|
console.log(` ${t.muted}reason:${t.reset} ${reason}`);
|
|
2692
2693
|
if (result.forensics && result.forensics.flag === 'suspect-mev') {
|
|
@@ -3042,11 +3043,11 @@ async function main() {
|
|
|
3042
3043
|
console.log();
|
|
3043
3044
|
section('Current');
|
|
3044
3045
|
const pnlColor = p.pnl.unrealizedPct >= 0 ? t.success : t.error;
|
|
3045
|
-
//
|
|
3046
|
-
//
|
|
3047
|
-
const realizedAmt = p.pnl.realized?.amount ??
|
|
3046
|
+
// Canonical asset-tagged pnl — normalizePosition guarantees these
|
|
3047
|
+
// exist on read, including back-fill from legacy on-disk fields.
|
|
3048
|
+
const realizedAmt = p.pnl.realized?.amount ?? 0;
|
|
3048
3049
|
const realizedAsset = p.pnl.realized?.asset ?? (p.chain === 'solana' ? 'SOL' : 'ETH');
|
|
3049
|
-
const unrealizedAmt = p.pnl.unrealized?.amount ??
|
|
3050
|
+
const unrealizedAmt = p.pnl.unrealized?.amount ?? 0;
|
|
3050
3051
|
const unrealizedAsset = p.pnl.unrealized?.asset ?? realizedAsset;
|
|
3051
3052
|
kv('Realized', `${realizedAmt >= 0 ? '+' : ''}${realizedAmt.toFixed(6)} ${realizedAsset}`);
|
|
3052
3053
|
console.log(` ${t.muted}Unrealized:${t.reset} ${pnlColor}${unrealizedAmt >= 0 ? '+' : ''}${unrealizedAmt.toFixed(6)} ${unrealizedAsset} (${p.pnl.unrealizedPct.toFixed(2)}%)${t.reset}`);
|