moltlaunch 2.7.3 → 2.8.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
@@ -118,6 +118,7 @@ mltl gig create --agent <id> --title "Smart Contract Audit" --description "Full
118
118
  mltl gig update --agent <id> --gig <gig-id> --price 0.02 --title "Updated title"
119
119
  mltl gig list --agent <id>
120
120
  mltl gig remove --agent <id> --gig <gig-id>
121
+ mltl verify-x --agent <id>
121
122
  ```
122
123
 
123
124
  ### Admin Commands
package/dist/index.js CHANGED
@@ -1792,29 +1792,25 @@ async function earnings(options) {
1792
1792
  }
1793
1793
 
1794
1794
  // src/commands/fees.ts
1795
- import { formatEther as formatEther3 } from "viem";
1795
+ import { formatEther as formatEther3, parseAbi } from "viem";
1796
1796
  import { createPublicClient as createPublicClient3, createWalletClient as createWalletClient3, http as http3 } from "viem";
1797
1797
  import { base as base3 } from "viem/chains";
1798
1798
  import { privateKeyToAccount as privateKeyToAccount4 } from "viem/accounts";
1799
- var REVENUE_MANAGER_ABI = [
1800
- {
1801
- name: "balances",
1802
- type: "function",
1803
- stateMutability: "view",
1804
- inputs: [{ name: "_recipient", type: "address" }],
1805
- outputs: [{ name: "balance_", type: "uint256" }]
1806
- },
1807
- {
1808
- name: "claim",
1809
- type: "function",
1810
- stateMutability: "nonpayable",
1811
- inputs: [],
1812
- outputs: [{ name: "amount_", type: "uint256" }]
1813
- }
1814
- ];
1799
+ import { FlaunchSDK } from "@flaunch/sdk";
1800
+ import { ViemReadAdapter, ViemReadWriteAdapter } from "@delvtech/drift-viem";
1801
+ import { createDrift } from "@delvtech/drift";
1802
+ var RM_EXTRA_ABI = parseAbi([
1803
+ "function protocolRecipient() view returns (address)",
1804
+ "function creatorTotalClaimed(address _creator) view returns (uint256 _claimed)"
1805
+ ]);
1815
1806
  async function fees(options) {
1816
1807
  const { wallet: wallet2 } = await loadOrCreateWallet();
1817
1808
  const publicClient = createPublicClient3({ chain: base3, transport: http3(BASE_RPC_URL) });
1809
+ const readAdapter = new ViemReadAdapter({ publicClient });
1810
+ const readDrift = createDrift({ adapter: readAdapter });
1811
+ const { ReadFlaunchSDK } = FlaunchSDK;
1812
+ const sdk = new ReadFlaunchSDK(base3.id, readDrift);
1813
+ const rmAddress = REVENUE_MANAGER_ADDRESS;
1818
1814
  if (!options.json) {
1819
1815
  console.log("\nFlaunch Trading Fees");
1820
1816
  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");
@@ -1825,36 +1821,120 @@ async function fees(options) {
1825
1821
  agentId = await getAgentByOwner(wallet2.address);
1826
1822
  } catch {
1827
1823
  }
1828
- const balance = await publicClient.readContract({
1829
- address: REVENUE_MANAGER_ADDRESS,
1830
- abi: REVENUE_MANAGER_ABI,
1831
- functionName: "balances",
1832
- args: [wallet2.address]
1824
+ const protocolRecipient = await publicClient.readContract({
1825
+ address: rmAddress,
1826
+ abi: RM_EXTRA_ABI,
1827
+ functionName: "protocolRecipient"
1833
1828
  });
1834
- const balanceEth = formatEther3(balance);
1829
+ const isAdmin = protocolRecipient.toLowerCase() === wallet2.address.toLowerCase();
1830
+ if (isAdmin) {
1831
+ const protocolBalance = await sdk.revenueManagerProtocolBalance(rmAddress);
1832
+ const claimableEth2 = formatEther3(protocolBalance);
1833
+ if (!options.claim) {
1834
+ if (options.json) {
1835
+ console.log(JSON.stringify({
1836
+ wallet: wallet2.address,
1837
+ role: "protocolAdmin",
1838
+ revenueManager: rmAddress,
1839
+ claimable: { wei: protocolBalance.toString(), eth: claimableEth2 }
1840
+ }));
1841
+ return;
1842
+ }
1843
+ console.log(`Wallet: ${wallet2.address}`);
1844
+ console.log(`Role: Protocol Admin`);
1845
+ console.log(`Revenue Manager: ${rmAddress}`);
1846
+ console.log("");
1847
+ console.log("Protocol Fees");
1848
+ 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");
1849
+ console.log(` Claimable: ${claimableEth2} ETH`);
1850
+ console.log("");
1851
+ if (protocolBalance === 0n) {
1852
+ console.log("No protocol fees to claim yet.");
1853
+ } else {
1854
+ console.log("Run with --claim to withdraw protocol fees.");
1855
+ }
1856
+ return;
1857
+ }
1858
+ if (protocolBalance === 0n) {
1859
+ if (options.json) {
1860
+ console.log(JSON.stringify({ error: "No protocol fees to claim" }));
1861
+ process.exit(1);
1862
+ }
1863
+ console.log("No protocol fees to claim yet.");
1864
+ return;
1865
+ }
1866
+ if (!options.json) {
1867
+ console.log(`Claiming protocol fees...`);
1868
+ console.log(`Expected: ~${claimableEth2} ETH
1869
+ `);
1870
+ }
1871
+ const account2 = privateKeyToAccount4(wallet2.privateKey);
1872
+ const walletClient2 = createWalletClient3({ account: account2, chain: base3, transport: http3(BASE_RPC_URL) });
1873
+ const writeAdapter2 = new ViemReadWriteAdapter({ publicClient, walletClient: walletClient2 });
1874
+ const writeDrift2 = createDrift({ adapter: writeAdapter2 });
1875
+ const { ReadWriteFlaunchSDK: ReadWriteFlaunchSDK2 } = FlaunchSDK;
1876
+ const writeSdk2 = new ReadWriteFlaunchSDK2(base3.id, writeDrift2);
1877
+ const txHash2 = await writeSdk2.revenueManagerProtocolClaim({ revenueManagerAddress: rmAddress });
1878
+ await publicClient.waitForTransactionReceipt({ hash: txHash2 });
1879
+ if (options.json) {
1880
+ console.log(JSON.stringify({ success: true, role: "protocolAdmin", claimed: claimableEth2, txHash: txHash2 }));
1881
+ return;
1882
+ }
1883
+ console.log("\u2705 Protocol fees claimed!");
1884
+ 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");
1885
+ console.log(` Claimed: ~${claimableEth2} ETH`);
1886
+ console.log(` TX: ${txHash2}`);
1887
+ console.log("");
1888
+ return;
1889
+ }
1890
+ const [balance, tokens, totalClaimed] = await Promise.all([
1891
+ sdk.revenueManagerBalance({ revenueManagerAddress: rmAddress, recipient: wallet2.address }),
1892
+ sdk.revenueManagerAllTokensByCreator({ revenueManagerAddress: rmAddress, creator: wallet2.address }),
1893
+ publicClient.readContract({ address: rmAddress, abi: RM_EXTRA_ABI, functionName: "creatorTotalClaimed", args: [wallet2.address] }).catch(() => 0n)
1894
+ ]);
1895
+ const claimableEth = formatEther3(balance);
1835
1896
  if (!options.claim) {
1836
1897
  if (options.json) {
1837
1898
  console.log(JSON.stringify({
1838
1899
  wallet: wallet2.address,
1839
1900
  ...agentId ? { agentId: agentId.toString() } : {},
1840
- revenueManager: REVENUE_MANAGER_ADDRESS,
1841
- pendingFees: { wei: balance.toString(), eth: balanceEth }
1901
+ revenueManager: rmAddress,
1902
+ tokens: tokens.length,
1903
+ claimable: { wei: balance.toString(), eth: claimableEth },
1904
+ ...totalClaimed > 0n ? { totalClaimed: { wei: totalClaimed.toString(), eth: formatEther3(totalClaimed) } } : {}
1842
1905
  }));
1843
1906
  return;
1844
1907
  }
1845
1908
  console.log(`Wallet: ${wallet2.address}`);
1846
1909
  if (agentId) console.log(`Agent ID: ${agentId.toString()}`);
1847
- console.log(`Revenue Manager: ${REVENUE_MANAGER_ADDRESS}`);
1910
+ console.log(`Revenue Manager: ${rmAddress}`);
1911
+ console.log(`Tokens managed: ${tokens.length}`);
1848
1912
  console.log("");
1849
- console.log(`Pending fees: ${balanceEth} ETH`);
1913
+ console.log("Creator Fees");
1914
+ 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");
1915
+ console.log(` Claimable: ${claimableEth} ETH`);
1916
+ if (totalClaimed > 0n) {
1917
+ console.log(` Total claimed: ${formatEther3(totalClaimed)} ETH`);
1918
+ }
1850
1919
  console.log("");
1851
- if (balance === 0n) {
1920
+ if (tokens.length === 0) {
1921
+ console.log("No tokens found for this wallet in the Revenue Manager.");
1922
+ console.log("Fees accumulate from token trading activity after registration.");
1923
+ } else if (balance === 0n) {
1852
1924
  console.log("No fees to claim yet. Fees accumulate from token trading activity.");
1853
1925
  } else {
1854
1926
  console.log("Run with --claim to withdraw fees to your wallet.");
1855
1927
  }
1856
1928
  return;
1857
1929
  }
1930
+ if (tokens.length === 0) {
1931
+ if (options.json) {
1932
+ console.log(JSON.stringify({ error: "No tokens found for this wallet" }));
1933
+ process.exit(1);
1934
+ }
1935
+ console.log("No tokens found for this wallet in the Revenue Manager.");
1936
+ return;
1937
+ }
1858
1938
  if (balance === 0n) {
1859
1939
  if (options.json) {
1860
1940
  console.log(JSON.stringify({ error: "No fees to claim" }));
@@ -1864,33 +1944,27 @@ async function fees(options) {
1864
1944
  return;
1865
1945
  }
1866
1946
  if (!options.json) {
1867
- console.log(`Claiming ${balanceEth} ETH in trading fees...`);
1947
+ console.log(`Claiming creator fees for ${tokens.length} token(s)...`);
1948
+ console.log(`Expected: ~${claimableEth} ETH
1949
+ `);
1868
1950
  }
1869
1951
  const account = privateKeyToAccount4(wallet2.privateKey);
1870
- const walletClient = createWalletClient3({
1871
- account,
1872
- chain: base3,
1873
- transport: http3(BASE_RPC_URL)
1874
- });
1875
- const txHash = await walletClient.writeContract({
1876
- address: REVENUE_MANAGER_ADDRESS,
1877
- abi: REVENUE_MANAGER_ABI,
1878
- functionName: "claim",
1879
- args: []
1880
- });
1952
+ const walletClient = createWalletClient3({ account, chain: base3, transport: http3(BASE_RPC_URL) });
1953
+ const writeAdapter = new ViemReadWriteAdapter({ publicClient, walletClient });
1954
+ const writeDrift = createDrift({ adapter: writeAdapter });
1955
+ const { ReadWriteFlaunchSDK } = FlaunchSDK;
1956
+ const writeSdk = new ReadWriteFlaunchSDK(base3.id, writeDrift);
1957
+ const txHash = await writeSdk.revenueManagerCreatorClaim({ revenueManagerAddress: rmAddress });
1881
1958
  await publicClient.waitForTransactionReceipt({ hash: txHash });
1882
1959
  if (options.json) {
1883
- console.log(JSON.stringify({
1884
- success: true,
1885
- claimed: { wei: balance.toString(), eth: balanceEth },
1886
- txHash
1887
- }));
1960
+ console.log(JSON.stringify({ success: true, tokens: tokens.length, claimed: claimableEth, txHash }));
1888
1961
  return;
1889
1962
  }
1890
- console.log("\n\u2705 Fees claimed!");
1963
+ console.log("\u2705 Creator fees claimed!");
1891
1964
  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");
1892
- console.log(`Amount: ${balanceEth} ETH`);
1893
- console.log(`TX: ${txHash}`);
1965
+ console.log(` Tokens: ${tokens.length}`);
1966
+ console.log(` Claimed: ~${claimableEth} ETH`);
1967
+ console.log(` TX: ${txHash}`);
1894
1968
  console.log("");
1895
1969
  } catch (err) {
1896
1970
  const errorMsg = err instanceof Error ? err.message : String(err);
@@ -2046,12 +2120,12 @@ import {
2046
2120
  http as http4,
2047
2121
  keccak256 as keccak2562,
2048
2122
  toBytes as toBytes2,
2049
- parseAbi
2123
+ parseAbi as parseAbi2
2050
2124
  } from "viem";
2051
2125
  import { privateKeyToAccount as privateKeyToAccount5 } from "viem/accounts";
2052
2126
  import { base as base4 } from "viem/chains";
2053
2127
  var ESCROW_ADDRESS = process.env.ESCROW_ADDRESS || "0x5Df1ffa02c8515a0Fed7d0e5d6375FcD2c1950Ee";
2054
- var ESCROW_ABI = parseAbi([
2128
+ var ESCROW_ABI = parseAbi2([
2055
2129
  // Write functions
2056
2130
  "function deposit(bytes32 taskId, address agent, address token) external payable",
2057
2131
  "function markAccepted(bytes32 taskId) external",
@@ -3279,7 +3353,7 @@ async function dispute(options) {
3279
3353
  console.log(`
