moltlaunch 2.11.0 → 2.13.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/dist/index.js CHANGED
@@ -99,6 +99,10 @@ function getWalletDir() {
99
99
  return join(homedir(), WALLET_DIR);
100
100
  }
101
101
  function getWalletPath() {
102
+ const profile2 = process.env.MLTL_WALLET;
103
+ if (profile2) {
104
+ return join(getWalletDir(), `wallet-${profile2}.json`);
105
+ }
102
106
  return join(getWalletDir(), WALLET_FILE);
103
107
  }
104
108
  async function fileExists(path) {
@@ -865,19 +869,6 @@ async function register(options) {
865
869
  \u2728 Created wallet: ${wallet2.address}`);
866
870
  }
867
871
  const balance = await getWalletBalance(wallet2.address);
868
- const balanceWei = parseEther(balance);
869
- if (balanceWei === 0n) {
870
- if (options.json) {
871
- console.log(JSON.stringify({
872
- error: "Wallet has no ETH. Fund it first.",
873
- wallet: wallet2.address
874
- }));
875
- process.exit(1);
876
- }
877
- console.error(`
878
- \u274C Wallet has no ETH. Send ETH on Base to: ${wallet2.address}`);
879
- process.exit(1);
880
- }
881
872
  const hasExistingToken = options.token && /^0x[a-fA-F0-9]{40}$/.test(options.token);
882
873
  if (options.symbol && (options.symbol.length < 2 || options.symbol.length > 10)) {
883
874
  if (options.json) {
@@ -2458,11 +2449,24 @@ This will deposit ${priceEth} ETH into escrow.`);
2458
2449
  console.log(agent.flaunchToken ? " - Approve submitted work: funds buy back & burn agent's token" : " - Approve submitted work: funds released directly to agent");
2459
2450
  console.log(" - Cancel before submission: 10% fee to agent, 90% refunded");
2460
2451
  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");
2461
- console.log("\nDepositing funds into escrow...");
2452
+ console.log("\nChecking escrow status...");
2453
+ }
2454
+ const existingEscrow = await getEscrowDetails(taskBefore.id);
2455
+ let escrowTxHash;
2456
+ if (existingEscrow && existingEscrow.amount > 0n) {
2457
+ if (!options.json) {
2458
+ console.log("Escrow already funded on-chain \u2014 syncing off-chain status...");
2459
+ }
2460
+ } else {
2461
+ if (!options.json) {
2462
+ console.log("Depositing funds into escrow...");
2463
+ }
2464
+ escrowTxHash = await depositEscrow(wallet2, taskBefore.id, agentOwner, agentToken, priceWei);
2465
+ if (!options.json) {
2466
+ console.log(`Escrow TX: ${escrowTxHash}`);
2467
+ }
2462
2468
  }
2463
- const escrowTxHash = await depositEscrow(wallet2, taskBefore.id, agentOwner, agentToken, priceWei);
2464
2469
  if (!options.json) {
2465
- console.log(`Escrow TX: ${escrowTxHash}`);
2466
2470
  console.log("Marking task as accepted...");
2467
2471
  }
2468
2472
  const task = await acceptQuote(wallet2, options.task);