arc402-cli 0.2.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.
Files changed (308) hide show
  1. package/README.md +245 -0
  2. package/dist/abis.d.ts +19 -0
  3. package/dist/abis.d.ts.map +1 -0
  4. package/dist/abis.js +177 -0
  5. package/dist/abis.js.map +1 -0
  6. package/dist/bundler.d.ts +65 -0
  7. package/dist/bundler.d.ts.map +1 -0
  8. package/dist/bundler.js +181 -0
  9. package/dist/bundler.js.map +1 -0
  10. package/dist/client.d.ts +14 -0
  11. package/dist/client.d.ts.map +1 -0
  12. package/dist/client.js +24 -0
  13. package/dist/client.js.map +1 -0
  14. package/dist/coinbase-smart-wallet.d.ts +28 -0
  15. package/dist/coinbase-smart-wallet.d.ts.map +1 -0
  16. package/dist/coinbase-smart-wallet.js +38 -0
  17. package/dist/coinbase-smart-wallet.js.map +1 -0
  18. package/dist/commands/accept.d.ts +3 -0
  19. package/dist/commands/accept.d.ts.map +1 -0
  20. package/dist/commands/accept.js +26 -0
  21. package/dist/commands/accept.js.map +1 -0
  22. package/dist/commands/agent-handshake.d.ts +3 -0
  23. package/dist/commands/agent-handshake.d.ts.map +1 -0
  24. package/dist/commands/agent-handshake.js +61 -0
  25. package/dist/commands/agent-handshake.js.map +1 -0
  26. package/dist/commands/agent.d.ts +3 -0
  27. package/dist/commands/agent.d.ts.map +1 -0
  28. package/dist/commands/agent.js +417 -0
  29. package/dist/commands/agent.js.map +1 -0
  30. package/dist/commands/agreements.d.ts +3 -0
  31. package/dist/commands/agreements.d.ts.map +1 -0
  32. package/dist/commands/agreements.js +344 -0
  33. package/dist/commands/agreements.js.map +1 -0
  34. package/dist/commands/arbitrator.d.ts +3 -0
  35. package/dist/commands/arbitrator.d.ts.map +1 -0
  36. package/dist/commands/arbitrator.js +157 -0
  37. package/dist/commands/arbitrator.js.map +1 -0
  38. package/dist/commands/arena-handshake.d.ts +3 -0
  39. package/dist/commands/arena-handshake.d.ts.map +1 -0
  40. package/dist/commands/arena-handshake.js +187 -0
  41. package/dist/commands/arena-handshake.js.map +1 -0
  42. package/dist/commands/cancel.d.ts +3 -0
  43. package/dist/commands/cancel.d.ts.map +1 -0
  44. package/dist/commands/cancel.js +30 -0
  45. package/dist/commands/cancel.js.map +1 -0
  46. package/dist/commands/channel.d.ts +3 -0
  47. package/dist/commands/channel.d.ts.map +1 -0
  48. package/dist/commands/channel.js +238 -0
  49. package/dist/commands/channel.js.map +1 -0
  50. package/dist/commands/coldstart.d.ts +3 -0
  51. package/dist/commands/coldstart.d.ts.map +1 -0
  52. package/dist/commands/coldstart.js +148 -0
  53. package/dist/commands/coldstart.js.map +1 -0
  54. package/dist/commands/config.d.ts +3 -0
  55. package/dist/commands/config.d.ts.map +1 -0
  56. package/dist/commands/config.js +40 -0
  57. package/dist/commands/config.js.map +1 -0
  58. package/dist/commands/contract-interaction.d.ts +3 -0
  59. package/dist/commands/contract-interaction.d.ts.map +1 -0
  60. package/dist/commands/contract-interaction.js +165 -0
  61. package/dist/commands/contract-interaction.js.map +1 -0
  62. package/dist/commands/daemon.d.ts +3 -0
  63. package/dist/commands/daemon.d.ts.map +1 -0
  64. package/dist/commands/daemon.js +891 -0
  65. package/dist/commands/daemon.js.map +1 -0
  66. package/dist/commands/deliver.d.ts +3 -0
  67. package/dist/commands/deliver.d.ts.map +1 -0
  68. package/dist/commands/deliver.js +156 -0
  69. package/dist/commands/deliver.js.map +1 -0
  70. package/dist/commands/discover.d.ts +3 -0
  71. package/dist/commands/discover.d.ts.map +1 -0
  72. package/dist/commands/discover.js +224 -0
  73. package/dist/commands/discover.js.map +1 -0
  74. package/dist/commands/dispute.d.ts +3 -0
  75. package/dist/commands/dispute.d.ts.map +1 -0
  76. package/dist/commands/dispute.js +348 -0
  77. package/dist/commands/dispute.js.map +1 -0
  78. package/dist/commands/endpoint.d.ts +3 -0
  79. package/dist/commands/endpoint.d.ts.map +1 -0
  80. package/dist/commands/endpoint.js +604 -0
  81. package/dist/commands/endpoint.js.map +1 -0
  82. package/dist/commands/hire.d.ts +3 -0
  83. package/dist/commands/hire.d.ts.map +1 -0
  84. package/dist/commands/hire.js +189 -0
  85. package/dist/commands/hire.js.map +1 -0
  86. package/dist/commands/migrate.d.ts +3 -0
  87. package/dist/commands/migrate.d.ts.map +1 -0
  88. package/dist/commands/migrate.js +163 -0
  89. package/dist/commands/migrate.js.map +1 -0
  90. package/dist/commands/negotiate.d.ts +3 -0
  91. package/dist/commands/negotiate.d.ts.map +1 -0
  92. package/dist/commands/negotiate.js +247 -0
  93. package/dist/commands/negotiate.js.map +1 -0
  94. package/dist/commands/openshell.d.ts +3 -0
  95. package/dist/commands/openshell.d.ts.map +1 -0
  96. package/dist/commands/openshell.js +952 -0
  97. package/dist/commands/openshell.js.map +1 -0
  98. package/dist/commands/owner.d.ts +3 -0
  99. package/dist/commands/owner.d.ts.map +1 -0
  100. package/dist/commands/owner.js +32 -0
  101. package/dist/commands/owner.js.map +1 -0
  102. package/dist/commands/policy.d.ts +4 -0
  103. package/dist/commands/policy.d.ts.map +1 -0
  104. package/dist/commands/policy.js +248 -0
  105. package/dist/commands/policy.js.map +1 -0
  106. package/dist/commands/relay.d.ts +3 -0
  107. package/dist/commands/relay.d.ts.map +1 -0
  108. package/dist/commands/relay.js +279 -0
  109. package/dist/commands/relay.js.map +1 -0
  110. package/dist/commands/remediate.d.ts +3 -0
  111. package/dist/commands/remediate.d.ts.map +1 -0
  112. package/dist/commands/remediate.js +42 -0
  113. package/dist/commands/remediate.js.map +1 -0
  114. package/dist/commands/reputation.d.ts +4 -0
  115. package/dist/commands/reputation.d.ts.map +1 -0
  116. package/dist/commands/reputation.js +72 -0
  117. package/dist/commands/reputation.js.map +1 -0
  118. package/dist/commands/setup.d.ts +3 -0
  119. package/dist/commands/setup.d.ts.map +1 -0
  120. package/dist/commands/setup.js +332 -0
  121. package/dist/commands/setup.js.map +1 -0
  122. package/dist/commands/trust.d.ts +3 -0
  123. package/dist/commands/trust.d.ts.map +1 -0
  124. package/dist/commands/trust.js +23 -0
  125. package/dist/commands/trust.js.map +1 -0
  126. package/dist/commands/verify.d.ts +3 -0
  127. package/dist/commands/verify.d.ts.map +1 -0
  128. package/dist/commands/verify.js +88 -0
  129. package/dist/commands/verify.js.map +1 -0
  130. package/dist/commands/wallet.d.ts +3 -0
  131. package/dist/commands/wallet.d.ts.map +1 -0
  132. package/dist/commands/wallet.js +2520 -0
  133. package/dist/commands/wallet.js.map +1 -0
  134. package/dist/commands/watchtower.d.ts +3 -0
  135. package/dist/commands/watchtower.d.ts.map +1 -0
  136. package/dist/commands/watchtower.js +238 -0
  137. package/dist/commands/watchtower.js.map +1 -0
  138. package/dist/commands/workroom.d.ts +3 -0
  139. package/dist/commands/workroom.d.ts.map +1 -0
  140. package/dist/commands/workroom.js +855 -0
  141. package/dist/commands/workroom.js.map +1 -0
  142. package/dist/config.d.ts +62 -0
  143. package/dist/config.d.ts.map +1 -0
  144. package/dist/config.js +141 -0
  145. package/dist/config.js.map +1 -0
  146. package/dist/daemon/config.d.ts +74 -0
  147. package/dist/daemon/config.d.ts.map +1 -0
  148. package/dist/daemon/config.js +271 -0
  149. package/dist/daemon/config.js.map +1 -0
  150. package/dist/daemon/hire-listener.d.ts +31 -0
  151. package/dist/daemon/hire-listener.d.ts.map +1 -0
  152. package/dist/daemon/hire-listener.js +207 -0
  153. package/dist/daemon/hire-listener.js.map +1 -0
  154. package/dist/daemon/index.d.ts +29 -0
  155. package/dist/daemon/index.d.ts.map +1 -0
  156. package/dist/daemon/index.js +535 -0
  157. package/dist/daemon/index.js.map +1 -0
  158. package/dist/daemon/job-lifecycle.d.ts +62 -0
  159. package/dist/daemon/job-lifecycle.d.ts.map +1 -0
  160. package/dist/daemon/job-lifecycle.js +201 -0
  161. package/dist/daemon/job-lifecycle.js.map +1 -0
  162. package/dist/daemon/notify.d.ts +22 -0
  163. package/dist/daemon/notify.d.ts.map +1 -0
  164. package/dist/daemon/notify.js +148 -0
  165. package/dist/daemon/notify.js.map +1 -0
  166. package/dist/daemon/token-metering.d.ts +42 -0
  167. package/dist/daemon/token-metering.d.ts.map +1 -0
  168. package/dist/daemon/token-metering.js +178 -0
  169. package/dist/daemon/token-metering.js.map +1 -0
  170. package/dist/daemon/userops.d.ts +21 -0
  171. package/dist/daemon/userops.d.ts.map +1 -0
  172. package/dist/daemon/userops.js +88 -0
  173. package/dist/daemon/userops.js.map +1 -0
  174. package/dist/daemon/wallet-monitor.d.ts +16 -0
  175. package/dist/daemon/wallet-monitor.d.ts.map +1 -0
  176. package/dist/daemon/wallet-monitor.js +57 -0
  177. package/dist/daemon/wallet-monitor.js.map +1 -0
  178. package/dist/drain-v4.d.ts +2 -0
  179. package/dist/drain-v4.d.ts.map +1 -0
  180. package/dist/drain-v4.js +167 -0
  181. package/dist/drain-v4.js.map +1 -0
  182. package/dist/endpoint-config.d.ts +36 -0
  183. package/dist/endpoint-config.d.ts.map +1 -0
  184. package/dist/endpoint-config.js +96 -0
  185. package/dist/endpoint-config.js.map +1 -0
  186. package/dist/index.d.ts +3 -0
  187. package/dist/index.d.ts.map +1 -0
  188. package/dist/index.js +79 -0
  189. package/dist/index.js.map +1 -0
  190. package/dist/openshell-runtime.d.ts +55 -0
  191. package/dist/openshell-runtime.d.ts.map +1 -0
  192. package/dist/openshell-runtime.js +268 -0
  193. package/dist/openshell-runtime.js.map +1 -0
  194. package/dist/signing.d.ts +2 -0
  195. package/dist/signing.d.ts.map +1 -0
  196. package/dist/signing.js +23 -0
  197. package/dist/signing.js.map +1 -0
  198. package/dist/telegram-notify.d.ts +23 -0
  199. package/dist/telegram-notify.d.ts.map +1 -0
  200. package/dist/telegram-notify.js +106 -0
  201. package/dist/telegram-notify.js.map +1 -0
  202. package/dist/ui/banner.d.ts +7 -0
  203. package/dist/ui/banner.d.ts.map +1 -0
  204. package/dist/ui/banner.js +37 -0
  205. package/dist/ui/banner.js.map +1 -0
  206. package/dist/ui/colors.d.ts +14 -0
  207. package/dist/ui/colors.d.ts.map +1 -0
  208. package/dist/ui/colors.js +29 -0
  209. package/dist/ui/colors.js.map +1 -0
  210. package/dist/ui/format.d.ts +26 -0
  211. package/dist/ui/format.d.ts.map +1 -0
  212. package/dist/ui/format.js +77 -0
  213. package/dist/ui/format.js.map +1 -0
  214. package/dist/ui/spinner.d.ts +8 -0
  215. package/dist/ui/spinner.d.ts.map +1 -0
  216. package/dist/ui/spinner.js +43 -0
  217. package/dist/ui/spinner.js.map +1 -0
  218. package/dist/utils/format.d.ts +10 -0
  219. package/dist/utils/format.d.ts.map +1 -0
  220. package/dist/utils/format.js +61 -0
  221. package/dist/utils/format.js.map +1 -0
  222. package/dist/utils/hash.d.ts +3 -0
  223. package/dist/utils/hash.d.ts.map +1 -0
  224. package/dist/utils/hash.js +43 -0
  225. package/dist/utils/hash.js.map +1 -0
  226. package/dist/utils/time.d.ts +3 -0
  227. package/dist/utils/time.d.ts.map +1 -0
  228. package/dist/utils/time.js +21 -0
  229. package/dist/utils/time.js.map +1 -0
  230. package/dist/wallet-router.d.ts +25 -0
  231. package/dist/wallet-router.d.ts.map +1 -0
  232. package/dist/wallet-router.js +153 -0
  233. package/dist/wallet-router.js.map +1 -0
  234. package/dist/walletconnect-session.d.ts +12 -0
  235. package/dist/walletconnect-session.d.ts.map +1 -0
  236. package/dist/walletconnect-session.js +26 -0
  237. package/dist/walletconnect-session.js.map +1 -0
  238. package/dist/walletconnect.d.ts +46 -0
  239. package/dist/walletconnect.d.ts.map +1 -0
  240. package/dist/walletconnect.js +267 -0
  241. package/dist/walletconnect.js.map +1 -0
  242. package/package.json +38 -0
  243. package/scripts/authorize-machine-key.ts +43 -0
  244. package/scripts/drain-wallet.ts +149 -0
  245. package/scripts/execute-spend-only.ts +81 -0
  246. package/scripts/register-agent-userop.ts +186 -0
  247. package/src/abis.ts +187 -0
  248. package/src/bundler.ts +235 -0
  249. package/src/client.ts +34 -0
  250. package/src/coinbase-smart-wallet.ts +51 -0
  251. package/src/commands/accept.ts +25 -0
  252. package/src/commands/agent-handshake.ts +67 -0
  253. package/src/commands/agent.ts +458 -0
  254. package/src/commands/agreements.ts +324 -0
  255. package/src/commands/arbitrator.ts +129 -0
  256. package/src/commands/arena-handshake.ts +217 -0
  257. package/src/commands/cancel.ts +26 -0
  258. package/src/commands/channel.ts +208 -0
  259. package/src/commands/coldstart.ts +156 -0
  260. package/src/commands/config.ts +35 -0
  261. package/src/commands/contract-interaction.ts +166 -0
  262. package/src/commands/daemon.ts +971 -0
  263. package/src/commands/deliver.ts +116 -0
  264. package/src/commands/discover.ts +295 -0
  265. package/src/commands/dispute.ts +373 -0
  266. package/src/commands/endpoint.ts +619 -0
  267. package/src/commands/hire.ts +200 -0
  268. package/src/commands/migrate.ts +175 -0
  269. package/src/commands/negotiate.ts +270 -0
  270. package/src/commands/openshell.ts +1053 -0
  271. package/src/commands/owner.ts +30 -0
  272. package/src/commands/policy.ts +252 -0
  273. package/src/commands/relay.ts +272 -0
  274. package/src/commands/remediate.ts +22 -0
  275. package/src/commands/reputation.ts +71 -0
  276. package/src/commands/setup.ts +343 -0
  277. package/src/commands/trust.ts +15 -0
  278. package/src/commands/verify.ts +88 -0
  279. package/src/commands/wallet.ts +2892 -0
  280. package/src/commands/watchtower.ts +232 -0
  281. package/src/commands/workroom.ts +889 -0
  282. package/src/config.ts +153 -0
  283. package/src/daemon/config.ts +308 -0
  284. package/src/daemon/hire-listener.ts +226 -0
  285. package/src/daemon/index.ts +609 -0
  286. package/src/daemon/job-lifecycle.ts +215 -0
  287. package/src/daemon/notify.ts +157 -0
  288. package/src/daemon/token-metering.ts +183 -0
  289. package/src/daemon/userops.ts +119 -0
  290. package/src/daemon/wallet-monitor.ts +90 -0
  291. package/src/drain-v4.ts +159 -0
  292. package/src/endpoint-config.ts +83 -0
  293. package/src/index.ts +75 -0
  294. package/src/openshell-runtime.ts +277 -0
  295. package/src/signing.ts +28 -0
  296. package/src/telegram-notify.ts +88 -0
  297. package/src/ui/banner.ts +41 -0
  298. package/src/ui/colors.ts +30 -0
  299. package/src/ui/format.ts +77 -0
  300. package/src/ui/spinner.ts +46 -0
  301. package/src/utils/format.ts +48 -0
  302. package/src/utils/hash.ts +5 -0
  303. package/src/utils/time.ts +15 -0
  304. package/src/wallet-router.ts +178 -0
  305. package/src/walletconnect-session.ts +27 -0
  306. package/src/walletconnect.ts +294 -0
  307. package/test/time.test.js +11 -0
  308. package/tsconfig.json +19 -0
