@waiaas/daemon 2.0.0-rc.1

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 (480) hide show
  1. package/dist/api/error-hints.d.ts +15 -0
  2. package/dist/api/error-hints.d.ts.map +1 -0
  3. package/dist/api/error-hints.js +71 -0
  4. package/dist/api/error-hints.js.map +1 -0
  5. package/dist/api/index.d.ts +11 -0
  6. package/dist/api/index.d.ts.map +1 -0
  7. package/dist/api/index.js +14 -0
  8. package/dist/api/index.js.map +1 -0
  9. package/dist/api/middleware/address-validation.d.ts +38 -0
  10. package/dist/api/middleware/address-validation.d.ts.map +1 -0
  11. package/dist/api/middleware/address-validation.js +134 -0
  12. package/dist/api/middleware/address-validation.js.map +1 -0
  13. package/dist/api/middleware/csp.d.ts +17 -0
  14. package/dist/api/middleware/csp.d.ts.map +1 -0
  15. package/dist/api/middleware/csp.js +31 -0
  16. package/dist/api/middleware/csp.js.map +1 -0
  17. package/dist/api/middleware/error-handler.d.ts +16 -0
  18. package/dist/api/middleware/error-handler.d.ts.map +1 -0
  19. package/dist/api/middleware/error-handler.js +46 -0
  20. package/dist/api/middleware/error-handler.js.map +1 -0
  21. package/dist/api/middleware/host-guard.d.ts +11 -0
  22. package/dist/api/middleware/host-guard.d.ts.map +1 -0
  23. package/dist/api/middleware/host-guard.js +25 -0
  24. package/dist/api/middleware/host-guard.js.map +1 -0
  25. package/dist/api/middleware/index.d.ts +13 -0
  26. package/dist/api/middleware/index.d.ts.map +1 -0
  27. package/dist/api/middleware/index.js +13 -0
  28. package/dist/api/middleware/index.js.map +1 -0
  29. package/dist/api/middleware/kill-switch-guard.d.ts +19 -0
  30. package/dist/api/middleware/kill-switch-guard.d.ts.map +1 -0
  31. package/dist/api/middleware/kill-switch-guard.js +49 -0
  32. package/dist/api/middleware/kill-switch-guard.js.map +1 -0
  33. package/dist/api/middleware/master-auth.d.ts +15 -0
  34. package/dist/api/middleware/master-auth.d.ts.map +1 -0
  35. package/dist/api/middleware/master-auth.js +35 -0
  36. package/dist/api/middleware/master-auth.js.map +1 -0
  37. package/dist/api/middleware/owner-auth.d.ts +30 -0
  38. package/dist/api/middleware/owner-auth.d.ts.map +1 -0
  39. package/dist/api/middleware/owner-auth.js +133 -0
  40. package/dist/api/middleware/owner-auth.js.map +1 -0
  41. package/dist/api/middleware/request-id.d.ts +10 -0
  42. package/dist/api/middleware/request-id.d.ts.map +1 -0
  43. package/dist/api/middleware/request-id.js +18 -0
  44. package/dist/api/middleware/request-id.js.map +1 -0
  45. package/dist/api/middleware/request-logger.d.ts +9 -0
  46. package/dist/api/middleware/request-logger.d.ts.map +1 -0
  47. package/dist/api/middleware/request-logger.js +18 -0
  48. package/dist/api/middleware/request-logger.js.map +1 -0
  49. package/dist/api/middleware/session-auth.d.ts +21 -0
  50. package/dist/api/middleware/session-auth.d.ts.map +1 -0
  51. package/dist/api/middleware/session-auth.js +51 -0
  52. package/dist/api/middleware/session-auth.js.map +1 -0
  53. package/dist/api/middleware/siwe-verify.d.ts +31 -0
  54. package/dist/api/middleware/siwe-verify.d.ts.map +1 -0
  55. package/dist/api/middleware/siwe-verify.js +55 -0
  56. package/dist/api/middleware/siwe-verify.js.map +1 -0
  57. package/dist/api/routes/actions.d.ts +56 -0
  58. package/dist/api/routes/actions.d.ts.map +1 -0
  59. package/dist/api/routes/actions.js +291 -0
  60. package/dist/api/routes/actions.js.map +1 -0
  61. package/dist/api/routes/admin.d.ts +99 -0
  62. package/dist/api/routes/admin.d.ts.map +1 -0
  63. package/dist/api/routes/admin.js +1304 -0
  64. package/dist/api/routes/admin.js.map +1 -0
  65. package/dist/api/routes/display-currency-helper.d.ts +26 -0
  66. package/dist/api/routes/display-currency-helper.d.ts.map +1 -0
  67. package/dist/api/routes/display-currency-helper.js +47 -0
  68. package/dist/api/routes/display-currency-helper.js.map +1 -0
  69. package/dist/api/routes/health.d.ts +14 -0
  70. package/dist/api/routes/health.d.ts.map +1 -0
  71. package/dist/api/routes/health.js +47 -0
  72. package/dist/api/routes/health.js.map +1 -0
  73. package/dist/api/routes/index.d.ts +15 -0
  74. package/dist/api/routes/index.d.ts.map +1 -0
  75. package/dist/api/routes/index.js +15 -0
  76. package/dist/api/routes/index.js.map +1 -0
  77. package/dist/api/routes/mcp.d.ts +30 -0
  78. package/dist/api/routes/mcp.d.ts.map +1 -0
  79. package/dist/api/routes/mcp.js +156 -0
  80. package/dist/api/routes/mcp.js.map +1 -0
  81. package/dist/api/routes/nonce.d.ts +20 -0
  82. package/dist/api/routes/nonce.d.ts.map +1 -0
  83. package/dist/api/routes/nonce.js +48 -0
  84. package/dist/api/routes/nonce.js.map +1 -0
  85. package/dist/api/routes/openapi-schemas.d.ts +2281 -0
  86. package/dist/api/routes/openapi-schemas.d.ts.map +1 -0
  87. package/dist/api/routes/openapi-schemas.js +770 -0
  88. package/dist/api/routes/openapi-schemas.js.map +1 -0
  89. package/dist/api/routes/policies.d.ts +29 -0
  90. package/dist/api/routes/policies.d.ts.map +1 -0
  91. package/dist/api/routes/policies.js +332 -0
  92. package/dist/api/routes/policies.js.map +1 -0
  93. package/dist/api/routes/sessions.d.ts +35 -0
  94. package/dist/api/routes/sessions.d.ts.map +1 -0
  95. package/dist/api/routes/sessions.js +347 -0
  96. package/dist/api/routes/sessions.js.map +1 -0
  97. package/dist/api/routes/skills.d.ts +9 -0
  98. package/dist/api/routes/skills.d.ts.map +1 -0
  99. package/dist/api/routes/skills.js +59 -0
  100. package/dist/api/routes/skills.js.map +1 -0
  101. package/dist/api/routes/tokens.d.ts +25 -0
  102. package/dist/api/routes/tokens.d.ts.map +1 -0
  103. package/dist/api/routes/tokens.js +161 -0
  104. package/dist/api/routes/tokens.js.map +1 -0
  105. package/dist/api/routes/transactions.d.ts +68 -0
  106. package/dist/api/routes/transactions.d.ts.map +1 -0
  107. package/dist/api/routes/transactions.js +576 -0
  108. package/dist/api/routes/transactions.js.map +1 -0
  109. package/dist/api/routes/utils.d.ts +9 -0
  110. package/dist/api/routes/utils.d.ts.map +1 -0
  111. package/dist/api/routes/utils.js +52 -0
  112. package/dist/api/routes/utils.js.map +1 -0
  113. package/dist/api/routes/wallet.d.ts +36 -0
  114. package/dist/api/routes/wallet.d.ts.map +1 -0
  115. package/dist/api/routes/wallet.js +358 -0
  116. package/dist/api/routes/wallet.js.map +1 -0
  117. package/dist/api/routes/wallets.d.ts +43 -0
  118. package/dist/api/routes/wallets.d.ts.map +1 -0
  119. package/dist/api/routes/wallets.js +630 -0
  120. package/dist/api/routes/wallets.js.map +1 -0
  121. package/dist/api/routes/wc.d.ts +46 -0
  122. package/dist/api/routes/wc.d.ts.map +1 -0
  123. package/dist/api/routes/wc.js +354 -0
  124. package/dist/api/routes/wc.js.map +1 -0
  125. package/dist/api/routes/x402.d.ts +61 -0
  126. package/dist/api/routes/x402.d.ts.map +1 -0
  127. package/dist/api/routes/x402.js +493 -0
  128. package/dist/api/routes/x402.js.map +1 -0
  129. package/dist/api/server.d.ts +81 -0
  130. package/dist/api/server.d.ts.map +1 -0
  131. package/dist/api/server.js +406 -0
  132. package/dist/api/server.js.map +1 -0
  133. package/dist/index.d.ts +35 -0
  134. package/dist/index.d.ts.map +1 -0
  135. package/dist/index.js +43 -0
  136. package/dist/index.js.map +1 -0
  137. package/dist/infrastructure/action/action-provider-registry.d.ts +77 -0
  138. package/dist/infrastructure/action/action-provider-registry.d.ts.map +1 -0
  139. package/dist/infrastructure/action/action-provider-registry.js +239 -0
  140. package/dist/infrastructure/action/action-provider-registry.js.map +1 -0
  141. package/dist/infrastructure/action/api-key-store.d.ts +60 -0
  142. package/dist/infrastructure/action/api-key-store.d.ts.map +1 -0
  143. package/dist/infrastructure/action/api-key-store.js +130 -0
  144. package/dist/infrastructure/action/api-key-store.js.map +1 -0
  145. package/dist/infrastructure/action/index.d.ts +10 -0
  146. package/dist/infrastructure/action/index.d.ts.map +1 -0
  147. package/dist/infrastructure/action/index.js +9 -0
  148. package/dist/infrastructure/action/index.js.map +1 -0
  149. package/dist/infrastructure/adapter-pool.d.ts +50 -0
  150. package/dist/infrastructure/adapter-pool.d.ts.map +1 -0
  151. package/dist/infrastructure/adapter-pool.js +110 -0
  152. package/dist/infrastructure/adapter-pool.js.map +1 -0
  153. package/dist/infrastructure/backup/backup-service.d.ts +53 -0
  154. package/dist/infrastructure/backup/backup-service.d.ts.map +1 -0
  155. package/dist/infrastructure/backup/backup-service.js +158 -0
  156. package/dist/infrastructure/backup/backup-service.js.map +1 -0
  157. package/dist/infrastructure/backup/index.d.ts +2 -0
  158. package/dist/infrastructure/backup/index.d.ts.map +1 -0
  159. package/dist/infrastructure/backup/index.js +2 -0
  160. package/dist/infrastructure/backup/index.js.map +1 -0
  161. package/dist/infrastructure/config/index.d.ts +8 -0
  162. package/dist/infrastructure/config/index.d.ts.map +1 -0
  163. package/dist/infrastructure/config/index.js +7 -0
  164. package/dist/infrastructure/config/index.js.map +1 -0
  165. package/dist/infrastructure/config/loader.d.ts +555 -0
  166. package/dist/infrastructure/config/loader.d.ts.map +1 -0
  167. package/dist/infrastructure/config/loader.js +311 -0
  168. package/dist/infrastructure/config/loader.js.map +1 -0
  169. package/dist/infrastructure/database/checks.d.ts +19 -0
  170. package/dist/infrastructure/database/checks.d.ts.map +1 -0
  171. package/dist/infrastructure/database/checks.js +27 -0
  172. package/dist/infrastructure/database/checks.js.map +1 -0
  173. package/dist/infrastructure/database/compatibility.d.ts +36 -0
  174. package/dist/infrastructure/database/compatibility.d.ts.map +1 -0
  175. package/dist/infrastructure/database/compatibility.js +75 -0
  176. package/dist/infrastructure/database/compatibility.js.map +1 -0
  177. package/dist/infrastructure/database/connection.d.ts +36 -0
  178. package/dist/infrastructure/database/connection.d.ts.map +1 -0
  179. package/dist/infrastructure/database/connection.js +47 -0
  180. package/dist/infrastructure/database/connection.js.map +1 -0
  181. package/dist/infrastructure/database/id.d.ts +17 -0
  182. package/dist/infrastructure/database/id.d.ts.map +1 -0
  183. package/dist/infrastructure/database/id.js +20 -0
  184. package/dist/infrastructure/database/id.js.map +1 -0
  185. package/dist/infrastructure/database/index.d.ts +15 -0
  186. package/dist/infrastructure/database/index.d.ts.map +1 -0
  187. package/dist/infrastructure/database/index.js +12 -0
  188. package/dist/infrastructure/database/index.js.map +1 -0
  189. package/dist/infrastructure/database/migrate.d.ts +76 -0
  190. package/dist/infrastructure/database/migrate.d.ts.map +1 -0
  191. package/dist/infrastructure/database/migrate.js +1214 -0
  192. package/dist/infrastructure/database/migrate.js.map +1 -0
  193. package/dist/infrastructure/database/schema.d.ts +2352 -0
  194. package/dist/infrastructure/database/schema.d.ts.map +1 -0
  195. package/dist/infrastructure/database/schema.js +288 -0
  196. package/dist/infrastructure/database/schema.js.map +1 -0
  197. package/dist/infrastructure/jwt/index.d.ts +2 -0
  198. package/dist/infrastructure/jwt/index.d.ts.map +1 -0
  199. package/dist/infrastructure/jwt/index.js +2 -0
  200. package/dist/infrastructure/jwt/index.js.map +1 -0
  201. package/dist/infrastructure/jwt/jwt-secret-manager.d.ts +58 -0
  202. package/dist/infrastructure/jwt/jwt-secret-manager.d.ts.map +1 -0
  203. package/dist/infrastructure/jwt/jwt-secret-manager.js +222 -0
  204. package/dist/infrastructure/jwt/jwt-secret-manager.js.map +1 -0
  205. package/dist/infrastructure/keystore/crypto.d.ts +62 -0
  206. package/dist/infrastructure/keystore/crypto.d.ts.map +1 -0
  207. package/dist/infrastructure/keystore/crypto.js +89 -0
  208. package/dist/infrastructure/keystore/crypto.js.map +1 -0
  209. package/dist/infrastructure/keystore/index.d.ts +4 -0
  210. package/dist/infrastructure/keystore/index.d.ts.map +1 -0
  211. package/dist/infrastructure/keystore/index.js +5 -0
  212. package/dist/infrastructure/keystore/index.js.map +1 -0
  213. package/dist/infrastructure/keystore/keystore.d.ts +115 -0
  214. package/dist/infrastructure/keystore/keystore.d.ts.map +1 -0
  215. package/dist/infrastructure/keystore/keystore.js +327 -0
  216. package/dist/infrastructure/keystore/keystore.js.map +1 -0
  217. package/dist/infrastructure/keystore/memory.d.ts +45 -0
  218. package/dist/infrastructure/keystore/memory.d.ts.map +1 -0
  219. package/dist/infrastructure/keystore/memory.js +105 -0
  220. package/dist/infrastructure/keystore/memory.js.map +1 -0
  221. package/dist/infrastructure/oracle/coingecko-forex.d.ts +35 -0
  222. package/dist/infrastructure/oracle/coingecko-forex.d.ts.map +1 -0
  223. package/dist/infrastructure/oracle/coingecko-forex.js +69 -0
  224. package/dist/infrastructure/oracle/coingecko-forex.js.map +1 -0
  225. package/dist/infrastructure/oracle/coingecko-oracle.d.ts +73 -0
  226. package/dist/infrastructure/oracle/coingecko-oracle.d.ts.map +1 -0
  227. package/dist/infrastructure/oracle/coingecko-oracle.js +199 -0
  228. package/dist/infrastructure/oracle/coingecko-oracle.js.map +1 -0
  229. package/dist/infrastructure/oracle/coingecko-platform-ids.d.ts +32 -0
  230. package/dist/infrastructure/oracle/coingecko-platform-ids.d.ts.map +1 -0
  231. package/dist/infrastructure/oracle/coingecko-platform-ids.js +30 -0
  232. package/dist/infrastructure/oracle/coingecko-platform-ids.js.map +1 -0
  233. package/dist/infrastructure/oracle/forex-currencies.d.ts +36 -0
  234. package/dist/infrastructure/oracle/forex-currencies.d.ts.map +1 -0
  235. package/dist/infrastructure/oracle/forex-currencies.js +71 -0
  236. package/dist/infrastructure/oracle/forex-currencies.js.map +1 -0
  237. package/dist/infrastructure/oracle/forex-rate-service.d.ts +51 -0
  238. package/dist/infrastructure/oracle/forex-rate-service.d.ts.map +1 -0
  239. package/dist/infrastructure/oracle/forex-rate-service.js +149 -0
  240. package/dist/infrastructure/oracle/forex-rate-service.js.map +1 -0
  241. package/dist/infrastructure/oracle/index.d.ts +18 -0
  242. package/dist/infrastructure/oracle/index.d.ts.map +1 -0
  243. package/dist/infrastructure/oracle/index.js +19 -0
  244. package/dist/infrastructure/oracle/index.js.map +1 -0
  245. package/dist/infrastructure/oracle/oracle-chain.d.ts +101 -0
  246. package/dist/infrastructure/oracle/oracle-chain.d.ts.map +1 -0
  247. package/dist/infrastructure/oracle/oracle-chain.js +163 -0
  248. package/dist/infrastructure/oracle/oracle-chain.js.map +1 -0
  249. package/dist/infrastructure/oracle/oracle-errors.d.ts +42 -0
  250. package/dist/infrastructure/oracle/oracle-errors.d.ts.map +1 -0
  251. package/dist/infrastructure/oracle/oracle-errors.js +53 -0
  252. package/dist/infrastructure/oracle/oracle-errors.js.map +1 -0
  253. package/dist/infrastructure/oracle/price-age.d.ts +38 -0
  254. package/dist/infrastructure/oracle/price-age.d.ts.map +1 -0
  255. package/dist/infrastructure/oracle/price-age.js +44 -0
  256. package/dist/infrastructure/oracle/price-age.js.map +1 -0
  257. package/dist/infrastructure/oracle/price-cache.d.ts +99 -0
  258. package/dist/infrastructure/oracle/price-cache.d.ts.map +1 -0
  259. package/dist/infrastructure/oracle/price-cache.js +173 -0
  260. package/dist/infrastructure/oracle/price-cache.js.map +1 -0
  261. package/dist/infrastructure/oracle/pyth-feed-ids.d.ts +31 -0
  262. package/dist/infrastructure/oracle/pyth-feed-ids.d.ts.map +1 -0
  263. package/dist/infrastructure/oracle/pyth-feed-ids.js +44 -0
  264. package/dist/infrastructure/oracle/pyth-feed-ids.js.map +1 -0
  265. package/dist/infrastructure/oracle/pyth-oracle.d.ts +69 -0
  266. package/dist/infrastructure/oracle/pyth-oracle.d.ts.map +1 -0
  267. package/dist/infrastructure/oracle/pyth-oracle.js +149 -0
  268. package/dist/infrastructure/oracle/pyth-oracle.js.map +1 -0
  269. package/dist/infrastructure/settings/hot-reload.d.ts +71 -0
  270. package/dist/infrastructure/settings/hot-reload.d.ts.map +1 -0
  271. package/dist/infrastructure/settings/hot-reload.js +315 -0
  272. package/dist/infrastructure/settings/hot-reload.js.map +1 -0
  273. package/dist/infrastructure/settings/index.d.ts +13 -0
  274. package/dist/infrastructure/settings/index.d.ts.map +1 -0
  275. package/dist/infrastructure/settings/index.js +10 -0
  276. package/dist/infrastructure/settings/index.js.map +1 -0
  277. package/dist/infrastructure/settings/setting-keys.d.ts +28 -0
  278. package/dist/infrastructure/settings/setting-keys.d.ts.map +1 -0
  279. package/dist/infrastructure/settings/setting-keys.js +105 -0
  280. package/dist/infrastructure/settings/setting-keys.js.map +1 -0
  281. package/dist/infrastructure/settings/settings-crypto.d.ts +39 -0
  282. package/dist/infrastructure/settings/settings-crypto.d.ts.map +1 -0
  283. package/dist/infrastructure/settings/settings-crypto.js +73 -0
  284. package/dist/infrastructure/settings/settings-crypto.js.map +1 -0
  285. package/dist/infrastructure/settings/settings-service.d.ts +82 -0
  286. package/dist/infrastructure/settings/settings-service.d.ts.map +1 -0
  287. package/dist/infrastructure/settings/settings-service.js +267 -0
  288. package/dist/infrastructure/settings/settings-service.js.map +1 -0
  289. package/dist/infrastructure/telegram/index.d.ts +6 -0
  290. package/dist/infrastructure/telegram/index.d.ts.map +1 -0
  291. package/dist/infrastructure/telegram/index.js +5 -0
  292. package/dist/infrastructure/telegram/index.js.map +1 -0
  293. package/dist/infrastructure/telegram/telegram-api.d.ts +35 -0
  294. package/dist/infrastructure/telegram/telegram-api.d.ts.map +1 -0
  295. package/dist/infrastructure/telegram/telegram-api.js +82 -0
  296. package/dist/infrastructure/telegram/telegram-api.js.map +1 -0
  297. package/dist/infrastructure/telegram/telegram-auth.d.ts +57 -0
  298. package/dist/infrastructure/telegram/telegram-auth.d.ts.map +1 -0
  299. package/dist/infrastructure/telegram/telegram-auth.js +88 -0
  300. package/dist/infrastructure/telegram/telegram-auth.js.map +1 -0
  301. package/dist/infrastructure/telegram/telegram-bot-service.d.ts +95 -0
  302. package/dist/infrastructure/telegram/telegram-bot-service.d.ts.map +1 -0
  303. package/dist/infrastructure/telegram/telegram-bot-service.js +564 -0
  304. package/dist/infrastructure/telegram/telegram-bot-service.js.map +1 -0
  305. package/dist/infrastructure/telegram/telegram-keyboard.d.ts +27 -0
  306. package/dist/infrastructure/telegram/telegram-keyboard.d.ts.map +1 -0
  307. package/dist/infrastructure/telegram/telegram-keyboard.js +52 -0
  308. package/dist/infrastructure/telegram/telegram-keyboard.js.map +1 -0
  309. package/dist/infrastructure/telegram/telegram-types.d.ts +43 -0
  310. package/dist/infrastructure/telegram/telegram-types.d.ts.map +1 -0
  311. package/dist/infrastructure/telegram/telegram-types.js +8 -0
  312. package/dist/infrastructure/telegram/telegram-types.js.map +1 -0
  313. package/dist/infrastructure/token-registry/builtin-tokens.d.ts +39 -0
  314. package/dist/infrastructure/token-registry/builtin-tokens.d.ts.map +1 -0
  315. package/dist/infrastructure/token-registry/builtin-tokens.js +135 -0
  316. package/dist/infrastructure/token-registry/builtin-tokens.js.map +1 -0
  317. package/dist/infrastructure/token-registry/index.d.ts +8 -0
  318. package/dist/infrastructure/token-registry/index.d.ts.map +1 -0
  319. package/dist/infrastructure/token-registry/index.js +8 -0
  320. package/dist/infrastructure/token-registry/index.js.map +1 -0
  321. package/dist/infrastructure/token-registry/token-registry-service.d.ts +49 -0
  322. package/dist/infrastructure/token-registry/token-registry-service.d.ts.map +1 -0
  323. package/dist/infrastructure/token-registry/token-registry-service.js +93 -0
  324. package/dist/infrastructure/token-registry/token-registry-service.js.map +1 -0
  325. package/dist/infrastructure/version/index.d.ts +5 -0
  326. package/dist/infrastructure/version/index.d.ts.map +1 -0
  327. package/dist/infrastructure/version/index.js +5 -0
  328. package/dist/infrastructure/version/index.js.map +1 -0
  329. package/dist/infrastructure/version/version-check-service.d.ts +35 -0
  330. package/dist/infrastructure/version/version-check-service.d.ts.map +1 -0
  331. package/dist/infrastructure/version/version-check-service.js +92 -0
  332. package/dist/infrastructure/version/version-check-service.js.map +1 -0
  333. package/dist/lifecycle/daemon.d.ts +103 -0
  334. package/dist/lifecycle/daemon.d.ts.map +1 -0
  335. package/dist/lifecycle/daemon.js +934 -0
  336. package/dist/lifecycle/daemon.js.map +1 -0
  337. package/dist/lifecycle/index.d.ts +9 -0
  338. package/dist/lifecycle/index.d.ts.map +1 -0
  339. package/dist/lifecycle/index.js +9 -0
  340. package/dist/lifecycle/index.js.map +1 -0
  341. package/dist/lifecycle/signal-handler.d.ts +18 -0
  342. package/dist/lifecycle/signal-handler.d.ts.map +1 -0
  343. package/dist/lifecycle/signal-handler.js +37 -0
  344. package/dist/lifecycle/signal-handler.js.map +1 -0
  345. package/dist/lifecycle/workers.d.ts +46 -0
  346. package/dist/lifecycle/workers.d.ts.map +1 -0
  347. package/dist/lifecycle/workers.js +101 -0
  348. package/dist/lifecycle/workers.js.map +1 -0
  349. package/dist/notifications/channels/discord.d.ts +10 -0
  350. package/dist/notifications/channels/discord.d.ts.map +1 -0
  351. package/dist/notifications/channels/discord.js +54 -0
  352. package/dist/notifications/channels/discord.js.map +1 -0
  353. package/dist/notifications/channels/ntfy.d.ts +13 -0
  354. package/dist/notifications/channels/ntfy.d.ts.map +1 -0
  355. package/dist/notifications/channels/ntfy.js +58 -0
  356. package/dist/notifications/channels/ntfy.js.map +1 -0
  357. package/dist/notifications/channels/slack.d.ts +10 -0
  358. package/dist/notifications/channels/slack.d.ts.map +1 -0
  359. package/dist/notifications/channels/slack.js +55 -0
  360. package/dist/notifications/channels/slack.js.map +1 -0
  361. package/dist/notifications/channels/telegram.d.ts +10 -0
  362. package/dist/notifications/channels/telegram.d.ts.map +1 -0
  363. package/dist/notifications/channels/telegram.js +40 -0
  364. package/dist/notifications/channels/telegram.js.map +1 -0
  365. package/dist/notifications/index.d.ts +9 -0
  366. package/dist/notifications/index.d.ts.map +1 -0
  367. package/dist/notifications/index.js +7 -0
  368. package/dist/notifications/index.js.map +1 -0
  369. package/dist/notifications/notification-service.d.ts +75 -0
  370. package/dist/notifications/notification-service.d.ts.map +1 -0
  371. package/dist/notifications/notification-service.js +213 -0
  372. package/dist/notifications/notification-service.js.map +1 -0
  373. package/dist/notifications/templates/message-templates.d.ts +12 -0
  374. package/dist/notifications/templates/message-templates.d.ts.map +1 -0
  375. package/dist/notifications/templates/message-templates.js +22 -0
  376. package/dist/notifications/templates/message-templates.js.map +1 -0
  377. package/dist/pipeline/database-policy-engine.d.ts +286 -0
  378. package/dist/pipeline/database-policy-engine.d.ts.map +1 -0
  379. package/dist/pipeline/database-policy-engine.js +992 -0
  380. package/dist/pipeline/database-policy-engine.js.map +1 -0
  381. package/dist/pipeline/default-policy-engine.d.ts +26 -0
  382. package/dist/pipeline/default-policy-engine.d.ts.map +1 -0
  383. package/dist/pipeline/default-policy-engine.js +25 -0
  384. package/dist/pipeline/default-policy-engine.js.map +1 -0
  385. package/dist/pipeline/index.d.ts +9 -0
  386. package/dist/pipeline/index.d.ts.map +1 -0
  387. package/dist/pipeline/index.js +9 -0
  388. package/dist/pipeline/index.js.map +1 -0
  389. package/dist/pipeline/network-resolver.d.ts +22 -0
  390. package/dist/pipeline/network-resolver.d.ts.map +1 -0
  391. package/dist/pipeline/network-resolver.js +32 -0
  392. package/dist/pipeline/network-resolver.js.map +1 -0
  393. package/dist/pipeline/pipeline.d.ts +72 -0
  394. package/dist/pipeline/pipeline.d.ts.map +1 -0
  395. package/dist/pipeline/pipeline.js +87 -0
  396. package/dist/pipeline/pipeline.js.map +1 -0
  397. package/dist/pipeline/resolve-effective-amount-usd.d.ts +41 -0
  398. package/dist/pipeline/resolve-effective-amount-usd.d.ts.map +1 -0
  399. package/dist/pipeline/resolve-effective-amount-usd.js +208 -0
  400. package/dist/pipeline/resolve-effective-amount-usd.js.map +1 -0
  401. package/dist/pipeline/sign-only.d.ts +99 -0
  402. package/dist/pipeline/sign-only.d.ts.map +1 -0
  403. package/dist/pipeline/sign-only.js +267 -0
  404. package/dist/pipeline/sign-only.js.map +1 -0
  405. package/dist/pipeline/sleep.d.ts +6 -0
  406. package/dist/pipeline/sleep.d.ts.map +1 -0
  407. package/dist/pipeline/sleep.js +8 -0
  408. package/dist/pipeline/sleep.js.map +1 -0
  409. package/dist/pipeline/stages.d.ts +82 -0
  410. package/dist/pipeline/stages.d.ts.map +1 -0
  411. package/dist/pipeline/stages.js +784 -0
  412. package/dist/pipeline/stages.js.map +1 -0
  413. package/dist/services/autostop-rules.d.ts +79 -0
  414. package/dist/services/autostop-rules.d.ts.map +1 -0
  415. package/dist/services/autostop-rules.js +174 -0
  416. package/dist/services/autostop-rules.js.map +1 -0
  417. package/dist/services/autostop-service.d.ts +82 -0
  418. package/dist/services/autostop-service.d.ts.map +1 -0
  419. package/dist/services/autostop-service.js +223 -0
  420. package/dist/services/autostop-service.js.map +1 -0
  421. package/dist/services/kill-switch-service.d.ts +118 -0
  422. package/dist/services/kill-switch-service.d.ts.map +1 -0
  423. package/dist/services/kill-switch-service.js +291 -0
  424. package/dist/services/kill-switch-service.js.map +1 -0
  425. package/dist/services/monitoring/balance-monitor-service.d.ts +65 -0
  426. package/dist/services/monitoring/balance-monitor-service.d.ts.map +1 -0
  427. package/dist/services/monitoring/balance-monitor-service.js +207 -0
  428. package/dist/services/monitoring/balance-monitor-service.js.map +1 -0
  429. package/dist/services/wc-session-service.d.ts +123 -0
  430. package/dist/services/wc-session-service.d.ts.map +1 -0
  431. package/dist/services/wc-session-service.js +363 -0
  432. package/dist/services/wc-session-service.js.map +1 -0
  433. package/dist/services/wc-signing-bridge.d.ts +60 -0
  434. package/dist/services/wc-signing-bridge.d.ts.map +1 -0
  435. package/dist/services/wc-signing-bridge.js +334 -0
  436. package/dist/services/wc-signing-bridge.js.map +1 -0
  437. package/dist/services/wc-storage.d.ts +32 -0
  438. package/dist/services/wc-storage.d.ts.map +1 -0
  439. package/dist/services/wc-storage.js +64 -0
  440. package/dist/services/wc-storage.js.map +1 -0
  441. package/dist/services/x402/payment-signer.d.ts +88 -0
  442. package/dist/services/x402/payment-signer.d.ts.map +1 -0
  443. package/dist/services/x402/payment-signer.js +311 -0
  444. package/dist/services/x402/payment-signer.js.map +1 -0
  445. package/dist/services/x402/ssrf-guard.d.ts +27 -0
  446. package/dist/services/x402/ssrf-guard.d.ts.map +1 -0
  447. package/dist/services/x402/ssrf-guard.js +236 -0
  448. package/dist/services/x402/ssrf-guard.js.map +1 -0
  449. package/dist/services/x402/x402-domain-policy.d.ts +50 -0
  450. package/dist/services/x402/x402-domain-policy.d.ts.map +1 -0
  451. package/dist/services/x402/x402-domain-policy.js +78 -0
  452. package/dist/services/x402/x402-domain-policy.js.map +1 -0
  453. package/dist/services/x402/x402-handler.d.ts +71 -0
  454. package/dist/services/x402/x402-handler.d.ts.map +1 -0
  455. package/dist/services/x402/x402-handler.js +195 -0
  456. package/dist/services/x402/x402-handler.js.map +1 -0
  457. package/dist/services/x402/x402-usd-resolver.d.ts +26 -0
  458. package/dist/services/x402/x402-usd-resolver.d.ts.map +1 -0
  459. package/dist/services/x402/x402-usd-resolver.js +79 -0
  460. package/dist/services/x402/x402-usd-resolver.js.map +1 -0
  461. package/dist/workflow/approval-workflow.d.ts +103 -0
  462. package/dist/workflow/approval-workflow.d.ts.map +1 -0
  463. package/dist/workflow/approval-workflow.js +202 -0
  464. package/dist/workflow/approval-workflow.js.map +1 -0
  465. package/dist/workflow/delay-queue.d.ts +78 -0
  466. package/dist/workflow/delay-queue.d.ts.map +1 -0
  467. package/dist/workflow/delay-queue.js +174 -0
  468. package/dist/workflow/delay-queue.js.map +1 -0
  469. package/dist/workflow/index.d.ts +11 -0
  470. package/dist/workflow/index.d.ts.map +1 -0
  471. package/dist/workflow/index.js +9 -0
  472. package/dist/workflow/index.js.map +1 -0
  473. package/dist/workflow/owner-state.d.ts +97 -0
  474. package/dist/workflow/owner-state.d.ts.map +1 -0
  475. package/dist/workflow/owner-state.js +168 -0
  476. package/dist/workflow/owner-state.js.map +1 -0
  477. package/package.json +71 -0
  478. package/public/admin/assets/index-BPoUSH8W.css +1 -0
  479. package/public/admin/assets/index-CDi1qoXB.js +1 -0
  480. package/public/admin/index.html +13 -0