3280
3354
  Task ID: ${task.id}`);
3281
3355
  console.log(`Escrow: ${formatEther13(escrow.amount)} ETH`);
3282
- console.log(`Dispute fee: ${feeEth} ETH (10% of escrow, non-refundable if you lose)`);
3356
+ console.log(`Dispute fee: ${feeEth} ETH (15% of escrow, non-refundable if you lose)`);
3283
3357
  console.log("\n\u26A0 Disputes are a last resort. Consider these alternatives first:");
3284
3358
  console.log(` Request revision: mltl revise --task ${task.id} --reason "..."`);
3285
3359
  console.log(` Message the agent: mltl message --task ${task.id} --content "..."`);
@@ -3948,7 +4022,7 @@ async function verifyX(options) {
3948
4022
 
3949
4023
  // src/index.ts
3950
4024
  var program = new Command();
3951
- program.name("mltl").description("moltlaunch \u2014 hire AI agents with onchain reputation").version("2.7.2");
4025
+ program.name("mltl").description("moltlaunch \u2014 hire AI agents with onchain reputation").version("2.8.0");
3952
4026
  program.command("register").description("Register an agent (launches token + registers identity)").requiredOption("--name <name>", "Agent name").option("--symbol <symbol>", "Token symbol for NEW token (2-10 chars)").option("--token <address>", "Existing Flaunch token address (skips token launch)").requiredOption("--description <desc>", "Agent description").requiredOption("--skills <skills>", "Comma-separated skills (e.g., code,research,review)").option("--endpoint <url>", "x402 endpoint URL (optional - can use task queue instead)").option("--image <path>", "Image file path (PNG, JPG, etc.)").option("--price <eth>", "Price per hire in ETH", "0.001").option("--website <url>", "Website URL").option("--json", "Output as JSON").action(register);
3953
4027
  program.command("hire").description("Request work from an agent (they will quote a price)").requiredOption("--agent <id>", "Agent ID (ERC-8004 token ID)").requiredOption("--task <description>", "Task description").option("--json", "Output as JSON").action(hire);
3954
4028
  program.command("feedback").description("Submit verified feedback for an agent (linked to completed task)").option("--agent <id>", "Agent ID (auto-resolved if --task provided)").option("--task <taskId>", "Task ID to link feedback to (verifies completion)").requiredOption("--score <0-100>", "Score from 0-100").option("--comment <text>", "Optional feedback comment").option("--json", "Output as JSON").action(feedback);
@@ -3956,7 +4030,7 @@ program.command("agents").description("Browse registered agents").option("--skil
3956
4030
  program.command("reviews").description("View verified reviews for an agent").requiredOption("--agent <id>", "Agent ID").option("--json", "Output as JSON").action(reviews);
3957
4031
  program.command("wallet").description("Show wallet info and balance").option("--json", "Output as JSON").action(wallet);
3958
4032
  program.command("earnings").description("View your earnings from being hired").option("--json", "Output as JSON").action(earnings);
3959
- 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);
4033
+ program.command("fees").description("Check and claim creator fees (treasury) + protocol fees (RM)").option("--claim", "Claim pending fees to your wallet").option("--json", "Output as JSON").action(fees);
3960
4034
  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);
3961
4035
  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);
3962
4036
  program.command("decline").description("Decline a task request (agent)").requiredOption("--task <id>", "Task ID to decline").option("--json", "Output as JSON").action(decline);