arc402-cli 1.0.0-rc.1 → 1.1.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/README.md +43 -2
- package/dist/abis.d.ts +1 -0
- package/dist/abis.d.ts.map +1 -1
- package/dist/abis.js +29 -1
- package/dist/abis.js.map +1 -1
- package/dist/commands/backup.d.ts +3 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +106 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/compute.d.ts +14 -0
- package/dist/commands/compute.d.ts.map +1 -0
- package/dist/commands/compute.js +466 -0
- package/dist/commands/compute.js.map +1 -0
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +11 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/daemon.d.ts.map +1 -1
- package/dist/commands/daemon.js +67 -0
- package/dist/commands/daemon.js.map +1 -1
- package/dist/commands/discover.d.ts.map +1 -1
- package/dist/commands/discover.js +60 -15
- package/dist/commands/discover.js.map +1 -1
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +205 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/tunnel.d.ts +3 -0
- package/dist/commands/tunnel.d.ts.map +1 -0
- package/dist/commands/tunnel.js +281 -0
- package/dist/commands/tunnel.js.map +1 -0
- package/dist/commands/wallet.d.ts.map +1 -1
- package/dist/commands/wallet.js +299 -65
- package/dist/commands/wallet.js.map +1 -1
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +146 -9
- package/dist/commands/watch.js.map +1 -1
- package/dist/commands/workroom.d.ts.map +1 -1
- package/dist/commands/workroom.js +112 -6
- package/dist/commands/workroom.js.map +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +41 -4
- package/dist/config.js.map +1 -1
- package/dist/daemon/compute-metering.d.ts +61 -0
- package/dist/daemon/compute-metering.d.ts.map +1 -0
- package/dist/daemon/compute-metering.js +299 -0
- package/dist/daemon/compute-metering.js.map +1 -0
- package/dist/daemon/compute-session.d.ts +100 -0
- package/dist/daemon/compute-session.d.ts.map +1 -0
- package/dist/daemon/compute-session.js +231 -0
- package/dist/daemon/compute-session.js.map +1 -0
- package/dist/daemon/config.d.ts +33 -1
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +69 -0
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/credentials.d.ts +24 -0
- package/dist/daemon/credentials.d.ts.map +1 -0
- package/dist/daemon/credentials.js +80 -0
- package/dist/daemon/credentials.js.map +1 -0
- package/dist/daemon/delivery-client.d.ts +35 -0
- package/dist/daemon/delivery-client.d.ts.map +1 -0
- package/dist/daemon/delivery-client.js +231 -0
- package/dist/daemon/delivery-client.js.map +1 -0
- package/dist/daemon/file-delivery.d.ts +98 -0
- package/dist/daemon/file-delivery.d.ts.map +1 -0
- package/dist/daemon/file-delivery.js +461 -0
- package/dist/daemon/file-delivery.js.map +1 -0
- package/dist/daemon/index.d.ts +1 -0
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +793 -227
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/notify.d.ts +35 -6
- package/dist/daemon/notify.d.ts.map +1 -1
- package/dist/daemon/notify.js +176 -48
- package/dist/daemon/notify.js.map +1 -1
- package/dist/daemon/worker-executor.d.ts +71 -0
- package/dist/daemon/worker-executor.d.ts.map +1 -0
- package/dist/daemon/worker-executor.js +382 -0
- package/dist/daemon/worker-executor.js.map +1 -0
- package/dist/drain-v4.js +2 -2
- package/dist/drain-v4.js.map +1 -1
- package/dist/endpoint-notify.d.ts +9 -1
- package/dist/endpoint-notify.d.ts.map +1 -1
- package/dist/endpoint-notify.js +116 -3
- package/dist/endpoint-notify.js.map +1 -1
- package/dist/index.js +81 -1
- package/dist/index.js.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +8 -0
- package/dist/program.js.map +1 -1
- package/dist/repl.d.ts.map +1 -1
- package/dist/repl.js +69 -486
- package/dist/repl.js.map +1 -1
- package/dist/tui/App.d.ts +12 -0
- package/dist/tui/App.d.ts.map +1 -0
- package/dist/tui/App.js +154 -0
- package/dist/tui/App.js.map +1 -0
- package/dist/tui/Footer.d.ts +11 -0
- package/dist/tui/Footer.d.ts.map +1 -0
- package/dist/tui/Footer.js +13 -0
- package/dist/tui/Footer.js.map +1 -0
- package/dist/tui/Header.d.ts +14 -0
- package/dist/tui/Header.d.ts.map +1 -0
- package/dist/tui/Header.js +19 -0
- package/dist/tui/Header.js.map +1 -0
- package/dist/tui/InputLine.d.ts +11 -0
- package/dist/tui/InputLine.d.ts.map +1 -0
- package/dist/tui/InputLine.js +145 -0
- package/dist/tui/InputLine.js.map +1 -0
- package/dist/tui/Viewport.d.ts +14 -0
- package/dist/tui/Viewport.d.ts.map +1 -0
- package/dist/tui/Viewport.js +48 -0
- package/dist/tui/Viewport.js.map +1 -0
- package/dist/tui/WalletConnectPairing.d.ts +23 -0
- package/dist/tui/WalletConnectPairing.d.ts.map +1 -0
- package/dist/tui/WalletConnectPairing.js +61 -0
- package/dist/tui/WalletConnectPairing.js.map +1 -0
- package/dist/tui/components/Button.d.ts +7 -0
- package/dist/tui/components/Button.d.ts.map +1 -0
- package/dist/tui/components/Button.js +21 -0
- package/dist/tui/components/Button.js.map +1 -0
- package/dist/tui/components/CeremonyView.d.ts +13 -0
- package/dist/tui/components/CeremonyView.d.ts.map +1 -0
- package/dist/tui/components/CeremonyView.js +10 -0
- package/dist/tui/components/CeremonyView.js.map +1 -0
- package/dist/tui/components/CompletionDropdown.d.ts +7 -0
- package/dist/tui/components/CompletionDropdown.d.ts.map +1 -0
- package/dist/tui/components/CompletionDropdown.js +23 -0
- package/dist/tui/components/CompletionDropdown.js.map +1 -0
- package/dist/tui/components/ConfirmPrompt.d.ts +9 -0
- package/dist/tui/components/ConfirmPrompt.d.ts.map +1 -0
- package/dist/tui/components/ConfirmPrompt.js +10 -0
- package/dist/tui/components/ConfirmPrompt.js.map +1 -0
- package/dist/tui/components/CustomTextInput.d.ts +15 -0
- package/dist/tui/components/CustomTextInput.d.ts.map +1 -0
- package/dist/tui/components/CustomTextInput.js +99 -0
- package/dist/tui/components/CustomTextInput.js.map +1 -0
- package/dist/tui/components/InteractiveTable.d.ts +14 -0
- package/dist/tui/components/InteractiveTable.d.ts.map +1 -0
- package/dist/tui/components/InteractiveTable.js +61 -0
- package/dist/tui/components/InteractiveTable.js.map +1 -0
- package/dist/tui/components/StepSpinner.d.ts +11 -0
- package/dist/tui/components/StepSpinner.d.ts.map +1 -0
- package/dist/tui/components/StepSpinner.js +32 -0
- package/dist/tui/components/StepSpinner.js.map +1 -0
- package/dist/tui/components/Toast.d.ts +18 -0
- package/dist/tui/components/Toast.d.ts.map +1 -0
- package/dist/tui/components/Toast.js +29 -0
- package/dist/tui/components/Toast.js.map +1 -0
- package/dist/tui/index.d.ts +2 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +55 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/useChat.d.ts +11 -0
- package/dist/tui/useChat.d.ts.map +1 -0
- package/dist/tui/useChat.js +91 -0
- package/dist/tui/useChat.js.map +1 -0
- package/dist/tui/useCommand.d.ts +12 -0
- package/dist/tui/useCommand.d.ts.map +1 -0
- package/dist/tui/useCommand.js +137 -0
- package/dist/tui/useCommand.js.map +1 -0
- package/dist/tui/useNotifications.d.ts +9 -0
- package/dist/tui/useNotifications.d.ts.map +1 -0
- package/dist/tui/useNotifications.js +17 -0
- package/dist/tui/useNotifications.js.map +1 -0
- package/dist/tui/useScroll.d.ts +17 -0
- package/dist/tui/useScroll.d.ts.map +1 -0
- package/dist/tui/useScroll.js +46 -0
- package/dist/tui/useScroll.js.map +1 -0
- package/dist/ui/format.d.ts.map +1 -1
- package/dist/ui/format.js +2 -0
- package/dist/ui/format.js.map +1 -1
- package/dist/ui/qr-render.d.ts +25 -0
- package/dist/ui/qr-render.d.ts.map +1 -0
- package/dist/ui/qr-render.js +90 -0
- package/dist/ui/qr-render.js.map +1 -0
- package/dist/ui/rpc-fallback.d.ts +11 -0
- package/dist/ui/rpc-fallback.d.ts.map +1 -0
- package/dist/ui/rpc-fallback.js +58 -0
- package/dist/ui/rpc-fallback.js.map +1 -0
- package/dist/walletconnect.d.ts +4 -0
- package/dist/walletconnect.d.ts.map +1 -1
- package/dist/walletconnect.js.map +1 -1
- package/package.json +11 -3
- package/scripts/authorize-machine-key.ts +0 -43
- package/scripts/drain-wallet.ts +0 -149
- package/scripts/execute-spend-only.ts +0 -81
- package/scripts/register-agent-userop.ts +0 -186
- package/src/abis.ts +0 -187
- package/src/bundler.ts +0 -235
- package/src/client.ts +0 -36
- package/src/coinbase-smart-wallet.ts +0 -51
- package/src/commands/accept.ts +0 -64
- package/src/commands/agent-handshake.ts +0 -72
- package/src/commands/agent.ts +0 -691
- package/src/commands/agreements.ts +0 -350
- package/src/commands/arbitrator.ts +0 -180
- package/src/commands/arena-handshake.ts +0 -257
- package/src/commands/arena.ts +0 -122
- package/src/commands/cancel.ts +0 -35
- package/src/commands/channel.ts +0 -218
- package/src/commands/coldstart.ts +0 -165
- package/src/commands/config.ts +0 -58
- package/src/commands/contract-interaction.ts +0 -166
- package/src/commands/daemon.ts +0 -978
- package/src/commands/deliver.ts +0 -148
- package/src/commands/discover.ts +0 -297
- package/src/commands/dispute.ts +0 -375
- package/src/commands/endpoint.ts +0 -620
- package/src/commands/feed.ts +0 -229
- package/src/commands/hire.ts +0 -245
- package/src/commands/migrate.ts +0 -177
- package/src/commands/negotiate.ts +0 -271
- package/src/commands/openshell.ts +0 -1055
- package/src/commands/owner.ts +0 -35
- package/src/commands/policy.ts +0 -263
- package/src/commands/relay.ts +0 -273
- package/src/commands/remediate.ts +0 -24
- package/src/commands/reputation.ts +0 -79
- package/src/commands/setup.ts +0 -343
- package/src/commands/trust.ts +0 -27
- package/src/commands/verify.ts +0 -91
- package/src/commands/wallet.ts +0 -3280
- package/src/commands/watch.ts +0 -23
- package/src/commands/watchtower.ts +0 -248
- package/src/commands/workroom.ts +0 -959
- package/src/config.ts +0 -174
- package/src/daemon/config.ts +0 -308
- package/src/daemon/hire-listener.ts +0 -226
- package/src/daemon/index.ts +0 -955
- package/src/daemon/job-lifecycle.ts +0 -215
- package/src/daemon/notify.ts +0 -157
- package/src/daemon/token-metering.ts +0 -183
- package/src/daemon/userops.ts +0 -119
- package/src/daemon/wallet-monitor.ts +0 -90
- package/src/drain-v4.ts +0 -159
- package/src/endpoint-config.ts +0 -83
- package/src/endpoint-notify.ts +0 -46
- package/src/index.ts +0 -26
- package/src/openshell-runtime.ts +0 -277
- package/src/program.ts +0 -83
- package/src/repl.ts +0 -680
- package/src/signing.ts +0 -28
- package/src/telegram-notify.ts +0 -88
- package/src/ui/banner.ts +0 -51
- package/src/ui/colors.ts +0 -30
- package/src/ui/format.ts +0 -77
- package/src/ui/spinner.ts +0 -56
- package/src/ui/tree.ts +0 -16
- package/src/utils/format.ts +0 -48
- package/src/utils/hash.ts +0 -5
- package/src/utils/time.ts +0 -15
- package/src/wallet-router.ts +0 -178
- package/src/walletconnect-session.ts +0 -27
- package/src/walletconnect.ts +0 -294
- package/test/time.test.js +0 -11
- package/tsconfig.json +0 -19
package/dist/walletconnect.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export type TelegramOpts = {
|
|
|
5
5
|
chatId: string;
|
|
6
6
|
threadId?: number;
|
|
7
7
|
};
|
|
8
|
+
export type WCCallbacks = {
|
|
9
|
+
onUri: (uri: string, links: Record<string, string>) => void;
|
|
10
|
+
onStatus: (status: "connecting" | "connected" | "chain-switching" | "ready" | "error", detail?: string) => void;
|
|
11
|
+
};
|
|
8
12
|
type SignClientT = Awaited<ReturnType<typeof SignClient.init>>;
|
|
9
13
|
type WCSession = ReturnType<SignClientT["session"]["get"]>;
|
|
10
14
|
/**
|
|
@@ -1 +1 @@
|
|
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AAO,EAAE,MAAM,EACf,MAAM,EAAE,YAAY,EACpB,IAAI,CAAC,EAAE;IAAE,YAAY,CAAC,EAAE,YAAY,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAC1E,OAAO,CAAC;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CA+HvE;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,SAAS,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,EAAE,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAC/C,OAAO,CAAC,MAAM,CAAC,CASjB;AAED;;;GAGG;AACH,wBAAsB,2BAA2B,CAC/C,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1E,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,YAAY,EAC3B,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAuE9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"walletconnect.js","sourceRoot":"","sources":["../src/walletconnect.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"walletconnect.js","sourceRoot":"","sources":["../src/walletconnect.ts"],"names":[],"mappings":";;;;;AA6DA,gDAoIC;AAMD,gEAe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B,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;IACvF,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "arc402-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "ARC-402 CLI for discovery, negotiation payloads, hire/remediation/dispute workflows, and network reads",
|
|
5
5
|
"bin": {
|
|
6
6
|
"arc402": "./dist/index.js"
|
|
7
7
|
},
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/",
|
|
11
|
+
"../workroom/credentials.template.toml"
|
|
12
|
+
],
|
|
9
13
|
"scripts": {
|
|
10
14
|
"build": "tsc",
|
|
11
15
|
"test": "node --test test/**/*.test.js"
|
|
12
16
|
},
|
|
13
17
|
"dependencies": {
|
|
14
|
-
"@arc402/sdk": "^0.
|
|
18
|
+
"@arc402/sdk": "^0.4.0",
|
|
15
19
|
"@coinbase/wallet-sdk": "^4.3.7",
|
|
16
20
|
"@types/better-sqlite3": "^7.6.13",
|
|
21
|
+
"@types/react": "^18.3.28",
|
|
17
22
|
"@walletconnect/keyvaluestorage": "^1.1.1",
|
|
18
23
|
"@walletconnect/sign-client": "^2.17.4",
|
|
19
24
|
"better-sqlite3": "^12.8.0",
|
|
@@ -21,10 +26,13 @@
|
|
|
21
26
|
"cli-table3": "^0.6.3",
|
|
22
27
|
"commander": "^12.1.0",
|
|
23
28
|
"ethers": "^6.13.4",
|
|
29
|
+
"ink": "^6.8.0",
|
|
30
|
+
"ink-text-input": "^4.0.3",
|
|
24
31
|
"jose": "^6.2.1",
|
|
25
32
|
"ora": "^8.1.1",
|
|
26
33
|
"prompts": "^2.4.2",
|
|
27
34
|
"qrcode-terminal": "^0.12.0",
|
|
35
|
+
"react": "^18.3.1",
|
|
28
36
|
"smol-toml": "^1.6.0",
|
|
29
37
|
"tweetnacl": "^1.0.3",
|
|
30
38
|
"yaml": "^2.8.2"
|
|
@@ -35,4 +43,4 @@
|
|
|
35
43
|
"@types/qrcode-terminal": "^0.12.2",
|
|
36
44
|
"typescript": "^5.4.5"
|
|
37
45
|
}
|
|
38
|
-
}
|
|
46
|
+
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ethers } from "ethers";
|
|
2
|
-
import { loadConfig } from "../src/config";
|
|
3
|
-
import { connectPhoneWallet, sendTransactionWithSession } from "../src/walletconnect";
|
|
4
|
-
|
|
5
|
-
const WALLET = "0xC3207bFe22cba39AeC4e8540c97c29B028103c7F";
|
|
6
|
-
const HOT_KEY = "0x747024C2e59C523E3B1621A4b3F92366C1E28A30";
|
|
7
|
-
const CHAIN_ID = 8453;
|
|
8
|
-
|
|
9
|
-
async function main() {
|
|
10
|
-
const config = loadConfig();
|
|
11
|
-
const iface = new ethers.Interface(["function authorizeMachineKey(address key) external"]);
|
|
12
|
-
|
|
13
|
-
const tx = {
|
|
14
|
-
to: WALLET,
|
|
15
|
-
data: iface.encodeFunctionData("authorizeMachineKey", [HOT_KEY]),
|
|
16
|
-
value: "0x0",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const tgOpts = {
|
|
20
|
-
botToken: config.telegramBotToken!,
|
|
21
|
-
chatId: config.telegramChatId!,
|
|
22
|
-
threadId: config.telegramThreadId,
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
console.log(`Authorizing hot key ${HOT_KEY} as machine key on ${WALLET}\n`);
|
|
26
|
-
|
|
27
|
-
const { client, session, account } = await connectPhoneWallet(
|
|
28
|
-
config.walletConnectProjectId!,
|
|
29
|
-
CHAIN_ID,
|
|
30
|
-
config,
|
|
31
|
-
{
|
|
32
|
-
telegramOpts: tgOpts,
|
|
33
|
-
prompt: "⛓ BASE — authorizeMachineKey (one-time). After this the hot key runs autonomously.",
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
console.log("Connected:", account);
|
|
38
|
-
const hash = await sendTransactionWithSession(client, session, account, CHAIN_ID, tx);
|
|
39
|
-
console.log("✅ Done:", hash);
|
|
40
|
-
process.exit(0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
main().catch(e => { console.error(e.message ?? e); process.exit(1); });
|
package/scripts/drain-wallet.ts
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* drain-wallet.ts
|
|
3
|
-
* Drain all ETH from the ARC402Wallet contract to the deployer wallet.
|
|
4
|
-
* Uses WalletConnect — sends MetaMask approval button to Telegram.
|
|
5
|
-
*
|
|
6
|
-
* Flow:
|
|
7
|
-
* 1. Read wallet balance
|
|
8
|
-
* 2. Build openContext + attest + executeSpend calldata
|
|
9
|
-
* 3. Connect via WalletConnect (sends Telegram button)
|
|
10
|
-
* 4. Send all 3 txs sequentially for owner approval
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { ethers } from "ethers";
|
|
14
|
-
import { loadConfig } from "../src/config";
|
|
15
|
-
import { connectPhoneWallet, sendTransactionWithSession } from "../src/walletconnect";
|
|
16
|
-
|
|
17
|
-
const DEPLOYER = "0x59A32A792d0f25B0E0a4A4aFbFDf514b94B102fB";
|
|
18
|
-
const WALLET = "0xC3207bFe22cba39AeC4e8540c97c29B028103c7F";
|
|
19
|
-
const RPC = "https://base-mainnet.g.alchemy.com/v2/YIA2uRCsFI-j5pqH-aRzflrACSlV1Qrs";
|
|
20
|
-
const CHAIN_ID = 8453;
|
|
21
|
-
|
|
22
|
-
const WALLET_ABI = [
|
|
23
|
-
"function openContext(bytes32 contextId, string calldata taskType) external",
|
|
24
|
-
"function closeContext() external",
|
|
25
|
-
"function attest(bytes32 attestationId, string calldata action, string calldata reason, address recipient, uint256 amount, address token, uint256 expiresAt) external returns (bytes32)",
|
|
26
|
-
"function executeSpend(address payable recipient, uint256 amount, string calldata category, bytes32 attestationId) external",
|
|
27
|
-
"function contextOpen() external view returns (bool)",
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
async function main() {
|
|
31
|
-
const config = loadConfig();
|
|
32
|
-
|
|
33
|
-
const balance = await new ethers.JsonRpcProvider(RPC).getBalance(WALLET);
|
|
34
|
-
|
|
35
|
-
if (balance === 0n) {
|
|
36
|
-
console.log("Wallet is already empty.");
|
|
37
|
-
process.exit(0);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Reserve gas for 3 transactions (~300k gas @ ~0.01 gwei = ~0.003 ETH buffer)
|
|
41
|
-
const gasReserve = ethers.parseEther("0.0001");
|
|
42
|
-
const sendAmount = balance - gasReserve;
|
|
43
|
-
|
|
44
|
-
if (sendAmount <= 0n) {
|
|
45
|
-
console.log(`Balance too low to drain safely: ${ethers.formatEther(balance)} ETH`);
|
|
46
|
-
process.exit(0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
console.log(`\nDraining ${ethers.formatEther(sendAmount)} ETH from wallet contract`);
|
|
50
|
-
console.log(` From: ${WALLET}`);
|
|
51
|
-
console.log(` To: ${DEPLOYER}\n`);
|
|
52
|
-
|
|
53
|
-
const iface = new ethers.Interface(WALLET_ABI);
|
|
54
|
-
|
|
55
|
-
const contextId = ethers.keccak256(ethers.toUtf8Bytes(`drain-${Date.now()}`));
|
|
56
|
-
const attestId = ethers.keccak256(ethers.toUtf8Bytes(`attest-${Date.now()}`));
|
|
57
|
-
const expiresAt = Math.floor(Date.now() / 1000) + 3600; // 1 hour
|
|
58
|
-
|
|
59
|
-
// Close any existing open context first (from prior partial run)
|
|
60
|
-
const provider = new ethers.JsonRpcProvider(RPC);
|
|
61
|
-
const contextOpenRaw = await provider.call({ to: WALLET, data: iface.encodeFunctionData("contextOpen") });
|
|
62
|
-
const contextAlreadyOpen = ethers.AbiCoder.defaultAbiCoder().decode(["bool"], contextOpenRaw)[0];
|
|
63
|
-
|
|
64
|
-
const txCloseContext = contextAlreadyOpen ? {
|
|
65
|
-
to: WALLET,
|
|
66
|
-
data: iface.encodeFunctionData("closeContext"),
|
|
67
|
-
value: "0x0",
|
|
68
|
-
} : null;
|
|
69
|
-
|
|
70
|
-
const txOpenContext = {
|
|
71
|
-
to: WALLET,
|
|
72
|
-
data: iface.encodeFunctionData("openContext", [contextId, "drain"]),
|
|
73
|
-
value: "0x0",
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const txAttest = {
|
|
77
|
-
to: WALLET,
|
|
78
|
-
data: iface.encodeFunctionData("attest", [
|
|
79
|
-
attestId,
|
|
80
|
-
"drain",
|
|
81
|
-
"drain to deployer",
|
|
82
|
-
DEPLOYER,
|
|
83
|
-
sendAmount,
|
|
84
|
-
ethers.ZeroAddress,
|
|
85
|
-
expiresAt,
|
|
86
|
-
]),
|
|
87
|
-
value: "0x0",
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
const txSpend = {
|
|
91
|
-
to: WALLET,
|
|
92
|
-
data: iface.encodeFunctionData("executeSpend", [
|
|
93
|
-
DEPLOYER,
|
|
94
|
-
sendAmount,
|
|
95
|
-
"drain",
|
|
96
|
-
attestId,
|
|
97
|
-
]),
|
|
98
|
-
value: "0x0",
|
|
99
|
-
};
|
|
100
|
-
|
|
101
|
-
const tgOpts = {
|
|
102
|
-
botToken: config.telegramBotToken!,
|
|
103
|
-
chatId: config.telegramChatId!,
|
|
104
|
-
threadId: config.telegramThreadId,
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
console.log("Connecting WalletConnect — fresh session, Base network enforced...\n");
|
|
108
|
-
|
|
109
|
-
const { client, session, account } = await connectPhoneWallet(
|
|
110
|
-
config.walletConnectProjectId!,
|
|
111
|
-
CHAIN_ID,
|
|
112
|
-
config,
|
|
113
|
-
{
|
|
114
|
-
telegramOpts: tgOpts,
|
|
115
|
-
prompt: `⛓ BASE NETWORK ONLY\nApprove drain of ${ethers.formatEther(sendAmount)} ETH → deployer wallet\n\n⚠️ Make sure MetaMask is on BASE before approving`,
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
console.log(`\nConnected: ${account}`);
|
|
120
|
-
|
|
121
|
-
let txCount = 1;
|
|
122
|
-
const total = (txCloseContext ? 4 : 3);
|
|
123
|
-
|
|
124
|
-
if (txCloseContext) {
|
|
125
|
-
console.log(`Sending tx ${txCount++}/${total}: closeContext (cleaning up prior run)...`);
|
|
126
|
-
const hClose = await sendTransactionWithSession(client, session, account, CHAIN_ID, txCloseContext);
|
|
127
|
-
console.log(` ✓ ${hClose}`);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
console.log(`Sending tx ${txCount++}/${total}: openContext...`);
|
|
131
|
-
const h1 = await sendTransactionWithSession(client, session, account, CHAIN_ID, txOpenContext);
|
|
132
|
-
console.log(` ✓ ${h1}`);
|
|
133
|
-
|
|
134
|
-
console.log(`Sending tx ${txCount++}/${total}: attest...`);
|
|
135
|
-
const h2 = await sendTransactionWithSession(client, session, account, CHAIN_ID, txAttest);
|
|
136
|
-
console.log(` ✓ ${h2}`);
|
|
137
|
-
|
|
138
|
-
console.log(`Sending tx ${txCount++}/${total}: executeSpend...`);
|
|
139
|
-
const h3 = await sendTransactionWithSession(client, session, account, CHAIN_ID, txSpend);
|
|
140
|
-
console.log(` ✓ ${h3}`);
|
|
141
|
-
|
|
142
|
-
console.log(`\n✅ Done. ${ethers.formatEther(sendAmount)} ETH sent to deployer.`);
|
|
143
|
-
process.exit(0);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
main().catch(e => {
|
|
147
|
-
console.error(e.message ?? e);
|
|
148
|
-
process.exit(1);
|
|
149
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* execute-spend-only.ts
|
|
3
|
-
* Send ONLY the executeSpend tx — context and attest already confirmed on-chain.
|
|
4
|
-
* Uses the attestation ID from the last successful attest tx.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ethers } from "ethers";
|
|
8
|
-
import { loadConfig } from "../src/config";
|
|
9
|
-
import { connectPhoneWallet, sendTransactionWithSession } from "../src/walletconnect";
|
|
10
|
-
|
|
11
|
-
const DEPLOYER = "0x59A32A792d0f25B0E0a4A4aFbFDf514b94B102fB";
|
|
12
|
-
const WALLET = "0xC3207bFe22cba39AeC4e8540c97c29B028103c7F";
|
|
13
|
-
const RPC = "https://base-mainnet.g.alchemy.com/v2/YIA2uRCsFI-j5pqH-aRzflrACSlV1Qrs";
|
|
14
|
-
const CHAIN_ID = 8453;
|
|
15
|
-
|
|
16
|
-
// Attest tx was: 0x28dbff33aa65b0617c4f25810f06f76bfcf0a430f461b...
|
|
17
|
-
// Recover attestId from the drain script's timestamp-based keccak
|
|
18
|
-
// The attest tx confirmed — we need to recover the attestId used.
|
|
19
|
-
// Re-derive it: the script used `attest-${Date.now()}` at time of that run.
|
|
20
|
-
// Instead, read it from the IntentAttestation contract by checking events.
|
|
21
|
-
|
|
22
|
-
const INTENT_ATTEST_ABI = [
|
|
23
|
-
"event AttestationCreated(bytes32 indexed attestationId, address indexed wallet, address recipient, uint256 amount, address token)",
|
|
24
|
-
"function verify(bytes32 attestationId, address wallet, address recipient, uint256 amount, address token) external view returns (bool)",
|
|
25
|
-
];
|
|
26
|
-
|
|
27
|
-
const WALLET_ABI = [
|
|
28
|
-
"function executeSpend(address payable recipient, uint256 amount, string calldata category, bytes32 attestationId) external",
|
|
29
|
-
];
|
|
30
|
-
|
|
31
|
-
const INTENT_ATTEST_ADDR = "0x7ad8db6C5f394542E8e9658F86C85cC99Cf6D460";
|
|
32
|
-
|
|
33
|
-
async function main() {
|
|
34
|
-
const config = loadConfig();
|
|
35
|
-
const provider = new ethers.JsonRpcProvider(RPC);
|
|
36
|
-
|
|
37
|
-
// Find the most recent AttestationCreated event for this wallet → DEPLOYER
|
|
38
|
-
const attestContract = new ethers.Contract(INTENT_ATTEST_ADDR, INTENT_ATTEST_ABI, provider);
|
|
39
|
-
const block = await provider.getBlockNumber();
|
|
40
|
-
// Hardcoded from confirmed attest tx 0x28dbff33...c17
|
|
41
|
-
const attestId = "0x9d8bdb5f551f63e986e5d0c980fd68f4e445b9f7902f71226ec08ce24bceebb0";
|
|
42
|
-
const amount = ethers.parseEther("0.00015");
|
|
43
|
-
|
|
44
|
-
console.log(`Found attestation: ${attestId}`);
|
|
45
|
-
console.log(`Amount: ${ethers.formatEther(amount)} ETH`);
|
|
46
|
-
console.log(`Sending executeSpend → ${DEPLOYER}\n`);
|
|
47
|
-
|
|
48
|
-
const iface = new ethers.Interface(WALLET_ABI);
|
|
49
|
-
const txSpend = {
|
|
50
|
-
to: WALLET,
|
|
51
|
-
data: iface.encodeFunctionData("executeSpend", [DEPLOYER, amount, "drain", attestId]),
|
|
52
|
-
value: "0x0",
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const tgOpts = {
|
|
56
|
-
botToken: config.telegramBotToken!,
|
|
57
|
-
chatId: config.telegramChatId!,
|
|
58
|
-
threadId: config.telegramThreadId,
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const { client, session, account } = await connectPhoneWallet(
|
|
62
|
-
config.walletConnectProjectId!,
|
|
63
|
-
CHAIN_ID,
|
|
64
|
-
config,
|
|
65
|
-
{
|
|
66
|
-
telegramOpts: tgOpts,
|
|
67
|
-
prompt: `⛓ BASE ONLY — Final tx: executeSpend ${ethers.formatEther(amount)} ETH → deployer\n\n⚠️ Keep MetaMask on Base and approve`,
|
|
68
|
-
}
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
console.log(`Connected: ${account}`);
|
|
72
|
-
console.log("Sending executeSpend...");
|
|
73
|
-
const hash = await sendTransactionWithSession(client, session, account, CHAIN_ID, txSpend);
|
|
74
|
-
console.log(`\n✅ Done: ${hash}`);
|
|
75
|
-
process.exit(0);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
main().catch(e => {
|
|
79
|
-
console.error(e.message ?? e);
|
|
80
|
-
process.exit(1);
|
|
81
|
-
});
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* register-agent-userop.ts
|
|
3
|
-
* Register GigaBrain in AgentRegistry via ERC-4337 UserOperation.
|
|
4
|
-
* Machine key signs → Pimlico bundler → EntryPoint executes → wallet is msg.sender.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { ethers } from "ethers";
|
|
8
|
-
import { loadConfig } from "../src/config";
|
|
9
|
-
import { BundlerClient, buildUserOp } from "../src/bundler";
|
|
10
|
-
import { ARC402_WALLET_EXECUTE_ABI, AGENT_REGISTRY_ABI } from "../src/abis";
|
|
11
|
-
|
|
12
|
-
const ENTRY_POINT = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
13
|
-
const CHAIN_ID = 8453;
|
|
14
|
-
|
|
15
|
-
// EntryPoint v0.7 nonce getter ABI
|
|
16
|
-
const EP_ABI = [
|
|
17
|
-
"function getNonce(address sender, uint192 key) external view returns (uint256)",
|
|
18
|
-
"function depositTo(address account) external payable",
|
|
19
|
-
"function balanceOf(address account) external view returns (uint256)",
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
async function main() {
|
|
23
|
-
const config = loadConfig();
|
|
24
|
-
if (!config.walletContractAddress) throw new Error("walletContractAddress not in config");
|
|
25
|
-
if (!config.privateKey) throw new Error("privateKey not in config");
|
|
26
|
-
|
|
27
|
-
const provider = new ethers.JsonRpcProvider(config.rpcUrl);
|
|
28
|
-
const machineKey = new ethers.Wallet(config.privateKey, provider);
|
|
29
|
-
const walletAddress = config.walletContractAddress;
|
|
30
|
-
|
|
31
|
-
const agentRegistryAddress =
|
|
32
|
-
config.agentRegistryV2Address ??
|
|
33
|
-
"0xD5c2851B00090c92Ba7F4723FB548bb30C9B6865";
|
|
34
|
-
|
|
35
|
-
console.log("Wallet: ", walletAddress);
|
|
36
|
-
console.log("Machine key: ", machineKey.address);
|
|
37
|
-
console.log("AgentRegistry: ", agentRegistryAddress);
|
|
38
|
-
|
|
39
|
-
// ── 1. Check ETH balance ───────────────────────────────────────────────────
|
|
40
|
-
const balance = await provider.getBalance(walletAddress);
|
|
41
|
-
console.log("Wallet balance: ", ethers.formatEther(balance), "ETH");
|
|
42
|
-
if (balance < ethers.parseEther("0.0005")) {
|
|
43
|
-
throw new Error("Wallet balance too low — need at least 0.0005 ETH");
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// ── 2. Get nonce from EntryPoint ───────────────────────────────────────────
|
|
47
|
-
const ep = new ethers.Contract(ENTRY_POINT, EP_ABI, provider);
|
|
48
|
-
const nonce: bigint = await ep.getNonce(walletAddress, 0);
|
|
49
|
-
console.log("Nonce: ", nonce.toString());
|
|
50
|
-
|
|
51
|
-
// ── 3. Encode AgentRegistry.register() calldata ───────────────────────────
|
|
52
|
-
const registryIface = new ethers.Interface(AGENT_REGISTRY_ABI);
|
|
53
|
-
const registerCalldata = registryIface.encodeFunctionData("register", [
|
|
54
|
-
"GigaBrain", // name
|
|
55
|
-
[], // capabilities (empty for now)
|
|
56
|
-
"ai.assistant", // serviceType
|
|
57
|
-
"https://gigabrain.arc402.xyz", // endpoint
|
|
58
|
-
"", // metadataURI
|
|
59
|
-
]);
|
|
60
|
-
|
|
61
|
-
// ── 4. Encode ARC402Wallet.executeContractCall() — this is the UserOp callData ──
|
|
62
|
-
const walletIface = new ethers.Interface(ARC402_WALLET_EXECUTE_ABI);
|
|
63
|
-
const userOpCallData = walletIface.encodeFunctionData("executeContractCall", [{
|
|
64
|
-
target: agentRegistryAddress,
|
|
65
|
-
data: registerCalldata,
|
|
66
|
-
value: BigInt(0),
|
|
67
|
-
minReturnValue: BigInt(0),
|
|
68
|
-
maxApprovalAmount: BigInt(0),
|
|
69
|
-
approvalToken: ethers.ZeroAddress,
|
|
70
|
-
}]);
|
|
71
|
-
|
|
72
|
-
console.log("UserOp callData built ✓");
|
|
73
|
-
|
|
74
|
-
// ── 5. Build UserOp — fetch live gas price from Pimlico ───────────────────
|
|
75
|
-
// Declare bundlerUrl here so it's available for gas price fetch AND sending
|
|
76
|
-
const bundlerUrl = (config as unknown as Record<string, unknown>)["bundlerUrl"] as string | undefined ?? "https://public.pimlico.io/v2/8453/rpc";
|
|
77
|
-
const gasPriceRes = await fetch(bundlerUrl, {
|
|
78
|
-
method: "POST",
|
|
79
|
-
headers: { "Content-Type": "application/json" },
|
|
80
|
-
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "pimlico_getUserOperationGasPrice", params: [] }),
|
|
81
|
-
});
|
|
82
|
-
const gasPriceJson = await gasPriceRes.json() as { result?: { fast?: { maxFeePerGas: string; maxPriorityFeePerGas: string } } };
|
|
83
|
-
const fast = gasPriceJson.result?.fast;
|
|
84
|
-
if (!fast) throw new Error("Could not fetch gas price from bundler");
|
|
85
|
-
console.log("Gas price (fast): maxFee=", fast.maxFeePerGas, "maxPriority=", fast.maxPriorityFeePerGas);
|
|
86
|
-
|
|
87
|
-
const userOp = await buildUserOp(userOpCallData, walletAddress, nonce, config);
|
|
88
|
-
// Override with bundler-recommended gas prices
|
|
89
|
-
userOp.maxFeePerGas = fast.maxFeePerGas;
|
|
90
|
-
userOp.maxPriorityFeePerGas = fast.maxPriorityFeePerGas;
|
|
91
|
-
// Bump callGasLimit — executeContractCall + AgentRegistry.register needs ~330k
|
|
92
|
-
userOp.callGasLimit = ethers.toBeHex(500_000);
|
|
93
|
-
userOp.verificationGasLimit = ethers.toBeHex(200_000);
|
|
94
|
-
|
|
95
|
-
// ── 6. Sign UserOp with machine key ───────────────────────────────────────
|
|
96
|
-
// ERC-4337 v0.7: hash = keccak256(abi.encode(userOpHash, entryPoint, chainId))
|
|
97
|
-
// where userOpHash = keccak256(packed(userOp fields))
|
|
98
|
-
const packedFields = ethers.AbiCoder.defaultAbiCoder().encode(
|
|
99
|
-
["address","uint256","bytes32","bytes32","bytes32","uint256","bytes32","bytes32"],
|
|
100
|
-
[
|
|
101
|
-
userOp.sender,
|
|
102
|
-
BigInt(userOp.nonce),
|
|
103
|
-
ethers.keccak256(ethers.concat(
|
|
104
|
-
userOp.factory ? [userOp.factory, userOp.factoryData ?? "0x"] : []
|
|
105
|
-
)),
|
|
106
|
-
ethers.keccak256(userOp.callData),
|
|
107
|
-
ethers.concat([
|
|
108
|
-
ethers.zeroPadValue(ethers.toBeHex(userOp.callGasLimit), 16),
|
|
109
|
-
ethers.zeroPadValue(ethers.toBeHex(userOp.verificationGasLimit), 16),
|
|
110
|
-
]),
|
|
111
|
-
BigInt(userOp.preVerificationGas),
|
|
112
|
-
ethers.concat([
|
|
113
|
-
ethers.zeroPadValue(ethers.toBeHex(userOp.maxPriorityFeePerGas), 16),
|
|
114
|
-
ethers.zeroPadValue(ethers.toBeHex(userOp.maxFeePerGas), 16),
|
|
115
|
-
]),
|
|
116
|
-
ethers.keccak256(
|
|
117
|
-
userOp.paymaster
|
|
118
|
-
? ethers.concat([
|
|
119
|
-
userOp.paymaster,
|
|
120
|
-
ethers.zeroPadValue(ethers.toBeHex(userOp.paymasterVerificationGasLimit ?? "0x0"), 16),
|
|
121
|
-
ethers.zeroPadValue(ethers.toBeHex(userOp.paymasterPostOpGasLimit ?? "0x0"), 16),
|
|
122
|
-
userOp.paymasterData ?? "0x",
|
|
123
|
-
])
|
|
124
|
-
: "0x"
|
|
125
|
-
),
|
|
126
|
-
]
|
|
127
|
-
);
|
|
128
|
-
const userOpHash = ethers.keccak256(
|
|
129
|
-
ethers.AbiCoder.defaultAbiCoder().encode(
|
|
130
|
-
["bytes32","address","uint256"],
|
|
131
|
-
[
|
|
132
|
-
ethers.keccak256(packedFields),
|
|
133
|
-
ENTRY_POINT,
|
|
134
|
-
CHAIN_ID,
|
|
135
|
-
]
|
|
136
|
-
)
|
|
137
|
-
);
|
|
138
|
-
console.log("UserOp hash: ", userOpHash);
|
|
139
|
-
|
|
140
|
-
// validateUserOp uses toEthSignedMessageHash — sign the eth-prefixed hash
|
|
141
|
-
const signature = await machineKey.signMessage(ethers.getBytes(userOpHash));
|
|
142
|
-
userOp.signature = signature;
|
|
143
|
-
console.log("Signed ✓");
|
|
144
|
-
|
|
145
|
-
// ── 7. Send to bundler ─────────────────────────────────────────────────────
|
|
146
|
-
const bundler = new BundlerClient(bundlerUrl, ENTRY_POINT, CHAIN_ID);
|
|
147
|
-
|
|
148
|
-
console.log("Sending UserOperation to bundler...");
|
|
149
|
-
let opHash: string;
|
|
150
|
-
try {
|
|
151
|
-
opHash = await bundler.sendUserOperation(userOp);
|
|
152
|
-
} catch (e) {
|
|
153
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
154
|
-
throw new Error(`Bundler rejected UserOp: ${msg}`);
|
|
155
|
-
}
|
|
156
|
-
console.log("UserOp hash: ", opHash);
|
|
157
|
-
console.log("Waiting for confirmation (up to 60s)...");
|
|
158
|
-
|
|
159
|
-
const receipt = await bundler.getUserOperationReceipt(opHash);
|
|
160
|
-
if (!receipt.success) {
|
|
161
|
-
throw new Error(`UserOp failed on-chain. Tx: ${receipt.receipt.transactionHash}`);
|
|
162
|
-
}
|
|
163
|
-
console.log("✓ AgentRegistry.register() confirmed");
|
|
164
|
-
console.log(" Tx:", receipt.receipt.transactionHash);
|
|
165
|
-
|
|
166
|
-
// ── 8. Claim subdomain ─────────────────────────────────────────────────────
|
|
167
|
-
console.log("\nClaiming gigabrain.arc402.xyz...");
|
|
168
|
-
const res = await fetch("https://api.arc402.xyz/register-subdomain", {
|
|
169
|
-
method: "POST",
|
|
170
|
-
headers: { "Content-Type": "application/json" },
|
|
171
|
-
body: JSON.stringify({
|
|
172
|
-
subdomain: "gigabrain",
|
|
173
|
-
walletAddress,
|
|
174
|
-
tunnelTarget: "https://gigabrain.arc402.xyz",
|
|
175
|
-
}),
|
|
176
|
-
});
|
|
177
|
-
const body = await res.json() as Record<string, unknown>;
|
|
178
|
-
if (!res.ok) {
|
|
179
|
-
console.error("✗ Subdomain claim failed:", body["error"] ?? body);
|
|
180
|
-
process.exit(1);
|
|
181
|
-
}
|
|
182
|
-
console.log("✓ Subdomain claimed:", body["subdomain"]);
|
|
183
|
-
console.log("\nAll done. GigaBrain is registered and live.");
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
main().catch(e => { console.error(e); process.exit(1); });
|