@bountyagents/bountyagents-task 2026.3.116 → 2026.3.118
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 +47 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55894,6 +55894,16 @@ function registerWorkerTools(api3) {
|
|
|
55894
55894
|
|
|
55895
55895
|
// index.ts
|
|
55896
55896
|
import * as fs2 from "fs";
|
|
55897
|
+
import * as readline from "readline";
|
|
55898
|
+
function question(prompt) {
|
|
55899
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
55900
|
+
return new Promise((resolve) => {
|
|
55901
|
+
rl.question(prompt, (answer) => {
|
|
55902
|
+
rl.close();
|
|
55903
|
+
resolve(answer.trim());
|
|
55904
|
+
});
|
|
55905
|
+
});
|
|
55906
|
+
}
|
|
55897
55907
|
function register(api3) {
|
|
55898
55908
|
api3.registerCommand({
|
|
55899
55909
|
name: "mycustomcommand",
|
|
@@ -55906,55 +55916,64 @@ function register(api3) {
|
|
|
55906
55916
|
}
|
|
55907
55917
|
});
|
|
55908
55918
|
api3.registerCli(({ program }) => {
|
|
55909
|
-
program.command("upclaw").description("UpClaw Bounty Agents CLI").argument("[action]", "action: status, init, reset, etc.", "status").option("-v, --verbose", "verbose output").action((action, options) => {
|
|
55910
|
-
console.log("Action:", action);
|
|
55919
|
+
program.command("upclaw").description("UpClaw Bounty Agents CLI").argument("[action]", "action: status, init, reset, etc.", "status").option("-v, --verbose", "verbose output").action(async (action, options) => {
|
|
55911
55920
|
if (options.verbose)
|
|
55912
55921
|
console.log("Verbose mode");
|
|
55913
55922
|
if (action === "status") {
|
|
55914
55923
|
const address = getWalletAddress();
|
|
55915
55924
|
if (!address) {
|
|
55916
|
-
|
|
55917
|
-
|
|
55918
|
-
});
|
|
55925
|
+
console.log("Status: Wallet not initialized, run `openclaw upclaw init` to initialize");
|
|
55926
|
+
return;
|
|
55919
55927
|
}
|
|
55920
|
-
|
|
55921
|
-
|
|
55922
|
-
|
|
55923
|
-
});
|
|
55928
|
+
console.log("Status: Wallet initialized");
|
|
55929
|
+
console.log("Wallet Address:", address);
|
|
55930
|
+
return;
|
|
55924
55931
|
}
|
|
55925
55932
|
if (action === "init") {
|
|
55926
55933
|
try {
|
|
55927
|
-
if (
|
|
55934
|
+
if (fs2.existsSync(KEY_PATH)) {
|
|
55935
|
+
console.log(`EVM private key already exists at ${KEY_PATH}. Run 'openclaw upclaw reset' first to use a different key.`);
|
|
55936
|
+
return;
|
|
55937
|
+
}
|
|
55938
|
+
console.log("");
|
|
55939
|
+
console.log(" 1) Generate a new random private key");
|
|
55940
|
+
console.log(" 2) Enter an existing private key to store");
|
|
55941
|
+
console.log("");
|
|
55942
|
+
const choice = await question("Choose 1 or 2: ");
|
|
55943
|
+
if (choice === "1") {
|
|
55928
55944
|
const pk = generatePrivateKey();
|
|
55929
55945
|
fs2.writeFileSync(KEY_PATH, pk, "utf-8");
|
|
55930
|
-
|
|
55931
|
-
|
|
55932
|
-
|
|
55933
|
-
|
|
55934
|
-
return json({
|
|
55935
|
-
text: `EVM private key already exists at ${KEY_PATH}, if you want to use a different key, run 'openclaw upclaw reset' first to initialize a new key`
|
|
55936
|
-
});
|
|
55946
|
+
const address = privateKeyToAccount(pk).address;
|
|
55947
|
+
console.log(`Initialized new EVM private key and saved to ${KEY_PATH}`);
|
|
55948
|
+
console.log("Wallet Address:", address);
|
|
55949
|
+
return;
|
|
55937
55950
|
}
|
|
55951
|
+
if (choice === "2") {
|
|
55952
|
+
const raw = await question("Enter private key (hex, with or without 0x): ");
|
|
55953
|
+
const key = raw.startsWith("0x") ? raw : `0x${raw}`;
|
|
55954
|
+
privateKeyToAccount(key);
|
|
55955
|
+
fs2.writeFileSync(KEY_PATH, key, "utf-8");
|
|
55956
|
+
const address = privateKeyToAccount(key).address;
|
|
55957
|
+
console.log(`Stored existing private key at ${KEY_PATH}`);
|
|
55958
|
+
console.log("Wallet Address:", address);
|
|
55959
|
+
return;
|
|
55960
|
+
}
|
|
55961
|
+
console.error("Invalid choice. Enter 1 or 2.");
|
|
55938
55962
|
} catch (error48) {
|
|
55939
|
-
|
|
55940
|
-
|
|
55941
|
-
error: error48.message
|
|
55942
|
-
});
|
|
55963
|
+
console.error("Failed to initialize key:", error48.message);
|
|
55964
|
+
return;
|
|
55943
55965
|
}
|
|
55944
55966
|
}
|
|
55945
55967
|
if (action === "reset") {
|
|
55946
55968
|
try {
|
|
55947
55969
|
if (fs2.existsSync(KEY_PATH)) {
|
|
55948
55970
|
fs2.unlinkSync(KEY_PATH);
|
|
55949
|
-
|
|
55950
|
-
|
|
55951
|
-
});
|
|
55971
|
+
console.log(`Reset EVM private key and deleted ${KEY_PATH}`);
|
|
55972
|
+
return;
|
|
55952
55973
|
}
|
|
55953
55974
|
} catch (error48) {
|
|
55954
|
-
|
|
55955
|
-
|
|
55956
|
-
error: error48.message
|
|
55957
|
-
});
|
|
55975
|
+
console.error("Failed to reset key:", error48.message);
|
|
55976
|
+
return;
|
|
55958
55977
|
}
|
|
55959
55978
|
}
|
|
55960
55979
|
});
|