{"version":3,"file":"tx-command.mjs","names":[],"sources":["../../../src/commands/tx-command.ts"],"sourcesContent":["/**\n * /tx command — show recent transaction history\n * Bypasses the LLM agent for fast, zero-cost responses.\n */\n\nimport { getTransactionHistory } from '../services/walletconnect-service.js';\n\nexport const txCommand = {\n  name: 'tx',\n  description: 'Show recent transaction history (approved, rejected, auto-approved)',\n  acceptsArgs: false,\n  requireAuth: true,\n  handler: async () => {\n    const history = getTransactionHistory();\n\n    if (history.length === 0) {\n      return {\n        text: 'No transactions yet this session.',\n      };\n    }\n\n    // Show most recent 20\n    const recent = history.slice(-20).reverse();\n    const lines = ['**Recent Transactions:**', ''];\n\n    for (const tx of recent) {\n      const status = {\n        approved: 'Approved',\n        auto_approved: `Auto-approved (${tx.policyLabel ?? 'policy'})`,\n        rejected: 'Rejected',\n        pending: 'Pending...',\n      }[tx.status];\n\n      const hashStr = tx.hash ? ` \\`${tx.hash.slice(0, 10)}...${tx.hash.slice(-6)}\\`` : '';\n      const time = new Date(tx.timestamp).toLocaleTimeString();\n\n      lines.push(`- [${time}] ${status}${hashStr} — ${tx.summary}`);\n    }\n\n    if (history.length > 20) {\n      lines.push('', `(showing 20 of ${history.length} total)`);\n    }\n\n    return { text: lines.join('\\n') };\n  },\n};\n"],"mappings":";;;;;;AAOA,MAAa,YAAY;CACvB,MAAM;CACN,aAAa;CACb,aAAa;CACb,aAAa;CACb,SAAS,YAAY;EACnB,MAAM,UAAU,uBAAuB;AAEvC,MAAI,QAAQ,WAAW,EACrB,QAAO,EACL,MAAM,qCACP;EAIH,MAAM,SAAS,QAAQ,MAAM,IAAI,CAAC,SAAS;EAC3C,MAAM,QAAQ,CAAC,4BAA4B,GAAG;AAE9C,OAAK,MAAM,MAAM,QAAQ;GACvB,MAAM,SAAS;IACb,UAAU;IACV,eAAe,kBAAkB,GAAG,eAAe,SAAS;IAC5D,UAAU;IACV,SAAS;IACV,CAAC,GAAG;GAEL,MAAM,UAAU,GAAG,OAAO,MAAM,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG,KAAK,MAAM,GAAG,CAAC,MAAM;GAClF,MAAM,OAAO,IAAI,KAAK,GAAG,UAAU,CAAC,oBAAoB;AAExD,SAAM,KAAK,MAAM,KAAK,IAAI,SAAS,QAAQ,KAAK,GAAG,UAAU;;AAG/D,MAAI,QAAQ,SAAS,GACnB,OAAM,KAAK,IAAI,kBAAkB,QAAQ,OAAO,SAAS;AAG3D,SAAO,EAAE,MAAM,MAAM,KAAK,KAAK,EAAE;;CAEpC"}