@otonix/cli 2.1.7 → 2.1.8

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.
@@ -97,13 +97,15 @@ export function agentCommand(program) {
97
97
  failure("No creator wallet found. Run: otonix wallet generate");
98
98
  process.exit(1);
99
99
  }
100
- const balSpinner = ora("Checking creator wallet balance...").start();
101
- let otxBal;
102
- let ethBal;
100
+ const balSpinner = ora("Checking balances...").start();
101
+ let creatorOtx, creatorEth;
102
+ let agentOtx, agentEth;
103
103
  try {
104
- [otxBal, ethBal] = await Promise.all([
104
+ [creatorOtx, creatorEth, agentOtx, agentEth] = await Promise.all([
105
105
  getOtxBalance(cfg.wallet.address),
106
106
  getEthBalance(cfg.wallet.address),
107
+ getOtxBalance(agent.address),
108
+ getEthBalance(agent.address),
107
109
  ]);
108
110
  }
109
111
  catch {
@@ -112,35 +114,46 @@ export function agentCommand(program) {
112
114
  process.exit(1);
113
115
  }
114
116
  balSpinner.stop();
117
+ const creatorOk = creatorOtx >= OTX_REQUIRED && parseFloat(creatorEth) >= 0.0001;
118
+ const agentOk = agentOtx >= OTX_REQUIRED && parseFloat(agentEth) >= 0.0001;
119
+ const payerKey = creatorOk ? cfg.wallet.privateKey : agent.privateKey;
120
+ const payerAddress = creatorOk ? cfg.wallet.address : agent.address;
121
+ const payerLabel = creatorOk ? "creator wallet" : "agent wallet";
115
122
  br();
116
- row("Creator wallet", cfg.wallet.address);
117
- row("$OTX balance", formatOtx(otxBal) + " OTX");
118
- row("ETH balance", parseFloat(ethBal).toFixed(6) + " ETH (for gas)");
119
- row("Registration fee", "200 $OTX → Otonix treasury");
120
- row("Treasury", OTONIX_TREASURY);
123
+ console.log(chalk.dim(" Creator wallet ") + chalk.white(cfg.wallet.address));
124
+ row(" $OTX", formatOtx(creatorOtx) + " OTX" + (creatorOtx >= OTX_REQUIRED ? chalk.green(" ✓") : chalk.yellow(" ✗")));
125
+ row(" ETH", parseFloat(creatorEth).toFixed(6) + " ETH" + (parseFloat(creatorEth) >= 0.0001 ? chalk.green(" ✓") : chalk.yellow(" ✗")));
126
+ br();
127
+ console.log(chalk.dim(" Agent wallet ") + chalk.white(agent.address));
128
+ row(" $OTX", formatOtx(agentOtx) + " OTX" + (agentOtx >= OTX_REQUIRED ? chalk.green(" ✓") : chalk.yellow(" ✗")));
129
+ row(" ETH", parseFloat(agentEth).toFixed(6) + " ETH" + (parseFloat(agentEth) >= 0.0001 ? chalk.green(" ✓") : chalk.yellow(" ✗")));
121
130
  br();
122
- if (otxBal < OTX_REQUIRED) {
123
- failure(`Insufficient $OTX. Need 200.000, have ${formatOtx(otxBal)}.`);
124
- info("Buy $OTX at: https://dexscreener.com/base/0xF7E2a6226Ffe0693DD85406AC3A8917cbea5DC40");
131
+ if (!creatorOk && !agentOk) {
132
+ failure("Neither creator nor agent wallet has enough $OTX + ETH.");
133
+ info("Need ≥ 200 $OTX + ≥ 0.0001 ETH in either wallet.");
134
+ info("Buy $OTX: https://dexscreener.com/base/0xF7E2a6226Ffe0693DD85406AC3A8917cbea5DC40");
125
135
  process.exit(1);
126
136
  }
127
- if (parseFloat(ethBal) < 0.0001) {
128
- failure("Insufficient ETH for gas. Send a small amount of ETH (Base) to your creator wallet.");
129
- info("Creator wallet: " + cfg.wallet.address);
130
- process.exit(1);
137
+ if (!creatorOk && agentOk) {
138
+ console.log(chalk.yellow(" ") + chalk.dim("Creator wallet insufficient using agent wallet instead."));
139
+ br();
131
140
  }
141
+ row("Paying from", payerLabel + " (" + payerAddress.slice(0, 10) + "...)");
142
+ row("Registration fee", "200 $OTX → Otonix treasury");
143
+ row("Treasury", OTONIX_TREASURY);
144
+ br();
132
145
  const confirmed = await confirm({
133
- message: `Send 200 $OTX from your creator wallet to Otonix treasury to activate "${opts.name}"?`,
146
+ message: `Send 200 $OTX from ${payerLabel} to Otonix treasury to activate "${opts.name}"?`,
134
147
  default: true,
135
148
  });
136
149
  if (!confirmed) {
137
150
  info("Cancelled.");
138
151
  return;
139
152
  }
140
- const sendSpinner = ora("Sending 200 $OTX to Otonix treasury...").start();
153
+ const sendSpinner = ora(`Sending 200 $OTX from ${payerLabel}...`).start();
141
154
  let txHash;
142
155
  try {
143
- txHash = await sendOtx(cfg.wallet.privateKey, OTONIX_TREASURY, OTX_REQUIRED);
156
+ txHash = await sendOtx(payerKey, OTONIX_TREASURY, OTX_REQUIRED);
144
157
  }
145
158
  catch (err) {
146
159
  sendSpinner.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@otonix/cli",
3
- "version": "2.1.7",
3
+ "version": "2.1.8",
4
4
  "description": "Otonix CLI — deploy autonomous agent tokens on Base via Clanker v4",
5
5
  "type": "module",
6
6
  "bin": {