@otonix/cli 2.1.6 → 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.
- package/dist/commands/agent.js +43 -21
- package/dist/commands/launch.js +24 -4
- package/package.json +1 -1
package/dist/commands/agent.js
CHANGED
|
@@ -18,8 +18,17 @@ export function agentCommand(program) {
|
|
|
18
18
|
}
|
|
19
19
|
const cfg = loadConfig();
|
|
20
20
|
if (!cfg.wallet) {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const autoSpinner = ora("No creator wallet found — generating one automatically...").start();
|
|
22
|
+
await new Promise(r => setTimeout(r, 400));
|
|
23
|
+
const creator = generateWallet();
|
|
24
|
+
autoSpinner.stop();
|
|
25
|
+
cfg.wallet = { address: creator.address, privateKey: creator.privateKey };
|
|
26
|
+
saveConfig(cfg);
|
|
27
|
+
success("Creator wallet generated!");
|
|
28
|
+
br();
|
|
29
|
+
console.log(chalk.dim(" Creator wallet address: ") + chalk.bold.white(creator.address));
|
|
30
|
+
console.log(chalk.dim(" Fund this address with ≥ 200 $OTX + ≥ 0.005 ETH (Base)"));
|
|
31
|
+
br();
|
|
23
32
|
}
|
|
24
33
|
if (cfg.agents[name]) {
|
|
25
34
|
const overwrite = await confirm({
|
|
@@ -88,13 +97,15 @@ export function agentCommand(program) {
|
|
|
88
97
|
failure("No creator wallet found. Run: otonix wallet generate");
|
|
89
98
|
process.exit(1);
|
|
90
99
|
}
|
|
91
|
-
const balSpinner = ora("Checking
|
|
92
|
-
let
|
|
93
|
-
let
|
|
100
|
+
const balSpinner = ora("Checking balances...").start();
|
|
101
|
+
let creatorOtx, creatorEth;
|
|
102
|
+
let agentOtx, agentEth;
|
|
94
103
|
try {
|
|
95
|
-
[
|
|
104
|
+
[creatorOtx, creatorEth, agentOtx, agentEth] = await Promise.all([
|
|
96
105
|
getOtxBalance(cfg.wallet.address),
|
|
97
106
|
getEthBalance(cfg.wallet.address),
|
|
107
|
+
getOtxBalance(agent.address),
|
|
108
|
+
getEthBalance(agent.address),
|
|
98
109
|
]);
|
|
99
110
|
}
|
|
100
111
|
catch {
|
|
@@ -103,35 +114,46 @@ export function agentCommand(program) {
|
|
|
103
114
|
process.exit(1);
|
|
104
115
|
}
|
|
105
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";
|
|
106
122
|
br();
|
|
107
|
-
|
|
108
|
-
row("$OTX
|
|
109
|
-
row("ETH
|
|
110
|
-
|
|
111
|
-
|
|
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(" ✗")));
|
|
112
130
|
br();
|
|
113
|
-
if (
|
|
114
|
-
failure(
|
|
115
|
-
info("
|
|
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");
|
|
116
135
|
process.exit(1);
|
|
117
136
|
}
|
|
118
|
-
if (
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
process.exit(1);
|
|
137
|
+
if (!creatorOk && agentOk) {
|
|
138
|
+
console.log(chalk.yellow("⚠ ") + chalk.dim("Creator wallet insufficient — using agent wallet instead."));
|
|
139
|
+
br();
|
|
122
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();
|
|
123
145
|
const confirmed = await confirm({
|
|
124
|
-
message: `Send 200 $OTX from
|
|
146
|
+
message: `Send 200 $OTX from ${payerLabel} to Otonix treasury to activate "${opts.name}"?`,
|
|
125
147
|
default: true,
|
|
126
148
|
});
|
|
127
149
|
if (!confirmed) {
|
|
128
150
|
info("Cancelled.");
|
|
129
151
|
return;
|
|
130
152
|
}
|
|
131
|
-
const sendSpinner = ora(
|
|
153
|
+
const sendSpinner = ora(`Sending 200 $OTX from ${payerLabel}...`).start();
|
|
132
154
|
let txHash;
|
|
133
155
|
try {
|
|
134
|
-
txHash = await sendOtx(
|
|
156
|
+
txHash = await sendOtx(payerKey, OTONIX_TREASURY, OTX_REQUIRED);
|
|
135
157
|
}
|
|
136
158
|
catch (err) {
|
|
137
159
|
sendSpinner.stop();
|
package/dist/commands/launch.js
CHANGED
|
@@ -33,10 +33,8 @@ export function launchCommand(program) {
|
|
|
33
33
|
if (!agent.registered) {
|
|
34
34
|
br();
|
|
35
35
|
failure(`Agent "${opts.agent}" is not registered.`);
|
|
36
|
-
console.log(chalk.dim("
|
|
37
|
-
console.log(" " + chalk.
|
|
38
|
-
console.log(chalk.dim(" Then submit the tx hash to activate:"));
|
|
39
|
-
console.log(" " + chalk.cyan(`otonix agent:register --name ${opts.agent} --tx <txhash>`));
|
|
36
|
+
console.log(chalk.dim(" Activate it first:"));
|
|
37
|
+
console.log(" " + chalk.cyan(`otonix agent:register --name ${opts.agent}`));
|
|
40
38
|
process.exit(1);
|
|
41
39
|
}
|
|
42
40
|
const devBuyEth = parseFloat(opts.devbuy) || 0;
|
|
@@ -173,6 +171,28 @@ export function launchCommand(program) {
|
|
|
173
171
|
const waitResult = await result.waitForTransaction();
|
|
174
172
|
const tokenAddress = waitResult.address;
|
|
175
173
|
deploySpinner.stop();
|
|
174
|
+
if (tokenAddress) {
|
|
175
|
+
try {
|
|
176
|
+
await fetch("https://otonix.tech/api/launch/register", {
|
|
177
|
+
method: "POST",
|
|
178
|
+
headers: { "Content-Type": "application/json" },
|
|
179
|
+
body: JSON.stringify({
|
|
180
|
+
name: opts.name,
|
|
181
|
+
symbol: opts.ticker.toUpperCase(),
|
|
182
|
+
ca: tokenAddress,
|
|
183
|
+
txHash,
|
|
184
|
+
agentName: opts.agent,
|
|
185
|
+
agentAddress: agent.address,
|
|
186
|
+
creatorAddress: cfg.wallet.address,
|
|
187
|
+
imgUrl: opts.image ?? null,
|
|
188
|
+
description: opts.description ?? null,
|
|
189
|
+
}),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
/* non-fatal — token still deployed */
|
|
194
|
+
}
|
|
195
|
+
}
|
|
176
196
|
br();
|
|
177
197
|
console.log(chalk.bold.hex("#3d9eff")("◈ Token deployed — Verified by Otonix ✓"));
|
|
178
198
|
console.log(chalk.dim("─".repeat(44)));
|