moltlaunch 2.4.0 → 2.5.0

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/README.md CHANGED
@@ -111,6 +111,7 @@ mltl decline --task <id>
111
111
  mltl submit --task <id> --result "Here's what I delivered..."
112
112
  mltl claim --task <id>
113
113
  mltl earnings
114
+ mltl fees
114
115
  mltl message --task <id>
115
116
  mltl profile --agent <id> --tagline "I audit Solidity contracts"
116
117
  mltl gig create --agent <id> --title "Smart Contract Audit" --description "Full audit report" --price 0.01 --delivery "24h"
package/dist/index.js CHANGED
@@ -1755,8 +1755,120 @@ async function earnings(options) {
1755
1755
  }
1756
1756
  }
1757
1757
 
1758
- // src/commands/inbox.ts
1758
+ // src/commands/fees.ts
1759
1759
  import { formatEther as formatEther3 } from "viem";
1760
+ import { createPublicClient as createPublicClient3, createWalletClient as createWalletClient3, http as http3 } from "viem";
1761
+ import { base as base3 } from "viem/chains";
1762
+ import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
1763
+ var REVENUE_MANAGER_ABI = [
1764
+ {
1765
+ name: "balances",
1766
+ type: "function",
1767
+ stateMutability: "view",
1768
+ inputs: [{ name: "_recipient", type: "address" }],
1769
+ outputs: [{ name: "balance_", type: "uint256" }]
1770
+ },
1771
+ {
1772
+ name: "claim",
1773
+ type: "function",
1774
+ stateMutability: "nonpayable",
1775
+ inputs: [],
1776
+ outputs: [{ name: "amount_", type: "uint256" }]
1777
+ }
1778
+ ];
1779
+ async function fees(options) {
1780
+ const { wallet: wallet2 } = await loadOrCreateWallet();
1781
+ const publicClient = createPublicClient3({ chain: base3, transport: http3(BASE_RPC_URL) });
1782
+ if (!options.json) {
1783
+ console.log("\nFlaunch Trading Fees");
1784
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n");
1785
+ }
1786
+ try {
1787
+ const agentId = await getAgentByOwner(wallet2.address);
1788
+ if (!agentId || agentId <= 0n) {
1789
+ throw new Error("No registered agent found for this wallet");
1790
+ }
1791
+ const balance = await publicClient.readContract({
1792
+ address: REVENUE_MANAGER_ADDRESS,
1793
+ abi: REVENUE_MANAGER_ABI,
1794
+ functionName: "balances",
1795
+ args: [wallet2.address]
1796
+ });
1797
+ const balanceEth = formatEther3(balance);
1798
+ if (!options.claim) {
1799
+ if (options.json) {
1800
+ console.log(JSON.stringify({
1801
+ wallet: wallet2.address,
1802
+ agentId: agentId.toString(),
1803
+ revenueManager: REVENUE_MANAGER_ADDRESS,
1804
+ pendingFees: { wei: balance.toString(), eth: balanceEth }
1805
+ }));
1806
+ return;
1807
+ }
1808
+ console.log(`Wallet: ${wallet2.address}`);
1809
+ console.log(`Agent ID: ${agentId.toString()}`);
1810
+ console.log(`Revenue Manager: ${REVENUE_MANAGER_ADDRESS}`);
1811
+ console.log("");
1812
+ console.log(`Pending fees: ${balanceEth} ETH`);
1813
+ console.log("");
1814
+ if (balance === 0n) {
1815
+ console.log("No fees to claim yet. Fees accumulate from token trading activity.");
1816
+ } else {
1817
+ console.log("Run with --claim to withdraw fees to your wallet.");
1818
+ }
1819
+ return;
1820
+ }
1821
+ if (balance === 0n) {
1822
+ if (options.json) {
1823
+ console.log(JSON.stringify({ error: "No fees to claim" }));
1824
+ process.exit(1);
1825
+ }
1826
+ console.log("No fees to claim yet.");
1827
+ return;
1828
+ }
1829
+ if (!options.json) {
1830
+ console.log(`Claiming ${balanceEth} ETH in trading fees...`);
1831
+ }
1832
+ const account = privateKeyToAccount4(wallet2.privateKey);
1833
+ const walletClient = createWalletClient3({
1834
+ account,
1835
+ chain: base3,
1836
+ transport: http3(BASE_RPC_URL)
1837
+ });
1838
+ const txHash = await walletClient.writeContract({
1839
+ address: REVENUE_MANAGER_ADDRESS,
1840
+ abi: REVENUE_MANAGER_ABI,
1841
+ functionName: "claim",
1842
+ args: []
1843
+ });
1844
+ await publicClient.waitForTransactionReceipt({ hash: txHash });
1845
+ if (options.json) {
1846
+ console.log(JSON.stringify({
1847
+ success: true,
1848
+ claimed: { wei: balance.toString(), eth: balanceEth },
1849
+ txHash
1850
+ }));
1851
+ return;
1852
+ }
1853
+ console.log("\n\u2705 Fees claimed!");
1854
+ console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
1855
+ console.log(`Amount: ${balanceEth} ETH`);
1856
+ console.log(`TX: ${txHash}`);
1857
+ console.log("");
1858
+ } catch (err) {
1859
+ const errorMsg = err instanceof Error ? err.message : String(err);
1860
+ if (options.json) {
1861
+ console.log(JSON.stringify({ error: errorMsg }));
1862
+ process.exit(1);
1863
+ }
1864
+ console.error(`
1865
+ \u274C Failed: ${errorMsg}`);
1866
+ process.exit(1);
1867
+ }
1868
+ }
1869
+
1870
+ // src/commands/inbox.ts
1871
+ import { formatEther as formatEther4 } from "viem";
1760
1872
  function formatTimestamp(ts) {
1761
1873
  const date = new Date(ts);
1762
1874
  return date.toLocaleString();
@@ -1797,7 +1909,7 @@ var STATUS_GROUPS = [
1797
1909
  { key: "disputed", label: "DISPUTED", emoji: "\u26A0\uFE0F", hint: "Task is disputed. Await admin resolution." }
1798
1910
  ];
1799
1911
  function renderTask(task) {
1800
- const priceEth = task.quotedPriceWei ? formatEther3(BigInt(task.quotedPriceWei)) : null;
1912
+ const priceEth = task.quotedPriceWei ? formatEther4(BigInt(task.quotedPriceWei)) : null;
1801
1913
  console.log(`Task ID: ${task.id}${taskCounts(task)}`);
1802
1914
  console.log(`Client: ${task.clientAddress}`);
1803
1915
  if (priceEth) console.log(`Price: ${priceEth} ETH`);
@@ -1880,19 +1992,19 @@ Failed to fetch inbox: ${errorMsg}`);
1880
1992
  }
1881
1993
 
1882
1994
  // src/commands/accept.ts
1883
- import { formatEther as formatEther4, parseEther as parseEther2 } from "viem";
1995
+ import { formatEther as formatEther5, parseEther as parseEther2 } from "viem";
1884
1996
 
1885
1997
  // src/lib/escrow.ts
1886
1998
  import {
1887
- createPublicClient as createPublicClient3,
1888
- createWalletClient as createWalletClient3,
1889
- http as http3,
1999
+ createPublicClient as createPublicClient4,
2000
+ createWalletClient as createWalletClient4,
2001
+ http as http4,
1890
2002
  keccak256 as keccak2562,
1891
2003
  toBytes as toBytes2,
1892
2004
  parseAbi
1893
2005
  } from "viem";
1894
- import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
1895
- import { base as base3 } from "viem/chains";
2006
+ import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
2007
+ import { base as base4 } from "viem/chains";
1896
2008
  var ESCROW_ADDRESS = process.env.ESCROW_ADDRESS || "0x5Df1ffa02c8515a0Fed7d0e5d6375FcD2c1950Ee";
1897
2009
  var ESCROW_ABI = parseAbi([
1898
2010
  // Write functions
@@ -1934,17 +2046,17 @@ function taskIdToBytes32(taskId) {
1934
2046
  return keccak2562(toBytes2(taskId));
1935
2047
  }
1936
2048
  function getPublicClient2() {
1937
- return createPublicClient3({
1938
- chain: base3,
1939
- transport: http3(BASE_RPC_URL)
2049
+ return createPublicClient4({
2050
+ chain: base4,
2051
+ transport: http4(BASE_RPC_URL)
1940
2052
  });
1941
2053
  }
1942
2054
  function getWalletClient2(wallet2) {
1943
- const account = privateKeyToAccount4(wallet2.privateKey);
1944
- return createWalletClient3({
2055
+ const account = privateKeyToAccount5(wallet2.privateKey);
2056
+ return createWalletClient4({
1945
2057
  account,
1946
- chain: base3,
1947
- transport: http3(BASE_RPC_URL)
2058
+ chain: base4,
2059
+ transport: http4(BASE_RPC_URL)
1948
2060
  });
1949
2061
  }
1950
2062
  async function depositEscrow(wallet2, taskId, agentAddress, tokenAddress, amountWei) {
@@ -2153,7 +2265,7 @@ async function accept(options) {
2153
2265
  if (taskBefore.clientAddress.toLowerCase() !== wallet2.address.toLowerCase()) {
2154
2266
  throw new Error("Only the client who created this task can accept the quote");
2155
2267
  }
2156
- const priceEth = taskBefore.quotedPriceWei ? formatEther4(BigInt(taskBefore.quotedPriceWei)) : "0";
2268
+ const priceEth = taskBefore.quotedPriceWei ? formatEther5(BigInt(taskBefore.quotedPriceWei)) : "0";
2157
2269
  const agent = await fetchAgent2(taskBefore.agentId);
2158
2270
  if (!agent) {
2159
2271
  throw new Error(`Agent #${taskBefore.agentId} not found`);
@@ -2296,7 +2408,7 @@ async function decline(options) {
2296
2408
  }
2297
2409
 
2298
2410
  // src/commands/submit.ts
2299
- import { formatEther as formatEther5 } from "viem";
2411
+ import { formatEther as formatEther6 } from "viem";
2300
2412
 
2301
2413
  // src/lib/files.ts
2302
2414
  import { readFileSync, statSync } from "fs";
@@ -2413,7 +2525,7 @@ Uploading ${filePaths.length} file(s)...`);
2413
2525
  );
2414
2526
  return;
2415
2527
  }
2416
- const priceEth = task.quotedPriceWei ? formatEther5(BigInt(task.quotedPriceWei)) : "0";
2528
+ const priceEth = task.quotedPriceWei ? formatEther6(BigInt(task.quotedPriceWei)) : "0";
2417
2529
  console.log(isRevision ? "\n\u2705 Revised work submitted!" : "\n\u2705 Work submitted!");
2418
2530
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
2419
2531
  console.log(`
@@ -2455,7 +2567,7 @@ Check status: mltl view --task ${task.id}
2455
2567
  }
2456
2568
 
2457
2569
  // src/commands/approve.ts
2458
- import { formatEther as formatEther6 } from "viem";
2570
+ import { formatEther as formatEther7 } from "viem";
2459
2571
  async function fetchAgent3(agentId) {
2460
2572
  const res = await fetch(`${APIS.MOLTLAUNCH}/api/agents/${agentId}`);
2461
2573
  if (!res.ok) return null;
@@ -2480,7 +2592,7 @@ async function approve(options) {
2480
2592
  throw new Error("Task has no quoted price");
2481
2593
  }
2482
2594
  const priceWei = BigInt(task.quotedPriceWei);
2483
- const priceEth = formatEther6(priceWei);
2595
+ const priceEth = formatEther7(priceWei);
2484
2596
  const agent = await fetchAgent3(task.agentId);
2485
2597
  if (!agent) {
2486
2598
  throw new Error(`Agent #${task.agentId} not found`);
@@ -2501,7 +2613,7 @@ async function approve(options) {
2501
2613
  Task ID: ${task.id}`);
2502
2614
  console.log(`Agent: ${agent.name || `#${task.agentId}`}`);
2503
2615
  console.log(`Agent Owner: ${agentOwner}`);
2504
- console.log(`Escrow: ${formatEther6(escrow.amount)} ETH (locked)`);
2616
+ console.log(`Escrow: ${formatEther7(escrow.amount)} ETH (locked)`);
2505
2617
  console.log(`
2506
2618
  Submitted result:
2507
2619
  ${task.result}
@@ -2561,7 +2673,7 @@ Payment: ${priceEth} ETH \u2192 ${agentOwner}`);
2561
2673
  }
2562
2674
 
2563
2675
  // src/commands/tasks.ts
2564
- import { formatEther as formatEther7 } from "viem";
2676
+ import { formatEther as formatEther8 } from "viem";
2565
2677
  function formatTimestamp2(ts) {
2566
2678
  const date = new Date(ts);
2567
2679
  return date.toLocaleString();
@@ -2625,7 +2737,7 @@ async function tasks(options) {
2625
2737
  console.log(`\u{1F4E5} NEEDS REVIEW (${needsReview.length})`);
2626
2738
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2627
2739
  for (const task of needsReview) {
2628
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2740
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2629
2741
  console.log(`Task ID: ${task.id}`);
2630
2742
  console.log(`Agent: #${task.agentId}`);
2631
2743
  console.log(`Price: ${priceEth} ETH`);
@@ -2647,7 +2759,7 @@ ${task.result}
2647
2759
  \u{1F4AC} QUOTES RECEIVED (${quoted.length})`);
2648
2760
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2649
2761
  for (const task of quoted) {
2650
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2762
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2651
2763
  console.log(`Task ID: ${task.id}`);
2652
2764
  console.log(`Agent: #${task.agentId}`);
2653
2765
  console.log(`Quote: ${priceEth} ETH`);
@@ -2678,7 +2790,7 @@ ${task.result}
2678
2790
  \u{1F528} IN PROGRESS (${inProgress.length})`);
2679
2791
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2680
2792
  for (const task of inProgress) {
2681
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2793
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2682
2794
  console.log(`Task ID: ${task.id}`);
2683
2795
  console.log(`Agent: #${task.agentId}`);
2684
2796
  console.log(`Price: ${priceEth} ETH`);
@@ -2692,7 +2804,7 @@ ${task.result}
2692
2804
  \u2705 COMPLETED (${completed.length})`);
2693
2805
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2694
2806
  for (const task of completed.slice(0, 5)) {
2695
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2807
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2696
2808
  console.log(`Task ID: ${task.id}`);
2697
2809
  console.log(`Agent: #${task.agentId}`);
2698
2810
  console.log(`Paid: ${priceEth} ETH`);
@@ -2710,7 +2822,7 @@ ${task.result}
2710
2822
  \u{1F504} REVISION REQUESTED (${revision.length})`);
2711
2823
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2712
2824
  for (const task of revision) {
2713
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2825
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2714
2826
  console.log(`Task ID: ${task.id}`);
2715
2827
  console.log(`Agent: #${task.agentId}`);
2716
2828
  console.log(`Price: ${priceEth} ETH`);
@@ -2724,7 +2836,7 @@ ${task.result}
2724
2836
  \u26A0\uFE0F DISPUTED (${disputed.length})`);
2725
2837
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2726
2838
  for (const task of disputed) {
2727
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2839
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2728
2840
  console.log(`Task ID: ${task.id}`);
2729
2841
  console.log(`Agent: #${task.agentId}`);
2730
2842
  console.log(`Price: ${priceEth} ETH`);
@@ -2739,7 +2851,7 @@ ${task.result}
2739
2851
  \u2705 RESOLVED (${resolved.length})`);
2740
2852
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n");
2741
2853
  for (const task of resolved) {
2742
- const priceEth = task.quotedPriceWei ? formatEther7(BigInt(task.quotedPriceWei)) : "0";
2854
+ const priceEth = task.quotedPriceWei ? formatEther8(BigInt(task.quotedPriceWei)) : "0";
2743
2855
  const winner = task.disputeResolution === "client" ? "Client (refunded)" : "Agent (buyback)";
2744
2856
  console.log(`Task ID: ${task.id}`);
2745
2857
  console.log(`Agent: #${task.agentId}`);
@@ -2770,7 +2882,7 @@ ${task.result}
2770
2882
  }
2771
2883
 
2772
2884
  // src/commands/quote.ts
2773
- import { parseEther as parseEther3, formatEther as formatEther8 } from "viem";
2885
+ import { parseEther as parseEther3, formatEther as formatEther9 } from "viem";
2774
2886
  async function quote(options) {
2775
2887
  const { wallet: wallet2 } = await loadOrCreateWallet();
2776
2888
  if (!options.json) {
@@ -2783,7 +2895,7 @@ async function quote(options) {
2783
2895
  throw new Error(`Task is ${taskBefore.status}, cannot quote`);
2784
2896
  }
2785
2897
  const priceWei = parseEther3(options.price);
2786
- const priceEth = formatEther8(priceWei);
2898
+ const priceEth = formatEther9(priceWei);
2787
2899
  if (!options.json) {
2788
2900
  console.log(`
2789
2901
  Task ID: ${taskBefore.id}`);
@@ -2846,7 +2958,7 @@ Flow: requested \u2192 [quoted] \u2192 accepted \u2192 submitted \u2192 complete
2846
2958
  }
2847
2959
 
2848
2960
  // src/commands/claim.ts
2849
- import { formatEther as formatEther9 } from "viem";
2961
+ import { formatEther as formatEther10 } from "viem";
2850
2962
  async function claim(options) {
2851
2963
  const { wallet: wallet2 } = await loadOrCreateWallet();
2852
2964
  if (!options.json) {
@@ -2868,7 +2980,7 @@ async function claim(options) {
2868
2980
  if (escrow.status === 3 /* Disputed */) {
2869
2981
  throw new Error("Task is disputed. Cannot claim until dispute is resolved.");
2870
2982
  }
2871
- const priceEth = formatEther9(escrow.amount);
2983
+ const priceEth = formatEther10(escrow.amount);
2872
2984
  const timedOut = await isEscrowTimedOut(options.task);
2873
2985
  if (!timedOut) {
2874
2986
  const secondsLeft = await getTimeUntilTimeout(options.task);
@@ -2945,7 +3057,7 @@ The client did not respond within 24 hours.`);
2945
3057
  }
2946
3058
 
2947
3059
  // src/commands/refund.ts
2948
- import { formatEther as formatEther10 } from "viem";
3060
+ import { formatEther as formatEther11 } from "viem";
2949
3061
  async function refund(options) {
2950
3062
  const { wallet: wallet2 } = await loadOrCreateWallet();
2951
3063
  if (!options.json) {
@@ -2973,7 +3085,7 @@ async function refund(options) {
2973
3085
  if (!options.json) {
2974
3086
  console.log(`
2975
3087
  Task ID: ${task.id}`);
2976
- console.log(`Escrowed: ${formatEther10(escrow.amount)} ETH`);
3088
+ console.log(`Escrowed: ${formatEther11(escrow.amount)} ETH`);
2977
3089
  console.log("\nRefunding to your wallet...");
2978
3090
  }
2979
3091
  const txHash = await refundEscrow(wallet2, task.id);
@@ -2986,7 +3098,7 @@ Task ID: ${task.id}`);
2986
3098
  JSON.stringify({
2987
3099
  success: true,
2988
3100
  taskId: task.id,
2989
- refundedAmount: formatEther10(escrow.amount),
3101
+ refundedAmount: formatEther11(escrow.amount),
2990
3102
  txHash,
2991
3103
  nextActions: [
2992
3104
  { command: `mltl hire --agent ${task.agentId} --task "..."`, description: "Hire the same agent again" },
@@ -3000,7 +3112,7 @@ Task ID: ${task.id}`);
3000
3112
  console.log("\n\u2705 Refund successful! No fees deducted.");
3001
3113
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
3002
3114
  console.log(`
3003
- Refunded: ${formatEther10(escrow.amount)} ETH \u2192 ${wallet2.address}`);
3115
+ Refunded: ${formatEther11(escrow.amount)} ETH \u2192 ${wallet2.address}`);
3004
3116
  console.log(`TX: ${txHash}
3005
3117
  `);
3006
3118
  } catch (err) {
@@ -3016,7 +3128,7 @@ Refunded: ${formatEther10(escrow.amount)} ETH \u2192 ${wallet2.address}`);
3016
3128
  }
3017
3129
 
3018
3130
  // src/commands/cancel.ts
3019
- import { formatEther as formatEther11 } from "viem";
3131
+ import { formatEther as formatEther12 } from "viem";
3020
3132
  async function cancel(options) {
3021
3133
  const { wallet: wallet2 } = await loadOrCreateWallet();
3022
3134
  if (!options.json) {
@@ -3042,9 +3154,9 @@ async function cancel(options) {
3042
3154
  if (!options.json) {
3043
3155
  console.log(`
3044
3156
  Task ID: ${task.id}`);
3045
- console.log(`Escrowed: ${formatEther11(escrow.amount)} ETH`);
3046
- console.log(`Cancel fee: ${formatEther11(fee)} ETH (10% to agent for lost opportunity)`);
3047
- console.log(`You receive: ${formatEther11(escrow.amount - fee)} ETH`);
3157
+ console.log(`Escrowed: ${formatEther12(escrow.amount)} ETH`);
3158
+ console.log(`Cancel fee: ${formatEther12(fee)} ETH (10% to agent for lost opportunity)`);
3159
+ console.log(`You receive: ${formatEther12(escrow.amount - fee)} ETH`);
3048
3160
  console.log("\nNote: If the agent hasn't started yet, consider 'mltl refund' instead (no fee).");
3049
3161
  console.log("Cancel is for tasks already accepted by the agent.\n");
3050
3162
  console.log("Cancelling...");
@@ -3059,8 +3171,8 @@ Task ID: ${task.id}`);
3059
3171
  JSON.stringify({
3060
3172
  success: true,
3061
3173
  taskId: task.id,
3062
- cancelFee: formatEther11(fee),
3063
- refundedAmount: formatEther11(escrow.amount - fee),
3174
+ cancelFee: formatEther12(fee),
3175
+ refundedAmount: formatEther12(escrow.amount - fee),
3064
3176
  txHash,
3065
3177
  nextActions: [
3066
3178
  { command: `mltl hire --agent ${task.agentId} --task "..."`, description: "Hire the same agent again" },
@@ -3073,8 +3185,8 @@ Task ID: ${task.id}`);
3073
3185
  console.log("\nTask cancelled.");
3074
3186
  console.log("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");
3075
3187
  console.log(`
3076
- Cancel fee: ${formatEther11(fee)} ETH \u2192 agent`);
3077
- console.log(`Refunded: ${formatEther11(escrow.amount - fee)} ETH \u2192 ${wallet2.address}`);
3188
+ Cancel fee: ${formatEther12(fee)} ETH \u2192 agent`);
3189
+ console.log(`Refunded: ${formatEther12(escrow.amount - fee)} ETH \u2192 ${wallet2.address}`);
3078
3190
  console.log(`TX: ${txHash}
3079
3191
  `);
3080
3192
  } catch (err) {
@@ -3090,7 +3202,7 @@ Cancel fee: ${formatEther11(fee)} ETH \u2192 agent`);
3090
3202
  }
3091
3203
 
3092
3204
  // src/commands/dispute.ts
3093
- import { formatEther as formatEther12 } from "viem";
3205
+ import { formatEther as formatEther13 } from "viem";
3094
3206
  async function dispute(options) {
3095
3207
  const { wallet: wallet2 } = await loadOrCreateWallet();
3096
3208
  if (!options.json) {
@@ -3113,11 +3225,11 @@ async function dispute(options) {
3113
3225
  throw new Error("Escrow is not in submitted state");
3114
3226
  }
3115
3227
  const feeWei = await getDisputeFee(task.id);
3116
- const feeEth = formatEther12(feeWei);
3228
+ const feeEth = formatEther13(feeWei);
3117
3229
  if (!options.json) {
3118
3230
  console.log(`
3119
3231
  Task ID: ${task.id}`);
3120
- console.log(`Escrow: ${formatEther12(escrow.amount)} ETH`);
3232
+ console.log(`Escrow: ${formatEther13(escrow.amount)} ETH`);
3121
3233
  console.log(`Dispute fee: ${feeEth} ETH (10% of escrow, non-refundable if you lose)`);
3122
3234
  console.log("\n\u26A0 Disputes are a last resort. Consider these alternatives first:");
3123
3235
  console.log(` Request revision: mltl revise --task ${task.id} --reason "..."`);
@@ -3171,7 +3283,7 @@ Fee paid: ${feeEth} ETH`);
3171
3283
  }
3172
3284
 
3173
3285
  // src/commands/resolve.ts
3174
- import { formatEther as formatEther13 } from "viem";
3286
+ import { formatEther as formatEther14 } from "viem";
3175
3287
  async function resolve(options) {
3176
3288
  const { wallet: wallet2 } = await loadOrCreateWallet();
3177
3289
  if (!["client", "agent"].includes(options.winner)) {
@@ -3198,8 +3310,8 @@ async function resolve(options) {
3198
3310
  if (!options.json) {
3199
3311
  console.log(`
3200
3312
  Task ID: ${task.id}`);
3201
- console.log(`Escrow: ${formatEther13(escrow.amount)} ETH`);
3202
- console.log(`Dispute fee: ${formatEther13(escrow.disputeFee)} ETH`);
3313
+ console.log(`Escrow: ${formatEther14(escrow.amount)} ETH`);
3314
+ console.log(`Dispute fee: ${formatEther14(escrow.disputeFee)} ETH`);
3203
3315
  console.log(`Resolution: ${clientWins ? "CLIENT WINS (refund)" : "AGENT WINS (buyback)"}`);
3204
3316
  console.log("\nCalling resolveDispute on-chain...");
3205
3317
  }
@@ -3392,7 +3504,7 @@ Failed to send message: ${errorMsg}`);
3392
3504
  }
3393
3505
 
3394
3506
  // src/commands/view.ts
3395
- import { formatEther as formatEther14 } from "viem";
3507
+ import { formatEther as formatEther15 } from "viem";
3396
3508
  function formatTimestamp4(ts) {
3397
3509
  return new Date(ts).toLocaleString();
3398
3510
  }
@@ -3478,7 +3590,7 @@ async function view(options) {
3478
3590
  console.log(JSON.stringify({ task, role, flow: flow2 }));
3479
3591
  return;
3480
3592
  }
3481
- const priceEth = task.quotedPriceWei ? formatEther14(BigInt(task.quotedPriceWei)) : null;
3593
+ const priceEth = task.quotedPriceWei ? formatEther15(BigInt(task.quotedPriceWei)) : null;
3482
3594
  console.log("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
3483
3595
  console.log(` Task ${task.id}`);
3484
3596
  console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n");
@@ -3751,6 +3863,7 @@ program.command("agents").description("Browse registered agents").option("--skil
3751
3863
  program.command("reviews").description("View verified reviews for an agent").requiredOption("--agent <id>", "Agent ID").option("--json", "Output as JSON").action(reviews);
3752
3864
  program.command("wallet").description("Show wallet info and balance").option("--json", "Output as JSON").action(wallet);
3753
3865
  program.command("earnings").description("View your earnings from being hired").option("--json", "Output as JSON").action(earnings);
3866
+ program.command("fees").description("Check and claim trading fees from your Flaunch token").option("--claim", "Claim pending fees to your wallet").option("--json", "Output as JSON").action(fees);
3754
3867
  program.command("inbox").description("View pending work requests for your agent").option("--agent <id>", "Agent ID (auto-detected from wallet if omitted)").option("--json", "Output as JSON").action(inbox);
3755
3868
  program.command("quote").description("Quote a price for a task request (agent)").requiredOption("--task <id>", "Task ID to quote").requiredOption("--price <eth>", "Price in ETH").option("--message <text>", "Optional message to client").option("--json", "Output as JSON").action(quote);
3756
3869
  program.command("decline").description("Decline a task request (agent)").requiredOption("--task <id>", "Task ID to decline").option("--json", "Output as JSON").action(decline);