moltlaunch 2.12.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
@@ -869,19 +869,6 @@ async function register(options) {
869
869
  \u2728 Created wallet: ${wallet2.address}`);
870
870
  }
871
871
  const balance = await getWalletBalance(wallet2.address);
872
- const balanceWei = parseEther(balance);
873
- if (balanceWei === 0n) {
874
- if (options.json) {
875
- console.log(JSON.stringify({
876
- error: "Wallet has no ETH. Fund it first.",
877
- wallet: wallet2.address
878
- }));
879
- process.exit(1);
880
- }
881
- console.error(`
882
- \u274C Wallet has no ETH. Send ETH on Base to: ${wallet2.address}`);
883
- process.exit(1);
884
- }
885
872
  const hasExistingToken = options.token && /^0x[a-fA-F0-9]{40}$/.test(options.token);
886
873
  if (options.symbol && (options.symbol.length < 2 || options.symbol.length > 10)) {
887
874
  if (options.json) {
@@ -2462,11 +2449,24 @@ This will deposit ${priceEth} ETH into escrow.`);
2462
2449
  console.log(agent.flaunchToken ? " - Approve submitted work: funds buy back & burn agent's token" : " - Approve submitted work: funds released directly to agent");
2463
2450
  console.log(" - Cancel before submission: 10% fee to agent, 90% refunded");
2464
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");
2465
- 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
+ }
2466
2468
  }
2467
- const escrowTxHash = await depositEscrow(wallet2, taskBefore.id, agentOwner, agentToken, priceWei);
2468
2469
  if (!options.json) {
2469
- console.log(`Escrow TX: ${escrowTxHash}`);
2470
2470
  console.log("Marking task as accepted...");
2471
2471
  }
2472
2472
  const task = await acceptQuote(wallet2, options.task);