@arcpaylabs/arbitrum-cli 0.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 ADDED
@@ -0,0 +1,40 @@
1
+ # ArcPay Arbitrum CLI
2
+
3
+ Developer CLI for ArcPay Arbitrum. It prints deployed contract addresses, derives IDs used by the contracts, returns integration guides, and generates MCP config.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install -g @arcpaylabs/arbitrum-cli
9
+ ```
10
+
11
+ ## Commands
12
+
13
+ ```bash
14
+ arcpay-arbitrum contracts
15
+ arcpay-arbitrum wallet
16
+ arcpay-arbitrum agent-id research-agent
17
+ arcpay-arbitrum invoice-id inv_001
18
+ arcpay-arbitrum claim-hash claim-research-agent-001
19
+ arcpay-arbitrum privacy-commit "invoice-secret"
20
+ arcpay-arbitrum privacy-guide
21
+ arcpay-arbitrum invoice-guide
22
+ arcpay-arbitrum x402-guide
23
+ arcpay-arbitrum execution-handoff
24
+ arcpay-arbitrum gmx-plan
25
+ arcpay-arbitrum zerodev-policy
26
+ arcpay-arbitrum dune-spec
27
+ arcpay-arbitrum fhenix-boundary
28
+ arcpay-arbitrum demo-path
29
+ arcpay-arbitrum smoke
30
+ arcpay-arbitrum mcp-config
31
+ ```
32
+
33
+ ## Live Surfaces
34
+
35
+ - App: https://arcpay-arbitrum.vercel.app
36
+ - Docs: https://arcpay-arbitrum.vercel.app/docs/overview
37
+ - x402: https://arcpay-arbitrum.vercel.app/api
38
+ - OpenAPI: https://arcpay-arbitrum.vercel.app/openapi.json
39
+
40
+ The CLI is a developer helper. It does not hold private keys or sign treasury transactions.
@@ -0,0 +1,271 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import { id, keccak256, toUtf8Bytes } from "ethers";
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
+ const repoDeploymentPath = path.join(process.cwd(), "deployments", "arbitrum-sepolia.json");
9
+ const packageDeploymentPath = path.join(__dirname, "deployment.json");
10
+
11
+ function deployment() {
12
+ const file = fs.existsSync(repoDeploymentPath) ? repoDeploymentPath : packageDeploymentPath;
13
+ return JSON.parse(fs.readFileSync(file, "utf8"));
14
+ }
15
+
16
+ function usage() {
17
+ console.log(`ArcPay Arbitrum CLI
18
+
19
+ Commands:
20
+ arcpay-arbitrum contracts Print deployed Arbitrum addresses
21
+ arcpay-arbitrum wallet Print network wallet instructions
22
+ arcpay-arbitrum agent-id <slug> Derive bytes32 agent id
23
+ arcpay-arbitrum invoice-id <publicId> Derive bytes32 invoice id
24
+ arcpay-arbitrum claim-hash <code> Derive claim-code hash
25
+ arcpay-arbitrum privacy-commit <text> Derive Privacy Intent commitment/nullifier
26
+ arcpay-arbitrum privacy-abi Print Privacy Intent contract ABI
27
+ arcpay-arbitrum privacy-guide Print builder integration guide
28
+ arcpay-arbitrum invoice-guide Print invoice settlement guide
29
+ arcpay-arbitrum x402-guide Print x402 HTTP payment gate guide
30
+ arcpay-arbitrum execution-handoff Print Arbitrum execution payload template
31
+ arcpay-arbitrum gmx-plan Print GMX execution plan template
32
+ arcpay-arbitrum zerodev-policy Print ZeroDev session policy template
33
+ arcpay-arbitrum dune-spec Print Dune analytics proof schema
34
+ arcpay-arbitrum fhenix-boundary Print Fhenix privacy boundary
35
+ arcpay-arbitrum demo-path Print operator demo steps
36
+ arcpay-arbitrum smoke Print smoke-test commands
37
+ arcpay-arbitrum mcp-config Print MCP host config
38
+ `);
39
+ }
40
+
41
+ const [, , command, ...args] = process.argv;
42
+
43
+ try {
44
+ if (!command || command === "help" || command === "--help") {
45
+ usage();
46
+ } else if (command === "contracts") {
47
+ console.log(JSON.stringify(deployment().contracts, null, 2));
48
+ } else if (command === "wallet") {
49
+ console.log("Add Arbitrum Sepolia to an EVM wallet:");
50
+ console.log("Chain ID: 421614 / 0x66eee");
51
+ console.log("RPC: https://sepolia-rollup.arbitrum.io/rpc");
52
+ console.log("Currency: ETH");
53
+ console.log("Explorer: https://sepolia.arbiscan.io");
54
+ } else if (command === "agent-id") {
55
+ console.log(id(args.join(" ") || "agent"));
56
+ } else if (command === "invoice-id") {
57
+ console.log(keccak256(toUtf8Bytes(args.join(" ") || "invoice")));
58
+ } else if (command === "claim-hash") {
59
+ console.log(keccak256(toUtf8Bytes(args.join(" "))));
60
+ } else if (command === "privacy-commit") {
61
+ console.log(keccak256(toUtf8Bytes(args.join(" "))));
62
+ } else if (command === "privacy-abi") {
63
+ console.log(JSON.stringify([
64
+ "function createNativeIntent(bytes32 commitment,string encryptedMemoUri) payable",
65
+ "function createTokenIntent(bytes32 commitment,address token,uint256 amount,string encryptedMemoUri)",
66
+ "function releaseIntent(bytes32 commitment,bytes32 nullifier,address recipient)",
67
+ "function cancelIntent(bytes32 commitment)",
68
+ "function intents(bytes32 commitment) view returns (address operator,address token,uint256 amount,string encryptedMemoUri,bool released,bool cancelled,uint256 createdAt)",
69
+ ], null, 2));
70
+ } else if (command === "privacy-guide") {
71
+ const info = deployment();
72
+ console.log([
73
+ "ArcPay Privacy Intents for Arbitrum",
74
+ "",
75
+ `Vault: ${info.contracts.ArbitrumPrivacyVault}`,
76
+ `USDC: ${info.usdcToken}`,
77
+ "",
78
+ "1. commitment = keccak256(secret)",
79
+ "2. nullifier = keccak256(releaseSecret)",
80
+ "3. approve USDC to the vault for token intents",
81
+ "4. call createTokenIntent(commitment, USDC, amount, encryptedMemoUri)",
82
+ "5. later call releaseIntent(commitment, nullifier, recipient)",
83
+ "",
84
+ "Privacy boundary: metadata and recipient are hidden during intent phase; release transfer is public.",
85
+ ].join("\n"));
86
+ } else if (command === "invoice-guide") {
87
+ const info = deployment();
88
+ console.log([
89
+ "ArcPay Arbitrum Invoices",
90
+ "",
91
+ `InvoiceBook: ${info.contracts.AgentInvoiceBook}`,
92
+ `USDC: ${info.usdcToken}`,
93
+ "",
94
+ "1. invoiceId = keccak256(publicInvoiceId).",
95
+ "2. ETH invoice: createInvoice(invoiceId, payerOrZero, address(0), amountWei, metadataUri).",
96
+ "3. USDC invoice: createInvoice(invoiceId, payerOrZero, USDC, amountBaseUnits, metadataUri).",
97
+ "4. Payer signs payNativeInvoice(invoiceId) with exact msg.value or approves USDC then payTokenInvoice(invoiceId).",
98
+ "5. Issuer can cancel unpaid invoices with cancelInvoice(invoiceId).",
99
+ "",
100
+ "Proof command: npm run smoke:live",
101
+ ].join("\n"));
102
+ } else if (command === "x402-guide") {
103
+ const info = deployment();
104
+ console.log([
105
+ "ArcPay Arbitrum x402",
106
+ "",
107
+ `Registry: ${info.contracts.AgentRegistry}`,
108
+ `OrderBook: ${info.contracts.AgentOrderBook}`,
109
+ "",
110
+ "1. Register an agent slug in AgentRegistry.",
111
+ "2. GET https://arcpay-arbitrum.vercel.app/api/agent/:slug/work returns HTTP 402 requirements.",
112
+ "3. Payer calls AgentOrderBook.createOrder(agentId, requestUri) with quoted msg.value.",
113
+ "4. Provider fulfills the order.",
114
+ "5. GET /agent/:slug/work?orderId=... unlocks only after Fulfilled or Settled.",
115
+ "",
116
+ "Proof command: npm run smoke:x402",
117
+ ].join("\n"));
118
+ } else if (command === "execution-handoff") {
119
+ const info = deployment();
120
+ const strategyName = args[0] || "arcpay-arbitrum-cfo";
121
+ const agentSlug = args[1] || "treasury-router";
122
+ const budgetEth = args[2] || "0.02";
123
+ const adapter = args[3] || "GMX execution intent";
124
+ console.log(JSON.stringify({
125
+ protocol: "arcpay-arbitrum-execution-handoff",
126
+ chain: "arbitrum-sepolia",
127
+ chainId: 421614,
128
+ adapter,
129
+ executionAddress: "set-after-wallet-or-smart-account-connection",
130
+ primaryVenue: "GMX",
131
+ strategyName,
132
+ agentSlug,
133
+ objective: "Execute only policy-approved Arbitrum treasury work through ArcPay x402, escrow, privacy, invoice, reputation, and audit modules.",
134
+ constraints: {
135
+ maxBudgetEth: budgetEth,
136
+ allowedAssets: ["ETH", "USDC", "WETH"],
137
+ allowedVenues: ["GMX", "Stylus policy module", "ZeroDev smart account", "Dune evidence", "Manual signer"],
138
+ requireArcPayPolicy: true,
139
+ requireOperatorApprovalForLeverage: true,
140
+ requireExecutionEvidence: true,
141
+ requireArbiscanTxHashForCompletion: true,
142
+ noCompletionWithoutTxHashOrOrderEvidence: true,
143
+ },
144
+ endpoints: {
145
+ x402Gateway: "https://arcpay-arbitrum.vercel.app/api",
146
+ protectedResource: `https://arcpay-arbitrum.vercel.app/api/agent/${encodeURIComponent(agentSlug)}/work`,
147
+ status: "https://arcpay-arbitrum.vercel.app/api/status",
148
+ openapi: "https://arcpay-arbitrum.vercel.app/openapi.json",
149
+ },
150
+ contracts: {
151
+ registry: info.contracts.AgentRegistry,
152
+ orderBook: info.contracts.AgentOrderBook,
153
+ policy: info.contracts.TreasuryPolicy,
154
+ privacyVault: info.contracts.ArbitrumPrivacyVault,
155
+ reputation: info.contracts.AgentReputationBook,
156
+ identity8004: info.contracts.AgentIdentity8004,
157
+ executionRouter: info.contracts.ArbitrumExecutionRouter,
158
+ },
159
+ setup: [
160
+ "Register or select an ArcPay agent identity.",
161
+ "Choose an execution adapter: GMX intent, Stylus policy check, ZeroDev smart account, Dune evidence, or manual signer.",
162
+ "Create the x402 quote or escrow order before work starts.",
163
+ "Execute only after policy approval and budget checks.",
164
+ "Attach Arbiscan tx hash, x402 verification, Dune query link, or signed result evidence before marking the work complete.",
165
+ ],
166
+ }, null, 2));
167
+ } else if (command === "gmx-plan") {
168
+ const info = deployment();
169
+ console.log(JSON.stringify({
170
+ protocol: "arcpay-gmx-execution-plan",
171
+ chain: "arbitrum-sepolia",
172
+ venue: "GMX",
173
+ market: args[0] || "ETH/USD",
174
+ collateral: args[1] || "USDC",
175
+ sizeUsd: args[2] || "25",
176
+ maxLeverage: args[3] || "1.2x",
177
+ controls: {
178
+ requireArcPayPolicy: true,
179
+ requireExecutionRouterIntent: true,
180
+ requireOperatorApprovalForLeverage: true,
181
+ requireArbiscanTxHash: true,
182
+ requireDuneEvidenceLink: true,
183
+ },
184
+ contracts: {
185
+ executionRouter: info.contracts.ArbitrumExecutionRouter,
186
+ policy: info.contracts.TreasuryPolicy,
187
+ orderBook: info.contracts.AgentOrderBook,
188
+ },
189
+ }, null, 2));
190
+ } else if (command === "zerodev-policy") {
191
+ const info = deployment();
192
+ console.log(JSON.stringify({
193
+ protocol: "arcpay-zerodev-session-policy",
194
+ chain: "arbitrum-sepolia",
195
+ agentSlug: args[0] || "treasury-router",
196
+ accountAbstraction: "ZeroDev",
197
+ sessionScope: {
198
+ allowedContracts: [
199
+ info.contracts.AgentOrderBook,
200
+ info.contracts.TreasuryPolicy,
201
+ info.contracts.ArbitrumExecutionRouter,
202
+ info.contracts.ArbitrumPrivacyVault,
203
+ ],
204
+ maxBudgetEth: args[1] || "0.02",
205
+ expiresInMinutes: Number(args[2] || 60),
206
+ blockedActions: ["unbounded leverage", "unknown target contract", "execution without evidence URI"],
207
+ },
208
+ }, null, 2));
209
+ } else if (command === "dune-spec") {
210
+ console.log(JSON.stringify({
211
+ protocol: "arcpay-dune-evidence",
212
+ chain: "arbitrum-sepolia",
213
+ eventFamilies: [
214
+ "AgentIdentityRegistered",
215
+ "AgentRegistered",
216
+ "OrderCreated/OrderStatusChanged/OrderFulfilled",
217
+ "ExecutionIntentProposed/Approved/Executed",
218
+ "SpendRecorded",
219
+ "Privacy intent events",
220
+ "ReputationRecorded",
221
+ ],
222
+ dashboardCards: ["active agents", "x402 order volume", "execution intents by adapter", "policy approvals", "privacy intent lifecycle", "reputation scores"],
223
+ }, null, 2));
224
+ } else if (command === "fhenix-boundary") {
225
+ console.log(JSON.stringify({
226
+ protocol: "arcpay-fhenix-privacy-boundary",
227
+ chain: "arbitrum",
228
+ privateInputs: ["counterparty notes", "agent prompt fragments", "risk memo", "invoice memo", "treasury strategy rationale"],
229
+ publicOutputs: ["commitment", "nullifier", "evidence URI", "execution intent id", "Arbiscan tx hash"],
230
+ boundary: "ArcPay PrivacyVault handles commitment/nullifier settlement; Fhenix is the confidential-compute adapter for encrypted policy and risk computation.",
231
+ }, null, 2));
232
+ } else if (command === "demo-path") {
233
+ console.log([
234
+ "1. Connect wallet and switch to Arbitrum Sepolia.",
235
+ "2. Register a provider on /agents.",
236
+ "3. Set policy and allowlist the agent on /policies.",
237
+ "4. Create an escrowed order on /orders.",
238
+ "5. Move order through accept -> processing -> fulfill -> settle or fail/refund.",
239
+ "6. Create claim codes and webhook circuit breakers on /operator.",
240
+ "7. Request risk scoring on /oracle.",
241
+ "8. Create and release encrypted Privacy Intents on /privacy.",
242
+ "9. Create, pay, cancel, and sync ETH/USDC invoices on /invoices.",
243
+ "10. Show /audit, /status, and /proofs.",
244
+ ].join("\n"));
245
+ } else if (command === "smoke") {
246
+ console.log([
247
+ "Run local + live verification:",
248
+ "npm run build:frontend",
249
+ "npm test",
250
+ "npm run check:worker",
251
+ "npm run check:x402",
252
+ "npm run smoke:auth",
253
+ "npm run smoke:live",
254
+ "npm run smoke:x402",
255
+ ].join("\n"));
256
+ } else if (command === "mcp-config") {
257
+ console.log(JSON.stringify({
258
+ mcpServers: {
259
+ "arcpay-arbitrum": {
260
+ command: "arcpay-arbitrum-mcp",
261
+ },
262
+ },
263
+ }, null, 2));
264
+ } else {
265
+ usage();
266
+ process.exitCode = 1;
267
+ }
268
+ } catch (error) {
269
+ console.error(error instanceof Error ? error.message : error);
270
+ process.exitCode = 1;
271
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "network": "arbitrum-sepolia",
3
+ "chainId": 421614,
4
+ "deployer": "0xB883e76A4f6841E72cAF1C28ba00f78df974f448",
5
+ "deployedAt": "2026-05-30T14:05:55.746Z",
6
+ "contracts": {
7
+ "AgentRegistry": "0x5F5b8109c832BB6609178F0bb2e6A597387dA17E",
8
+ "TreasuryPolicy": "0x3F8bc2b46E7b71632CdADd1f00d4FD6BB11d8283",
9
+ "AgentTreasury": "0xe472A6367ab66C271aa47cA5882E919c0DEA0ff2",
10
+ "AgentOrderBook": "0x3587fd962d40433165d5f2a3dFc60636ebD11e59",
11
+ "OperatorControls": "0x0cbafFF48ac25178bd10D1cE851C04CCa4Fe387e",
12
+ "ArbitrumAgentRiskOracle": "0x176018C6C8c445807FE3688f463487E4b01C8ae3",
13
+ "AgentSpendCardVault": "0x7C7304bC2D7bB39800eFE7Cdd9c79C7Afd04acF0",
14
+ "ArbitrumPrivacyVault": "0xCBa6Fa24a02F11fE0cd9F16B50e883fE1B4D40Eb",
15
+ "AgentInvoiceBook": "0x487CbD73e298721a83ff460Eb56645C61BEb0f79",
16
+ "AgentReputationBook": "0xDdbe6aD2652BD5d0Ab4D8a6D2ab8798Cf294D9dD",
17
+ "AgentIdentity8004": "0xA6c4C9c5479553450F60663E5D8046f9E2CBF37D",
18
+ "ArbitrumExecutionRouter": "0x463152158F32aFeedCe58a6BbD19F8ECfA702d8e",
19
+ "MockUSDC": "0xd4Ae4c23A308024e2F2d7531cF395365eF67dE20",
20
+ "MockArbitrumAgentPlatform": "0x2D8bb0EBAa850626d2cEFA15bB3A7761B7F86196"
21
+ },
22
+ "arbitrumAgentPlatform": "0x2D8bb0EBAa850626d2cEFA15bB3A7761B7F86196",
23
+ "arbitrumRiskAgentId": "13174292974160097713",
24
+ "usdcToken": "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
25
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@arcpaylabs/arbitrum-cli",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "description": "Developer CLI for ArcPay Arbitrum contracts, x402, invoices, privacy intents, and MCP setup.",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "author": "Henry Sam Marfo <jasonneil4040@gmail.com>",
9
+ "homepage": "https://arcpay-arbitrum.vercel.app/docs/cli",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/ArcPayLabs/arcpay-arbitrum.git",
13
+ "directory": "apps/cli"
14
+ },
15
+ "bin": {
16
+ "arcpay-arbitrum": "arcpay-arbitrum.mjs"
17
+ },
18
+ "files": [
19
+ "README.md",
20
+ "arcpay-arbitrum.mjs",
21
+ "deployment.json"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "start": "node arcpay-arbitrum.mjs",
28
+ "pack:dry": "npm pack --dry-run"
29
+ },
30
+ "dependencies": {
31
+ "ethers": "^6.13.5"
32
+ },
33
+ "overrides": {
34
+ "ws": "^8.20.1"
35
+ }
36
+ }