@absol-labs/agent 0.11.0 → 0.12.0-rc.2

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 (366) hide show
  1. package/README.md +43 -51
  2. package/dist/capability/invocation-capability.d.ts +2 -2
  3. package/dist/capability/probe-capability.d.ts +225 -0
  4. package/dist/capability/probe-capability.d.ts.map +1 -0
  5. package/dist/capability/probe-capability.js +248 -0
  6. package/dist/capability/probe-capability.js.map +1 -0
  7. package/dist/cli/args.d.ts +11 -0
  8. package/dist/cli/args.d.ts.map +1 -1
  9. package/dist/cli/args.js +23 -0
  10. package/dist/cli/args.js.map +1 -1
  11. package/dist/cli/commands/claim.d.ts +32 -0
  12. package/dist/cli/commands/claim.d.ts.map +1 -1
  13. package/dist/cli/commands/claim.js +116 -28
  14. package/dist/cli/commands/claim.js.map +1 -1
  15. package/dist/cli/commands/close.d.ts.map +1 -1
  16. package/dist/cli/commands/close.js +35 -3
  17. package/dist/cli/commands/close.js.map +1 -1
  18. package/dist/cli/commands/invoke.d.ts +2 -0
  19. package/dist/cli/commands/invoke.d.ts.map +1 -1
  20. package/dist/cli/commands/invoke.js +2 -2
  21. package/dist/cli/commands/invoke.js.map +1 -1
  22. package/dist/cli/commands/mcp.d.ts.map +1 -1
  23. package/dist/cli/commands/mcp.js +15 -2
  24. package/dist/cli/commands/mcp.js.map +1 -1
  25. package/dist/cli/commands/open.d.ts.map +1 -1
  26. package/dist/cli/commands/open.js +58 -4
  27. package/dist/cli/commands/open.js.map +1 -1
  28. package/dist/cli/commands/pay.d.ts +34 -0
  29. package/dist/cli/commands/pay.d.ts.map +1 -0
  30. package/dist/cli/commands/pay.js +479 -0
  31. package/dist/cli/commands/pay.js.map +1 -0
  32. package/dist/cli/commands/reclaim-unverified.d.ts.map +1 -1
  33. package/dist/cli/commands/reclaim-unverified.js +3 -2
  34. package/dist/cli/commands/reclaim-unverified.js.map +1 -1
  35. package/dist/cli/commands/reclaim.d.ts +23 -2
  36. package/dist/cli/commands/reclaim.d.ts.map +1 -1
  37. package/dist/cli/commands/reclaim.js +204 -20
  38. package/dist/cli/commands/reclaim.js.map +1 -1
  39. package/dist/cli/commands/refund.d.ts +31 -0
  40. package/dist/cli/commands/refund.d.ts.map +1 -0
  41. package/dist/cli/commands/refund.js +397 -0
  42. package/dist/cli/commands/refund.js.map +1 -0
  43. package/dist/cli/commands/status.d.ts.map +1 -1
  44. package/dist/cli/commands/status.js +21 -2
  45. package/dist/cli/commands/status.js.map +1 -1
  46. package/dist/cli/commands/streams.js +8 -12
  47. package/dist/cli/commands/streams.js.map +1 -1
  48. package/dist/cli/commands/watch.d.ts.map +1 -1
  49. package/dist/cli/commands/watch.js +4 -1
  50. package/dist/cli/commands/watch.js.map +1 -1
  51. package/dist/cli/config.d.ts +44 -26
  52. package/dist/cli/config.d.ts.map +1 -1
  53. package/dist/cli/config.js +88 -38
  54. package/dist/cli/config.js.map +1 -1
  55. package/dist/cli/context.d.ts +19 -0
  56. package/dist/cli/context.d.ts.map +1 -1
  57. package/dist/cli/deps.d.ts +53 -0
  58. package/dist/cli/deps.d.ts.map +1 -1
  59. package/dist/cli/deps.js +51 -1
  60. package/dist/cli/deps.js.map +1 -1
  61. package/dist/cli/errors.d.ts.map +1 -1
  62. package/dist/cli/errors.js +21 -1
  63. package/dist/cli/errors.js.map +1 -1
  64. package/dist/cli/escape-hatch.d.ts +6 -4
  65. package/dist/cli/escape-hatch.d.ts.map +1 -1
  66. package/dist/cli/escape-hatch.js +6 -2
  67. package/dist/cli/escape-hatch.js.map +1 -1
  68. package/dist/cli/listings.d.ts +18 -0
  69. package/dist/cli/listings.d.ts.map +1 -1
  70. package/dist/cli/listings.js +22 -12
  71. package/dist/cli/listings.js.map +1 -1
  72. package/dist/cli/preflight.d.ts +20 -14
  73. package/dist/cli/preflight.d.ts.map +1 -1
  74. package/dist/cli/preflight.js +34 -20
  75. package/dist/cli/preflight.js.map +1 -1
  76. package/dist/cli/privy.d.ts.map +1 -1
  77. package/dist/cli/privy.js +4 -2
  78. package/dist/cli/privy.js.map +1 -1
  79. package/dist/cli/progress.d.ts +13 -1
  80. package/dist/cli/progress.d.ts.map +1 -1
  81. package/dist/cli/progress.js +7 -1
  82. package/dist/cli/progress.js.map +1 -1
  83. package/dist/cli/reclaimability.d.ts +82 -0
  84. package/dist/cli/reclaimability.d.ts.map +1 -0
  85. package/dist/cli/reclaimability.js +80 -0
  86. package/dist/cli/reclaimability.js.map +1 -0
  87. package/dist/cli/run.d.ts +2 -1
  88. package/dist/cli/run.d.ts.map +1 -1
  89. package/dist/cli/run.js +62 -21
  90. package/dist/cli/run.js.map +1 -1
  91. package/dist/cli/scan-range.d.ts +2 -2
  92. package/dist/cli/scan-range.js +2 -2
  93. package/dist/cli/status.d.ts +106 -1
  94. package/dist/cli/status.d.ts.map +1 -1
  95. package/dist/cli/status.js +325 -44
  96. package/dist/cli/status.js.map +1 -1
  97. package/dist/cli/wallet.d.ts +2 -2
  98. package/dist/cli/wallet.d.ts.map +1 -1
  99. package/dist/cli/wallet.js +29 -5
  100. package/dist/cli/wallet.js.map +1 -1
  101. package/dist/discovery/rate-band.d.ts +74 -0
  102. package/dist/discovery/rate-band.d.ts.map +1 -0
  103. package/dist/discovery/rate-band.js +114 -0
  104. package/dist/discovery/rate-band.js.map +1 -0
  105. package/dist/escrow-generation.d.ts +81 -0
  106. package/dist/escrow-generation.d.ts.map +1 -0
  107. package/dist/escrow-generation.js +76 -0
  108. package/dist/escrow-generation.js.map +1 -0
  109. package/dist/frameworks/agentkit.d.ts +8 -4
  110. package/dist/frameworks/agentkit.d.ts.map +1 -1
  111. package/dist/frameworks/agentkit.js +27 -10
  112. package/dist/frameworks/agentkit.js.map +1 -1
  113. package/dist/frameworks/eliza.d.ts +3 -3
  114. package/dist/frameworks/eliza.d.ts.map +1 -1
  115. package/dist/frameworks/eliza.js +15 -6
  116. package/dist/frameworks/eliza.js.map +1 -1
  117. package/dist/frameworks/langchain.d.ts.map +1 -1
  118. package/dist/frameworks/langchain.js +8 -0
  119. package/dist/frameworks/langchain.js.map +1 -1
  120. package/dist/gateway/caller-auth-gateway.d.ts +83 -31
  121. package/dist/gateway/caller-auth-gateway.d.ts.map +1 -1
  122. package/dist/gateway/caller-auth-gateway.js +180 -27
  123. package/dist/gateway/caller-auth-gateway.js.map +1 -1
  124. package/dist/gateway/http-server.d.ts +128 -44
  125. package/dist/gateway/http-server.d.ts.map +1 -1
  126. package/dist/gateway/http-server.js +506 -155
  127. package/dist/gateway/http-server.js.map +1 -1
  128. package/dist/gateway/probe-auth.d.ts +112 -0
  129. package/dist/gateway/probe-auth.d.ts.map +1 -0
  130. package/dist/gateway/probe-auth.js +127 -0
  131. package/dist/gateway/probe-auth.js.map +1 -0
  132. package/dist/gateway/signed-rate-bounds.d.ts +51 -0
  133. package/dist/gateway/signed-rate-bounds.d.ts.map +1 -0
  134. package/dist/gateway/signed-rate-bounds.js +94 -0
  135. package/dist/gateway/signed-rate-bounds.js.map +1 -0
  136. package/dist/gateway/x402-opener-mode.d.ts +252 -0
  137. package/dist/gateway/x402-opener-mode.d.ts.map +1 -0
  138. package/dist/gateway/x402-opener-mode.js +772 -0
  139. package/dist/gateway/x402-opener-mode.js.map +1 -0
  140. package/dist/index.d.ts +6 -2
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +10 -5
  143. package/dist/index.js.map +1 -1
  144. package/dist/mcp/server.d.ts +64 -1
  145. package/dist/mcp/server.d.ts.map +1 -1
  146. package/dist/mcp/server.js +247 -37
  147. package/dist/mcp/server.js.map +1 -1
  148. package/dist/mcp/x402-tools.d.ts +109 -0
  149. package/dist/mcp/x402-tools.d.ts.map +1 -0
  150. package/dist/mcp/x402-tools.js +554 -0
  151. package/dist/mcp/x402-tools.js.map +1 -0
  152. package/dist/network.d.ts +119 -0
  153. package/dist/network.d.ts.map +1 -0
  154. package/dist/network.js +199 -0
  155. package/dist/network.js.map +1 -0
  156. package/dist/sdk/client.d.ts +13 -0
  157. package/dist/sdk/client.d.ts.map +1 -1
  158. package/dist/sdk/client.js +15 -0
  159. package/dist/sdk/client.js.map +1 -1
  160. package/dist/sdk/invoke.d.ts +4 -0
  161. package/dist/sdk/invoke.d.ts.map +1 -1
  162. package/dist/sdk/invoke.js +2 -5
  163. package/dist/sdk/invoke.js.map +1 -1
  164. package/dist/wallet/autonomous-wallet-broker.d.ts +3 -0
  165. package/dist/wallet/autonomous-wallet-broker.d.ts.map +1 -1
  166. package/dist/wallet/autonomous-wallet-broker.js +27 -23
  167. package/dist/wallet/autonomous-wallet-broker.js.map +1 -1
  168. package/dist/wallet/autonomous-wallet-protocol.d.ts +8 -2
  169. package/dist/wallet/autonomous-wallet-protocol.d.ts.map +1 -1
  170. package/dist/wallet/autonomous-wallet-protocol.js +9 -2
  171. package/dist/wallet/autonomous-wallet-protocol.js.map +1 -1
  172. package/dist/wallet/autonomous-wallet.d.ts.map +1 -1
  173. package/dist/wallet/autonomous-wallet.js +3 -2
  174. package/dist/wallet/autonomous-wallet.js.map +1 -1
  175. package/dist/wallet/broker-escrows.d.ts +222 -0
  176. package/dist/wallet/broker-escrows.d.ts.map +1 -0
  177. package/dist/wallet/broker-escrows.js +36 -0
  178. package/dist/wallet/broker-escrows.js.map +1 -0
  179. package/dist/wallet/lifecycle.d.ts +21 -5
  180. package/dist/wallet/lifecycle.d.ts.map +1 -1
  181. package/dist/wallet/lifecycle.js +32 -12
  182. package/dist/wallet/lifecycle.js.map +1 -1
  183. package/dist/wallet/privy-broker-server.d.ts.map +1 -1
  184. package/dist/wallet/privy-broker-server.js +31 -26
  185. package/dist/wallet/privy-broker-server.js.map +1 -1
  186. package/dist/wallet/privy-session-broker.d.ts +14 -5
  187. package/dist/wallet/privy-session-broker.d.ts.map +1 -1
  188. package/dist/wallet/privy-session-broker.js +29 -17
  189. package/dist/wallet/privy-session-broker.js.map +1 -1
  190. package/dist/wallet/privy-session-provider.d.ts +3 -1
  191. package/dist/wallet/privy-session-provider.d.ts.map +1 -1
  192. package/dist/wallet/privy-session-provider.js +5 -3
  193. package/dist/wallet/privy-session-provider.js.map +1 -1
  194. package/dist/wallet/provider.d.ts.map +1 -1
  195. package/dist/wallet/provider.js +15 -8
  196. package/dist/wallet/provider.js.map +1 -1
  197. package/dist/x402/facilitator.d.ts +3 -30
  198. package/dist/x402/facilitator.d.ts.map +1 -1
  199. package/dist/x402/facilitator.js +0 -27
  200. package/dist/x402/facilitator.js.map +1 -1
  201. package/dist/x402-buyer/guarded-fetch.d.ts +51 -0
  202. package/dist/x402-buyer/guarded-fetch.d.ts.map +1 -0
  203. package/dist/x402-buyer/guarded-fetch.js +147 -0
  204. package/dist/x402-buyer/guarded-fetch.js.map +1 -0
  205. package/dist/x402-buyer/index.d.ts +10 -0
  206. package/dist/x402-buyer/index.d.ts.map +1 -0
  207. package/dist/x402-buyer/index.js +10 -0
  208. package/dist/x402-buyer/index.js.map +1 -0
  209. package/dist/x402-buyer/pay.d.ts +157 -0
  210. package/dist/x402-buyer/pay.d.ts.map +1 -0
  211. package/dist/x402-buyer/pay.js +366 -0
  212. package/dist/x402-buyer/pay.js.map +1 -0
  213. package/dist/x402-opener/abi.d.ts +684 -0
  214. package/dist/x402-opener/abi.d.ts.map +1 -0
  215. package/dist/x402-opener/abi.js +880 -0
  216. package/dist/x402-opener/abi.js.map +1 -0
  217. package/dist/x402-opener/facilitator-entry.d.ts +3 -0
  218. package/dist/x402-opener/facilitator-entry.d.ts.map +1 -0
  219. package/dist/x402-opener/facilitator-entry.js +40 -0
  220. package/dist/x402-opener/facilitator-entry.js.map +1 -0
  221. package/dist/x402-opener/facilitator-server.d.ts +209 -0
  222. package/dist/x402-opener/facilitator-server.d.ts.map +1 -0
  223. package/dist/x402-opener/facilitator-server.js +762 -0
  224. package/dist/x402-opener/facilitator-server.js.map +1 -0
  225. package/dist/x402-opener/index.d.ts +14 -0
  226. package/dist/x402-opener/index.d.ts.map +1 -0
  227. package/dist/x402-opener/index.js +14 -0
  228. package/dist/x402-opener/index.js.map +1 -0
  229. package/dist/x402-opener/listing-resolver.d.ts +55 -0
  230. package/dist/x402-opener/listing-resolver.d.ts.map +1 -0
  231. package/dist/x402-opener/listing-resolver.js +125 -0
  232. package/dist/x402-opener/listing-resolver.js.map +1 -0
  233. package/dist/x402-opener/refund-relay.d.ts +266 -0
  234. package/dist/x402-opener/refund-relay.d.ts.map +1 -0
  235. package/dist/x402-opener/refund-relay.js +1341 -0
  236. package/dist/x402-opener/refund-relay.js.map +1 -0
  237. package/dist/x402-opener/relayer-queue.d.ts +14 -0
  238. package/dist/x402-opener/relayer-queue.d.ts.map +1 -0
  239. package/dist/x402-opener/relayer-queue.js +18 -0
  240. package/dist/x402-opener/relayer-queue.js.map +1 -0
  241. package/dist/x402-opener/scheme.d.ts +296 -0
  242. package/dist/x402-opener/scheme.d.ts.map +1 -0
  243. package/dist/x402-opener/scheme.js +1035 -0
  244. package/dist/x402-opener/scheme.js.map +1 -0
  245. package/dist/x402-opener/terms.d.ts +165 -0
  246. package/dist/x402-opener/terms.d.ts.map +1 -0
  247. package/dist/x402-opener/terms.js +304 -0
  248. package/dist/x402-opener/terms.js.map +1 -0
  249. package/dist/zktls/reclaim.d.ts +2 -2
  250. package/dist/zktls/t2-delivery-proof.d.ts +6 -6
  251. package/docs/agent-layer.md +3 -2
  252. package/docs/autonomous-privy-wallet.md +188 -0
  253. package/docs/cli.md +265 -34
  254. package/docs/langchain.md +5 -0
  255. package/docs/mcp-reference.md +91 -5
  256. package/docs/probe-capability.md +191 -0
  257. package/docs/quickstart.md +39 -4
  258. package/docs/threat-model.md +20 -0
  259. package/docs/x402.md +766 -593
  260. package/package.json +19 -17
  261. package/src/capability/probe-capability.ts +355 -0
  262. package/src/cli/args.ts +29 -0
  263. package/src/cli/commands/claim.ts +168 -33
  264. package/src/cli/commands/close.ts +36 -3
  265. package/src/cli/commands/invoke.ts +5 -2
  266. package/src/cli/commands/mcp.ts +18 -2
  267. package/src/cli/commands/open.ts +75 -4
  268. package/src/cli/commands/pay.ts +584 -0
  269. package/src/cli/commands/reclaim-unverified.ts +8 -2
  270. package/src/cli/commands/reclaim.ts +277 -19
  271. package/src/cli/commands/refund.ts +475 -0
  272. package/src/cli/commands/status.ts +28 -2
  273. package/src/cli/commands/streams.ts +10 -14
  274. package/src/cli/commands/watch.ts +11 -1
  275. package/src/cli/config.ts +139 -52
  276. package/src/cli/context.ts +16 -0
  277. package/src/cli/deps.ts +111 -1
  278. package/src/cli/errors.ts +24 -1
  279. package/src/cli/escape-hatch.ts +19 -5
  280. package/src/cli/listings.ts +43 -10
  281. package/src/cli/preflight.ts +36 -21
  282. package/src/cli/privy.ts +4 -2
  283. package/src/cli/progress.ts +21 -2
  284. package/src/cli/reclaimability.ts +154 -0
  285. package/src/cli/run.ts +77 -21
  286. package/src/cli/scan-range.ts +2 -2
  287. package/src/cli/status.ts +454 -44
  288. package/src/cli/wallet.ts +45 -8
  289. package/src/discovery/rate-band.ts +172 -0
  290. package/src/escrow-generation.ts +135 -0
  291. package/src/frameworks/agentkit.ts +45 -11
  292. package/src/frameworks/eliza.ts +27 -5
  293. package/src/frameworks/langchain.ts +14 -0
  294. package/src/gateway/caller-auth-gateway.ts +320 -68
  295. package/src/gateway/http-server.ts +717 -220
  296. package/src/gateway/probe-auth.ts +191 -0
  297. package/src/gateway/signed-rate-bounds.ts +164 -0
  298. package/src/gateway/x402-opener-mode.ts +1171 -0
  299. package/src/index.ts +82 -19
  300. package/src/mcp/server.ts +351 -42
  301. package/src/mcp/x402-tools.ts +785 -0
  302. package/src/network.ts +302 -0
  303. package/src/sdk/client.ts +25 -0
  304. package/src/sdk/invoke.ts +6 -5
  305. package/src/wallet/autonomous-wallet-broker.ts +46 -20
  306. package/src/wallet/autonomous-wallet-protocol.ts +11 -2
  307. package/src/wallet/autonomous-wallet.ts +4 -2
  308. package/src/wallet/broker-escrows.ts +66 -0
  309. package/src/wallet/lifecycle.ts +53 -18
  310. package/src/wallet/privy-broker-server.ts +35 -25
  311. package/src/wallet/privy-session-broker.ts +58 -25
  312. package/src/wallet/privy-session-provider.ts +7 -3
  313. package/src/wallet/provider.ts +20 -15
  314. package/src/x402/facilitator.ts +3 -43
  315. package/src/x402-buyer/guarded-fetch.ts +213 -0
  316. package/src/x402-buyer/index.ts +9 -0
  317. package/src/x402-buyer/pay.ts +555 -0
  318. package/src/x402-opener/abi.ts +881 -0
  319. package/src/x402-opener/facilitator-entry.ts +48 -0
  320. package/src/x402-opener/facilitator-server.ts +1114 -0
  321. package/src/x402-opener/index.ts +13 -0
  322. package/src/x402-opener/listing-resolver.ts +202 -0
  323. package/src/x402-opener/refund-relay.ts +1873 -0
  324. package/src/x402-opener/relayer-queue.ts +18 -0
  325. package/src/x402-opener/scheme.ts +1551 -0
  326. package/src/x402-opener/terms.ts +453 -0
  327. package/dist/gateway/x402-mode.d.ts +0 -123
  328. package/dist/gateway/x402-mode.d.ts.map +0 -1
  329. package/dist/gateway/x402-mode.js +0 -212
  330. package/dist/gateway/x402-mode.js.map +0 -1
  331. package/dist/x402/delivery-oracle.d.ts +0 -108
  332. package/dist/x402/delivery-oracle.d.ts.map +0 -1
  333. package/dist/x402/delivery-oracle.js +0 -174
  334. package/dist/x402/delivery-oracle.js.map +0 -1
  335. package/dist/x402/facilitator-server-entry.d.ts +0 -3
  336. package/dist/x402/facilitator-server-entry.d.ts.map +0 -1
  337. package/dist/x402/facilitator-server-entry.js +0 -27
  338. package/dist/x402/facilitator-server-entry.js.map +0 -1
  339. package/dist/x402/facilitator-server.d.ts +0 -73
  340. package/dist/x402/facilitator-server.d.ts.map +0 -1
  341. package/dist/x402/facilitator-server.js +0 -305
  342. package/dist/x402/facilitator-server.js.map +0 -1
  343. package/dist/x402/payment-requirements.d.ts +0 -106
  344. package/dist/x402/payment-requirements.d.ts.map +0 -1
  345. package/dist/x402/payment-requirements.js +0 -138
  346. package/dist/x402/payment-requirements.js.map +0 -1
  347. package/dist/x402/relayer.d.ts +0 -41
  348. package/dist/x402/relayer.d.ts.map +0 -1
  349. package/dist/x402/relayer.js +0 -64
  350. package/dist/x402/relayer.js.map +0 -1
  351. package/dist/x402/resource-index.d.ts +0 -75
  352. package/dist/x402/resource-index.d.ts.map +0 -1
  353. package/dist/x402/resource-index.js +0 -126
  354. package/dist/x402/resource-index.js.map +0 -1
  355. package/dist/x402/verified-delivery-facilitator.d.ts +0 -285
  356. package/dist/x402/verified-delivery-facilitator.d.ts.map +0 -1
  357. package/dist/x402/verified-delivery-facilitator.js +0 -423
  358. package/dist/x402/verified-delivery-facilitator.js.map +0 -1
  359. package/src/gateway/x402-mode.ts +0 -350
  360. package/src/x402/delivery-oracle.ts +0 -285
  361. package/src/x402/facilitator-server-entry.ts +0 -35
  362. package/src/x402/facilitator-server.ts +0 -445
  363. package/src/x402/payment-requirements.ts +0 -231
  364. package/src/x402/relayer.ts +0 -122
  365. package/src/x402/resource-index.ts +0 -228
  366. package/src/x402/verified-delivery-facilitator.ts +0 -744
