@t2000/cli 0.17.29 → 0.18.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.
Files changed (151) hide show
  1. package/README.md +65 -22
  2. package/dist/chunk-5QCOX5AE.js +5336 -0
  3. package/dist/chunk-5QCOX5AE.js.map +1 -0
  4. package/dist/{chunk-D4HDZEJT.js → chunk-PLDDJCW6.js} +16 -4
  5. package/dist/chunk-QJ5CPQJK.js +2053 -0
  6. package/dist/chunk-QJ5CPQJK.js.map +1 -0
  7. package/dist/{dist-F6YRISIO.js → dist-4RT6I45C.js} +2853 -7984
  8. package/dist/dist-4RT6I45C.js.map +1 -0
  9. package/dist/dist-DOHDQ4GX.js +26874 -0
  10. package/dist/dist-DOHDQ4GX.js.map +1 -0
  11. package/dist/fileFromPath-H3SAQMJK.js +130 -0
  12. package/dist/fileFromPath-H3SAQMJK.js.map +1 -0
  13. package/dist/index.js +3195 -2
  14. package/dist/index.js.map +1 -1
  15. package/package.json +9 -6
  16. package/dist/commands/address.d.ts +0 -3
  17. package/dist/commands/address.d.ts.map +0 -1
  18. package/dist/commands/address.js +0 -26
  19. package/dist/commands/address.js.map +0 -1
  20. package/dist/commands/balance.d.ts +0 -3
  21. package/dist/commands/balance.d.ts.map +0 -1
  22. package/dist/commands/balance.js +0 -134
  23. package/dist/commands/balance.js.map +0 -1
  24. package/dist/commands/borrow.d.ts +0 -3
  25. package/dist/commands/borrow.d.ts.map +0 -1
  26. package/dist/commands/borrow.js +0 -40
  27. package/dist/commands/borrow.js.map +0 -1
  28. package/dist/commands/claimRewards.d.ts +0 -3
  29. package/dist/commands/claimRewards.d.ts.map +0 -1
  30. package/dist/commands/claimRewards.js +0 -49
  31. package/dist/commands/claimRewards.js.map +0 -1
  32. package/dist/commands/config.d.ts +0 -3
  33. package/dist/commands/config.d.ts.map +0 -1
  34. package/dist/commands/config.js +0 -139
  35. package/dist/commands/config.js.map +0 -1
  36. package/dist/commands/contacts.d.ts +0 -3
  37. package/dist/commands/contacts.d.ts.map +0 -1
  38. package/dist/commands/contacts.js +0 -83
  39. package/dist/commands/contacts.js.map +0 -1
  40. package/dist/commands/deposit.d.ts +0 -3
  41. package/dist/commands/deposit.d.ts.map +0 -1
  42. package/dist/commands/deposit.js +0 -27
  43. package/dist/commands/deposit.js.map +0 -1
  44. package/dist/commands/earn.d.ts +0 -3
  45. package/dist/commands/earn.d.ts.map +0 -1
  46. package/dist/commands/earn.js +0 -186
  47. package/dist/commands/earn.js.map +0 -1
  48. package/dist/commands/earnings.d.ts +0 -3
  49. package/dist/commands/earnings.d.ts.map +0 -1
  50. package/dist/commands/earnings.js +0 -38
  51. package/dist/commands/earnings.js.map +0 -1
  52. package/dist/commands/exchange.d.ts +0 -3
  53. package/dist/commands/exchange.d.ts.map +0 -1
  54. package/dist/commands/exchange.js +0 -45
  55. package/dist/commands/exchange.js.map +0 -1
  56. package/dist/commands/exportKey.d.ts +0 -3
  57. package/dist/commands/exportKey.d.ts.map +0 -1
  58. package/dist/commands/exportKey.js +0 -81
  59. package/dist/commands/exportKey.js.map +0 -1
  60. package/dist/commands/fundStatus.d.ts +0 -3
  61. package/dist/commands/fundStatus.d.ts.map +0 -1
  62. package/dist/commands/fundStatus.js +0 -50
  63. package/dist/commands/fundStatus.js.map +0 -1
  64. package/dist/commands/health.d.ts +0 -3
  65. package/dist/commands/health.d.ts.map +0 -1
  66. package/dist/commands/health.js +0 -44
  67. package/dist/commands/health.js.map +0 -1
  68. package/dist/commands/history.d.ts +0 -3
  69. package/dist/commands/history.d.ts.map +0 -1
  70. package/dist/commands/history.js +0 -37
  71. package/dist/commands/history.js.map +0 -1
  72. package/dist/commands/importKey.d.ts +0 -3
  73. package/dist/commands/importKey.d.ts.map +0 -1
  74. package/dist/commands/importKey.js +0 -39
  75. package/dist/commands/importKey.js.map +0 -1
  76. package/dist/commands/init.d.ts +0 -3
  77. package/dist/commands/init.d.ts.map +0 -1
  78. package/dist/commands/init.js +0 -56
  79. package/dist/commands/init.js.map +0 -1
  80. package/dist/commands/invest.d.ts +0 -3
  81. package/dist/commands/invest.d.ts.map +0 -1
  82. package/dist/commands/invest.js +0 -637
  83. package/dist/commands/invest.js.map +0 -1
  84. package/dist/commands/lock.d.ts +0 -3
  85. package/dist/commands/lock.d.ts.map +0 -1
  86. package/dist/commands/lock.js +0 -66
  87. package/dist/commands/lock.js.map +0 -1
  88. package/dist/commands/mcp.d.ts +0 -3
  89. package/dist/commands/mcp.d.ts.map +0 -1
  90. package/dist/commands/mcp.js +0 -141
  91. package/dist/commands/mcp.js.map +0 -1
  92. package/dist/commands/pay.d.ts +0 -3
  93. package/dist/commands/pay.d.ts.map +0 -1
  94. package/dist/commands/pay.js +0 -96
  95. package/dist/commands/pay.js.map +0 -1
  96. package/dist/commands/portfolio.d.ts +0 -3
  97. package/dist/commands/portfolio.d.ts.map +0 -1
  98. package/dist/commands/portfolio.js +0 -104
  99. package/dist/commands/portfolio.js.map +0 -1
  100. package/dist/commands/positions.d.ts +0 -3
  101. package/dist/commands/positions.d.ts.map +0 -1
  102. package/dist/commands/positions.js +0 -73
  103. package/dist/commands/positions.js.map +0 -1
  104. package/dist/commands/rates.d.ts +0 -3
  105. package/dist/commands/rates.d.ts.map +0 -1
  106. package/dist/commands/rates.js +0 -64
  107. package/dist/commands/rates.js.map +0 -1
  108. package/dist/commands/rebalance.d.ts +0 -3
  109. package/dist/commands/rebalance.d.ts.map +0 -1
  110. package/dist/commands/rebalance.js +0 -109
  111. package/dist/commands/rebalance.js.map +0 -1
  112. package/dist/commands/repay.d.ts +0 -3
  113. package/dist/commands/repay.d.ts.map +0 -1
  114. package/dist/commands/repay.js +0 -35
  115. package/dist/commands/repay.js.map +0 -1
  116. package/dist/commands/save.d.ts +0 -3
  117. package/dist/commands/save.d.ts.map +0 -1
  118. package/dist/commands/save.js +0 -57
  119. package/dist/commands/save.js.map +0 -1
  120. package/dist/commands/send.d.ts +0 -3
  121. package/dist/commands/send.d.ts.map +0 -1
  122. package/dist/commands/send.js +0 -52
  123. package/dist/commands/send.js.map +0 -1
  124. package/dist/commands/sentinel.d.ts +0 -3
  125. package/dist/commands/sentinel.d.ts.map +0 -1
  126. package/dist/commands/sentinel.js +0 -142
  127. package/dist/commands/sentinel.js.map +0 -1
  128. package/dist/commands/serve.d.ts +0 -3
  129. package/dist/commands/serve.d.ts.map +0 -1
  130. package/dist/commands/serve.js +0 -341
  131. package/dist/commands/serve.js.map +0 -1
  132. package/dist/commands/withdraw.d.ts +0 -3
  133. package/dist/commands/withdraw.d.ts.map +0 -1
  134. package/dist/commands/withdraw.js +0 -34
  135. package/dist/commands/withdraw.js.map +0 -1
  136. package/dist/dist-F6YRISIO.js.map +0 -1
  137. package/dist/index.d.ts +0 -3
  138. package/dist/index.d.ts.map +0 -1
  139. package/dist/output.d.ts +0 -16
  140. package/dist/output.d.ts.map +0 -1
  141. package/dist/output.js +0 -85
  142. package/dist/output.js.map +0 -1
  143. package/dist/program.d.ts +0 -3
  144. package/dist/program.d.ts.map +0 -1
  145. package/dist/program.js +0 -80
  146. package/dist/program.js.map +0 -1
  147. package/dist/prompts.d.ts +0 -16
  148. package/dist/prompts.d.ts.map +0 -1
  149. package/dist/prompts.js +0 -69
  150. package/dist/prompts.js.map +0 -1
  151. /package/dist/{chunk-D4HDZEJT.js.map → chunk-PLDDJCW6.js.map} +0 -0