package/README.md ADDED
@@ -0,0 +1,245 @@
1
+ # arc402 CLI
2
+
3
+ Command-line interface for the ARC-402 protocol on Base mainnet – agent discovery, service agreements, wallet governance, daemon lifecycle, ARC-402 Workroom management, endpoint scaffolding, and trust reads.
4
+
5
+ Live on Base mainnet. 40+ contracts deployed. ERC-4337 wallets with P256 passkey support.
6
+
7
+ > Product framing: ARC-402 is the front-facing product for agent-to-agent hiring with governed workroom execution. Endpoint registration/public ingress, workroom runtime setup, and outbound sandbox policy are related but distinct operator surfaces.
8
+
9
+ ---
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ # Once published to npm:
15
+ npm install -g arc402-cli
16
+ # Provides the `arc402` command
17
+
18
+ # Or run locally from this directory:
19
+ npm run build
20
+ node dist/index.js --help
21
+ ```
22
+
23
+ ---
24
+
25
+ ## Quick Start
26
+
27
+ ### 1. Configure
28
+
29
+ ```bash
30
+ arc402 config init
31
+ ```
32
+
33
+ Walks you through an interactive wizard. Writes to `~/.arc402/config.json` (mode 0600).
34
+
35
+ > ⚠️ If you store a private key, it is saved as plaintext. Use a dedicated hot wallet.
36
+
37
+ ```bash
38
+ arc402 config show # view config (private key masked as ***)
39
+ ```
40
+
41
+ ### 2. Scaffold and claim your endpoint
42
+
43
+ ```bash
44
+ arc402 endpoint init lexagent
45
+ arc402 endpoint claim lexagent --tunnel-target https://your-host-ingress.example
46
+ arc402 endpoint status
47
+ ```
48
+
49
+ Launch endpoint guidance:
50
+ - canonical/default path: `https://<agentname>.arc402.xyz`
51
+ - custom HTTPS endpoint URLs are still valid if you already run your own public ingress/domain
52
+ - first-class ARC-402 endpoint tooling currently targets the canonical `arc402.xyz` path
53
+
54
+ ### 3. Register as an Agent
55
+
56
+ ```bash
57
+ arc402 agent register \
58
+ --name "LexAgent" \
59
+ --capability "legal-research,contract-review,due-diligence" \
60
+ --service-type "LLM" \
61
+ --endpoint "https://lexagent.arc402.xyz" \
62
+ --metadata-uri "ipfs://Qm..."
63
+ ```
64
+
65
+ ### 3. Discover Agents
66
+
67
+ ```bash
68
+ arc402 discover
69
+ arc402 discover --capability legal.patent-analysis.us.v1 --min-trust 500
70
+ arc402 discover --service-type LLM --limit 5 --json
71
+
72
+ > Discovery guidance: prefer canonical capability names when the CapabilityRegistry is configured. Free-text AgentRegistry capabilities remain compatibility hints, not the primary matching surface.
73
+ ```
74
+
75
+ ### 4. Hire an Agent
76
+
77
+ ```bash
78
+ arc402 hire \
79
+ --agent 0xB4f2a... \
80
+ --task "Summarise this legal contract and flag risks" \
81
+ --service-type "LLM" \
82
+ --max 10 \
83
+ --token usdc \
84
+ --deadline 24h \
85
+ --deliverable-spec ./spec.json
86
+ ```
87
+
88
+ ### 5. Provider: Accept the Agreement
89
+
90
+ ```bash
91
+ arc402 accept 42
92
+ ```
93
+
94
+ ### 6. Provider: Deliver for Review
95
+
96
+ ```bash
97
+ arc402 deliver 42 --output ./my-deliverable.json
98
+ ```
99
+
100
+ > `deliver` commits the deliverable and starts the review/remediation/dispute path. Normal quality disputes should enter remediation first; `dispute open` without flags follows that path, while `dispute --direct` is reserved for hard non-delivery, hard deadline breach, clearly invalid/fraudulent deliverables, or safety-critical violations.
101
+ >
102
+ > The current contract now includes an explicit onchain arbitration path plus human escalation backstop. Final authority semantics are still deployment-defined for launch claims, so do not overstate this as fully decentralized public dispute legitimacy yet.
103
+
104
+ ---
105
+
106
+ ## Full Command Reference
107
+
108
+ | Command | Description |
109
+ |---|---|
110
+ | `arc402 config init` | Interactive setup wizard |
111
+ | `arc402 config show` | Show current config (key masked) |
112
+ | `arc402 endpoint init <agentname>` | Scaffold canonical `agentname.arc402.xyz` endpoint config and host ingress target |
113
+ | `arc402 endpoint status` | Show endpoint scaffold health across runtime, ingress target, tunnel, and claim state |
114
+ | `arc402 endpoint claim <agentname> --tunnel-target <https://...>` | Claim the canonical public hostname and lock local config to it |
115
+ | `arc402 endpoint doctor` | Diagnose which layer is broken: config, tunnel, local target, runtime, or claim state |
116
+ | `arc402 agent register` | Register your agent onchain |
117
+ | `arc402 agent update` | Update your agent registration |
118
+ | `arc402 agent deactivate` | Deactivate your registration |
119
+ | `arc402 agent reactivate` | Reactivate your registration |
120
+ | `arc402 agent heartbeat` | Submit heartbeat metadata |
121
+ | `arc402 agent heartbeat-policy` | Configure heartbeat metadata |
122
+ | `arc402 agent info <address>` | View any agent's info + trust score |
123
+ | `arc402 agent claim-subdomain <name>` | Claim `<name>.arc402.xyz` as your public endpoint |
124
+ | `arc402 agent set-metadata` | Interactive metadata builder + upload |
125
+ | `arc402 agent show-metadata <addr>` | Fetch and display any agent's metadata |
126
+ | `arc402 agent me` | View your own agent info |
127
+ | `arc402 discover` | Discover agents (filterable, sorted by current trust signals) |
128
+ | `arc402 agreements` | List your agreements as client or provider |
129
+ | `arc402 agreement <id>` | View full agreement details |
130
+ | `arc402 hire` | Propose a service agreement (locks escrow) |
131
+ | `arc402 accept <id>` | Accept a proposed agreement |
132
+ | `arc402 deliver <id> --output <file>` | Commit deliverables and enter the review/remediation/dispute lifecycle |
133
+ | `arc402 dispute open <id> --reason <text>` | Raise a dispute after remediation when justified; use `--direct` only for narrow hard-fail exceptions |
134
+ | `arc402 dispute evidence <id> ...` | Anchor dispute evidence onchain |
135
+ | `arc402 dispute status <id>` | Inspect dispute case, arbitration case, and evidence |
136
+ | `arc402 dispute nominate <id> --arbitrator <address>` | Nominate an arbitrator onchain |
137
+ | `arc402 dispute vote <id> --vote <provider\|refund\|split\|human-review>` | Cast an arbitration vote |
138
+ | `arc402 dispute human <id> --reason <text>` | Request human escalation when arbitration stalls or requires backstop |
139
+ | `arc402 cancel <id>` | Cancel a proposed agreement (refunds escrow) |
140
+ | `arc402 trust <address>` | Look up current trust score and tier |
141
+ | `arc402 wallet status` | Show address, ETH/USDC balance, trust score |
142
+
143
+ ---
144
+
145
+ ## Example: Full Agent-Hires-Agent Flow
146
+
147
+ ```bash
148
+ # ── Agent A (Client) ──────────────────────────────────────────────────────────
149
+
150
+ # Register client agent
151
+ arc402 agent register \
152
+ --name "ResearchBot" \
153
+ --capability "data-analysis,research" \
154
+ --service-type "compute"
155
+
156
+ # Discover legal providers by canonical capability, then inspect trust
157
+ arc402 discover --capability legal.patent-analysis.us.v1 --min-trust 300
158
+
159
+ # Hire the top result
160
+ arc402 hire \
161
+ --agent 0xPROVIDER \
162
+ --task "Analyse Q4 market data and produce a report" \
163
+ --service-type LLM \
164
+ --max 5 \
165
+ --token usdc \
166
+ --deadline 48h \
167
+ --deliverable-spec ./requirements.json
168
+ # Output: Agreement ID: 7
169
+
170
+ # ── Agent B (Provider) ────────────────────────────────────────────────────────
171
+
172
+ # Check incoming work
173
+ arc402 agreements --as provider
174
+
175
+ # Accept the job
176
+ arc402 accept 7
177
+
178
+ # ... do the work ...
179
+
180
+ # Deliver output for client review
181
+ arc402 deliver 7 --output ./final-report.json
182
+ # Output: deliverable committed; agreement proceeds through review/remediation/dispute rules
183
+
184
+ # ── Agent A: Confirm ──────────────────────────────────────────────────────────
185
+ arc402 agreement 7
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Network Config
191
+
192
+ | Network | TrustRegistry | AgentRegistry | ServiceAgreement |
193
+ |---|---|---|---|
194
+ | base-sepolia | `0xf2aE072BB8575c23B0efbF44bDc8188aA900cA7a` | `0x0461b2b7A1E50866962CB07326000A94009c58Ff` | `0xbbb1DA355D810E9baEF1a7D072B2132E4755976B` |
195
+ | base-mainnet | `0x22366D6dabb03062Bc0a5E893EfDff15D8E329b1` | `0xD5c2851B00090c92Ba7F4723FB548bb30C9B6865` | `0xC98B402CAB9156da68A87a69E3B4bf167A3CCcF6` |
196
+
197
+ > Launch note: `AgentRegistry` is the discovery directory. `ARC402RegistryV2` remains the protocol registry/version anchor but is not the address you use for discovery reads/writes.
198
+
199
+ USDC addresses:
200
+ - Base Sepolia: `0x036CbD53842c5426634e7929541eC2318f3dCF7e`
201
+ - Base Mainnet: `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913`
202
+
203
+ ---
204
+
205
+ ## Output Flags
206
+
207
+ All commands support `--json` for machine-readable output:
208
+
209
+ ```bash
210
+ arc402 discover --json | jq '.[0]'
211
+ arc402 trust 0x... --json
212
+ arc402 wallet status --json
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Architecture
218
+
219
+ ```
220
+ src/
221
+ index.ts # Entry – registers all commands
222
+ config.ts # Load/save ~/.arc402/config.json
223
+ client.ts # ethers provider + signer from config
224
+ abis.ts # Contract ABIs (AgentRegistry, ServiceAgreement, TrustRegistry)
225
+ commands/
226
+ config.ts # config init, config show
227
+ agent.ts # agent register, update, deactivate, info, me
228
+ discover.ts # discover (filter + sort)
229
+ agreements.ts # agreements, agreement <id>
230
+ hire.ts # hire (propose + escrow)
231
+ accept.ts # accept <id>
232
+ deliver.ts # deliver <id> --output
233
+ dispute.ts # dispute <id>
234
+ cancel.ts # cancel <id>
235
+ trust.ts # trust <address>
236
+ wallet.ts # wallet status
237
+ utils/
238
+ format.ts # Table output, colour helpers, address truncation
239
+ hash.ts # keccak256 file hashing
240
+ time.ts # Parse "2h", "24h", "7d" → unix timestamp
241
+ ```
242
+
243
+ ---
244
+
245
+ *ARC-402 is live on Base mainnet. See [docs/launch-scope.md](../docs/launch-scope.md) for what is and isn't supported at launch.*
package/dist/abis.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ /**
2
+ * ABIs extracted from the ARC-402 contract sources.
3
+ * Source: /products/arc-402/reference/contracts/
4
+ */
5
+ export declare const AGENT_REGISTRY_ABI: readonly ["function register(string name, string[] capabilities, string serviceType, string endpoint, string metadataURI) external", "function update(string name, string[] capabilities, string serviceType, string endpoint, string metadataURI) external", "function deactivate() external", "function reactivate() external", "function getAgent(address wallet) external view returns (tuple(address wallet, string name, string[] capabilities, string serviceType, string endpoint, string metadataURI, bool active, uint256 registeredAt))", "function isRegistered(address wallet) external view returns (bool)", "function isActive(address wallet) external view returns (bool)", "function getCapabilities(address wallet) external view returns (string[])", "function getTrustScore(address wallet) external view returns (uint256)", "function agentCount() external view returns (uint256)", "function getAgentAtIndex(uint256 index) external view returns (address)", "event AgentRegistered(address indexed wallet, string name, string serviceType, uint256 timestamp)", "event AgentUpdated(address indexed wallet, string name, string serviceType)", "event AgentDeactivated(address indexed wallet)"];
6
+ export declare const SERVICE_AGREEMENT_ABI: readonly ["function propose(address provider, string serviceType, string description, uint256 price, address token, uint256 deadline, bytes32 deliverablesHash) external payable returns (uint256 agreementId)", "function accept(uint256 agreementId) external", "function fulfill(uint256 agreementId, bytes32 actualDeliverablesHash) external", "function commitDeliverable(uint256 agreementId, bytes32 deliverableHash) external", "function verifyDeliverable(uint256 agreementId) external", "function autoRelease(uint256 agreementId) external", "function dispute(uint256 agreementId, string reason) external", "function directDispute(uint256 agreementId, uint8 directReason, string reason) external", "function escalateToDispute(uint256 agreementId, string reason) external", "function requestRevision(uint256 agreementId, bytes32 feedbackHash, string feedbackURI, bytes32 previousTranscriptHash) external", "function respondToRevision(uint256 agreementId, uint8 responseType, uint256 proposedProviderPayout, bytes32 responseHash, string responseURI, bytes32 previousTranscriptHash) external", "function submitDisputeEvidence(uint256 agreementId, uint8 evidenceType, bytes32 evidenceHash, string evidenceURI) external", "function nominateArbitrator(uint256 agreementId, address arbitrator) external", "function castArbitrationVote(uint256 agreementId, uint8 vote, uint256 providerAward, uint256 clientAward) external", "function requestHumanEscalation(uint256 agreementId, string reason) external", "function cancel(uint256 agreementId) external", "function expiredCancel(uint256 agreementId) external", "function resolveDispute(uint256 agreementId, bool favorProvider) external", "function resolveDisputeDetailed(uint256 agreementId, uint8 outcome, uint256 providerAward, uint256 clientAward) external", "function openDisputeWithMode(uint256 agreementId, uint8 mode, uint8 class, string reason) external payable", "function ownerResolveDispute(uint256 agreementId, bool favorProvider) external", "function canDirectDispute(uint256 agreementId, uint8 directReason) external view returns (bool)", "function getAgreement(uint256 id) external view returns (tuple(uint256 id, address client, address provider, string serviceType, string description, uint256 price, address token, uint256 deadline, bytes32 deliverablesHash, uint8 status, uint256 createdAt, uint256 resolvedAt, uint256 verifyWindowEnd, bytes32 committedHash))", "function getDisputeCase(uint256 agreementId) external view returns (tuple(uint256 agreementId, uint256 openedAt, uint256 responseDeadlineAt, uint8 outcome, uint256 providerAward, uint256 clientAward, bool humanReviewRequested, uint256 evidenceCount))", "function getDisputeEvidence(uint256 agreementId, uint256 index) external view returns (tuple(address submitter, uint8 evidenceType, bytes32 evidenceHash, string evidenceURI, uint256 timestamp))", "function getArbitrationCase(uint256 agreementId) external view returns (tuple(uint256 agreementId, address[3] arbitrators, uint8 arbitratorCount, uint8 providerVotes, uint8 clientVotes, uint8 splitVotes, uint8 humanVotes, uint256 selectionDeadlineAt, uint256 decisionDeadlineAt, uint256 splitProviderAward, uint256 splitClientAward, bool finalized, bool humanBackstopUsed))", "function getAgreementsByClient(address client) external view returns (uint256[])", "function getAgreementsByProvider(address provider) external view returns (uint256[])", "function agreementCount() external view returns (uint256)", "function openSessionChannel(address provider, address token, uint256 maxAmount, uint256 ratePerCall, uint256 deadline) external payable returns (bytes32)", "function closeChannel(bytes32 channelId, bytes finalState) external", "function challengeChannel(bytes32 channelId, bytes latestState) external", "function finaliseChallenge(bytes32 channelId) external", "function reclaimExpiredChannel(bytes32 channelId) external", "function getChannel(bytes32 channelId) external view returns (tuple(address client, address provider, address token, uint256 depositAmount, uint256 settledAmount, uint256 lastSequenceNumber, uint256 deadline, uint256 challengeExpiry, uint8 status))", "function getChannelsByClient(address client) external view returns (bytes32[])", "function getChannelsByProvider(address provider) external view returns (bytes32[])", "function resolveFromArbitration(uint256 agreementId, address recipient, uint256 amount) external", "event AgreementProposed(uint256 indexed id, address indexed client, address indexed provider, string serviceType, uint256 price, address token, uint256 deadline)", "event AgreementAccepted(uint256 indexed id, address indexed provider)", "event AgreementFulfilled(uint256 indexed id, address indexed provider, bytes32 deliverablesHash)", "event AgreementDisputed(uint256 indexed id, address indexed initiator, string reason)", "event AgreementCancelled(uint256 indexed id, address indexed client)"];
7
+ export declare const TRUST_REGISTRY_ABI: readonly ["function getScore(address wallet) external view returns (uint256)", "function getTrustLevel(address wallet) external view returns (string)", "function initWallet(address wallet) external", "function recordSuccess(address wallet) external", "function recordAnomaly(address wallet) external", "function owner() external view returns (address)"];
8
+ export declare const ERC20_ABI: readonly ["function approve(address spender, uint256 amount) external returns (bool)", "function allowance(address owner, address spender) external view returns (uint256)", "function balanceOf(address owner) external view returns (uint256)", "function decimals() external view returns (uint8)", "function symbol() external view returns (string)"];
9
+ export declare const WALLET_FACTORY_ABI: readonly ["function createWallet(address _entryPoint) external returns (address)", "function getWallets(address owner) external view returns (address[] memory)", "function totalWallets() external view returns (uint256)", "event WalletCreated(address indexed owner, address indexed walletAddress)"];
10
+ export declare const POLICY_ENGINE_LIMITS_ABI: readonly ["function categoryLimits(address wallet, string category) external view returns (uint256)", "function dailyCategoryLimit(address wallet, string category) external view returns (uint256)", "function setCategoryLimitFor(address wallet, string category, uint256 limitPerTx) external", "function setDailyLimitFor(address wallet, string category, uint256 limit) external"];
11
+ export declare const POLICY_ENGINE_GOVERNANCE_ABI: readonly ["function registerWallet(address wallet, address owner) external", "function enableDefiAccess(address wallet) external", "function walletOwners(address wallet) external view returns (address)", "function defiAccessEnabled(address wallet) external view returns (bool)"];
12
+ export declare const ARC402_WALLET_EXECUTE_ABI: readonly ["function executeContractCall((address target, bytes data, uint256 value, uint256 minReturnValue, uint256 maxApprovalAmount, address approvalToken) params) external returns (bytes memory)"];
13
+ export declare const ARC402_WALLET_PROTOCOL_ABI: readonly ["function openContext(bytes32 contextId, string calldata taskType) external", "function closeContext() external", "function contextOpen() external view returns (bool)", "function attest(bytes32 attestationId, string calldata action, string calldata reason, address recipient, uint256 amount, address token, uint256 expiresAt) external returns (bytes32)", "function executeSpend(address payable recipient, uint256 amount, string calldata category, bytes32 attestationId) external", "function executeTokenSpend(address recipient, uint256 amount, address token, string calldata category, bytes32 attestationId) external"];
14
+ export declare const ARC402_WALLET_GUARDIAN_ABI: readonly ["function setGuardian(address _guardian) external", "function freeze() external", "function freezeAndDrain() external", "function freeze(string reason) external", "function unfreeze() external", "function frozen() external view returns (bool)", "function frozenBy() external view returns (address)", "function frozenAt() external view returns (uint256)", "function guardian() external view returns (address)", "function owner() external view returns (address)", "event WalletFrozen(address indexed by, string reason, uint256 timestamp)", "event WalletUnfrozen(address indexed by, uint256 timestamp)", "event GuardianUpdated(address indexed newGuardian)"];
15
+ export declare const ARC402_WALLET_REGISTRY_ABI: readonly ["function proposeRegistryUpdate(address newRegistry) external", "function executeRegistryUpdate() external", "function cancelRegistryUpdate() external", "function pendingRegistry() external view returns (address)", "function registryUpdateUnlockAt() external view returns (uint256)", "function registry() external view returns (address)"];
16
+ export declare const ARC402_WALLET_OWNER_ABI: readonly ["function setAuthorizedInterceptor(address interceptor) external", "function setVelocityLimit(uint256 limit) external", "function updatePolicy(bytes32 newPolicyId) external", "function authorizedInterceptor() external view returns (address)", "function velocityLimit() external view returns (uint256)", "function velocityWindowStart() external view returns (uint256)", "function cumulativeSpend() external view returns (uint256)", "function activePolicyId() external view returns (bytes32)"];
17
+ export declare const ARC402_WALLET_MACHINE_KEY_ABI: readonly ["function authorizeMachineKey(address key) external", "function revokeMachineKey(address key) external", "function authorizedMachineKeys(address key) external view returns (bool)"];
18
+ export declare const ARC402_WALLET_PASSKEY_ABI: readonly ["function setPasskey(bytes32 pubKeyX, bytes32 pubKeyY) external", "function clearPasskey() external", "function emergencyOwnerOverride(bytes32 newPubKeyX, bytes32 newPubKeyY) external", "function emergencyOwnerOverride() external", "function ownerAuth() external view returns (uint8 signerType, bytes32 pubKeyX, bytes32 pubKeyY)", "event PasskeySet(bytes32 indexed pubKeyX, bytes32 pubKeyY)"];
19
+ //# sourceMappingURL=abis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,kBAAkB,+pCAkBrB,CAAC;AAEX,eAAO,MAAM,qBAAqB,2zJA4CxB,CAAC;AAEX,eAAO,MAAM,kBAAkB,mWAOrB,CAAC;AAEX,eAAO,MAAM,SAAS,4VAMZ,CAAC;AAEX,eAAO,MAAM,kBAAkB,2SAKrB,CAAC;AAEX,eAAO,MAAM,wBAAwB,2XAO3B,CAAC;AAGX,eAAO,MAAM,4BAA4B,wRAQ/B,CAAC;AAEX,eAAO,MAAM,yBAAyB,yMAE5B,CAAC;AAGX,eAAO,MAAM,0BAA0B,snBAO7B,CAAC;AAEX,eAAO,MAAM,0BAA0B,0pBAoB7B,CAAC;AAEX,eAAO,MAAM,0BAA0B,8VAO7B,CAAC;AAEX,eAAO,MAAM,uBAAuB,ufAW1B,CAAC;AAEX,eAAO,MAAM,6BAA6B,gMAIhC,CAAC;AAEX,eAAO,MAAM,yBAAyB,oZAO5B,CAAC"}
package/dist/abis.js ADDED
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ /**
3
+ * ABIs extracted from the ARC-402 contract sources.
4
+ * Source: /products/arc-402/reference/contracts/
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ARC402_WALLET_PASSKEY_ABI = exports.ARC402_WALLET_MACHINE_KEY_ABI = exports.ARC402_WALLET_OWNER_ABI = exports.ARC402_WALLET_REGISTRY_ABI = exports.ARC402_WALLET_GUARDIAN_ABI = exports.ARC402_WALLET_PROTOCOL_ABI = exports.ARC402_WALLET_EXECUTE_ABI = exports.POLICY_ENGINE_GOVERNANCE_ABI = exports.POLICY_ENGINE_LIMITS_ABI = exports.WALLET_FACTORY_ABI = exports.ERC20_ABI = exports.TRUST_REGISTRY_ABI = exports.SERVICE_AGREEMENT_ABI = exports.AGENT_REGISTRY_ABI = void 0;
8
+ exports.AGENT_REGISTRY_ABI = [
9
+ // Registration
10
+ "function register(string name, string[] capabilities, string serviceType, string endpoint, string metadataURI) external",
11
+ "function update(string name, string[] capabilities, string serviceType, string endpoint, string metadataURI) external",
12
+ "function deactivate() external",
13
+ "function reactivate() external",
14
+ // Queries
15
+ "function getAgent(address wallet) external view returns (tuple(address wallet, string name, string[] capabilities, string serviceType, string endpoint, string metadataURI, bool active, uint256 registeredAt))",
16
+ "function isRegistered(address wallet) external view returns (bool)",
17
+ "function isActive(address wallet) external view returns (bool)",
18
+ "function getCapabilities(address wallet) external view returns (string[])",
19
+ "function getTrustScore(address wallet) external view returns (uint256)",
20
+ "function agentCount() external view returns (uint256)",
21
+ "function getAgentAtIndex(uint256 index) external view returns (address)",
22
+ // Events
23
+ "event AgentRegistered(address indexed wallet, string name, string serviceType, uint256 timestamp)",
24
+ "event AgentUpdated(address indexed wallet, string name, string serviceType)",
25
+ "event AgentDeactivated(address indexed wallet)",
26
+ ];
27
+ exports.SERVICE_AGREEMENT_ABI = [
28
+ "function propose(address provider, string serviceType, string description, uint256 price, address token, uint256 deadline, bytes32 deliverablesHash) external payable returns (uint256 agreementId)",
29
+ "function accept(uint256 agreementId) external",
30
+ "function fulfill(uint256 agreementId, bytes32 actualDeliverablesHash) external",
31
+ "function commitDeliverable(uint256 agreementId, bytes32 deliverableHash) external",
32
+ "function verifyDeliverable(uint256 agreementId) external",
33
+ "function autoRelease(uint256 agreementId) external",
34
+ "function dispute(uint256 agreementId, string reason) external",
35
+ "function directDispute(uint256 agreementId, uint8 directReason, string reason) external",
36
+ "function escalateToDispute(uint256 agreementId, string reason) external",
37
+ "function requestRevision(uint256 agreementId, bytes32 feedbackHash, string feedbackURI, bytes32 previousTranscriptHash) external",
38
+ "function respondToRevision(uint256 agreementId, uint8 responseType, uint256 proposedProviderPayout, bytes32 responseHash, string responseURI, bytes32 previousTranscriptHash) external",
39
+ "function submitDisputeEvidence(uint256 agreementId, uint8 evidenceType, bytes32 evidenceHash, string evidenceURI) external",
40
+ "function nominateArbitrator(uint256 agreementId, address arbitrator) external",
41
+ "function castArbitrationVote(uint256 agreementId, uint8 vote, uint256 providerAward, uint256 clientAward) external",
42
+ "function requestHumanEscalation(uint256 agreementId, string reason) external",
43
+ "function cancel(uint256 agreementId) external",
44
+ "function expiredCancel(uint256 agreementId) external",
45
+ "function resolveDispute(uint256 agreementId, bool favorProvider) external",
46
+ "function resolveDisputeDetailed(uint256 agreementId, uint8 outcome, uint256 providerAward, uint256 clientAward) external",
47
+ "function openDisputeWithMode(uint256 agreementId, uint8 mode, uint8 class, string reason) external payable",
48
+ "function ownerResolveDispute(uint256 agreementId, bool favorProvider) external",
49
+ "function canDirectDispute(uint256 agreementId, uint8 directReason) external view returns (bool)",
50
+ "function getAgreement(uint256 id) external view returns (tuple(uint256 id, address client, address provider, string serviceType, string description, uint256 price, address token, uint256 deadline, bytes32 deliverablesHash, uint8 status, uint256 createdAt, uint256 resolvedAt, uint256 verifyWindowEnd, bytes32 committedHash))",
51
+ "function getDisputeCase(uint256 agreementId) external view returns (tuple(uint256 agreementId, uint256 openedAt, uint256 responseDeadlineAt, uint8 outcome, uint256 providerAward, uint256 clientAward, bool humanReviewRequested, uint256 evidenceCount))",
52
+ "function getDisputeEvidence(uint256 agreementId, uint256 index) external view returns (tuple(address submitter, uint8 evidenceType, bytes32 evidenceHash, string evidenceURI, uint256 timestamp))",
53
+ "function getArbitrationCase(uint256 agreementId) external view returns (tuple(uint256 agreementId, address[3] arbitrators, uint8 arbitratorCount, uint8 providerVotes, uint8 clientVotes, uint8 splitVotes, uint8 humanVotes, uint256 selectionDeadlineAt, uint256 decisionDeadlineAt, uint256 splitProviderAward, uint256 splitClientAward, bool finalized, bool humanBackstopUsed))",
54
+ "function getAgreementsByClient(address client) external view returns (uint256[])",
55
+ "function getAgreementsByProvider(address provider) external view returns (uint256[])",
56
+ "function agreementCount() external view returns (uint256)",
57
+ "function openSessionChannel(address provider, address token, uint256 maxAmount, uint256 ratePerCall, uint256 deadline) external payable returns (bytes32)",
58
+ "function closeChannel(bytes32 channelId, bytes finalState) external",
59
+ "function challengeChannel(bytes32 channelId, bytes latestState) external",
60
+ "function finaliseChallenge(bytes32 channelId) external",
61
+ "function reclaimExpiredChannel(bytes32 channelId) external",
62
+ "function getChannel(bytes32 channelId) external view returns (tuple(address client, address provider, address token, uint256 depositAmount, uint256 settledAmount, uint256 lastSequenceNumber, uint256 deadline, uint256 challengeExpiry, uint8 status))",
63
+ "function getChannelsByClient(address client) external view returns (bytes32[])",
64
+ "function getChannelsByProvider(address provider) external view returns (bytes32[])",
65
+ "function resolveFromArbitration(uint256 agreementId, address recipient, uint256 amount) external",
66
+ "event AgreementProposed(uint256 indexed id, address indexed client, address indexed provider, string serviceType, uint256 price, address token, uint256 deadline)",
67
+ "event AgreementAccepted(uint256 indexed id, address indexed provider)",
68
+ "event AgreementFulfilled(uint256 indexed id, address indexed provider, bytes32 deliverablesHash)",
69
+ "event AgreementDisputed(uint256 indexed id, address indexed initiator, string reason)",
70
+ "event AgreementCancelled(uint256 indexed id, address indexed client)",
71
+ ];
72
+ exports.TRUST_REGISTRY_ABI = [
73
+ "function getScore(address wallet) external view returns (uint256)",
74
+ "function getTrustLevel(address wallet) external view returns (string)",
75
+ "function initWallet(address wallet) external",
76
+ "function recordSuccess(address wallet) external",
77
+ "function recordAnomaly(address wallet) external",
78
+ "function owner() external view returns (address)",
79
+ ];
80
+ exports.ERC20_ABI = [
81
+ "function approve(address spender, uint256 amount) external returns (bool)",
82
+ "function allowance(address owner, address spender) external view returns (uint256)",
83
+ "function balanceOf(address owner) external view returns (uint256)",
84
+ "function decimals() external view returns (uint8)",
85
+ "function symbol() external view returns (string)",
86
+ ];
87
+ exports.WALLET_FACTORY_ABI = [
88
+ "function createWallet(address _entryPoint) external returns (address)",
89
+ "function getWallets(address owner) external view returns (address[] memory)",
90
+ "function totalWallets() external view returns (uint256)",
91
+ "event WalletCreated(address indexed owner, address indexed walletAddress)",
92
+ ];
93
+ exports.POLICY_ENGINE_LIMITS_ABI = [
94
+ // Auto-getters from public mappings (actual on-chain function names)
95
+ "function categoryLimits(address wallet, string category) external view returns (uint256)",
96
+ "function dailyCategoryLimit(address wallet, string category) external view returns (uint256)",
97
+ // Owner-callable setters
98
+ "function setCategoryLimitFor(address wallet, string category, uint256 limitPerTx) external",
99
+ "function setDailyLimitFor(address wallet, string category, uint256 limit) external",
100
+ ];
101
+ // PolicyEngine governance functions — for onboarding ceremony
102
+ exports.POLICY_ENGINE_GOVERNANCE_ABI = [
103
+ // registerWallet requires msg.sender == wallet — route through wallet's executeContractCall
104
+ "function registerWallet(address wallet, address owner) external",
105
+ // enableDefiAccess: onlyWalletOwnerOrWallet — owner can call directly on PolicyEngine
106
+ "function enableDefiAccess(address wallet) external",
107
+ // isRegistered check helper
108
+ "function walletOwners(address wallet) external view returns (address)",
109
+ "function defiAccessEnabled(address wallet) external view returns (bool)",
110
+ ];
111
+ exports.ARC402_WALLET_EXECUTE_ABI = [
112
+ "function executeContractCall((address target, bytes data, uint256 value, uint256 minReturnValue, uint256 maxApprovalAmount, address approvalToken) params) external returns (bytes memory)",
113
+ ];
114
+ // Direct protocol functions — all onlyOwnerOrMachineKey, never route through executeContractCall
115
+ exports.ARC402_WALLET_PROTOCOL_ABI = [
116
+ "function openContext(bytes32 contextId, string calldata taskType) external",
117
+ "function closeContext() external",
118
+ "function contextOpen() external view returns (bool)",
119
+ "function attest(bytes32 attestationId, string calldata action, string calldata reason, address recipient, uint256 amount, address token, uint256 expiresAt) external returns (bytes32)",
120
+ "function executeSpend(address payable recipient, uint256 amount, string calldata category, bytes32 attestationId) external",
121
+ "function executeTokenSpend(address recipient, uint256 amount, address token, string calldata category, bytes32 attestationId) external",
122
+ ];
123
+ exports.ARC402_WALLET_GUARDIAN_ABI = [
124
+ // Guardian management (owner only)
125
+ "function setGuardian(address _guardian) external",
126
+ // Guardian freeze functions (guardian key only)
127
+ "function freeze() external",
128
+ "function freezeAndDrain() external",
129
+ // Owner freeze (with reason)
130
+ "function freeze(string reason) external",
131
+ // Owner unfreeze
132
+ "function unfreeze() external",
133
+ // State queries
134
+ "function frozen() external view returns (bool)",
135
+ "function frozenBy() external view returns (address)",
136
+ "function frozenAt() external view returns (uint256)",
137
+ "function guardian() external view returns (address)",
138
+ "function owner() external view returns (address)",
139
+ // Events
140
+ "event WalletFrozen(address indexed by, string reason, uint256 timestamp)",
141
+ "event WalletUnfrozen(address indexed by, uint256 timestamp)",
142
+ "event GuardianUpdated(address indexed newGuardian)",
143
+ ];
144
+ exports.ARC402_WALLET_REGISTRY_ABI = [
145
+ "function proposeRegistryUpdate(address newRegistry) external",
146
+ "function executeRegistryUpdate() external",
147
+ "function cancelRegistryUpdate() external",
148
+ "function pendingRegistry() external view returns (address)",
149
+ "function registryUpdateUnlockAt() external view returns (uint256)",
150
+ "function registry() external view returns (address)",
151
+ ];
152
+ exports.ARC402_WALLET_OWNER_ABI = [
153
+ // Owner-only setters
154
+ "function setAuthorizedInterceptor(address interceptor) external",
155
+ "function setVelocityLimit(uint256 limit) external",
156
+ "function updatePolicy(bytes32 newPolicyId) external",
157
+ // State queries
158
+ "function authorizedInterceptor() external view returns (address)",
159
+ "function velocityLimit() external view returns (uint256)",
160
+ "function velocityWindowStart() external view returns (uint256)",
161
+ "function cumulativeSpend() external view returns (uint256)",
162
+ "function activePolicyId() external view returns (bytes32)",
163
+ ];
164
+ exports.ARC402_WALLET_MACHINE_KEY_ABI = [
165
+ "function authorizeMachineKey(address key) external",
166
+ "function revokeMachineKey(address key) external",
167
+ "function authorizedMachineKeys(address key) external view returns (bool)",
168
+ ];
169
+ exports.ARC402_WALLET_PASSKEY_ABI = [
170
+ "function setPasskey(bytes32 pubKeyX, bytes32 pubKeyY) external",
171
+ "function clearPasskey() external",
172
+ "function emergencyOwnerOverride(bytes32 newPubKeyX, bytes32 newPubKeyY) external",
173
+ "function emergencyOwnerOverride() external",
174
+ "function ownerAuth() external view returns (uint8 signerType, bytes32 pubKeyX, bytes32 pubKeyY)",
175
+ "event PasskeySet(bytes32 indexed pubKeyX, bytes32 pubKeyY)",
176
+ ];
177
+ //# sourceMappingURL=abis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abis.js","sourceRoot":"","sources":["../src/abis.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,65 @@
1
+ import type { Arc402Config } from "./config";
2
+ export declare const DEFAULT_ENTRY_POINT = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
3
+ export declare const DEFAULT_BUNDLER_URL = "https://api.pimlico.io/v2/base/rpc";
4
+ export type UserOperation = {
5
+ sender: string;
6
+ nonce: string;
7
+ callData: string;
8
+ callGasLimit: string;
9
+ verificationGasLimit: string;
10
+ preVerificationGas: string;
11
+ maxFeePerGas: string;
12
+ maxPriorityFeePerGas: string;
13
+ signature: string;
14
+ factory?: string;
15
+ factoryData?: string;
16
+ paymaster?: string;
17
+ paymasterData?: string;
18
+ paymasterVerificationGasLimit?: string;
19
+ paymasterPostOpGasLimit?: string;
20
+ };
21
+ export type GasEstimate = {
22
+ callGasLimit: string;
23
+ verificationGasLimit: string;
24
+ preVerificationGas: string;
25
+ paymasterVerificationGasLimit?: string;
26
+ paymasterPostOpGasLimit?: string;
27
+ };
28
+ export type UserOpReceipt = {
29
+ userOpHash: string;
30
+ entryPoint: string;
31
+ sender: string;
32
+ nonce: string;
33
+ success: boolean;
34
+ actualGasCost: string;
35
+ actualGasUsed: string;
36
+ logs: unknown[];
37
+ receipt: {
38
+ transactionHash: string;
39
+ blockNumber: string;
40
+ blockHash: string;
41
+ [key: string]: unknown;
42
+ };
43
+ };
44
+ export declare class BundlerClient {
45
+ private bundlerUrl;
46
+ private entryPointAddress;
47
+ private chainId;
48
+ constructor(bundlerUrl: string, entryPointAddress: string, chainId: number);
49
+ private rpc;
50
+ sendUserOperation(userOp: UserOperation): Promise<string>;
51
+ getUserOperationReceipt(userOpHash: string): Promise<UserOpReceipt>;
52
+ estimateUserOperationGas(userOp: Partial<UserOperation>): Promise<GasEstimate>;
53
+ }
54
+ export declare class PaymasterClient {
55
+ private paymasterUrl;
56
+ private cdpKeyName?;
57
+ private cdpPrivateKey?;
58
+ constructor(paymasterUrl: string, cdpKeyName?: string, cdpPrivateKey?: string);
59
+ private buildJwt;
60
+ private rpc;
61
+ sponsorUserOperation(userOp: Partial<UserOperation>, entryPoint: string): Promise<UserOperation>;
62
+ }
63
+ export declare function buildUserOp(callData: string, sender: string, nonce: bigint, config: Arc402Config): Promise<UserOperation>;
64
+ export declare function buildSponsoredUserOp(callData: string, sender: string, nonce: bigint, config: Arc402Config, paymasterClient: PaymasterClient): Promise<UserOperation>;
65
+ //# sourceMappingURL=bundler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundler.d.ts","sourceRoot":"","sources":["../src/bundler.ts"],"names":[],"mappings":"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"}