@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,45 @@
1
+ /**
2
+ * Sodium-native guarded memory management.
3
+ *
4
+ * Design reference: 26-keystore-spec.md section 4.
5
+ * - sodium_malloc: allocate guarded buffer with guard pages
6
+ * - sodium_mprotect_readonly: protect after writing
7
+ * - sodium_memzero: zero-fill before release
8
+ * - sodium_mprotect_noaccess: prevent any further access
9
+ *
10
+ * Falls back to regular Buffer if sodium-native is not available (with warning).
11
+ */
12
+ /**
13
+ * Check if sodium-native is available.
14
+ * Caches the result after first check.
15
+ */
16
+ export declare function isAvailable(): boolean;
17
+ /**
18
+ * Allocate a guarded memory buffer of the given size.
19
+ *
20
+ * Uses sodium_malloc which places guard pages around the allocation,
21
+ * preventing buffer overflows from accessing adjacent memory.
22
+ *
23
+ * @param size - Number of bytes to allocate
24
+ * @returns Guarded buffer (default: no access until writeToGuarded)
25
+ */
26
+ export declare function allocateGuarded(size: number): Buffer;
27
+ /**
28
+ * Write source data into a guarded buffer and set it to readonly.
29
+ *
30
+ * @param target - Guarded buffer (from allocateGuarded)
31
+ * @param source - Data to copy into the guarded buffer
32
+ */
33
+ export declare function writeToGuarded(target: Buffer, source: Buffer): void;
34
+ /**
35
+ * Zero-fill and release a guarded buffer.
36
+ *
37
+ * After this call, the buffer contents are zeroed and the buffer
38
+ * is set to no-access mode. The buffer should not be used after this.
39
+ *
40
+ * Note: sodium_free is not exposed in sodium-native; rely on GC after zero+noaccess.
41
+ *
42
+ * @param buf - Guarded buffer to zero and release
43
+ */
44
+ export declare function zeroAndRelease(buf: Buffer): void;
45
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/keystore/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH;;;GAGG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAerC;AAaD;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOpD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CASnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAahD"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * Sodium-native guarded memory management.
3
+ *
4
+ * Design reference: 26-keystore-spec.md section 4.
5
+ * - sodium_malloc: allocate guarded buffer with guard pages
6
+ * - sodium_mprotect_readonly: protect after writing
7
+ * - sodium_memzero: zero-fill before release
8
+ * - sodium_mprotect_noaccess: prevent any further access
9
+ *
10
+ * Falls back to regular Buffer if sodium-native is not available (with warning).
11
+ */
12
+ import { createRequire } from 'node:module';
13
+ const require = createRequire(import.meta.url);
14
+ let sodium = null;
15
+ let sodiumChecked = false;
16
+ /**
17
+ * Check if sodium-native is available.
18
+ * Caches the result after first check.
19
+ */
20
+ export function isAvailable() {
21
+ if (!sodiumChecked) {
22
+ try {
23
+ sodium = require('sodium-native');
24
+ sodiumChecked = true;
25
+ }
26
+ catch {
27
+ console.warn('[WAIaaS] sodium-native not available. Using regular Buffer for key storage. ' +
28
+ 'Install sodium-native for guarded memory protection.');
29
+ sodium = null;
30
+ sodiumChecked = true;
31
+ }
32
+ }
33
+ return sodium !== null;
34
+ }
35
+ /**
36
+ * Get the sodium-native module, loading it if necessary.
37
+ * Returns null if not available.
38
+ */
39
+ function getSodium() {
40
+ if (!sodiumChecked) {
41
+ isAvailable();
42
+ }
43
+ return sodium;
44
+ }
45
+ /**
46
+ * Allocate a guarded memory buffer of the given size.
47
+ *
48
+ * Uses sodium_malloc which places guard pages around the allocation,
49
+ * preventing buffer overflows from accessing adjacent memory.
50
+ *
51
+ * @param size - Number of bytes to allocate
52
+ * @returns Guarded buffer (default: no access until writeToGuarded)
53
+ */
54
+ export function allocateGuarded(size) {
55
+ const s = getSodium();
56
+ if (s) {
57
+ return s.sodium_malloc(size);
58
+ }
59
+ // Fallback: regular buffer
60
+ return Buffer.alloc(size);
61
+ }
62
+ /**
63
+ * Write source data into a guarded buffer and set it to readonly.
64
+ *
65
+ * @param target - Guarded buffer (from allocateGuarded)
66
+ * @param source - Data to copy into the guarded buffer
67
+ */
68
+ export function writeToGuarded(target, source) {
69
+ const s = getSodium();
70
+ if (s) {
71
+ s.sodium_mprotect_readwrite(target);
72
+ source.copy(target);
73
+ s.sodium_mprotect_readonly(target);
74
+ }
75
+ else {
76
+ source.copy(target);
77
+ }
78
+ }
79
+ /**
80
+ * Zero-fill and release a guarded buffer.
81
+ *
82
+ * After this call, the buffer contents are zeroed and the buffer
83
+ * is set to no-access mode. The buffer should not be used after this.
84
+ *
85
+ * Note: sodium_free is not exposed in sodium-native; rely on GC after zero+noaccess.
86
+ *
87
+ * @param buf - Guarded buffer to zero and release
88
+ */
89
+ export function zeroAndRelease(buf) {
90
+ const s = getSodium();
91
+ if (s) {
92
+ try {
93
+ s.sodium_mprotect_readwrite(buf);
94
+ }
95
+ catch {
96
+ // Buffer may already be in a writable state
97
+ }
98
+ s.sodium_memzero(buf);
99
+ s.sodium_mprotect_noaccess(buf);
100
+ }
101
+ else {
102
+ buf.fill(0);
103
+ }
104
+ }
105
+ //# sourceMappingURL=memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.js","sourceRoot":"","sources":["../../../src/infrastructure/keystore/memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAI5C,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAE/C,IAAI,MAAM,GAAwB,IAAI,CAAC;AACvC,IAAI,aAAa,GAAG,KAAK,CAAC;AAE1B;;;GAGG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,IAAI,CAAC;YACH,MAAM,GAAG,OAAO,CAAC,eAAe,CAAiB,CAAC;YAClD,aAAa,GAAG,IAAI,CAAC;QACvB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,CAAC,IAAI,CACV,8EAA8E;gBAC5E,sDAAsD,CACzD,CAAC;YACF,MAAM,GAAG,IAAI,CAAC;YACd,aAAa,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,KAAK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;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * CoinGecko-based forex rate provider.
3
+ *
4
+ * Queries CoinGecko's `/simple/price?ids=tether&vs_currencies=...` endpoint
5
+ * to get USD -> fiat exchange rates. Uses USDT (tether) as USD proxy
6
+ * since CoinGecko doesn't provide direct forex rates.
7
+ *
8
+ * Rate limits: Same as CoinGecko Demo API (30 calls/min, 10,000/month).
9
+ * Shares API key with CoinGeckoOracle (crypto price oracle).
10
+ *
11
+ * This provider does NOT manage cache -- caching is handled by ForexRateService
12
+ * via InMemoryPriceCache (30-minute TTL).
13
+ */
14
+ /**
15
+ * CoinGecko forex rate provider.
16
+ *
17
+ * Fetches fiat exchange rates using tether (USDT ~ 1 USD) as proxy.
18
+ * GET /simple/price?ids=tether&vs_currencies=krw,jpy,eur,...
19
+ *
20
+ * Returns Map<currencyCode, rate> where rate is 1 USD in target currency.
21
+ * Empty Map if API key is not configured (graceful degradation).
22
+ */
23
+ export declare class CoinGeckoForexProvider {
24
+ private readonly apiKey;
25
+ constructor(apiKey: string);
26
+ /**
27
+ * Fetch forex rates for multiple currencies from CoinGecko.
28
+ *
29
+ * @param currencies - Array of uppercase currency codes (e.g. ['KRW', 'JPY']).
30
+ * @returns Map from currency code to exchange rate.
31
+ * @throws Error on HTTP errors (non-2xx status).
32
+ */
33
+ getRates(currencies: string[]): Promise<Map<string, number>>;
34
+ }
35
+ //# sourceMappingURL=coingecko-forex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coingecko-forex.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/oracle/coingecko-forex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAQH;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C;;;;;;OAMG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAoCnE"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * CoinGecko-based forex rate provider.
3
+ *
4
+ * Queries CoinGecko's `/simple/price?ids=tether&vs_currencies=...` endpoint
5
+ * to get USD -> fiat exchange rates. Uses USDT (tether) as USD proxy
6
+ * since CoinGecko doesn't provide direct forex rates.
7
+ *
8
+ * Rate limits: Same as CoinGecko Demo API (30 calls/min, 10,000/month).
9
+ * Shares API key with CoinGeckoOracle (crypto price oracle).
10
+ *
11
+ * This provider does NOT manage cache -- caching is handled by ForexRateService
12
+ * via InMemoryPriceCache (30-minute TTL).
13
+ */
14
+ /** CoinGecko Demo API base URL. */
15
+ const BASE_URL = 'https://api.coingecko.com/api/v3';
16
+ /** Request timeout in milliseconds. */
17
+ const TIMEOUT_MS = 5000;
18
+ /**
19
+ * CoinGecko forex rate provider.
20
+ *
21
+ * Fetches fiat exchange rates using tether (USDT ~ 1 USD) as proxy.
22
+ * GET /simple/price?ids=tether&vs_currencies=krw,jpy,eur,...
23
+ *
24
+ * Returns Map<currencyCode, rate> where rate is 1 USD in target currency.
25
+ * Empty Map if API key is not configured (graceful degradation).
26
+ */
27
+ export class CoinGeckoForexProvider {
28
+ apiKey;
29
+ constructor(apiKey) {
30
+ this.apiKey = apiKey;
31
+ }
32
+ /**
33
+ * Fetch forex rates for multiple currencies from CoinGecko.
34
+ *
35
+ * @param currencies - Array of uppercase currency codes (e.g. ['KRW', 'JPY']).
36
+ * @returns Map from currency code to exchange rate.
37
+ * @throws Error on HTTP errors (non-2xx status).
38
+ */
39
+ async getRates(currencies) {
40
+ // Graceful: no API key -> empty result (no throw)
41
+ if (!this.apiKey) {
42
+ return new Map();
43
+ }
44
+ if (currencies.length === 0) {
45
+ return new Map();
46
+ }
47
+ // CoinGecko vs_currencies expects lowercase
48
+ const vsCurrencies = currencies.map((c) => c.toLowerCase()).join(',');
49
+ const url = `${BASE_URL}/simple/price?ids=tether&vs_currencies=${vsCurrencies}`;
50
+ const res = await fetch(url, {
51
+ headers: { 'x-cg-demo-api-key': this.apiKey },
52
+ signal: AbortSignal.timeout(TIMEOUT_MS),
53
+ });
54
+ if (!res.ok) {
55
+ throw new Error(`CoinGecko forex API error: ${res.status} ${res.statusText}`);
56
+ }
57
+ const data = (await res.json());
58
+ const tetherData = data.tether ?? {};
59
+ const result = new Map();
60
+ for (const curr of currencies) {
61
+ const rate = tetherData[curr.toLowerCase()];
62
+ if (typeof rate === 'number' && rate > 0) {
63
+ result.set(curr, rate);
64
+ }
65
+ }
66
+ return result;
67
+ }
68
+ }
69
+ //# sourceMappingURL=coingecko-forex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coingecko-forex.js","sourceRoot":"","sources":["../../../src/infrastructure/oracle/coingecko-forex.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,mCAAmC;AACnC,MAAM,QAAQ,GAAG,kCAAkC,CAAC;AAEpD,uCAAuC;AACvC,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,OAAO,sBAAsB;IACJ;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;;;;;OAMG;IACH,KAAK,CAAC,QAAQ,CAAC,UAAoB;QACjC,kDAAkD;QAClD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,OAAO,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;QAED,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;QAED,4CAA4C;QAC5C,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACtE,MAAM,GAAG,GAAG,GAAG,QAAQ,0CAA0C,YAAY,EAAE,CAAC;QAEhF,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAC3B,OAAO,EAAE,EAAE,mBAAmB,EAAE,IAAI,CAAC,MAAM,EAAE;YAC7C,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC;SACxC,CAAC,CAAC;QAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;QAChF,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA2C,CAAC;QAC1E,MAAM,UAAU,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;QAErC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;QACzC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;YAC9B,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;YAC5C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,GAAG,CAAC,EAAE,CAAC;gBACzC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YACzB,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * CoinGecko Demo API oracle implementation.
3
+ *
4
+ * Queries CoinGecko for SPL/ERC-20 token and native token (SOL/ETH) prices.
5
+ * Uses the Demo API with x-cg-demo-api-key header authentication.
6
+ *
7
+ * Rate limits: 30 calls/min (Demo tier), 10,000 calls/month.
8
+ *
9
+ * This oracle does NOT manage its own cache -- caching is handled by
10
+ * OracleChain via InMemoryPriceCache (v1.5 cache responsibility decision).
11
+ */
12
+ import type { ChainType, PriceInfo, CacheStats, IPriceOracle, TokenRef } from '@waiaas/core';
13
+ export { PriceNotAvailableError, CoinGeckoNotConfiguredError } from './oracle-errors.js';
14
+ /**
15
+ * CoinGecko price oracle implementing IPriceOracle.
16
+ *
17
+ * Fetches prices from CoinGecko Demo API:
18
+ * - Token prices: GET /simple/token_price/{platformId}
19
+ * - Native prices: GET /simple/price
20
+ *
21
+ * Does not manage cache internally (OracleChain manages shared cache).
22
+ */
23
+ export declare class CoinGeckoOracle implements IPriceOracle {
24
+ private readonly apiKey;
25
+ constructor(apiKey: string);
26
+ /**
27
+ * Get price for a single token.
28
+ *
29
+ * @param token - Token reference with address, chain, decimals.
30
+ * @returns PriceInfo with USD price from CoinGecko.
31
+ * @throws CoinGeckoNotConfiguredError if API key is empty.
32
+ * @throws PriceNotAvailableError if CoinGecko has no data for this token.
33
+ * @throws Error on HTTP errors (429, 500, etc).
34
+ */
35
+ getPrice(token: TokenRef): Promise<PriceInfo>;
36
+ /**
37
+ * Get prices for multiple tokens in batch.
38
+ *
39
+ * Groups tokens by chain and makes one API call per chain
40
+ * (comma-separated addresses). Native tokens are queried separately.
41
+ *
42
+ * Individual token failures are skipped (not included in result Map).
43
+ *
44
+ * @param tokens - Array of token references.
45
+ * @returns Map from cache key to PriceInfo.
46
+ */
47
+ getPrices(tokens: TokenRef[]): Promise<Map<string, PriceInfo>>;
48
+ /**
49
+ * Get native token price (SOL or ETH).
50
+ *
51
+ * @param chain - Chain type ('solana' or 'ethereum').
52
+ * @returns PriceInfo with native token USD price.
53
+ * @throws CoinGeckoNotConfiguredError if API key is empty.
54
+ * @throws PriceNotAvailableError if chain is unsupported or no data.
55
+ */
56
+ getNativePrice(chain: ChainType): Promise<PriceInfo>;
57
+ /**
58
+ * Get cache statistics.
59
+ *
60
+ * CoinGeckoOracle does not manage its own cache (OracleChain manages
61
+ * the shared InMemoryPriceCache), so all counters are zero.
62
+ */
63
+ getCacheStats(): CacheStats;
64
+ /** Throw if API key is not configured. */
65
+ private ensureConfigured;
66
+ /** Fetch JSON from CoinGecko API with timeout and API key header. */
67
+ private fetchJson;
68
+ /** Build a PriceInfo with coingecko source and 5-minute TTL. */
69
+ private buildPriceInfo;
70
+ /** Fetch batch token prices for a single chain and add to result map. */
71
+ private fetchBatchTokenPrices;
72
+ }
73
+ //# sourceMappingURL=coingecko-oracle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coingecko-oracle.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/oracle/coingecko-oracle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAM7F,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAWzF;;;;;;;;GAQG;AACH,qBAAa,eAAgB,YAAW,YAAY;IACtC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,MAAM;IAE3C;;;;;;;;OAQG;IACG,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,OAAO,CAAC,SAAS,CAAC;IAwCnD;;;;;;;;;;OAUG;IACG,SAAS,CAAC,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IA6CpE;;;;;;;OAOG;IACG,cAAc,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IA4B1D;;;;;OAKG;IACH,aAAa,IAAI,UAAU;IAQ3B,0CAA0C;IAC1C,OAAO,CAAC,gBAAgB;IAMxB,qEAAqE;YACvD,SAAS;IAavB,gEAAgE;IAChE,OAAO,CAAC,cAAc;IAWtB,yEAAyE;YAC3D,qBAAqB;CAqCpC"}
@@ -0,0 +1,199 @@
1
+ import { getCoinGeckoPlatform } from './coingecko-platform-ids.js';
2
+ import { PriceNotAvailableError, CoinGeckoNotConfiguredError } from './oracle-errors.js';
3
+ import { buildCacheKey } from './price-cache.js';
4
+ // Re-export error classes for consumer convenience
5
+ export { PriceNotAvailableError, CoinGeckoNotConfiguredError } from './oracle-errors.js';
6
+ /** CoinGecko Demo API base URL. */
7
+ const BASE_URL = 'https://api.coingecko.com/api/v3';
8
+ /** Request timeout in milliseconds. */
9
+ const TIMEOUT_MS = 5000;
10
+ /** Price TTL in milliseconds (5 minutes). */
11
+ const PRICE_TTL_MS = 5 * 60 * 1000;
12
+ /**
13
+ * CoinGecko price oracle implementing IPriceOracle.
14
+ *
15
+ * Fetches prices from CoinGecko Demo API:
16
+ * - Token prices: GET /simple/token_price/{platformId}
17
+ * - Native prices: GET /simple/price
18
+ *
19
+ * Does not manage cache internally (OracleChain manages shared cache).
20
+ */
21
+ export class CoinGeckoOracle {
22
+ apiKey;
23
+ constructor(apiKey) {
24
+ this.apiKey = apiKey;
25
+ }
26
+ /**
27
+ * Get price for a single token.
28
+ *
29
+ * @param token - Token reference with address, chain, decimals.
30
+ * @returns PriceInfo with USD price from CoinGecko.
31
+ * @throws CoinGeckoNotConfiguredError if API key is empty.
32
+ * @throws PriceNotAvailableError if CoinGecko has no data for this token.
33
+ * @throws Error on HTTP errors (429, 500, etc).
34
+ */
35
+ async getPrice(token) {
36
+ this.ensureConfigured();
37
+ // Delegate native tokens to getNativePrice
38
+ if (token.address === 'native') {
39
+ return this.getNativePrice(token.chain);
40
+ }
41
+ const platform = getCoinGeckoPlatform(token.chain);
42
+ if (!platform) {
43
+ throw new PriceNotAvailableError(`Unsupported chain for CoinGecko: ${token.chain}`);
44
+ }
45
+ // EVM addresses must be lowercased for CoinGecko API
46
+ const address = token.chain === 'ethereum'
47
+ ? token.address.toLowerCase()
48
+ : token.address;
49
+ const url = `${BASE_URL}/simple/token_price/${platform.platformId}` +
50
+ `?contract_addresses=${address}` +
51
+ `&vs_currencies=usd` +
52
+ `&include_last_updated_at=true`;
53
+ const data = await this.fetchJson(url);
54
+ // CoinGecko returns EVM addresses lowercased; Solana addresses are returned as-is
55
+ const lookupKey = token.chain === 'ethereum' ? address.toLowerCase() : address;
56
+ const tokenData = data[lookupKey];
57
+ if (!tokenData?.usd) {
58
+ throw new PriceNotAvailableError(`CoinGecko returned no price for ${token.symbol ?? token.address} on ${token.chain}`);
59
+ }
60
+ return this.buildPriceInfo(tokenData.usd);
61
+ }
62
+ /**
63
+ * Get prices for multiple tokens in batch.
64
+ *
65
+ * Groups tokens by chain and makes one API call per chain
66
+ * (comma-separated addresses). Native tokens are queried separately.
67
+ *
68
+ * Individual token failures are skipped (not included in result Map).
69
+ *
70
+ * @param tokens - Array of token references.
71
+ * @returns Map from cache key to PriceInfo.
72
+ */
73
+ async getPrices(tokens) {
74
+ this.ensureConfigured();
75
+ const result = new Map();
76
+ // Separate native and non-native tokens
77
+ const nativeTokens = [];
78
+ const tokensByChain = new Map();
79
+ for (const token of tokens) {
80
+ if (token.address === 'native') {
81
+ nativeTokens.push(token);
82
+ }
83
+ else {
84
+ const list = tokensByChain.get(token.chain) ?? [];
85
+ list.push(token);
86
+ tokensByChain.set(token.chain, list);
87
+ }
88
+ }
89
+ // Batch query per chain (comma-separated addresses)
90
+ const batchPromises = [];
91
+ for (const [chain, chainTokens] of tokensByChain) {
92
+ batchPromises.push(this.fetchBatchTokenPrices(chain, chainTokens, result));
93
+ }
94
+ // Native token queries
95
+ for (const token of nativeTokens) {
96
+ batchPromises.push(this.getNativePrice(token.chain)
97
+ .then((price) => {
98
+ result.set(buildCacheKey(token.chain, 'native'), price);
99
+ })
100
+ .catch(() => {
101
+ // Skip failed native price queries
102
+ }));
103
+ }
104
+ await Promise.all(batchPromises);
105
+ return result;
106
+ }
107
+ /**
108
+ * Get native token price (SOL or ETH).
109
+ *
110
+ * @param chain - Chain type ('solana' or 'ethereum').
111
+ * @returns PriceInfo with native token USD price.
112
+ * @throws CoinGeckoNotConfiguredError if API key is empty.
113
+ * @throws PriceNotAvailableError if chain is unsupported or no data.
114
+ */
115
+ async getNativePrice(chain) {
116
+ this.ensureConfigured();
117
+ const platform = getCoinGeckoPlatform(chain);
118
+ if (!platform) {
119
+ throw new PriceNotAvailableError(`Unsupported chain for CoinGecko native price: ${chain}`);
120
+ }
121
+ const url = `${BASE_URL}/simple/price` +
122
+ `?ids=${platform.nativeCoinId}` +
123
+ `&vs_currencies=usd` +
124
+ `&include_last_updated_at=true`;
125
+ const data = await this.fetchJson(url);
126
+ const coinData = data[platform.nativeCoinId];
127
+ if (!coinData?.usd) {
128
+ throw new PriceNotAvailableError(`CoinGecko returned no native price for ${chain}`);
129
+ }
130
+ return this.buildPriceInfo(coinData.usd);
131
+ }
132
+ /**
133
+ * Get cache statistics.
134
+ *
135
+ * CoinGeckoOracle does not manage its own cache (OracleChain manages
136
+ * the shared InMemoryPriceCache), so all counters are zero.
137
+ */
138
+ getCacheStats() {
139
+ return { hits: 0, misses: 0, staleHits: 0, size: 0, evictions: 0 };
140
+ }
141
+ // ---------------------------------------------------------------------------
142
+ // Private helpers
143
+ // ---------------------------------------------------------------------------
144
+ /** Throw if API key is not configured. */
145
+ ensureConfigured() {
146
+ if (!this.apiKey) {
147
+ throw new CoinGeckoNotConfiguredError();
148
+ }
149
+ }
150
+ /** Fetch JSON from CoinGecko API with timeout and API key header. */
151
+ async fetchJson(url) {
152
+ const res = await fetch(url, {
153
+ headers: { 'x-cg-demo-api-key': this.apiKey },
154
+ signal: AbortSignal.timeout(TIMEOUT_MS),
155
+ });
156
+ if (!res.ok) {
157
+ throw new Error(`CoinGecko API error: ${res.status} ${res.statusText}`);
158
+ }
159
+ return res.json();
160
+ }
161
+ /** Build a PriceInfo with coingecko source and 5-minute TTL. */
162
+ buildPriceInfo(usdPrice) {
163
+ const now = Date.now();
164
+ return {
165
+ usdPrice,
166
+ source: 'coingecko',
167
+ fetchedAt: now,
168
+ expiresAt: now + PRICE_TTL_MS,
169
+ isStale: false,
170
+ };
171
+ }
172
+ /** Fetch batch token prices for a single chain and add to result map. */
173
+ async fetchBatchTokenPrices(chain, tokens, result) {
174
+ const platform = getCoinGeckoPlatform(chain);
175
+ if (!platform)
176
+ return;
177
+ const addresses = tokens.map((t) => chain === 'ethereum' ? t.address.toLowerCase() : t.address);
178
+ const url = `${BASE_URL}/simple/token_price/${platform.platformId}` +
179
+ `?contract_addresses=${addresses.join(',')}` +
180
+ `&vs_currencies=usd` +
181
+ `&include_last_updated_at=true`;
182
+ try {
183
+ const data = await this.fetchJson(url);
184
+ for (const token of tokens) {
185
+ const addr = chain === 'ethereum'
186
+ ? token.address.toLowerCase()
187
+ : token.address;
188
+ const tokenData = data[addr];
189
+ if (tokenData?.usd) {
190
+ result.set(buildCacheKey(chain, token.address), this.buildPriceInfo(tokenData.usd));
191
+ }
192
+ }
193
+ }
194
+ catch {
195
+ // Skip failed batch queries (individual token failures)
196
+ }
197
+ }
198
+ }
199
+ //# sourceMappingURL=coingecko-oracle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coingecko-oracle.js","sourceRoot":"","sources":["../../../src/infrastructure/oracle/coingecko-oracle.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,mDAAmD;AACnD,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAEzF,mCAAmC;AACnC,MAAM,QAAQ,GAAG,kCAAkC,CAAC;AAEpD,uCAAuC;AACvC,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,6CAA6C;AAC7C,MAAM,YAAY,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAEnC;;;;;;;;GAQG;AACH,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;;;;;;;OAQG;IACH,KAAK,CAAC,QAAQ,CAAC,KA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YACpB,+BAA+B,CAAC;QAElC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,SAAS,CAA6D,GAAG,CAAC,CAAC;YAEnG,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC3B,MAAM,IAAI,GAAG,KAAK,KAAK,UAAU;oBAC/B,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE;oBAC7B,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;gBAClB,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC7B,IAAI,SAAS,EAAE,GAAG,EAAE,CAAC;oBACnB,MAAM,CAAC,GAAG,CACR,aAAa,CAAC,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACnC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,GAAG,CAAC,CACnC,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,wDAAwD;QAC1D,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * CoinGecko platform ID and native coin ID mapping.
3
+ *
4
+ * Maps WAIaaS ChainType to CoinGecko API identifiers:
5
+ * - platformId: used in /simple/token_price/{platformId} path
6
+ * - nativeCoinId: used in /simple/price?ids={nativeCoinId} path
7
+ *
8
+ * v1.5: Only solana and ethereum. L2 networks (Polygon, Arbitrum, etc.)
9
+ * will be added when TokenRef gains a network field.
10
+ */
11
+ /** CoinGecko platform configuration for a chain. */
12
+ export interface CoinGeckoPlatform {
13
+ /** Platform ID for /simple/token_price/{platformId} endpoint. */
14
+ platformId: string;
15
+ /** Native coin ID for /simple/price?ids={nativeCoinId} endpoint. */
16
+ nativeCoinId: string;
17
+ }
18
+ /**
19
+ * Map from WAIaaS ChainType to CoinGecko platform/coin IDs.
20
+ *
21
+ * Currently supports solana and ethereum (mainnet).
22
+ * L2 platformIds (polygon-pos, arbitrum-one, etc.) are out of v1.5 scope.
23
+ */
24
+ export declare const COINGECKO_PLATFORM_MAP: Record<string, CoinGeckoPlatform>;
25
+ /**
26
+ * Look up CoinGecko platform config for a chain.
27
+ *
28
+ * @param chain - WAIaaS ChainType ('solana' | 'ethereum').
29
+ * @returns CoinGeckoPlatform if supported, undefined otherwise.
30
+ */
31
+ export declare function getCoinGeckoPlatform(chain: string): CoinGeckoPlatform | undefined;
32
+ //# sourceMappingURL=coingecko-platform-ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coingecko-platform-ids.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/oracle/coingecko-platform-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE;IACpE,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAGpE,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEjF"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * CoinGecko platform ID and native coin ID mapping.
3
+ *
4
+ * Maps WAIaaS ChainType to CoinGecko API identifiers:
5
+ * - platformId: used in /simple/token_price/{platformId} path
6
+ * - nativeCoinId: used in /simple/price?ids={nativeCoinId} path
7
+ *
8
+ * v1.5: Only solana and ethereum. L2 networks (Polygon, Arbitrum, etc.)
9
+ * will be added when TokenRef gains a network field.
10
+ */
11
+ /**
12
+ * Map from WAIaaS ChainType to CoinGecko platform/coin IDs.
13
+ *
14
+ * Currently supports solana and ethereum (mainnet).
15
+ * L2 platformIds (polygon-pos, arbitrum-one, etc.) are out of v1.5 scope.
16
+ */
17
+ export const COINGECKO_PLATFORM_MAP = {
18
+ solana: { platformId: 'solana', nativeCoinId: 'solana' },
19
+ ethereum: { platformId: 'ethereum', nativeCoinId: 'ethereum' },
20
+ };
21
+ /**
22
+ * Look up CoinGecko platform config for a chain.
23
+ *
24
+ * @param chain - WAIaaS ChainType ('solana' | 'ethereum').
25
+ * @returns CoinGeckoPlatform if supported, undefined otherwise.
26
+ */
27
+ export function getCoinGeckoPlatform(chain) {
28
+ return COINGECKO_PLATFORM_MAP[chain];
29
+ }
30
+ //# sourceMappingURL=coingecko-platform-ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coingecko-platform-ids.js","sourceRoot":"","sources":["../../../src/infrastructure/oracle/coingecko-platform-ids.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAsC;IACvE,MAAM,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE;IACxD,QAAQ,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE;CAC/D,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAa;IAChD,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}