@@ -1,27 +0,0 @@
1
- import { T2000 } from '@t2000/sdk';
2
- import { resolvePin } from '../prompts.js';
3
- import { printHeader, printBlank, printJson, isJsonMode, handleError } from '../output.js';
4
- export function registerDeposit(program) {
5
- program
6
- .command('deposit')
7
- .description('Show funding instructions')
8
- .option('--key <path>', 'Key file path')
9
- .action(async (opts) => {
10
- try {
11
- const pin = await resolvePin();
12
- const agent = await T2000.create({ pin, keyPath: opts.key });
13
- const info = await agent.deposit();
14
- if (isJsonMode()) {
15
- printJson(info);
16
- return;
17
- }
18
- printHeader('Fund your wallet');
19
- console.log(info.instructions);
20
- printBlank();
21
- }
22
- catch (error) {
23
- handleError(error);
24
- }
25
- });
26
- }
27
- //# sourceMappingURL=deposit.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deposit.js","sourceRoot":"","sources":["../../src/commands/deposit.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3F,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO;SACJ,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,2BAA2B,CAAC;SACxC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC;SACvC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAE7D,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;YAEnC,IAAI,UAAU,EAAE,EAAE,CAAC;gBACjB,SAAS,CAAC,IAAI,CAAC,CAAC;gBAChB,OAAO;YACT,CAAC;YAED,WAAW,CAAC,kBAAkB,CAAC,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC/B,UAAU,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerEarn(program: Command): void;
3
- //# sourceMappingURL=earn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"earn.d.ts","sourceRoot":"","sources":["../../src/commands/earn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,QAqL5C"}
@@ -1,186 +0,0 @@
1
- import { T2000, MIST_PER_SUI, listSentinels, formatUsd } from '@t2000/sdk';
2
- import { resolvePin } from '../prompts.js';
3
- import { printHeader, printKeyValue, printBlank, printJson, isJsonMode, handleError, printDivider, printLine, printInfo, } from '../output.js';
4
- import pc from 'picocolors';
5
- function mistToSui(mist) {
6
- return Number(mist) / Number(MIST_PER_SUI);
7
- }
8
- function bestTarget(sentinels) {
9
- const withPool = sentinels.filter((s) => s.prizePool > 0n && s.attackFee > 0n);
10
- if (withPool.length === 0)
11
- return undefined;
12
- return withPool.sort((a, b) => {
13
- const ratioA = Number(a.prizePool) / Number(a.attackFee);
14
- const ratioB = Number(b.prizePool) / Number(b.attackFee);
15
- return ratioB - ratioA;
16
- })[0];
17
- }
18
- export function registerEarn(program) {
19
- program
20
- .command('earn')
21
- .description('Show all earning opportunities — savings yield + sentinel bounties')
22
- .option('--key <path>', 'Key file path')
23
- .action(async (opts) => {
24
- try {
25
- const pin = await resolvePin();
26
- const agent = await T2000.create({ pin, keyPath: opts.key });
27
- const [positionsResult, portfolioResult, ratesResult, sentinels] = await Promise.allSettled([
28
- agent.positions(),
29
- agent.getPortfolio(),
30
- agent.allRates('USDC'),
31
- listSentinels(),
32
- ]);
33
- const posData = positionsResult.status === 'fulfilled' ? positionsResult.value : null;
34
- const portfolio = portfolioResult.status === 'fulfilled' ? portfolioResult.value : null;
35
- const ratesData = ratesResult.status === 'fulfilled' ? ratesResult.value : null;
36
- const agents = sentinels.status === 'fulfilled' ? sentinels.value : null;
37
- const savePositions = posData?.positions.filter((p) => p.type === 'save') ?? [];
38
- const totalSaved = savePositions.reduce((s, p) => s + p.amount, 0);
39
- const earningInvestments = portfolio?.positions.filter((p) => p.earning && p.currentValue > 0) ?? [];
40
- const bestSaveApy = ratesData?.length
41
- ? Math.max(...ratesData.map(r => r.rates.saveApy))
42
- : 0;
43
- if (isJsonMode()) {
44
- const best = agents ? bestTarget(agents) : undefined;
45
- const totalPool = agents
46
- ? agents.reduce((sum, s) => sum + mistToSui(s.prizePool), 0)
47
- : 0;
48
- const cheapest = agents
49
- ? Math.min(...agents.map((s) => mistToSui(s.attackFee)))
50
- : 0;
51
- printJson({
52
- savings: savePositions.map((p) => ({
53
- protocol: p.protocol,
54
- asset: p.asset,
55
- amount: p.amount,
56
- apy: p.apy,
57
- })),
58
- totalSaved,
59
- availableRates: ratesData?.map(r => ({
60
- protocol: r.protocol,
61
- asset: 'USDC',
62
- saveApy: r.rates.saveApy,
63
- })) ?? [],
64
- investments: earningInvestments.map((p) => ({
65
- asset: p.asset,
66
- amount: p.totalAmount,
67
- value: p.currentValue,
68
- protocol: p.earningProtocol,
69
- apy: p.earningApy,
70
- })),
71
- sentinel: agents
72
- ? {
73
- activeSentinels: agents.length,
74
- totalPrizePool: Number(totalPool.toFixed(2)),
75
- cheapestFee: Number(cheapest.toFixed(2)),
76
- bestTarget: best
77
- ? {
78
- name: best.name,
79
- objectId: best.objectId,
80
- prizePool: mistToSui(best.prizePool),
81
- attackFee: mistToSui(best.attackFee),
82
- ratio: Number((Number(best.prizePool) / Number(best.attackFee)).toFixed(1)),
83
- }
84
- : null,
85
- }
86
- : null,
87
- });
88
- return;
89
- }
90
- printHeader('Earning Opportunities');
91
- // --- Savings section ---
92
- printLine(pc.bold('SAVINGS') + pc.dim(' — Passive Yield'));
93
- printDivider();
94
- if (savePositions.length > 0) {
95
- for (const pos of savePositions) {
96
- const dailyYield = (pos.amount * pos.apy / 100) / 365;
97
- printKeyValue(pos.protocol, `${formatUsd(pos.amount)} ${pos.asset} @ ${pos.apy.toFixed(2)}% APY`);
98
- if (dailyYield > 0.0001) {
99
- const dailyStr = dailyYield < 0.01 ? `$${dailyYield.toFixed(4)}` : formatUsd(dailyYield);
100
- const monthlyStr = dailyYield * 30 < 0.01 ? `$${(dailyYield * 30).toFixed(4)}` : formatUsd(dailyYield * 30);
101
- printLine(pc.dim(` ~${dailyStr}/day · ~${monthlyStr}/month`));
102
- }
103
- }
104
- if (savePositions.length > 1) {
105
- printBlank();
106
- printKeyValue('Total Saved', formatUsd(totalSaved));
107
- }
108
- }
109
- else if (ratesData && ratesData.length > 0) {
110
- const sorted = [...ratesData].sort((a, b) => b.rates.saveApy - a.rates.saveApy);
111
- for (const r of sorted) {
112
- printKeyValue(r.protocol, `USDC @ ${r.rates.saveApy.toFixed(2)}% APY`);
113
- }
114
- const example = 100;
115
- const daily = (example * bestSaveApy / 100) / 365;
116
- const monthly = daily * 30;
117
- printLine(pc.dim(` Save $${example} → ~$${daily.toFixed(2)}/day · ~$${monthly.toFixed(2)}/month`));
118
- printBlank();
119
- printInfo('No savings yet — run `t2000 save <amount>` to start');
120
- }
121
- else if (posData) {
122
- printInfo('No savings yet — run `t2000 save <amount>` to start');
123
- }
124
- else {
125
- printInfo('Savings data unavailable');
126
- }
127
- // --- Investment yield section ---
128
- if (earningInvestments.length > 0) {
129
- printBlank();
130
- printLine(pc.bold('INVESTMENTS') + pc.dim(' — Earning Yield'));
131
- printDivider();
132
- let totalInvestValue = 0;
133
- for (const pos of earningInvestments) {
134
- const dailyYield = (pos.currentValue * (pos.earningApy ?? 0) / 100) / 365;
135
- const apyStr = pos.earningApy ? `${pos.earningApy.toFixed(2)}%` : '—';
136
- printKeyValue(`${pos.asset} via ${pos.earningProtocol ?? 'unknown'}`, `${formatUsd(pos.currentValue)} (${pos.totalAmount.toFixed(4)} ${pos.asset}) @ ${apyStr} APY`);
137
- if (dailyYield > 0.0001) {
138
- const dailyStr = dailyYield < 0.01 ? `$${dailyYield.toFixed(4)}` : formatUsd(dailyYield);
139
- const monthlyStr = dailyYield * 30 < 0.01 ? `$${(dailyYield * 30).toFixed(4)}` : formatUsd(dailyYield * 30);
140
- printLine(pc.dim(` ~${dailyStr}/day · ~${monthlyStr}/month`));
141
- }
142
- totalInvestValue += pos.currentValue;
143
- }
144
- if (earningInvestments.length > 1) {
145
- printBlank();
146
- printKeyValue('Total Earning', formatUsd(totalInvestValue));
147
- }
148
- }
149
- printBlank();
150
- // --- Sentinel section ---
151
- printLine(pc.bold('SENTINEL BOUNTIES') + pc.dim(' — Active Red Teaming'));
152
- printDivider();
153
- if (agents && agents.length > 0) {
154
- const totalPool = agents.reduce((sum, s) => sum + mistToSui(s.prizePool), 0);
155
- const cheapest = Math.min(...agents.map((s) => mistToSui(s.attackFee)));
156
- const best = bestTarget(agents);
157
- printKeyValue('Active', `${agents.length} sentinels`);
158
- printKeyValue('Prize Pools', `${totalPool.toFixed(2)} SUI available`);
159
- printKeyValue('Cheapest Fee', `${cheapest.toFixed(2)} SUI`);
160
- if (best) {
161
- const ratio = (Number(best.prizePool) / Number(best.attackFee)).toFixed(1);
162
- printKeyValue('Best Target', `${best.name} — ${mistToSui(best.prizePool).toFixed(2)} SUI pool (${ratio}x ratio)`);
163
- }
164
- }
165
- else if (agents) {
166
- printInfo('No active bounties right now');
167
- }
168
- else {
169
- printInfo('Sentinel data unavailable');
170
- }
171
- printBlank();
172
- // --- Quick actions ---
173
- printLine(pc.bold('Quick Actions'));
174
- printDivider();
175
- printLine(` ${pc.dim('t2000 save <amount> [asset]')} Save stablecoins for yield`);
176
- printLine(` ${pc.dim('t2000 invest earn <asset>')} Earn yield on investments`);
177
- printLine(` ${pc.dim('t2000 sentinel list')} Browse sentinel bounties`);
178
- printLine(` ${pc.dim('t2000 sentinel attack <id>')} Attack a sentinel`);
179
- printBlank();
180
- }
181
- catch (error) {
182
- handleError(error);
183
- }
184
- });
185
- }
186
- //# sourceMappingURL=earn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"earn.js","sourceRoot":"","sources":["../../src/commands/earn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK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AC,CAAC,CAAC;oBAC3E,aAAa,CAAC,aAAa,EAAE,GAAG,IAAI,CAAC,IAAI,MAAM,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,KAAK,UAAU,CAAC,CAAC;gBACpH,CAAC;YACH,CAAC;iBAAM,IAAI,MAAM,EAAE,CAAC;gBAClB,SAAS,CAAC,8BAA8B,CAAC,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,2BAA2B,CAAC,CAAC;YACzC,CAAC;YAED,UAAU,EAAE,CAAC;YAEb,wBAAwB;YACxB,SAAS,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC;YACpC,YAAY,EAAE,CAAC;YACf,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,6BAA6B,CAAC,iCAAiC,CAAC,CAAC;YACvF,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,2BAA2B,CAAC,gCAAgC,CAAC,CAAC;YACpF,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,sCAAsC,CAAC,CAAC;YACpF,SAAS,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,4BAA4B,CAAC,wBAAwB,CAAC,CAAC;YAC7E,UAAU,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerEarnings(program: Command): void;
3
- //# sourceMappingURL=earnings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"earnings.d.ts","sourceRoot":"","sources":["../../src/commands/earnings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAoChD"}
@@ -1,38 +0,0 @@
1
- import pc from 'picocolors';
2
- import { T2000, formatUsd } from '@t2000/sdk';
3
- import { resolvePin } from '../prompts.js';
4
- import { printKeyValue, printBlank, printJson, isJsonMode, handleError, printLine } from '../output.js';
5
- export function registerEarnings(program) {
6
- program
7
- .command('earnings')
8
- .description('Show yield earned to date')
9
- .option('--key <path>', 'Key file path')
10
- .action(async (opts) => {
11
- try {
12
- const pin = await resolvePin();
13
- const agent = await T2000.create({ pin, keyPath: opts.key });
14
- const result = await agent.earnings();
15
- const pos = await agent.positions();
16
- const savePositions = pos.positions.filter((p) => p.type === 'save');
17
- if (isJsonMode()) {
18
- printJson({ ...result, positions: savePositions });
19
- return;
20
- }
21
- printBlank();
22
- printKeyValue('Total Saved', formatUsd(result.supplied));
23
- if (savePositions.length > 0) {
24
- for (const p of savePositions) {
25
- printLine(` ${pc.dim('•')} ${formatUsd(p.amount)} ${p.asset} on ${p.protocol} @ ${p.apy.toFixed(2)}% APY`);
26
- }
27
- }
28
- printKeyValue('Blended APY', `${result.currentApy.toFixed(2)}%`);
29
- printKeyValue('Daily Yield', `~${formatUsd(result.dailyEarning)}/day`);
30
- printKeyValue('Est. Earned', `~${formatUsd(result.totalYieldEarned)}`);
31
- printBlank();
32
- }
33
- catch (error) {
34
- handleError(error);
35
- }
36
- });
37
- }
38
- //# sourceMappingURL=earnings.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"earnings.js","sourceRoot":"","sources":["../../src/commands/earnings.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAExG,MAAM,UAAU,gBAAg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,CAAC,aAAa,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACjE,aAAa,CAAC,aAAa,EAAE,IAAI,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YACvE,aAAa,CAAC,aAAa,EAAE,IAAI,SAAS,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;YACvE,UAAU,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerExchange(program: Command): void;
3
- //# sourceMappingURL=exchange.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exchange.d.ts","sourceRoot":"","sources":["../../src/commands/exchange.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QA6ChD"}
@@ -1,45 +0,0 @@
1
- import { T2000, formatUsd, SUPPORTED_ASSETS } from '@t2000/sdk';
2
- import { resolvePin } from '../prompts.js';
3
- import { printSuccess, printKeyValue, printBlank, printJson, isJsonMode, handleError, explorerUrl } from '../output.js';
4
- export function registerExchange(program) {
5
- program
6
- .command('exchange <amount> <from> <to>')
7
- .description('Exchange between tokens (e.g. USDC ⇌ SUI) via Cetus DEX')
8
- .option('--key <path>', 'Key file path')
9
- .option('--slippage <pct>', 'Max slippage percentage (default: 3)', '3')
10
- .action(async (amount, from, to, opts) => {
11
- try {
12
- const pin = await resolvePin();
13
- const agent = await T2000.create({ pin, keyPath: opts.key });
14
- const fromAsset = from.toUpperCase();
15
- const toAsset = to.toUpperCase();
16
- const parsedAmount = parseFloat(amount);
17
- if (isNaN(parsedAmount) || parsedAmount <= 0) {
18
- throw new Error('Amount must be a positive number');
19
- }
20
- const result = await agent.exchange({
21
- from: fromAsset,
22
- to: toAsset,
23
- amount: parsedAmount,
24
- maxSlippage: parseFloat(opts.slippage ?? '3'),
25
- });
26
- if (isJsonMode()) {
27
- printJson(result);
28
- return;
29
- }
30
- const fromDisplay = SUPPORTED_ASSETS[fromAsset]?.displayName ?? fromAsset;
31
- const toDisplay = SUPPORTED_ASSETS[toAsset]?.displayName ?? toAsset;
32
- const toDecimals = toAsset === 'SUI' ? 4 : 2;
33
- printBlank();
34
- const fromStr = ['USDC', 'USDT', 'USDE'].includes(fromAsset) ? formatUsd(parsedAmount) : parsedAmount.toFixed(4);
35
- printSuccess(`Exchanged ${fromStr} ${fromDisplay} → ${result.toAmount.toFixed(toDecimals)} ${toDisplay}`);
36
- printKeyValue('Tx', explorerUrl(result.tx));
37
- printKeyValue('Gas', `${result.gasCost.toFixed(4)} SUI (${result.gasMethod})`);
38
- printBlank();
39
- }
40
- catch (error) {
41
- handleError(error);
42
- }
43
- });
44
- }
45
- //# sourceMappingURL=exchange.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exchange.js","sourceRoot":"","sources":["../../src/commands/exchange.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,OAAO;SACJ,OAAO,CAAC,+BAA+B,CAAC;SACxC,WAAW,CAAC,yDAAyD,CAAC;SACtE,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC;SACvC,MAAM,CAAC,kBAAkB,EAAE,sCAAsC,EAAE,GAAG,CAAC;SACvE,MAAM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AAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACjH,YAAY,CAAC,aAAa,OAAO,IAAI,WAAW,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;YAC1G,aAAa,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC;YAC5C,aAAa,CAAC,KAAK,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;YAC/E,UAAU,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerExport(program: Command): void;
3
- //# sourceMappingURL=exportKey.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exportKey.d.ts","sourceRoot":"","sources":["../../src/commands/exportKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QA8D9C"}
@@ -1,81 +0,0 @@
1
- import { readFile, writeFile, mkdir } from 'node:fs/promises';
2
- import { resolve } from 'node:path';
3
- import { homedir } from 'node:os';
4
- import { T2000 } from '@t2000/sdk';
5
- import { resolvePin, askConfirm } from '../prompts.js';
6
- import { printSuccess, printBlank, printInfo, printJson, isJsonMode, handleError, printError } from '../output.js';
7
- const LOCKFILE = resolve(homedir(), '.t2000', '.pin-lock');
8
- const MAX_ATTEMPTS = 5;
9
- const LOCKOUT_MS = 5 * 60 * 1000;
10
- async function getLockState() {
11
- try {
12
- const data = JSON.parse(await readFile(LOCKFILE, 'utf-8'));
13
- return data;
14
- }
15
- catch {
16
- return { attempts: 0, lockedUntil: 0 };
17
- }
18
- }
19
- async function setLockState(state) {
20
- await mkdir(resolve(homedir(), '.t2000'), { recursive: true });
21
- await writeFile(LOCKFILE, JSON.stringify(state), { mode: 0o600 });
22
- }
23
- export function registerExport(program) {
24
- program
25
- .command('export')
26
- .description('Export private key (raw Ed25519 hex)')
27
- .option('--key <path>', 'Key file path')
28
- .option('--yes', 'Skip confirmation')
29
- .action(async (opts) => {
30
- try {
31
- const lock = await getLockState();
32
- if (lock.lockedUntil > Date.now()) {
33
- const remainSec = Math.ceil((lock.lockedUntil - Date.now()) / 1000);
34
- printError(`Too many failed PIN attempts. Try again in ${remainSec}s.`);
35
- return;
36
- }
37
- if (!opts.yes && !isJsonMode()) {
38
- const proceed = await askConfirm('WARNING: This will display your raw private key. Anyone with this key controls your wallet. Continue?');
39
- if (!proceed)
40
- return;
41
- }
42
- const pin = await resolvePin();
43
- let agent;
44
- try {
45
- agent = await T2000.create({ pin, keyPath: opts.key });
46
- }
47
- catch (error) {
48
- const msg = error instanceof Error ? error.message : '';
49
- if (msg.includes('Invalid PIN')) {
50
- const newAttempts = lock.attempts + 1;
51
- if (newAttempts >= MAX_ATTEMPTS) {
52
- await setLockState({ attempts: newAttempts, lockedUntil: Date.now() + LOCKOUT_MS });
53
- printError(`Invalid PIN. Account locked for 5 minutes (${newAttempts} failed attempts).`);
54
- }
55
- else {
56
- await setLockState({ attempts: newAttempts, lockedUntil: 0 });
57
- printError(`Invalid PIN. ${MAX_ATTEMPTS - newAttempts} attempts remaining.`);
58
- }
59
- return;
60
- }
61
- throw error;
62
- }
63
- await setLockState({ attempts: 0, lockedUntil: 0 });
64
- const hex = agent.exportKey();
65
- if (isJsonMode()) {
66
- printJson({ privateKey: hex, format: 'ed25519_hex' });
67
- return;
68
- }
69
- printBlank();
70
- printSuccess('Private key (Ed25519, hex):');
71
- console.log(` ${hex}`);
72
- printBlank();
73
- printInfo('Not a BIP39 mnemonic. Store securely and never share.');
74
- printBlank();
75
- }
76
- catch (error) {
77
- handleError(error);
78
- }
79
- });
80
- }
81
- //# sourceMappingURL=exportKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exportKey.js","sourceRoot":"","sources":["../../src/commands/exportKey.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAEnH,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;AAC3D,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAOjC,KAAK,UAAU,YAAY;IACzB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAC3D,OAAO,IAAiB,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,CAAC;IACzC,CAAC;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,KAAgB;IAC1C,MAAM,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,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ACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerFundStatus(program: Command): void;
3
- //# sourceMappingURL=fundStatus.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fundStatus.d.ts","sourceRoot":"","sources":["../../src/commands/fundStatus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMzC,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,QA+ClD"}
@@ -1,50 +0,0 @@
1
- import pc from 'picocolors';
2
- import { T2000, formatUsd } from '@t2000/sdk';
3
- import { resolvePin } from '../prompts.js';
4
- import { printSuccess, printKeyValue, printBlank, printJson, isJsonMode, handleError, printInfo, printLine } from '../output.js';
5
- export function registerFundStatus(program) {
6
- program
7
- .command('fund-status')
8
- .description('Full savings summary')
9
- .option('--key <path>', 'Key file path')
10
- .action(async (opts) => {
11
- try {
12
- const pin = await resolvePin();
13
- const agent = await T2000.create({ pin, keyPath: opts.key });
14
- const result = await agent.fundStatus();
15
- const pos = await agent.positions();
16
- const savePositions = pos.positions.filter((p) => p.type === 'save');
17
- if (isJsonMode()) {
18
- printJson({ ...result, positions: savePositions });
19
- return;
20
- }
21
- printBlank();
22
- if (result.supplied > 0) {
23
- printSuccess('Savings: ACTIVE');
24
- }
25
- else {
26
- printInfo('Savings: INACTIVE — run `t2000 save <amount>` to start earning');
27
- }
28
- printBlank();
29
- printKeyValue('Total Saved', formatUsd(result.supplied));
30
- if (savePositions.length > 0) {
31
- for (const p of savePositions) {
32
- printLine(` ${pc.dim('•')} ${formatUsd(p.amount)} ${p.asset} on ${p.protocol} @ ${p.apy.toFixed(2)}% APY`);
33
- }
34
- }
35
- printKeyValue('Blended APY', `${result.apy.toFixed(2)}%`);
36
- printKeyValue('Earned today', `~${formatUsd(result.earnedToday)}`);
37
- printKeyValue('Earned all time', `~${formatUsd(result.earnedAllTime)}`);
38
- printKeyValue('Monthly projected', `~${formatUsd(result.projectedMonthly)}/month`);
39
- printBlank();
40
- if (result.supplied > 0) {
41
- printInfo('Withdraw anytime: t2000 withdraw <amount>');
42
- }
43
- printBlank();
44
- }
45
- catch (error) {
46
- handleError(error);
47
- }
48
- });
49
- }
50
- //# sourceMappingURL=fundStatus.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fundStatus.js","sourceRoot":"","sources":["../../src/commands/fundStatus.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEjI,MAAM,UAAU,kBAAkB,CAAC,OAAgB;IACjD,OAAO;SACJ,OAAO,CAAC,aAAa,CAAC;SACtB,WAAW,CAAC,sBAAsB,CAAC;SACnC,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC;SACvC,MAAM,CAAC,KAAK,EAAE,IAAsB,EAAE,EAAE;QACvC,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAE7D,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,CAAC;YACxC,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,EAAE,CAAC;YACpC,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CA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AAC;YACb,IAAI,MAAM,CAAC,QAAQ,GAAG,CAAC,EAAE,CAAC;gBACxB,SAAS,CAAC,2CAA2C,CAAC,CAAC;YACzD,CAAC;YACD,UAAU,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerHealth(program: Command): void;
3
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/commands/health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,QAwC9C"}
@@ -1,44 +0,0 @@
1
- import { T2000, formatUsd } from '@t2000/sdk';
2
- import { resolvePin } from '../prompts.js';
3
- import { printKeyValue, printBlank, printJson, isJsonMode, handleError, printSuccess, printWarning, printError } from '../output.js';
4
- export function registerHealth(program) {
5
- program
6
- .command('health')
7
- .description('Check savings health factor')
8
- .option('--key <path>', 'Key file path')
9
- .action(async (opts) => {
10
- try {
11
- const pin = await resolvePin();
12
- const agent = await T2000.create({ pin, keyPath: opts.key });
13
- const hf = await agent.healthFactor();
14
- if (isJsonMode()) {
15
- printJson(hf);
16
- return;
17
- }
18
- printBlank();
19
- const noActiveLoan = hf.borrowed < 0.01;
20
- const hfStr = (hf.healthFactor === Infinity || noActiveLoan) ? '∞' : hf.healthFactor.toFixed(2);
21
- if (hf.healthFactor >= 2.0) {
22
- printSuccess(`Health Factor: ${hfStr} (healthy)`);
23
- }
24
- else if (hf.healthFactor >= 1.5) {
25
- printWarning(`Health Factor: ${hfStr} (moderate)`);
26
- }
27
- else if (hf.healthFactor >= 1.2) {
28
- printWarning(`Health Factor: ${hfStr} (low)`);
29
- }
30
- else {
31
- printError(`Health Factor: ${hfStr} (CRITICAL)`);
32
- }
33
- printBlank();
34
- printKeyValue('Supplied', `${formatUsd(hf.supplied)} USDC`);
35
- printKeyValue('Borrowed', `${formatUsd(hf.borrowed)} USDC`);
36
- printKeyValue('Max Borrow', `${formatUsd(hf.maxBorrow)} USDC`);
37
- printBlank();
38
- }
39
- catch (error) {
40
- handleError(error);
41
- }
42
- });
43
- }
44
- //# sourceMappingURL=health.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/commands/health.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAErI,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,6BAA6B,CAAC;SAC1C,MAAM,CAAC,cAAc,EAAE,eAAe,CAAC;SACvC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QACrB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,UAAU,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAE7D,MAAM,EAAE,GAAG,MAAM,KAAK,CAAC,YAAY,EAAE,CAAC;YAEtC,IAAI,UAAU,EAAE,EAAE,CAAC;gBACjB,SAAS,CAAC,EAAE,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YAED,UAAU,EAAE,CAAC;YAEb,MAAM,YAAY,GAAG,EAAE,CAAC,QAAQ,GAAG,IAAI,CAAC;YACxC,MAAM,KAAK,GAAG,CAAC,EAAE,CAAC,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAChG,IAAI,EAAE,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC;gBAC3B,YAAY,CAAC,kBAAkB,KAAK,YAAY,CAAC,CAAC;YACpD,CAAC;iBAAM,IAAI,EAAE,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC;gBAClC,YAAY,CAAC,kBAAkB,KAAK,aAAa,CAAC,CAAC;YACrD,CAAC;iBAAM,IAAI,EAAE,CAAC,YAAY,IAAI,GAAG,EAAE,CAAC;gBAClC,YAAY,CAAC,kBAAkB,KAAK,QAAQ,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,UAAU,CAAC,kBAAkB,KAAK,aAAa,CAAC,CAAC;YACnD,CAAC;YAED,UAAU,EAAE,CAAC;YACb,aAAa,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC5D,aAAa,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAC5D,aAAa,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;YAC/D,UAAU,EAAE,CAAC;QACf,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { Command } from 'commander';
2
- export declare function registerHistory(program: Command): void;
3
- //# sourceMappingURL=history.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"history.d.ts","sourceRoot":"","sources":["../../src/commands/history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,QAmC/C"}
@@ -1,37 +0,0 @@
1
- import { T2000, truncateAddress } from '@t2000/sdk';
2
- import { resolvePin } from '../prompts.js';
3
- import { printHeader, printBlank, printJson, isJsonMode, handleError, printLine, printInfo } from '../output.js';
4
- export function registerHistory(program) {
5
- program
6
- .command('history')
7
- .description('Show transaction history')
8
- .option('--limit <n>', 'Number of transactions', '20')
9
- .option('--key <path>', 'Key file path')
10
- .action(async (opts) => {
11
- try {
12
- const pin = await resolvePin();
13
- const agent = await T2000.create({ pin, keyPath: opts.key });
14
- const txns = await agent.history({ limit: parseInt(opts.limit, 10) });
15
- if (isJsonMode()) {
16
- printJson(txns);
17
- return;
18
- }
19
- printHeader('Transaction History');
20
- if (txns.length === 0) {
21
- printInfo('No transactions yet.');
22
- }
23
- else {
24
- for (const tx of txns) {
25
- const time = tx.timestamp ? new Date(tx.timestamp).toLocaleString() : 'unknown';
26
- const gas = tx.gasMethod ? ` (${tx.gasMethod})` : '';
27
- printLine(`${truncateAddress(tx.digest)} ${tx.action}${gas} ${time}`);
28
- }
29
- }
30
- printBlank();
31
- }
32
- catch (error) {
33
- handleError(error);
34
- }
35
- });
36
- }
37
- //# sourceMappingURL=history.js.map