@@ -1,5 +1,12 @@
1
+ import { networkForChainId } from "@absol-labs/sdk";
1
2
  import { erc20Abi, type Address } from "viem";
2
3
 
4
+ import {
5
+ defaultNetwork,
6
+ describeAllowedNetworks,
7
+ networkFunding,
8
+ } from "../network.js";
9
+
3
10
  /**
4
11
  * Agent wallet lifecycle helpers (metrik-agent#65).
5
12
  *
@@ -21,7 +28,7 @@ import { erc20Abi, type Address } from "viem";
21
28
 
22
29
  /** Native gas balance + USDC balance for one address. */
23
30
  export interface WalletBalances {
24
- /** Native token balance (ETH on Base/Base Sepolia), in wei. */
31
+ /** Native gas-token balance, in its smallest unit (the network's `gasToken.decimals`). */
25
32
  readonly nativeWei: bigint;
26
33
  /** USDC balance, in atomic units (6 decimals). */
27
34
  readonly usdcAtomic: bigint;
@@ -63,10 +70,21 @@ export async function getWalletBalances(
63
70
 
64
71
  /** Human-facing pointers to fund a freshly created/restored testnet wallet. */
65
72
  export interface FaucetHint {
73
+ /** The Coinbase CDP faucet's name for the network (e.g. what `requestCdpFaucet` sends). */
66
74
  readonly network: string;
67
- /** Coinbase CDP faucet — funds native ETH (and, on some networks, USDC) for a CDP-managed address. */
75
+ /** The registry id of the network the hint is for. */
76
+ readonly networkId: string;
77
+ /**
78
+ * The network's gas token, from the registry's gas-token metadata. NOT always
79
+ * ETH: where gas is the settlement token, it is USDC and
80
+ * {@link FaucetHint.gasIsSettlementToken} is `true`.
81
+ */
82
+ readonly gasToken: string;
83
+ /** Whether gas is paid in the same token streams settle in (one balance to fund). */
84
+ readonly gasIsSettlementToken: boolean;
85
+ /** Coinbase CDP faucet — funds the gas token (and, on some networks, USDC) for a CDP-managed address. */
68
86
  readonly cdpFaucetUrl: string;
69
- /** Circle's own Base Sepolia USDC faucet — an alternative USDC source that doesn't require a CDP account. */
87
+ /** Circle's USDC faucet for the network — a USDC source that doesn't require a CDP account. */
70
88
  readonly usdcFaucetUrl: string;
71
89
  /** How to request the same funds programmatically from a CDP wallet — see {@link requestCdpFaucet}. */
72
90
  readonly programmaticHint: string;
@@ -75,28 +93,42 @@ export interface FaucetHint {
75
93
  export class UnsupportedFaucetChainError extends Error {
76
94
  constructor(chainId: number) {
77
95
  super(
78
- `no known testnet faucet for chainId ${chainId} (Metrik is Base Sepolia (84532) only)`,
96
+ `no known testnet faucet for chainId ${chainId} (registered testnets: ${describeAllowedNetworks({ testnetOnly: true })})`,
79
97
  );
80
98
  this.name = "UnsupportedFaucetChainError";
81
99
  }
82
100
  }
83
101
 
84
- const BASE_SEPOLIA_CHAIN_ID = 84532;
102
+ const CDP_FAUCET_URL = "https://portal.cdp.coinbase.com/products/faucet";
85
103
 
86
- const BASE_SEPOLIA_FAUCET_HINT: FaucetHint = {
87
- network: "base-sepolia",
88
- cdpFaucetUrl: "https://portal.cdp.coinbase.com/products/faucet",
89
- usdcFaucetUrl: "https://faucet.circle.com",
90
- programmaticHint:
91
- "requestCdpFaucet({ cdp, address, token: 'eth' | 'usdc' }) — subject to a 24h per-address rate limit",
92
- };
93
-
94
- /** A faucet hint for the given chain. Only Base Sepolia (84532) is supported — Metrik is testnet-only, single-chain. */
104
+ /**
105
+ * A faucet hint for the given chain, read from the network registry (gas token)
106
+ * plus the agent's funding catalogue (faucet URLs). Only a registered TESTNET
107
+ * with a known CDP faucet has one; anything else throws
108
+ * {@link UnsupportedFaucetChainError}.
109
+ */
95
110
  export function faucetHint(chainId: number): FaucetHint {
96
- if (chainId !== BASE_SEPOLIA_CHAIN_ID) {
111
+ const network = networkForChainId(chainId);
112
+ if (network === undefined || !network.testnet) {
113
+ throw new UnsupportedFaucetChainError(chainId);
114
+ }
115
+ const funding = networkFunding(network);
116
+ if (funding.cdpNetwork === null || funding.usdcFaucetUrl === null) {
97
117
  throw new UnsupportedFaucetChainError(chainId);
98
118
  }
99
- return BASE_SEPOLIA_FAUCET_HINT;
119
+ const gasToken = network.gasToken.symbol;
120
+ const tokens = network.gasToken.isSettlementToken
121
+ ? "'usdc'"
122
+ : `'${gasToken.toLowerCase()}' | 'usdc'`;
123
+ return {
124
+ network: funding.cdpNetwork,
125
+ networkId: network.id,
126
+ gasToken,
127
+ gasIsSettlementToken: network.gasToken.isSettlementToken,
128
+ cdpFaucetUrl: CDP_FAUCET_URL,
129
+ usdcFaucetUrl: funding.usdcFaucetUrl,
130
+ programmaticHint: `requestCdpFaucet({ cdp, address, token: ${tokens} }) — subject to a 24h per-address rate limit`,
131
+ };
100
132
  }
101
133
 
102
134
  export type FaucetToken = "eth" | "usdc";
@@ -116,7 +148,7 @@ export interface RequestCdpFaucetOptions {
116
148
  readonly cdp: CdpFaucetClientLike;
117
149
  readonly address: Address;
118
150
  readonly token: FaucetToken;
119
- /** Default `"base-sepolia"`. */
151
+ /** CDP faucet network name. Default: the registry's default network's CDP name. */
120
152
  readonly network?: string;
121
153
  }
122
154
 
@@ -145,7 +177,10 @@ export async function requestCdpFaucet(
145
177
  try {
146
178
  const result = await options.cdp.evm.requestFaucet({
147
179
  address: options.address,
148
- network: options.network ?? "base-sepolia",
180
+ network:
181
+ options.network ??
182
+ networkFunding(defaultNetwork()).cdpNetwork ??
183
+ defaultNetwork().id,
149
184
  token: options.token,
150
185
  });
151
186
  return { requested: true, txHash: result.transactionHash };
@@ -20,12 +20,15 @@ import {
20
20
  type AutonomousWalletProvision,
21
21
  } from "./autonomous-wallet-broker.js";
22
22
  import {
23
+ PRIVY_BROKER_CAIP2,
24
+ PRIVY_BROKER_CHAIN_ID,
23
25
  PrivySessionBroker,
24
26
  PrivySessionBrokerError,
25
27
  type PrivyBrokerProvider,
26
28
  type PrivyBrokerSession,
27
29
  type PrivyBrokerSessionStore,
28
30
  } from "./privy-session-broker.js";
31
+ import { defaultNetwork } from "../network.js";
29
32
 
30
33
  const serverEnvSchema = z.object({
31
34
  PRIVY_APP_ID: z.string().min(1),
@@ -56,7 +59,7 @@ const rpcSchema = z.object({
56
59
  const autonomousProofSchema = z.object({
57
60
  version: z.literal(1),
58
61
  appId: z.string().min(1).max(200),
59
- chainId: z.literal(84532),
62
+ chainId: z.literal(PRIVY_BROKER_CHAIN_ID),
60
63
  publicKey: z.string().min(1).max(1_024),
61
64
  nonce: z.string().min(16).max(256),
62
65
  issuedAt: z.number().int().safe(),
@@ -64,7 +67,7 @@ const autonomousProofSchema = z.object({
64
67
  });
65
68
  const autonomousProvisionSchema = z.object({
66
69
  appId: z.string().min(1).max(200),
67
- chainId: z.literal(84532),
70
+ chainId: z.literal(PRIVY_BROKER_CHAIN_ID),
68
71
  publicKey: z.string().min(1).max(1_024),
69
72
  proof: autonomousProofSchema,
70
73
  idempotencyKey: z.string().min(16).max(256),
@@ -92,7 +95,32 @@ export async function startPrivyBrokerServer(
92
95
  appId: config.PRIVY_APP_ID,
93
96
  appSecret: config.PRIVY_APP_SECRET,
94
97
  });
95
- const metrik = MetrikClient.baseSepolia();
98
+ // One read-only client per escrow: the current one, and a legacy one when an
99
+ // exit targets it (V2 and V3 share the getStream tuple).
100
+ const network = defaultNetwork();
101
+ const clients = new Map<string, MetrikClient>();
102
+ const clientFor = (escrow?: `0x${string}`): MetrikClient => {
103
+ const key = (escrow ?? network.escrow.address).toLowerCase();
104
+ let client = clients.get(key);
105
+ if (client === undefined) {
106
+ client = MetrikClient.forNetwork(
107
+ network,
108
+ escrow === undefined ? {} : { escrow },
109
+ );
110
+ clients.set(key, client);
111
+ }
112
+ return client;
113
+ };
114
+ const brokerStreamReader = {
115
+ getStream: async (streamId: Hex, escrow?: `0x${string}`) => {
116
+ const stream = await clientFor(escrow).getStreamV2(streamId);
117
+ return {
118
+ buyer: stream.buyer,
119
+ serviceRef: stream.serviceRef,
120
+ status: stream.status,
121
+ };
122
+ },
123
+ };
96
124
  const provider = createPrivyProvider(client);
97
125
  const autonomousBroker = new AutonomousWalletBroker({
98
126
  appId: config.PRIVY_APP_ID,
@@ -102,31 +130,13 @@ export async function startPrivyBrokerServer(
102
130
  config.METRIK_PRIVY_AUTONOMOUS_STORE ??
103
131
  `${config.METRIK_PRIVY_SESSION_STORE}.autonomous`,
104
132
  ),
105
- streamReader: {
106
- getStream: async (streamId) => {
107
- const stream = await metrik.getStreamV2(streamId);
108
- return {
109
- buyer: stream.buyer,
110
- serviceRef: stream.serviceRef,
111
- status: stream.status,
112
- };
113
- },
114
- },
133
+ streamReader: brokerStreamReader,
115
134
  });
116
135
  const broker = new PrivySessionBroker({
117
136
  provider,
118
137
  store: new JsonPrivyBrokerSessionStore(config.METRIK_PRIVY_SESSION_STORE),
119
138
  authorizationPrivateKey,
120
- streamReader: {
121
- getStream: async (streamId) => {
122
- const stream = await metrik.getStreamV2(streamId);
123
- return {
124
- buyer: stream.buyer,
125
- serviceRef: stream.serviceRef,
126
- status: stream.status,
127
- };
128
- },
129
- },
139
+ streamReader: brokerStreamReader,
130
140
  });
131
141
  const allowedOrigins = new Set(
132
142
  config.METRIK_PRIVY_ALLOWED_ORIGINS.split(",").map((value) => value.trim()),
@@ -150,7 +160,7 @@ export async function startPrivyBrokerServer(
150
160
  appId: config.PRIVY_APP_ID,
151
161
  keyQuorumId: config.PRIVY_KEY_QUORUM_ID,
152
162
  policyId: config.PRIVY_POLICY_ID,
153
- chainId: 84532,
163
+ chainId: PRIVY_BROKER_CHAIN_ID,
154
164
  maxTotalUsdcAtomic: "1000000",
155
165
  maxRatePerSecondAtomic: "1000",
156
166
  maxDurationSeconds: 3600,
@@ -431,7 +441,7 @@ function createPrivyProvider(client: PrivyClient): PrivyBrokerProvider {
431
441
  .wallets()
432
442
  .ethereum()
433
443
  .sendTransaction(input.walletId, {
434
- caip2: "eip155:84532",
444
+ caip2: PRIVY_BROKER_CAIP2,
435
445
  params: { transaction: input.transaction as never },
436
446
  sponsor: input.sponsor,
437
447
  authorization_context: {
@@ -1,6 +1,5 @@
1
1
  import { createHash, randomBytes, timingSafeEqual } from "node:crypto";
2
2
 
3
- import { streamEscrowV2Abi } from "@absol-labs/shared";
4
3
  import {
5
4
  decodeFunctionData,
6
5
  getAddress,
@@ -22,13 +21,25 @@ import {
22
21
  invocationCapabilityDomainVersion,
23
22
  invocationCapabilitySchema,
24
23
  } from "../capability/invocation-capability.js";
25
-
26
- export const PRIVY_BROKER_CHAIN_ID = 84532;
27
- export const PRIVY_BROKER_CAIP2 = "eip155:84532" as const;
28
- export const PRIVY_BROKER_ESCROW =
29
- "0x0f09f36Ccc05A7c9882F438721C08De314dFd46C" as const;
30
- export const PRIVY_BROKER_USDC =
31
- "0x036CbD53842c5426634e7929541eC2318f3dCF7e" as const;
24
+ import { defaultNetwork } from "../network.js";
25
+ import {
26
+ BROKER_EXIT_METHODS,
27
+ brokerEscrowPolicy,
28
+ decodeEscrowCall,
29
+ escrowRole,
30
+ type BrokerEscrowPolicy,
31
+ } from "./broker-escrows.js";
32
+
33
+ /**
34
+ * The deployment a Privy broker polices: the registry's default network. Its
35
+ * Privy policy allowlists exactly this escrow and this USDC, so these are read
36
+ * once from the `@absol-labs/sdk` network registry, never written as literals.
37
+ */
38
+ const BROKER_NETWORK = defaultNetwork();
39
+ export const PRIVY_BROKER_CHAIN_ID: number = BROKER_NETWORK.chain.id;
40
+ export const PRIVY_BROKER_CAIP2: `eip155:${number}` = BROKER_NETWORK.caip2;
41
+ export const PRIVY_BROKER_ESCROW: `0x${string}` = BROKER_NETWORK.escrow.address;
42
+ export const PRIVY_BROKER_USDC: `0x${string}` = BROKER_NETWORK.usdc.address;
32
43
  export const PRIVY_POLICY_MAX_TOTAL_USDC = 1_000_000n;
33
44
  export const PRIVY_POLICY_MAX_RATE_USDC = 1_000n;
34
45
  export const PRIVY_POLICY_MAX_DURATION_SECONDS = 3_600;
@@ -83,7 +94,15 @@ export interface PrivyBrokerProvider {
83
94
  }
84
95
 
85
96
  export interface BrokerStreamReader {
86
- getStream(streamId: Hex): Promise<{
97
+ /**
98
+ * Read a stream. `escrow` names the escrow the transaction targets (the
99
+ * current one, or a legacy one for an exit); readers that serve only one
100
+ * escrow may ignore it.
101
+ */
102
+ getStream(
103
+ streamId: Hex,
104
+ escrow?: Address,
105
+ ): Promise<{
87
106
  readonly buyer: Address;
88
107
  readonly serviceRef: Hex;
89
108
  readonly status: "active" | "closed";
@@ -151,8 +170,14 @@ export class PrivySessionBroker {
151
170
  readonly streamReader: BrokerStreamReader;
152
171
  readonly authorizationPrivateKey: string;
153
172
  readonly nowSeconds?: () => number;
173
+ /** Current + legacy escrows. Default: from the registries (see `./broker-escrows.ts`). */
174
+ readonly escrows?: BrokerEscrowPolicy;
154
175
  },
155
- ) {}
176
+ ) {
177
+ this.escrows = dependencies.escrows ?? brokerEscrowPolicy(BROKER_NETWORK);
178
+ }
179
+
180
+ private readonly escrows: BrokerEscrowPolicy;
156
181
 
157
182
  async createSession(input: CreatePrivyBrokerSessionInput): Promise<{
158
183
  readonly sessionId: string;
@@ -276,11 +301,13 @@ export class PrivySessionBroker {
276
301
  const to = getAddress(transaction.to);
277
302
  const data = transaction.data as Hex;
278
303
 
304
+ const role = escrowRole(this.escrows, to);
279
305
  if (to.toLowerCase() === PRIVY_BROKER_USDC.toLowerCase()) {
280
- assertBoundedApproval(data, session.signedMandate);
281
- } else if (to.toLowerCase() === PRIVY_BROKER_ESCROW.toLowerCase()) {
282
- const decoded = decodeFunctionData({ abi: streamEscrowV2Abi, data });
283
- if (decoded.functionName === "openStream") {
306
+ // The approval spender must be the CURRENT escrow, never a legacy one.
307
+ assertBoundedApproval(data, session.signedMandate, this.escrows.current);
308
+ } else if (role !== null) {
309
+ const decoded = decodeEscrowCall(data);
310
+ if (decoded.functionName === "openStream" && role === "current") {
284
311
  const [operator, , deposit, rate, duration] = decoded.args;
285
312
  const decision = await checkMandate(
286
313
  session.signedMandate,
@@ -307,14 +334,13 @@ export class PrivySessionBroker {
307
334
  });
308
335
  return hash;
309
336
  }
310
- if (
311
- decoded.functionName !== "close" &&
312
- decoded.functionName !== "reclaim" &&
313
- decoded.functionName !== "reclaimUnverified"
314
- ) {
337
+ // A legacy escrow is exit-only: openStream falls through to here too.
338
+ if (!BROKER_EXIT_METHODS.has(decoded.functionName)) {
315
339
  throw new PrivySessionBrokerError(
316
340
  "policy-denied",
317
- "escrow method is not allowed for an agent session",
341
+ role === "legacy"
342
+ ? "only close, reclaim and reclaimUnverified are allowed on a legacy escrow"
343
+ : "escrow method is not allowed for an agent session",
318
344
  );
319
345
  }
320
346
  const owner = await verifyMandateOwnerSignature(session.signedMandate);
@@ -324,8 +350,11 @@ export class PrivySessionBroker {
324
350
  "mandate owner signature is invalid",
325
351
  );
326
352
  }
327
- const streamId = decoded.args[0];
328
- const stream = await this.dependencies.streamReader.getStream(streamId);
353
+ const streamId = (decoded.args as readonly unknown[])[0] as Hex;
354
+ const stream = await this.dependencies.streamReader.getStream(
355
+ streamId,
356
+ to,
357
+ );
329
358
  if (stream.buyer.toLowerCase() !== session.address.toLowerCase()) {
330
359
  throw new PrivySessionBrokerError(
331
360
  "policy-denied",
@@ -375,7 +404,7 @@ export class PrivySessionBroker {
375
404
  Number(domain.chainId) !== PRIVY_BROKER_CHAIN_ID ||
376
405
  typeof domain.verifyingContract !== "string" ||
377
406
  domain.verifyingContract.toLowerCase() !==
378
- PRIVY_BROKER_ESCROW.toLowerCase() ||
407
+ this.escrows.current.toLowerCase() ||
379
408
  typedDataRecord.primaryType !== "InvocationCapability"
380
409
  ) {
381
410
  throw new PrivySessionBrokerError(
@@ -563,7 +592,11 @@ function assertMandateWithinPrivyPolicy(signed: SignedSpendMandate): void {
563
592
  }
564
593
  }
565
594
 
566
- function assertBoundedApproval(data: Hex, signed: SignedSpendMandate): void {
595
+ function assertBoundedApproval(
596
+ data: Hex,
597
+ signed: SignedSpendMandate,
598
+ currentEscrow: Address,
599
+ ): void {
567
600
  const decoded = decodeFunctionData({
568
601
  abi: [
569
602
  {
@@ -581,7 +614,7 @@ function assertBoundedApproval(data: Hex, signed: SignedSpendMandate): void {
581
614
  });
582
615
  const [spender, amount] = decoded.args;
583
616
  if (
584
- spender.toLowerCase() !== PRIVY_BROKER_ESCROW.toLowerCase() ||
617
+ spender.toLowerCase() !== currentEscrow.toLowerCase() ||
585
618
  amount > signed.mandate.maxPerStreamUsdc
586
619
  ) {
587
620
  throw new PrivySessionBrokerError(
@@ -1,6 +1,7 @@
1
1
  import { getAddress, type Address, type Hex } from "viem";
2
2
  import { z } from "zod";
3
3
 
4
+ import { defaultNetwork } from "../network.js";
4
5
  import type { PrivyEip1193Provider } from "./provider.js";
5
6
 
6
7
  const jsonRpcResponseSchema = z.object({
@@ -21,6 +22,8 @@ export interface PrivySessionProviderConfig {
21
22
  readonly sessionToken: string;
22
23
  readonly address: Address;
23
24
  readonly rpcUrl?: string;
25
+ /** Chain the session signs on. Default: the registry's default network. */
26
+ readonly chainId?: number;
24
27
  readonly fetchImpl?: typeof fetch;
25
28
  }
26
29
 
@@ -34,7 +37,7 @@ export class PrivySessionProviderError extends Error {
34
37
  /**
35
38
  * EIP-1193 provider for a policy-bound Metrik/Privy headless session.
36
39
  * Signing and writes go only to the broker; public read RPCs go directly to
37
- * Base Sepolia and never receive the session token.
40
+ * the network's public RPC and never receive the session token.
38
41
  */
39
42
  export function createPrivySessionProvider(
40
43
  config: PrivySessionProviderConfig,
@@ -42,12 +45,13 @@ export function createPrivySessionProvider(
42
45
  const fetchImpl = config.fetchImpl ?? fetch;
43
46
  const address = getAddress(config.address);
44
47
  const brokerUrl = new URL("/v1/rpc", requireHttpsBase(config.brokerUrl));
45
- const rpcUrl = config.rpcUrl ?? "https://base-sepolia-rpc.publicnode.com";
48
+ const rpcUrl = config.rpcUrl ?? defaultNetwork().rpcUrls[0];
49
+ const chainIdHex = `0x${(config.chainId ?? defaultNetwork().chain.id).toString(16)}`;
46
50
  let rpcId = 0;
47
51
 
48
52
  return {
49
53
  async request({ method, params = [] }) {
50
- if (method === "eth_chainId") return "0x14a34";
54
+ if (method === "eth_chainId") return chainIdHex;
51
55
  if (method === "eth_accounts" || method === "eth_requestAccounts") {
52
56
  return [address];
53
57
  }
@@ -1,4 +1,7 @@
1
- import { type StreamProofClientConfig } from "@absol-labs/sdk";
1
+ import {
2
+ networkForChainId,
3
+ type StreamProofClientConfig,
4
+ } from "@absol-labs/sdk";
2
5
  // `@coinbase/cdp-sdk` is an OPTIONAL peer dependency: TYPES only here (erased at
3
6
  // compile time), the runtime module via `loadCdpSdk()` at the point of first use.
4
7
  // This module IS reachable from the package barrel, so a value import here would
@@ -26,6 +29,7 @@ import {
26
29
  VerifiedStreamAgentClient,
27
30
  type AgentSdkClientFactory,
28
31
  } from "../sdk/client.js";
32
+ import { defaultNetwork, requireNetworkForChainId } from "../network.js";
29
33
 
30
34
  const privateKeySchema = z
31
35
  .string()
@@ -165,7 +169,7 @@ export async function resolveAgentWallet(
165
169
  }
166
170
 
167
171
  if ("privy" in input) {
168
- const chainId = input.privy.chainId ?? BASE_SEPOLIA_CHAIN_ID;
172
+ const chainId = input.privy.chainId ?? defaultNetwork().chain.id;
169
173
  const account = await createPrivyEmbeddedAccount(input.privy);
170
174
  return {
171
175
  source: "privy",
@@ -214,7 +218,7 @@ export async function createPrivyEmbeddedAccount(
214
218
  config: PrivyEmbeddedWalletConfig,
215
219
  ): Promise<Account> {
216
220
  validatePrivyConfig(config);
217
- const chainId = config.chainId ?? BASE_SEPOLIA_CHAIN_ID;
221
+ const chainId = config.chainId ?? defaultNetwork().chain.id;
218
222
  await assertPrivySession(config, chainId);
219
223
 
220
224
  const account = {
@@ -357,8 +361,6 @@ async function defaultCdpClientFactory(
357
361
  });
358
362
  }
359
363
 
360
- const BASE_SEPOLIA_CHAIN_ID = 84532;
361
-
362
364
  function validatePrivyConfig(config: PrivyEmbeddedWalletConfig): void {
363
365
  if (config.appId.trim() === "") {
364
366
  throw new PrivyEmbeddedWalletError(
@@ -372,14 +374,17 @@ function validatePrivyConfig(config: PrivyEmbeddedWalletConfig): void {
372
374
  "Privy wallet address is invalid",
373
375
  );
374
376
  }
375
- if (
376
- config.chainId !== undefined &&
377
- config.chainId !== BASE_SEPOLIA_CHAIN_ID
378
- ) {
379
- throw new PrivyEmbeddedWalletError(
380
- "invalid-config",
381
- `Metrik Privy wallets support Base Sepolia chain ID ${BASE_SEPOLIA_CHAIN_ID} only`,
382
- );
377
+ if (config.chainId !== undefined) {
378
+ // A registered TESTNET network only: the wallet signs with a key the
379
+ // browser holds and Metrik settles real value on a mainnet.
380
+ try {
381
+ requireNetworkForChainId(config.chainId, { testnetOnly: true });
382
+ } catch (error) {
383
+ throw new PrivyEmbeddedWalletError(
384
+ "invalid-config",
385
+ `Metrik Privy wallets support registered testnet networks only: ${error instanceof Error ? error.message : String(error)}`,
386
+ );
387
+ }
383
388
  }
384
389
  }
385
390
 
@@ -406,7 +411,7 @@ async function assertPrivySession(
406
411
  if (chainId !== expectedChainId) {
407
412
  throw new PrivyEmbeddedWalletError(
408
413
  "chain-mismatch",
409
- `Privy wallet chain ID ${chainId} is not Base Sepolia (${expectedChainId})`,
414
+ `Privy wallet chain ID ${chainId} is not ${networkForChainId(expectedChainId)?.name ?? "the configured network"} (${expectedChainId})`,
410
415
  );
411
416
  }
412
417
  if (
@@ -441,7 +446,7 @@ async function requestPrivy(
441
446
  function createCheckedPrivyProvider(
442
447
  config: PrivyEmbeddedWalletConfig,
443
448
  ): PrivyEip1193Provider {
444
- const expectedChainId = config.chainId ?? BASE_SEPOLIA_CHAIN_ID;
449
+ const expectedChainId = config.chainId ?? defaultNetwork().chain.id;
445
450
  return {
446
451
  request: async (args) => {
447
452
  if (args.method === "eth_sendTransaction") {
@@ -8,8 +8,9 @@
8
8
  * facilitator. See `docs/x402.md` for the full explanation of why Metrik's
9
9
  * metered-stream settlement does not fit any shipped x402 scheme.
10
10
  *
11
- * The `X402*` / `x402*` exports at the bottom of this file are deprecated
12
- * aliases of the canonical names, kept so existing consumers keep working.
11
+ * The directory name is historical. The deprecated `X402*` / `x402*` alias
12
+ * exports that used to live here were removed with the x402 v1 integration
13
+ * (metrik-agent#115); only the canonical names below are exported.
13
14
  */
14
15
  import type { StreamProofClientConfig } from "@absol-labs/sdk";
15
16
  import { z } from "zod";
@@ -442,44 +443,3 @@ function reviveBigInts(value: unknown): unknown {
442
443
 
443
444
  return value;
444
445
  }
445
-
446
- /* -------------------------------------------------------------------------- */
447
- /* Deprecated `x402`-flavoured aliases. */
448
- /* */
449
- /* These names are misleading — this flow is Metrik-native and not x402 (see */
450
- /* `docs/x402.md`). They are retained as aliases bound to the SAME values and */
451
- /* class objects as the canonical exports above, so existing consumers and */
452
- /* `instanceof` checks keep working. Prefer the canonical names. */
453
- /* -------------------------------------------------------------------------- */
454
-
455
- export {
456
- /** @deprecated Use {@link METRIK_STREAM_SCHEME}. This flow is not x402. */
457
- METRIK_STREAM_SCHEME as X402_SCHEME,
458
- /** @deprecated Use {@link VerifiedStreamFacilitator}. This flow is not x402. */
459
- VerifiedStreamFacilitator as VerifiedStreamX402Facilitator,
460
- /** @deprecated Use {@link StreamPayloadError}. Same class object. */
461
- StreamPayloadError as X402PayloadError,
462
- /** @deprecated Use {@link SpendControlUnavailableError}. Same class object. */
463
- SpendControlUnavailableError as X402SpendControlUnavailableError,
464
- /** @deprecated Use {@link streamChallengeSchema}. */
465
- streamChallengeSchema as x402StreamChallengeSchema,
466
- /** @deprecated Use {@link streamOpenPayloadSchema}. */
467
- streamOpenPayloadSchema as x402OpenPayloadSchema,
468
- /** @deprecated Use {@link encodeStreamPayloadHeader}. */
469
- encodeStreamPayloadHeader as encodeX402PayloadHeader,
470
- /** @deprecated Use {@link parseStreamPayloadHeader}. */
471
- parseStreamPayloadHeader as parseX402PayloadHeader,
472
- /** @deprecated Use {@link parseStreamChallengeJson}. */
473
- parseStreamChallengeJson as parseX402ChallengeJson,
474
- };
475
-
476
- export type {
477
- /** @deprecated Use {@link StreamFacilitator}. This flow is not x402. */
478
- StreamFacilitator as X402Facilitator,
479
- /** @deprecated Use {@link StreamChallenge}. */
480
- StreamChallenge as X402StreamChallenge,
481
- /** @deprecated Use {@link StreamOpenPayload}. */
482
- StreamOpenPayload as X402OpenPayload,
483
- /** @deprecated Use {@link ConsumedHttpsResponseProofInput}. */
484
- ConsumedHttpsResponseProofInput as X402ConsumedHttpsResponseProofInput,
485
- };