@@ -0,0 +1,770 @@
1
+ /**
2
+ * Shared OpenAPI Zod response schemas and error code mapping.
3
+ *
4
+ * This file provides:
5
+ * 1. Response schemas for all 18 routes (using z from @hono/zod-openapi)
6
+ * 2. Error code -> OpenAPI response mapping via buildErrorResponses()
7
+ * 3. Re-exported request schemas with .openapi() metadata
8
+ *
9
+ * @see docs/37-rest-api-complete-spec.md
10
+ */
11
+ import { z } from '@hono/zod-openapi';
12
+ import { ERROR_CODES, WAIaaSError, CreateWalletRequestSchema, CreateSessionRequestSchema, SendTransactionRequestSchema, CreatePolicyRequestSchema, UpdatePolicyRequestSchema, TransferRequestSchema, TokenTransferRequestSchema, ContractCallRequestSchema, ApproveRequestSchema, BatchRequestSchema, } from '@waiaas/core';
13
+ // ---------------------------------------------------------------------------
14
+ // Error Response Schema
15
+ // ---------------------------------------------------------------------------
16
+ export const ErrorResponseSchema = z
17
+ .object({
18
+ code: z.string(),
19
+ message: z.string(),
20
+ retryable: z.boolean(),
21
+ details: z.record(z.unknown()).optional(),
22
+ requestId: z.string().optional(),
23
+ hint: z.string().optional(),
24
+ })
25
+ .openapi('ErrorResponse');
26
+ // ---------------------------------------------------------------------------
27
+ // Health Response Schema
28
+ // ---------------------------------------------------------------------------
29
+ export const HealthResponseSchema = z
30
+ .object({
31
+ status: z.string(),
32
+ version: z.string(),
33
+ latestVersion: z.string().nullable(),
34
+ updateAvailable: z.boolean(),
35
+ schemaVersion: z.number().int(),
36
+ uptime: z.number().int(),
37
+ timestamp: z.number().int(),
38
+ })
39
+ .openapi('HealthResponse');
40
+ // ---------------------------------------------------------------------------
41
+ // Wallet CRUD Response Schemas
42
+ // ---------------------------------------------------------------------------
43
+ export const WalletCrudResponseSchema = z
44
+ .object({
45
+ id: z.string().uuid(),
46
+ name: z.string(),
47
+ chain: z.string(),
48
+ network: z.string(),
49
+ environment: z.string(),
50
+ publicKey: z.string(),
51
+ status: z.string(),
52
+ ownerAddress: z.string().nullable(),
53
+ ownerState: z.enum(['NONE', 'GRACE', 'LOCKED']),
54
+ createdAt: z.number().int(),
55
+ })
56
+ .openapi('WalletCrudResponse');
57
+ export const WalletOwnerResponseSchema = z
58
+ .object({
59
+ id: z.string().uuid(),
60
+ name: z.string(),
61
+ chain: z.string(),
62
+ network: z.string(),
63
+ environment: z.string(),
64
+ publicKey: z.string(),
65
+ status: z.string(),
66
+ ownerAddress: z.string().nullable(),
67
+ ownerVerified: z.boolean().nullable(),
68
+ updatedAt: z.number().int().nullable(),
69
+ })
70
+ .openapi('WalletOwnerResponse');
71
+ export const OwnerVerifyResponseSchema = z
72
+ .object({
73
+ ownerState: z.enum(['NONE', 'GRACE', 'LOCKED']),
74
+ ownerAddress: z.string().nullable(),
75
+ ownerVerified: z.boolean(),
76
+ })
77
+ .openapi('OwnerVerifyResponse');
78
+ // ---------------------------------------------------------------------------
79
+ // Wallet Query Response Schemas
80
+ // ---------------------------------------------------------------------------
81
+ export const WalletAddressResponseSchema = z
82
+ .object({
83
+ walletId: z.string().uuid(),
84
+ chain: z.string(),
85
+ network: z.string(),
86
+ address: z.string(),
87
+ })
88
+ .openapi('WalletAddressResponse');
89
+ export const WalletBalanceResponseSchema = z
90
+ .object({
91
+ walletId: z.string().uuid(),
92
+ chain: z.string(),
93
+ network: z.string(),
94
+ address: z.string(),
95
+ balance: z.string(),
96
+ decimals: z.number().int(),
97
+ symbol: z.string(),
98
+ displayBalance: z.string().nullable().optional(),
99
+ displayCurrency: z.string().nullable().optional(),
100
+ })
101
+ .openapi('WalletBalanceResponse');
102
+ // ---------------------------------------------------------------------------
103
+ // Session Response Schemas
104
+ // ---------------------------------------------------------------------------
105
+ export const SessionCreateResponseSchema = z
106
+ .object({
107
+ id: z.string().uuid(),
108
+ token: z.string(),
109
+ expiresAt: z.number().int(),
110
+ walletId: z.string().uuid(),
111
+ })
112
+ .openapi('SessionCreateResponse');
113
+ export const SessionListItemSchema = z
114
+ .object({
115
+ id: z.string().uuid(),
116
+ walletId: z.string().uuid(),
117
+ walletName: z.string().nullable(),
118
+ status: z.string(),
119
+ renewalCount: z.number().int(),
120
+ maxRenewals: z.number().int(),
121
+ expiresAt: z.number().int(),
122
+ absoluteExpiresAt: z.number().int(),
123
+ createdAt: z.number().int(),
124
+ lastRenewedAt: z.number().int().nullable(),
125
+ })
126
+ .openapi('SessionListItem');
127
+ export const SessionRevokeResponseSchema = z
128
+ .object({
129
+ id: z.string().uuid(),
130
+ status: z.string(),
131
+ message: z.string().optional(),
132
+ })
133
+ .openapi('SessionRevokeResponse');
134
+ export const SessionRenewResponseSchema = z
135
+ .object({
136
+ id: z.string().uuid(),
137
+ token: z.string(),
138
+ expiresAt: z.number().int(),
139
+ renewalCount: z.number().int(),
140
+ })
141
+ .openapi('SessionRenewResponse');
142
+ // ---------------------------------------------------------------------------
143
+ // Transaction Response Schemas
144
+ // ---------------------------------------------------------------------------
145
+ export const TxSendResponseSchema = z
146
+ .object({
147
+ id: z.string().uuid(),
148
+ status: z.string(),
149
+ })
150
+ .openapi('TxSendResponse');
151
+ export const TxDetailResponseSchema = z
152
+ .object({
153
+ id: z.string().uuid(),
154
+ walletId: z.string().uuid(),
155
+ type: z.string(),
156
+ status: z.string(),
157
+ tier: z.string().nullable(),
158
+ chain: z.string(),
159
+ network: z.string().nullable(),
160
+ toAddress: z.string().nullable(),
161
+ amount: z.string().nullable(),
162
+ txHash: z.string().nullable(),
163
+ error: z.string().nullable(),
164
+ createdAt: z.number().int().nullable(),
165
+ displayAmount: z.string().nullable().optional(),
166
+ displayCurrency: z.string().nullable().optional(),
167
+ })
168
+ .openapi('TxDetailResponse');
169
+ export const TxApproveResponseSchema = z
170
+ .object({
171
+ id: z.string().uuid(),
172
+ status: z.string(),
173
+ approvedAt: z.number().int(),
174
+ })
175
+ .openapi('TxApproveResponse');
176
+ export const TxRejectResponseSchema = z
177
+ .object({
178
+ id: z.string().uuid(),
179
+ status: z.string(),
180
+ rejectedAt: z.number().int(),
181
+ })
182
+ .openapi('TxRejectResponse');
183
+ export const TxCancelResponseSchema = z
184
+ .object({
185
+ id: z.string().uuid(),
186
+ status: z.string(),
187
+ })
188
+ .openapi('TxCancelResponse');
189
+ // ---------------------------------------------------------------------------
190
+ // Policy Response Schemas
191
+ // ---------------------------------------------------------------------------
192
+ export const PolicyResponseSchema = z
193
+ .object({
194
+ id: z.string().uuid(),
195
+ walletId: z.string().uuid().nullable(),
196
+ type: z.string(),
197
+ rules: z.record(z.unknown()),
198
+ priority: z.number().int(),
199
+ enabled: z.boolean(),
200
+ network: z.string().nullable(),
201
+ createdAt: z.number().int(),
202
+ updatedAt: z.number().int(),
203
+ })
204
+ .openapi('PolicyResponse');
205
+ export const PolicyDeleteResponseSchema = z
206
+ .object({
207
+ id: z.string().uuid(),
208
+ deleted: z.boolean(),
209
+ })
210
+ .openapi('PolicyDeleteResponse');
211
+ // ---------------------------------------------------------------------------
212
+ // Error Code -> OpenAPI Response Mapping
213
+ // ---------------------------------------------------------------------------
214
+ /**
215
+ * Build OpenAPI error response entries from a list of error codes.
216
+ * Groups error codes by httpStatus, merging multiple codes into a single
217
+ * response entry with description listing which codes can occur.
218
+ *
219
+ * @param codes - Array of error code keys from ERROR_CODES
220
+ * @returns Record of HTTP status code string -> OpenAPI response definition
221
+ */
222
+ export function buildErrorResponses(codes) {
223
+ const grouped = new Map();
224
+ for (const code of codes) {
225
+ const entry = ERROR_CODES[code];
226
+ const status = entry.httpStatus;
227
+ if (!grouped.has(status)) {
228
+ grouped.set(status, []);
229
+ }
230
+ grouped.get(status).push(code);
231
+ }
232
+ const result = {};
233
+ for (const [status, codelist] of grouped) {
234
+ const descriptions = codelist.map((c) => `${c}: ${ERROR_CODES[c].message}`);
235
+ result[String(status)] = {
236
+ description: descriptions.join(' | '),
237
+ content: {
238
+ 'application/json': { schema: ErrorResponseSchema },
239
+ },
240
+ };
241
+ }
242
+ return result;
243
+ }
244
+ // ---------------------------------------------------------------------------
245
+ // Re-exported Request Schemas with OpenAPI metadata
246
+ // ---------------------------------------------------------------------------
247
+ export const CreateWalletRequestOpenAPI = CreateWalletRequestSchema.openapi('CreateWalletRequest');
248
+ export const CreateSessionRequestOpenAPI = CreateSessionRequestSchema.openapi('CreateSessionRequest');
249
+ export const SendTransactionRequestOpenAPI = SendTransactionRequestSchema.openapi('SendTransactionRequest');
250
+ export const CreatePolicyRequestOpenAPI = CreatePolicyRequestSchema.openapi('CreatePolicyRequest');
251
+ export const UpdatePolicyRequestOpenAPI = UpdatePolicyRequestSchema.openapi('UpdatePolicyRequest');
252
+ // ---------------------------------------------------------------------------
253
+ // 5-type Transaction Request OpenAPI Components (Phase 86-01)
254
+ // ---------------------------------------------------------------------------
255
+ export const TransferRequestOpenAPI = TransferRequestSchema.openapi('TransferRequest');
256
+ export const TokenTransferRequestOpenAPI = TokenTransferRequestSchema.openapi('TokenTransferRequest');
257
+ export const ContractCallRequestOpenAPI = ContractCallRequestSchema.openapi('ContractCallRequest');
258
+ export const ApproveRequestOpenAPI = ApproveRequestSchema.openapi('ApproveRequest');
259
+ export const BatchRequestOpenAPI = BatchRequestSchema.openapi('BatchRequest');
260
+ /**
261
+ * Loose passthrough schema for the send transaction route.
262
+ * Uses z.any() to bypass Hono's built-in Zod validation (validation is delegated
263
+ * to stage1Validate which uses the correct discriminatedUnion or legacy schema).
264
+ * The OpenAPI doc uses manual oneOf to document all 6 request variants.
265
+ */
266
+ export const TransactionRequestOpenAPI = z.any().openapi({
267
+ type: 'object',
268
+ oneOf: [
269
+ { $ref: '#/components/schemas/TransferRequest' },
270
+ { $ref: '#/components/schemas/TokenTransferRequest' },
271
+ { $ref: '#/components/schemas/ContractCallRequest' },
272
+ { $ref: '#/components/schemas/ApproveRequest' },
273
+ { $ref: '#/components/schemas/BatchRequest' },
274
+ { $ref: '#/components/schemas/SendTransactionRequest' },
275
+ ],
276
+ description: 'Transaction request. Legacy format (to/amount/memo without type) is treated as TRANSFER.',
277
+ });
278
+ // ---------------------------------------------------------------------------
279
+ // Default validation hook for OpenAPIHono
280
+ // ---------------------------------------------------------------------------
281
+ /**
282
+ * Default validation hook that throws WAIaaSError on validation failure.
283
+ * This ensures OpenAPIHono's built-in Zod validation produces the same
284
+ * error format as our existing errorHandler (code, message, retryable).
285
+ */
286
+ export function openApiValidationHook(result, _c) {
287
+ if (!result.success) {
288
+ throw new WAIaaSError('ACTION_VALIDATION_FAILED', {
289
+ message: 'Validation error',
290
+ details: { issues: result.error?.issues ?? [] },
291
+ });
292
+ }
293
+ }
294
+ // ---------------------------------------------------------------------------
295
+ // Wallet Assets Response Schema (GET /v1/wallet/assets)
296
+ // ---------------------------------------------------------------------------
297
+ export const WalletAssetsResponseSchema = z
298
+ .object({
299
+ walletId: z.string().uuid(),
300
+ chain: z.string(),
301
+ network: z.string(),
302
+ assets: z.array(z.object({
303
+ mint: z.string(),
304
+ symbol: z.string(),
305
+ name: z.string(),
306
+ balance: z.string(),
307
+ decimals: z.number().int(),
308
+ isNative: z.boolean(),
309
+ usdValue: z.number().optional(),
310
+ displayValue: z.string().nullable().optional(),
311
+ })),
312
+ displayCurrency: z.string().nullable().optional(),
313
+ })
314
+ .openapi('WalletAssetsResponse');
315
+ // ---------------------------------------------------------------------------
316
+ // Transaction List Response Schemas (GET /v1/transactions, /pending)
317
+ // ---------------------------------------------------------------------------
318
+ export const TxListResponseSchema = z
319
+ .object({
320
+ items: z.array(TxDetailResponseSchema),
321
+ cursor: z.string().nullable(),
322
+ hasMore: z.boolean(),
323
+ })
324
+ .openapi('TxListResponse');
325
+ export const TxPendingListResponseSchema = z
326
+ .object({
327
+ items: z.array(TxDetailResponseSchema),
328
+ })
329
+ .openapi('TxPendingListResponse');
330
+ // ---------------------------------------------------------------------------
331
+ // Nonce Response Schema (GET /v1/nonce)
332
+ // ---------------------------------------------------------------------------
333
+ export const NonceResponseSchema = z
334
+ .object({
335
+ nonce: z.string(),
336
+ expiresAt: z.number().int(),
337
+ })
338
+ .openapi('NonceResponse');
339
+ // ---------------------------------------------------------------------------
340
+ // Wallet List / Detail Response Schemas (GET /v1/wallets, GET /v1/wallets/:id)
341
+ // ---------------------------------------------------------------------------
342
+ export const WalletListResponseSchema = z
343
+ .object({
344
+ items: z.array(WalletCrudResponseSchema),
345
+ })
346
+ .openapi('WalletListResponse');
347
+ export const WalletDetailResponseSchema = z
348
+ .object({
349
+ id: z.string().uuid(),
350
+ name: z.string(),
351
+ chain: z.string(),
352
+ network: z.string(),
353
+ environment: z.string(),
354
+ defaultNetwork: z.string().nullable().optional(),
355
+ publicKey: z.string(),
356
+ status: z.string(),
357
+ ownerAddress: z.string().nullable(),
358
+ ownerVerified: z.boolean().nullable(),
359
+ ownerState: z.enum(['NONE', 'GRACE', 'LOCKED']),
360
+ createdAt: z.number().int(),
361
+ updatedAt: z.number().int().nullable(),
362
+ })
363
+ .openapi('WalletDetailResponse');
364
+ // ---------------------------------------------------------------------------
365
+ // Wallet Network Management Schemas (PUT /wallets/:id/default-network, GET /wallets/:id/networks)
366
+ // ---------------------------------------------------------------------------
367
+ // PUT /wallets/:id/default-network request
368
+ export const UpdateDefaultNetworkRequestSchema = z
369
+ .object({
370
+ network: z.string().min(1),
371
+ })
372
+ .openapi('UpdateDefaultNetworkRequest');
373
+ // PUT /wallets/:id/default-network response
374
+ export const UpdateDefaultNetworkResponseSchema = z
375
+ .object({
376
+ id: z.string().uuid(),
377
+ defaultNetwork: z.string(),
378
+ previousNetwork: z.string().nullable(),
379
+ })
380
+ .openapi('UpdateDefaultNetworkResponse');
381
+ // GET /wallets/:id/networks response
382
+ export const WalletNetworksResponseSchema = z
383
+ .object({
384
+ id: z.string().uuid(),
385
+ chain: z.string(),
386
+ environment: z.string(),
387
+ defaultNetwork: z.string().nullable(),
388
+ availableNetworks: z.array(z.object({
389
+ network: z.string(),
390
+ isDefault: z.boolean(),
391
+ })),
392
+ })
393
+ .openapi('WalletNetworksResponse');
394
+ // Owner address request body schema (for PUT /wallets/:id/owner)
395
+ export const SetOwnerRequestSchema = z
396
+ .object({
397
+ owner_address: z.string().min(1),
398
+ })
399
+ .openapi('SetOwnerRequest');
400
+ // ---------------------------------------------------------------------------
401
+ // Wallet CRUD Schemas (PUT /wallets/:id, DELETE /wallets/:id)
402
+ // ---------------------------------------------------------------------------
403
+ export const UpdateWalletRequestSchema = z
404
+ .object({
405
+ name: z.string().min(1).max(100),
406
+ })
407
+ .openapi('UpdateWalletRequest');
408
+ export const WalletDeleteResponseSchema = z
409
+ .object({
410
+ id: z.string().uuid(),
411
+ status: z.literal('TERMINATED'),
412
+ })
413
+ .openapi('WalletDeleteResponse');
414
+ // ---------------------------------------------------------------------------
415
+ // Admin Response Schemas (6 admin endpoints)
416
+ // ---------------------------------------------------------------------------
417
+ export const AdminStatusResponseSchema = z
418
+ .object({
419
+ status: z.string(),
420
+ version: z.string(),
421
+ uptime: z.number().int(),
422
+ walletCount: z.number().int(),
423
+ activeSessionCount: z.number().int(),
424
+ killSwitchState: z.string(),
425
+ adminTimeout: z.number().int(),
426
+ timestamp: z.number().int(),
427
+ policyCount: z.number().int(),
428
+ recentTxCount: z.number().int(),
429
+ failedTxCount: z.number().int(),
430
+ recentTransactions: z.array(z.object({
431
+ id: z.string(),
432
+ walletId: z.string(),
433
+ walletName: z.string().nullable(),
434
+ type: z.string(),
435
+ status: z.string(),
436
+ toAddress: z.string().nullable(),
437
+ amount: z.string().nullable(),
438
+ network: z.string().nullable(),
439
+ createdAt: z.number().int().nullable(),
440
+ })),
441
+ })
442
+ .openapi('AdminStatusResponse');
443
+ export const KillSwitchResponseSchema = z
444
+ .object({
445
+ state: z.string(),
446
+ activatedAt: z.number().int().nullable(),
447
+ activatedBy: z.string().nullable(),
448
+ })
449
+ .openapi('KillSwitchResponse');
450
+ export const KillSwitchActivateResponseSchema = z
451
+ .object({
452
+ state: z.literal('SUSPENDED'),
453
+ activatedAt: z.number().int(),
454
+ })
455
+ .openapi('KillSwitchActivateResponse');
456
+ export const KillSwitchEscalateResponseSchema = z
457
+ .object({
458
+ state: z.literal('LOCKED'),
459
+ escalatedAt: z.number().int(),
460
+ })
461
+ .openapi('KillSwitchEscalateResponse');
462
+ export const RecoverResponseSchema = z
463
+ .object({
464
+ state: z.literal('ACTIVE'),
465
+ recoveredAt: z.number().int(),
466
+ })
467
+ .openapi('RecoverResponse');
468
+ export const KillSwitchRecoverRequestSchema = z
469
+ .object({
470
+ ownerSignature: z.string().optional(),
471
+ ownerAddress: z.string().optional(),
472
+ chain: z.enum(['solana', 'ethereum']).optional(),
473
+ message: z.string().optional(),
474
+ })
475
+ .openapi('KillSwitchRecoverRequest');
476
+ export const OwnerKillSwitchResponseSchema = z
477
+ .object({
478
+ state: z.literal('SUSPENDED'),
479
+ activatedAt: z.number().int(),
480
+ })
481
+ .openapi('OwnerKillSwitchResponse');
482
+ export const ShutdownResponseSchema = z
483
+ .object({
484
+ message: z.string(),
485
+ })
486
+ .openapi('ShutdownResponse');
487
+ export const RotateSecretResponseSchema = z
488
+ .object({
489
+ rotatedAt: z.number().int(),
490
+ message: z.string(),
491
+ })
492
+ .openapi('RotateSecretResponse');
493
+ // ---------------------------------------------------------------------------
494
+ // Notification Admin Response Schemas (3 notification admin endpoints)
495
+ // ---------------------------------------------------------------------------
496
+ export const NotificationChannelStatusSchema = z
497
+ .object({
498
+ name: z.string(),
499
+ enabled: z.boolean(),
500
+ })
501
+ .openapi('NotificationChannelStatus');
502
+ export const NotificationStatusResponseSchema = z
503
+ .object({
504
+ enabled: z.boolean(),
505
+ channels: z.array(NotificationChannelStatusSchema),
506
+ })
507
+ .openapi('NotificationStatusResponse');
508
+ export const NotificationTestRequestSchema = z
509
+ .object({
510
+ channel: z.string().optional(),
511
+ })
512
+ .openapi('NotificationTestRequest');
513
+ export const NotificationTestResponseSchema = z
514
+ .object({
515
+ results: z.array(z.object({
516
+ channel: z.string(),
517
+ success: z.boolean(),
518
+ error: z.string().optional(),
519
+ })),
520
+ })
521
+ .openapi('NotificationTestResponse');
522
+ export const NotificationLogEntrySchema = z
523
+ .object({
524
+ id: z.string(),
525
+ eventType: z.string(),
526
+ walletId: z.string().nullable(),
527
+ channel: z.string(),
528
+ status: z.string(),
529
+ error: z.string().nullable(),
530
+ message: z.string().nullable(),
531
+ createdAt: z.number(),
532
+ })
533
+ .openapi('NotificationLogEntry');
534
+ export const NotificationLogResponseSchema = z
535
+ .object({
536
+ logs: z.array(NotificationLogEntrySchema),
537
+ total: z.number(),
538
+ page: z.number(),
539
+ pageSize: z.number(),
540
+ })
541
+ .openapi('NotificationLogResponse');
542
+ // ---------------------------------------------------------------------------
543
+ // Token Registry Schemas (GET/POST/DELETE /v1/tokens)
544
+ // ---------------------------------------------------------------------------
545
+ export const TokenRegistryItemSchema = z
546
+ .object({
547
+ address: z.string(),
548
+ symbol: z.string(),
549
+ name: z.string(),
550
+ decimals: z.number().int(),
551
+ source: z.enum(['builtin', 'custom']),
552
+ })
553
+ .openapi('TokenRegistryItem');
554
+ export const TokenRegistryListResponseSchema = z
555
+ .object({
556
+ network: z.string(),
557
+ tokens: z.array(TokenRegistryItemSchema),
558
+ })
559
+ .openapi('TokenRegistryListResponse');
560
+ export const AddTokenRequestSchema = z
561
+ .object({
562
+ network: z.string().openapi({ example: 'ethereum-mainnet' }),
563
+ address: z.string().openapi({ example: '0x...' }),
564
+ symbol: z.string().min(1).max(20).openapi({ example: 'LINK' }),
565
+ name: z.string().min(1).max(100).openapi({ example: 'Chainlink Token' }),
566
+ decimals: z.number().int().min(0).max(18).openapi({ example: 18 }),
567
+ })
568
+ .openapi('AddTokenRequest');
569
+ export const AddTokenResponseSchema = z
570
+ .object({
571
+ id: z.string(),
572
+ network: z.string(),
573
+ address: z.string(),
574
+ symbol: z.string(),
575
+ })
576
+ .openapi('AddTokenResponse');
577
+ export const RemoveTokenRequestSchema = z
578
+ .object({
579
+ network: z.string(),
580
+ address: z.string(),
581
+ })
582
+ .openapi('RemoveTokenRequest');
583
+ export const RemoveTokenResponseSchema = z
584
+ .object({
585
+ removed: z.boolean(),
586
+ network: z.string(),
587
+ address: z.string(),
588
+ })
589
+ .openapi('RemoveTokenResponse');
590
+ // ---------------------------------------------------------------------------
591
+ // Settings Admin Schemas (GET/PUT /v1/admin/settings, POST /v1/admin/settings/test-rpc)
592
+ // ---------------------------------------------------------------------------
593
+ export const SettingsResponseSchema = z
594
+ .object({
595
+ notifications: z.record(z.union([z.string(), z.boolean()])),
596
+ rpc: z.record(z.union([z.string(), z.boolean()])),
597
+ security: z.record(z.union([z.string(), z.boolean()])),
598
+ daemon: z.record(z.union([z.string(), z.boolean()])),
599
+ walletconnect: z.record(z.union([z.string(), z.boolean()])),
600
+ })
601
+ .openapi('SettingsResponse');
602
+ export const SettingsUpdateRequestSchema = z
603
+ .object({
604
+ settings: z
605
+ .array(z.object({
606
+ key: z.string(),
607
+ value: z.string(),
608
+ }))
609
+ .min(1),
610
+ })
611
+ .openapi('SettingsUpdateRequest');
612
+ export const SettingsUpdateResponseSchema = z
613
+ .object({
614
+ updated: z.number().int(),
615
+ settings: SettingsResponseSchema,
616
+ })
617
+ .openapi('SettingsUpdateResponse');
618
+ export const TestRpcRequestSchema = z
619
+ .object({
620
+ url: z.string().url(),
621
+ chain: z.enum(['solana', 'ethereum']).optional().default('ethereum'),
622
+ })
623
+ .openapi('TestRpcRequest');
624
+ export const TestRpcResponseSchema = z
625
+ .object({
626
+ success: z.boolean(),
627
+ latencyMs: z.number().optional(),
628
+ error: z.string().optional(),
629
+ chainId: z.string().optional(),
630
+ blockNumber: z.number().optional(),
631
+ })
632
+ .openapi('TestRpcResponse');
633
+ // ---------------------------------------------------------------------------
634
+ // MCP Token Provisioning Schemas (POST /v1/mcp/tokens) -- BUG-013 fix
635
+ // ---------------------------------------------------------------------------
636
+ export const McpTokenCreateRequestSchema = z
637
+ .object({
638
+ walletId: z.string().uuid(),
639
+ expiresIn: z.number().int().min(300).max(604800).optional(),
640
+ })
641
+ .openapi('McpTokenCreateRequest');
642
+ export const McpTokenCreateResponseSchema = z
643
+ .object({
644
+ walletId: z.string(),
645
+ walletName: z.string().nullable(),
646
+ tokenPath: z.string(),
647
+ expiresAt: z.number(),
648
+ claudeDesktopConfig: z.record(z.unknown()),
649
+ })
650
+ .openapi('McpTokenCreateResponse');
651
+ // ---------------------------------------------------------------------------
652
+ // Utils: Encode Calldata Schemas
653
+ // ---------------------------------------------------------------------------
654
+ export const EncodeCalldataRequestSchema = z
655
+ .object({
656
+ abi: z.array(z.record(z.unknown())).describe('ABI fragment array (JSON)'),
657
+ functionName: z.string().describe('Function name to encode'),
658
+ args: z.array(z.any()).optional().default([]).describe('Function arguments'),
659
+ })
660
+ .openapi('EncodeCalldataRequest');
661
+ export const EncodeCalldataResponseSchema = z
662
+ .object({
663
+ calldata: z.string().describe('Hex-encoded calldata (0x-prefixed)'),
664
+ selector: z.string().describe('Function selector (first 4 bytes, 0x-prefixed)'),
665
+ functionName: z.string().describe('Encoded function name'),
666
+ })
667
+ .openapi('EncodeCalldataResponse');
668
+ // ---------------------------------------------------------------------------
669
+ // Sign-Only Transaction Schemas (POST /v1/transactions/sign)
670
+ // ---------------------------------------------------------------------------
671
+ export const TxSignRequestSchema = z
672
+ .object({
673
+ transaction: z.string().min(1).openapi({
674
+ description: 'Unsigned transaction (base64 for Solana, 0x-hex for EVM)',
675
+ }),
676
+ chain: z.string().optional().openapi({
677
+ description: 'Chain type (optional -- inferred from wallet)',
678
+ }),
679
+ network: z.string().optional().openapi({
680
+ description: 'Network (optional -- resolved from wallet defaults)',
681
+ }),
682
+ })
683
+ .openapi('TxSignRequest');
684
+ export const TxSignResponseSchema = z
685
+ .object({
686
+ id: z.string().uuid(),
687
+ signedTransaction: z.string(),
688
+ txHash: z.string().nullable(),
689
+ operations: z.array(z.object({
690
+ type: z.string(),
691
+ to: z.string().nullable().optional(),
692
+ amount: z.string().nullable().optional(),
693
+ token: z.string().nullable().optional(),
694
+ programId: z.string().nullable().optional(),
695
+ method: z.string().nullable().optional(),
696
+ })),
697
+ policyResult: z.object({
698
+ tier: z.string(),
699
+ }),
700
+ })
701
+ .openapi('TxSignResponse');
702
+ // ---------------------------------------------------------------------------
703
+ // Oracle Status Schema (GET /v1/admin/oracle-status)
704
+ // ---------------------------------------------------------------------------
705
+ export const OracleStatusResponseSchema = z
706
+ .object({
707
+ cache: z.object({
708
+ hits: z.number(),
709
+ misses: z.number(),
710
+ staleHits: z.number(),
711
+ size: z.number(),
712
+ evictions: z.number(),
713
+ }),
714
+ sources: z.object({
715
+ pyth: z.object({
716
+ available: z.boolean(),
717
+ baseUrl: z.string(),
718
+ }),
719
+ coingecko: z.object({
720
+ available: z.boolean(),
721
+ apiKeyConfigured: z.boolean(),
722
+ }),
723
+ }),
724
+ crossValidation: z.object({
725
+ enabled: z.boolean(),
726
+ threshold: z.number(),
727
+ }),
728
+ })
729
+ .openapi('OracleStatusResponse');
730
+ // ---------------------------------------------------------------------------
731
+ // WalletConnect Pairing & Session Schemas
732
+ // ---------------------------------------------------------------------------
733
+ export const WcPairingResponseSchema = z.object({
734
+ uri: z.string(),
735
+ qrCode: z.string(), // data:image/png;base64,...
736
+ expiresAt: z.number().int(),
737
+ }).openapi('WcPairingResponse');
738
+ export const WcSessionResponseSchema = z.object({
739
+ walletId: z.string(),
740
+ topic: z.string(),
741
+ peerName: z.string().nullable(),
742
+ peerUrl: z.string().nullable(),
743
+ chainId: z.string(),
744
+ ownerAddress: z.string(),
745
+ expiry: z.number().int(),
746
+ createdAt: z.number().int(),
747
+ }).openapi('WcSessionResponse');
748
+ export const WcPairingStatusResponseSchema = z.object({
749
+ status: z.enum(['pending', 'connected', 'expired', 'none']),
750
+ session: WcSessionResponseSchema.nullable().optional(),
751
+ }).openapi('WcPairingStatusResponse');
752
+ export const WcDisconnectResponseSchema = z.object({
753
+ disconnected: z.boolean(),
754
+ }).openapi('WcDisconnectResponse');
755
+ // ---------------------------------------------------------------------------
756
+ // Withdraw (sweep) response
757
+ // ---------------------------------------------------------------------------
758
+ export const WithdrawResponseSchema = z.object({
759
+ total: z.number().int(),
760
+ succeeded: z.number().int(),
761
+ failed: z.number().int(),
762
+ results: z.array(z.object({
763
+ asset: z.string(),
764
+ amount: z.string(),
765
+ txHash: z.string().optional(),
766
+ error: z.string().optional(),
767
+ status: z.enum(['success', 'failed']),
768
+ })),
769
+ }).openapi('WithdrawResponse');
770
+ //# sourceMappingURL=openapi-schemas.js.map