tapimo 0.12.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/dist/App.d.ts +11333 -9563
  2. package/dist/App.d.ts.map +1 -1
  3. package/dist/App.js +39 -3
  4. package/dist/App.js.map +1 -1
  5. package/dist/Scope.d.ts +2 -0
  6. package/dist/Scope.d.ts.map +1 -1
  7. package/dist/Scope.js +17 -0
  8. package/dist/Scope.js.map +1 -1
  9. package/dist/Webhooks.js +2 -2
  10. package/dist/Webhooks.js.map +1 -1
  11. package/dist/admin/App.d.ts +1064 -924
  12. package/dist/admin/App.d.ts.map +1 -1
  13. package/dist/admin/apps/api-keys.d.ts +80 -0
  14. package/dist/admin/apps/api-keys.d.ts.map +1 -1
  15. package/dist/admin/apps/api-keys.js +54 -0
  16. package/dist/admin/apps/api-keys.js.map +1 -1
  17. package/dist/admin/apps/earn-vaults.d.ts +63 -15
  18. package/dist/admin/apps/earn-vaults.d.ts.map +1 -1
  19. package/dist/admin/apps/earn-vaults.js +2 -1
  20. package/dist/admin/apps/earn-vaults.js.map +1 -1
  21. package/dist/admin/apps/organizations.d.ts +92 -3
  22. package/dist/admin/apps/organizations.d.ts.map +1 -1
  23. package/dist/admin/apps/organizations.js +69 -7
  24. package/dist/admin/apps/organizations.js.map +1 -1
  25. package/dist/admin/apps/verified-tokens.d.ts +7 -7
  26. package/dist/admin/ui.generated.d.ts +1 -1
  27. package/dist/admin/ui.generated.d.ts.map +1 -1
  28. package/dist/admin/ui.generated.js +151 -151
  29. package/dist/admin/ui.generated.js.map +1 -1
  30. package/dist/apps/Zones.d.ts +28 -28
  31. package/dist/apps/Zones.js +7 -7
  32. package/dist/apps/data/App.d.ts +2909 -2523
  33. package/dist/apps/data/App.d.ts.map +1 -1
  34. package/dist/apps/data/App.js +26 -21
  35. package/dist/apps/data/App.js.map +1 -1
  36. package/dist/apps/data/ZoneSelection.d.ts +8 -8
  37. package/dist/apps/data/ZoneSelection.d.ts.map +1 -1
  38. package/dist/apps/data/ZoneSelection.js +1 -1
  39. package/dist/apps/data/ZoneSelection.js.map +1 -1
  40. package/dist/apps/data/routes/activities.d.ts +588 -584
  41. package/dist/apps/data/routes/activities.d.ts.map +1 -1
  42. package/dist/apps/data/routes/activities.js +1561 -1239
  43. package/dist/apps/data/routes/activities.js.map +1 -1
  44. package/dist/apps/data/routes/addresses.d.ts +22 -22
  45. package/dist/apps/data/routes/balances.d.ts +26 -26
  46. package/dist/apps/data/routes/balances.d.ts.map +1 -1
  47. package/dist/apps/data/routes/balances.js +43 -16
  48. package/dist/apps/data/routes/balances.js.map +1 -1
  49. package/dist/apps/data/routes/blocks.d.ts +44 -44
  50. package/dist/apps/data/routes/blocks.d.ts.map +1 -1
  51. package/dist/apps/data/routes/blocks.js +21 -11
  52. package/dist/apps/data/routes/blocks.js.map +1 -1
  53. package/dist/apps/data/routes/coingecko.d.ts +3 -3
  54. package/dist/apps/data/routes/earn.d.ts +201 -25
  55. package/dist/apps/data/routes/earn.d.ts.map +1 -1
  56. package/dist/apps/data/routes/earn.js +434 -75
  57. package/dist/apps/data/routes/earn.js.map +1 -1
  58. package/dist/apps/data/routes/exchanges.d.ts +160 -145
  59. package/dist/apps/data/routes/exchanges.d.ts.map +1 -1
  60. package/dist/apps/data/routes/exchanges.js +180 -114
  61. package/dist/apps/data/routes/exchanges.js.map +1 -1
  62. package/dist/apps/data/routes/fee-amm.d.ts +2 -2
  63. package/dist/apps/data/routes/fee-amm.d.ts.map +1 -1
  64. package/dist/apps/data/routes/fee-amm.js +18 -19
  65. package/dist/apps/data/routes/fee-amm.js.map +1 -1
  66. package/dist/apps/data/routes/receipts.d.ts +155 -55
  67. package/dist/apps/data/routes/receipts.d.ts.map +1 -1
  68. package/dist/apps/data/routes/receipts.js +28 -10
  69. package/dist/apps/data/routes/receipts.js.map +1 -1
  70. package/dist/apps/data/routes/tokenlist.d.ts +13 -13
  71. package/dist/apps/data/routes/tokens.d.ts +5 -5
  72. package/dist/apps/data/routes/tokens.d.ts.map +1 -1
  73. package/dist/apps/data/routes/tokens.js +51 -20
  74. package/dist/apps/data/routes/tokens.js.map +1 -1
  75. package/dist/apps/data/routes/transactions.d.ts +7 -2
  76. package/dist/apps/data/routes/transactions.d.ts.map +1 -1
  77. package/dist/apps/data/routes/transactions.js +37 -17
  78. package/dist/apps/data/routes/transactions.js.map +1 -1
  79. package/dist/apps/data/routes/transfers.d.ts +13 -13
  80. package/dist/apps/data/routes/transfers.d.ts.map +1 -1
  81. package/dist/apps/data/routes/transfers.js +18 -12
  82. package/dist/apps/data/routes/transfers.js.map +1 -1
  83. package/dist/apps/data/routes/valuation.d.ts +31 -31
  84. package/dist/apps/data/routes/valuation.d.ts.map +1 -1
  85. package/dist/apps/data/routes/valuation.js +12 -7
  86. package/dist/apps/data/routes/valuation.js.map +1 -1
  87. package/dist/apps/data/routes/verified-tokens.d.ts +8 -8
  88. package/dist/apps/data/routes/webhooks.d.ts +816 -113
  89. package/dist/apps/data/routes/webhooks.d.ts.map +1 -1
  90. package/dist/apps/data/routes/webhooks.js +47 -5
  91. package/dist/apps/data/routes/webhooks.js.map +1 -1
  92. package/dist/apps/data/routes/zones.d.ts +14 -14
  93. package/dist/apps/data/routes/zones.js +1 -1
  94. package/dist/apps/funding/App.d.ts +466 -44
  95. package/dist/apps/funding/App.d.ts.map +1 -1
  96. package/dist/apps/funding/App.js +1 -1
  97. package/dist/apps/funding/App.js.map +1 -1
  98. package/dist/apps/funding/routes/deposit-addresses.d.ts +17 -17
  99. package/dist/apps/funding/routes/deposit-addresses.d.ts.map +1 -1
  100. package/dist/apps/funding/routes/deposit-addresses.js +17 -12
  101. package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
  102. package/dist/apps/funding/routes/transfers.d.ts +650 -57
  103. package/dist/apps/funding/routes/transfers.d.ts.map +1 -1
  104. package/dist/apps/funding/routes/transfers.js +238 -24
  105. package/dist/apps/funding/routes/transfers.js.map +1 -1
  106. package/dist/apps/management/App.d.ts +5120 -4152
  107. package/dist/apps/management/App.d.ts.map +1 -1
  108. package/dist/apps/management/Billing.d.ts +1 -1
  109. package/dist/apps/management/Billing.d.ts.map +1 -1
  110. package/dist/apps/management/Billing.js +17 -1
  111. package/dist/apps/management/Billing.js.map +1 -1
  112. package/dist/apps/management/routes/api-keys.d.ts +632 -81
  113. package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
  114. package/dist/apps/management/routes/api-keys.js +236 -4
  115. package/dist/apps/management/routes/api-keys.js.map +1 -1
  116. package/dist/apps/management/routes/billing.d.ts +76 -76
  117. package/dist/apps/management/routes/faucet.d.ts +6 -6
  118. package/dist/apps/management/routes/invitations.d.ts +24 -24
  119. package/dist/apps/management/routes/invite-links.d.ts +4 -4
  120. package/dist/apps/management/routes/members.d.ts +16 -16
  121. package/dist/apps/management/routes/orgs.d.ts +20 -20
  122. package/dist/apps/management/routes/projects.d.ts +4 -4
  123. package/dist/apps/management/routes/usage.d.ts +8 -8
  124. package/dist/apps/management/routes/verified-token-requests.d.ts +17 -17
  125. package/dist/apps/management/routes/webhooks.d.ts +675 -25
  126. package/dist/apps/management/routes/webhooks.d.ts.map +1 -1
  127. package/dist/apps/management/routes/webhooks.js +21 -21
  128. package/dist/apps/management/routes/webhooks.js.map +1 -1
  129. package/dist/apps/relay/App.d.ts.map +1 -1
  130. package/dist/apps/relay/App.js +115 -23
  131. package/dist/apps/relay/App.js.map +1 -1
  132. package/dist/apps/relay/Sponsorships.d.ts.map +1 -1
  133. package/dist/apps/relay/Sponsorships.js +27 -1
  134. package/dist/apps/relay/Sponsorships.js.map +1 -1
  135. package/dist/db/Db.d.ts.map +1 -1
  136. package/dist/db/Db.js +34 -1
  137. package/dist/db/Db.js.map +1 -1
  138. package/dist/db/Schema.d.ts +11 -5
  139. package/dist/db/Schema.d.ts.map +1 -1
  140. package/dist/db/Schema.js +21 -3
  141. package/dist/db/Schema.js.map +1 -1
  142. package/dist/db/tables/fundingCatalog.d.ts +4 -2
  143. package/dist/db/tables/fundingCatalog.d.ts.map +1 -1
  144. package/dist/db/tables/fundingCatalog.js +5 -1
  145. package/dist/db/tables/fundingCatalog.js.map +1 -1
  146. package/dist/db/tables/fundingTransferTransactions.d.ts +38 -0
  147. package/dist/db/tables/fundingTransferTransactions.d.ts.map +1 -1
  148. package/dist/db/tables/fundingTransferTransactions.js +44 -3
  149. package/dist/db/tables/fundingTransferTransactions.js.map +1 -1
  150. package/dist/db/tables/fundingTransfers.d.ts +17 -0
  151. package/dist/db/tables/fundingTransfers.d.ts.map +1 -1
  152. package/dist/db/tables/fundingTransfers.js +21 -0
  153. package/dist/db/tables/fundingTransfers.js.map +1 -1
  154. package/dist/db/tables/organizations.d.ts +24 -0
  155. package/dist/db/tables/organizations.d.ts.map +1 -1
  156. package/dist/db/tables/organizations.js +27 -0
  157. package/dist/db/tables/organizations.js.map +1 -1
  158. package/dist/db/tables/projects.d.ts +25 -1
  159. package/dist/db/tables/projects.d.ts.map +1 -1
  160. package/dist/db/tables/projects.js +26 -0
  161. package/dist/db/tables/projects.js.map +1 -1
  162. package/dist/db/tables/sponsoredTransactions.d.ts +44 -0
  163. package/dist/db/tables/sponsoredTransactions.d.ts.map +1 -1
  164. package/dist/db/tables/sponsoredTransactions.js +146 -13
  165. package/dist/db/tables/sponsoredTransactions.js.map +1 -1
  166. package/dist/db/tables/webhookSubscriptions.d.ts +10 -6
  167. package/dist/db/tables/webhookSubscriptions.d.ts.map +1 -1
  168. package/dist/db/tables/webhookSubscriptions.js +9 -6
  169. package/dist/db/tables/webhookSubscriptions.js.map +1 -1
  170. package/dist/handlers/internal/utils.d.ts.map +1 -1
  171. package/dist/handlers/internal/utils.js +9 -0
  172. package/dist/handlers/internal/utils.js.map +1 -1
  173. package/dist/internal/Auth.d.ts +3 -1
  174. package/dist/internal/Auth.d.ts.map +1 -1
  175. package/dist/internal/Auth.js +6 -3
  176. package/dist/internal/Auth.js.map +1 -1
  177. package/dist/internal/EarnVaults.d.ts +3 -3
  178. package/dist/internal/EarnVaults.js +5 -5
  179. package/dist/internal/EarnVaults.js.map +1 -1
  180. package/dist/internal/Fetch.d.ts +23 -0
  181. package/dist/internal/Fetch.d.ts.map +1 -0
  182. package/dist/internal/Fetch.js +26 -0
  183. package/dist/internal/Fetch.js.map +1 -0
  184. package/dist/internal/Log.d.ts +4 -2
  185. package/dist/internal/Log.d.ts.map +1 -1
  186. package/dist/internal/Log.js +16 -3
  187. package/dist/internal/Log.js.map +1 -1
  188. package/dist/internal/OpenApi.d.ts +5 -3
  189. package/dist/internal/OpenApi.d.ts.map +1 -1
  190. package/dist/internal/OpenApi.js +13 -3
  191. package/dist/internal/OpenApi.js.map +1 -1
  192. package/dist/internal/Response.d.ts +1 -1
  193. package/dist/internal/Response.d.ts.map +1 -1
  194. package/dist/internal/Schema.d.ts +6 -3
  195. package/dist/internal/Schema.d.ts.map +1 -1
  196. package/dist/internal/Schema.js +8 -2
  197. package/dist/internal/Schema.js.map +1 -1
  198. package/dist/internal/Store.d.ts +16 -3
  199. package/dist/internal/Store.d.ts.map +1 -1
  200. package/dist/internal/Store.js +82 -16
  201. package/dist/internal/Store.js.map +1 -1
  202. package/dist/internal/Tidx.d.ts.map +1 -1
  203. package/dist/internal/Tidx.js +7 -2
  204. package/dist/internal/Tidx.js.map +1 -1
  205. package/dist/internal/Timeout.d.ts +36 -0
  206. package/dist/internal/Timeout.d.ts.map +1 -0
  207. package/dist/internal/Timeout.js +37 -0
  208. package/dist/internal/Timeout.js.map +1 -0
  209. package/dist/internal/Timing.d.ts +9 -0
  210. package/dist/internal/Timing.d.ts.map +1 -1
  211. package/dist/internal/Timing.js +7 -0
  212. package/dist/internal/Timing.js.map +1 -1
  213. package/dist/internal/Viem.d.ts +16 -1
  214. package/dist/internal/Viem.d.ts.map +1 -1
  215. package/dist/internal/Viem.js +12 -2
  216. package/dist/internal/Viem.js.map +1 -1
  217. package/dist/internal/WebhookDestination.d.ts.map +1 -1
  218. package/dist/internal/WebhookDestination.js +3 -0
  219. package/dist/internal/WebhookDestination.js.map +1 -1
  220. package/dist/internal/funding/Action.d.ts +9 -0
  221. package/dist/internal/funding/Action.d.ts.map +1 -1
  222. package/dist/internal/funding/Action.js +16 -8
  223. package/dist/internal/funding/Action.js.map +1 -1
  224. package/dist/internal/funding/Catalog.d.ts +9 -2
  225. package/dist/internal/funding/Catalog.d.ts.map +1 -1
  226. package/dist/internal/funding/Catalog.js +19 -8
  227. package/dist/internal/funding/Catalog.js.map +1 -1
  228. package/dist/internal/funding/DepositWebhook.d.ts.map +1 -1
  229. package/dist/internal/funding/DepositWebhook.js +2 -1
  230. package/dist/internal/funding/DepositWebhook.js.map +1 -1
  231. package/dist/internal/funding/Evidence.d.ts.map +1 -1
  232. package/dist/internal/funding/Evidence.js +2 -10
  233. package/dist/internal/funding/Evidence.js.map +1 -1
  234. package/dist/internal/funding/Provider.d.ts +108 -13
  235. package/dist/internal/funding/Provider.d.ts.map +1 -1
  236. package/dist/internal/funding/Provider.js +34 -8
  237. package/dist/internal/funding/Provider.js.map +1 -1
  238. package/dist/internal/funding/SourceObservation.d.ts.map +1 -1
  239. package/dist/internal/funding/SourceObservation.js +5 -7
  240. package/dist/internal/funding/SourceObservation.js.map +1 -1
  241. package/dist/internal/funding/Transfer.d.ts +114 -18
  242. package/dist/internal/funding/Transfer.d.ts.map +1 -1
  243. package/dist/internal/funding/Transfer.js +185 -55
  244. package/dist/internal/funding/Transfer.js.map +1 -1
  245. package/dist/internal/funding/TransferReconciliation.d.ts +52 -0
  246. package/dist/internal/funding/TransferReconciliation.d.ts.map +1 -0
  247. package/dist/internal/funding/TransferReconciliation.js +192 -0
  248. package/dist/internal/funding/TransferReconciliation.js.map +1 -0
  249. package/dist/internal/funding/TransferWebhook.d.ts +21 -0
  250. package/dist/internal/funding/TransferWebhook.d.ts.map +1 -0
  251. package/dist/internal/funding/TransferWebhook.js +43 -0
  252. package/dist/internal/funding/TransferWebhook.js.map +1 -0
  253. package/dist/internal/funding/index.d.ts +1 -0
  254. package/dist/internal/funding/index.d.ts.map +1 -1
  255. package/dist/internal/funding/index.js +1 -0
  256. package/dist/internal/funding/index.js.map +1 -1
  257. package/dist/internal/funding/providers/relay.d.ts.map +1 -1
  258. package/dist/internal/funding/providers/relay.js +3 -12
  259. package/dist/internal/funding/providers/relay.js.map +1 -1
  260. package/dist/internal/funding/providers/stargate.d.ts +127 -9
  261. package/dist/internal/funding/providers/stargate.d.ts.map +1 -1
  262. package/dist/internal/funding/providers/stargate.js +548 -112
  263. package/dist/internal/funding/providers/stargate.js.map +1 -1
  264. package/dist/internal/index.d.ts +1 -0
  265. package/dist/internal/index.d.ts.map +1 -1
  266. package/dist/internal/index.js +1 -0
  267. package/dist/internal/index.js.map +1 -1
  268. package/dist/internal/webhookDestinations/slack.d.ts.map +1 -1
  269. package/dist/internal/webhookDestinations/slack.js +16 -0
  270. package/dist/internal/webhookDestinations/slack.js.map +1 -1
  271. package/package.json +2 -2
  272. package/src/App.test.ts +100 -0
  273. package/src/App.ts +43 -3
  274. package/src/Client.test-d.ts +129 -2
  275. package/src/Scope.test.ts +20 -0
  276. package/src/Scope.ts +16 -0
  277. package/src/Webhooks.ts +2 -2
  278. package/src/admin/apps/api-keys.test.ts +75 -0
  279. package/src/admin/apps/api-keys.ts +64 -0
  280. package/src/admin/apps/earn-vaults.test.ts +1 -1
  281. package/src/admin/apps/earn-vaults.ts +2 -1
  282. package/src/admin/apps/organizations.test.ts +53 -1
  283. package/src/admin/apps/organizations.ts +90 -5
  284. package/src/admin/ui/src/lib/api-keys.ts +19 -0
  285. package/src/admin/ui/src/lib/organizations.test.ts +112 -1
  286. package/src/admin/ui/src/lib/organizations.ts +55 -0
  287. package/src/admin/ui/src/routes/api-keys.tsx +89 -2
  288. package/src/admin/ui/src/routes/organizations_.$orgId.tsx +116 -0
  289. package/src/admin/ui.generated.ts +189 -151
  290. package/src/apps/Zones.test.ts +7 -7
  291. package/src/apps/Zones.ts +7 -7
  292. package/src/apps/composition.test.ts +2 -1
  293. package/src/apps/data/App.test.ts +41 -0
  294. package/src/apps/data/App.ts +30 -21
  295. package/src/apps/data/ZoneSelection.test.ts +2 -2
  296. package/src/apps/data/ZoneSelection.ts +8 -8
  297. package/src/apps/data/routes/activities.test.ts +1526 -12
  298. package/src/apps/data/routes/activities.ts +1774 -1356
  299. package/src/apps/data/routes/balances.ts +133 -97
  300. package/src/apps/data/routes/blocks.test.ts +533 -0
  301. package/src/apps/data/routes/blocks.ts +35 -16
  302. package/src/apps/data/routes/earn.test.ts +373 -16
  303. package/src/apps/data/routes/earn.ts +548 -79
  304. package/src/apps/data/routes/earn.zone-access.test.ts +6 -6
  305. package/src/apps/data/routes/exchanges.test.ts +740 -15
  306. package/src/apps/data/routes/exchanges.ts +954 -753
  307. package/src/apps/data/routes/fee-amm.ts +17 -18
  308. package/src/apps/data/routes/receipts.ts +47 -16
  309. package/src/apps/data/routes/tokens.test.ts +578 -0
  310. package/src/apps/data/routes/tokens.ts +283 -225
  311. package/src/apps/data/routes/transactions.ts +68 -29
  312. package/src/apps/data/routes/transfers.test.ts +421 -0
  313. package/src/apps/data/routes/transfers.ts +45 -27
  314. package/src/apps/data/routes/valuation.ts +94 -78
  315. package/src/apps/data/routes/webhooks.test.ts +21 -5
  316. package/src/apps/data/routes/webhooks.ts +63 -8
  317. package/src/apps/data/routes/zones.test.ts +2 -2
  318. package/src/apps/data/routes/zones.ts +1 -1
  319. package/src/apps/funding/App.ts +12 -2
  320. package/src/apps/funding/routes/deposit-addresses.test.ts +29 -7
  321. package/src/apps/funding/routes/deposit-addresses.ts +19 -14
  322. package/src/apps/funding/routes/quotes.test.ts +5 -9
  323. package/src/apps/funding/routes/transfers.test.ts +901 -23
  324. package/src/apps/funding/routes/transfers.ts +347 -64
  325. package/src/apps/management/Billing.ts +18 -5
  326. package/src/apps/management/routes/api-keys.test.ts +220 -0
  327. package/src/apps/management/routes/api-keys.ts +280 -3
  328. package/src/apps/management/routes/webhooks.test.ts +3 -3
  329. package/src/apps/management/routes/webhooks.ts +24 -25
  330. package/src/apps/relay/App.test.ts +212 -1
  331. package/src/apps/relay/App.ts +158 -29
  332. package/src/apps/relay/Sponsorships.ts +24 -1
  333. package/src/db/Db.ts +48 -1
  334. package/src/db/Schema.ts +22 -4
  335. package/src/db/tables/earnVaults.test.ts +9 -9
  336. package/src/db/tables/fundingCatalog.test.ts +16 -2
  337. package/src/db/tables/fundingCatalog.ts +9 -3
  338. package/src/db/tables/fundingTransferTransactions.test.ts +43 -0
  339. package/src/db/tables/fundingTransferTransactions.ts +79 -3
  340. package/src/db/tables/fundingTransfers.test.ts +26 -0
  341. package/src/db/tables/fundingTransfers.ts +36 -0
  342. package/src/db/tables/organizations.test.ts +41 -0
  343. package/src/db/tables/organizations.ts +49 -0
  344. package/src/db/tables/projects.test.ts +55 -0
  345. package/src/db/tables/projects.ts +46 -1
  346. package/src/db/tables/sponsoredTransactions.test.ts +338 -0
  347. package/src/db/tables/sponsoredTransactions.ts +197 -13
  348. package/src/db/tables/webhookSubscriptions.ts +18 -11
  349. package/src/handlers/internal/utils.test.ts +53 -0
  350. package/src/handlers/internal/utils.ts +15 -0
  351. package/src/internal/Auth.ts +12 -4
  352. package/src/internal/EarnVaults.capabilities.test.ts +2 -2
  353. package/src/internal/EarnVaults.test.ts +1 -1
  354. package/src/internal/EarnVaults.ts +5 -5
  355. package/src/internal/Fetch.test.ts +46 -0
  356. package/src/internal/Fetch.ts +56 -0
  357. package/src/internal/Log.test-d.ts +2 -0
  358. package/src/internal/Log.test.ts +21 -0
  359. package/src/internal/Log.ts +22 -5
  360. package/src/internal/OpenApi.ts +14 -4
  361. package/src/internal/Response.ts +1 -1
  362. package/src/internal/Schema.test.ts +2 -0
  363. package/src/internal/Schema.ts +12 -2
  364. package/src/internal/Store.test.ts +178 -0
  365. package/src/internal/Store.ts +104 -18
  366. package/src/internal/Tidx.test.ts +2 -1
  367. package/src/internal/Tidx.ts +7 -2
  368. package/src/internal/Timeout.test.ts +35 -0
  369. package/src/internal/Timeout.ts +73 -0
  370. package/src/internal/Timing.ts +16 -0
  371. package/src/internal/Viem.ts +39 -3
  372. package/src/internal/WebhookDestination.ts +3 -0
  373. package/src/internal/Webhooks.test.ts +45 -0
  374. package/src/internal/funding/Action.test.ts +41 -1
  375. package/src/internal/funding/Action.ts +69 -41
  376. package/src/internal/funding/Catalog.test.ts +34 -0
  377. package/src/internal/funding/Catalog.ts +28 -11
  378. package/src/internal/funding/DepositWebhook.ts +2 -1
  379. package/src/internal/funding/Evidence.ts +2 -13
  380. package/src/internal/funding/Provider.test.ts +73 -0
  381. package/src/internal/funding/Provider.ts +125 -28
  382. package/src/internal/funding/SourceObservation.ts +5 -9
  383. package/src/internal/funding/Transfer.test.ts +155 -0
  384. package/src/internal/funding/Transfer.ts +387 -147
  385. package/src/internal/funding/TransferReconciliation.test.ts +147 -0
  386. package/src/internal/funding/TransferReconciliation.ts +264 -0
  387. package/src/internal/funding/TransferWebhook.test.ts +128 -0
  388. package/src/internal/funding/TransferWebhook.ts +67 -0
  389. package/src/internal/funding/index.test.ts +1 -0
  390. package/src/internal/funding/index.ts +1 -0
  391. package/src/internal/funding/providers/index.test.ts +4 -167
  392. package/src/internal/funding/providers/relay.test.ts +2 -2
  393. package/src/internal/funding/providers/relay.ts +3 -15
  394. package/src/internal/funding/providers/stargate.test.ts +328 -0
  395. package/src/internal/funding/providers/stargate.ts +807 -135
  396. package/src/internal/index.test.ts +1 -0
  397. package/src/internal/index.ts +1 -0
  398. package/src/internal/webhookDestinations/slack.ts +15 -0
@@ -122,17 +122,23 @@ export namespace schema {
122
122
  ),
123
123
  )
124
124
 
125
- /** A token amount carrying its nominal value in the requested denomination. */
126
- const ValuedAmount = z.extend(Schema.TokenAmount, {
127
- valuation: z
128
- .optional(z.nullable(Valuation.schema.Value))
129
- .check(
130
- z.describe(
131
- 'The amount’s nominal value in the requested `valuation.currency`. `null` when the token is ' +
132
- 'unverified, its display currency has no rate, or rates were unavailable.',
125
+ const transferToken = OpenApi.component(SourceToken, 'TokenTransferToken')
126
+
127
+ const ValuedAmount = Schema.describe(
128
+ z.extend(Schema.TokenAmount, {
129
+ valuation: z
130
+ .optional(z.nullable(Valuation.schema.Value))
131
+ .check(
132
+ z.describe(
133
+ 'The amount’s nominal value in the requested `valuation.currency`. `null` when the token is ' +
134
+ 'unverified, its display currency has no rate, or rates were unavailable.',
135
+ ),
133
136
  ),
134
- ),
135
- })
137
+ }),
138
+ 'A token amount carrying its nominal value in the requested denomination.',
139
+ )
140
+
141
+ const valuedTokenAmount = OpenApi.component(ValuedAmount, 'ValuedTokenAmount')
136
142
 
137
143
  /**
138
144
  * Filter predicates shared verbatim by the `GET /transfers` list query
@@ -243,14 +249,14 @@ export namespace schema {
243
249
  z.meta({ examples: [23456789] }),
244
250
  ),
245
251
  destinationAmount: z
246
- .optional(ValuedAmount)
252
+ .optional(valuedTokenAmount)
247
253
  .check(
248
254
  z.describe(
249
255
  'Amount delivered to the recipient for a cross-token transfer. Omitted with `destinationToken` for a same-token transfer.',
250
256
  ),
251
257
  ),
252
258
  destinationToken: z
253
- .optional(schema.SourceToken)
259
+ .optional(transferToken)
254
260
  .check(
255
261
  z.describe(
256
262
  'The token delivered to the recipient when it differs from `sourceToken`. Omitted for same-token transfers and returned only with `include=crossToken`.',
@@ -284,8 +290,8 @@ export namespace schema {
284
290
  z.describe('The account address that received the tokens.'),
285
291
  ),
286
292
  sender: Schema.Address.check(z.describe('The account address that sent the tokens.')),
287
- sourceAmount: ValuedAmount.check(z.describe('Amount associated with `sourceToken`.')),
288
- sourceToken: schema.SourceToken.check(z.describe('The token that moved.')),
293
+ sourceAmount: valuedTokenAmount,
294
+ sourceToken: transferToken.check(z.describe('The token that moved.')),
289
295
  timestamp: z.iso
290
296
  .datetime()
291
297
  .check(
@@ -310,6 +316,8 @@ export namespace schema {
310
316
  ),
311
317
  )
312
318
 
319
+ const transfer = OpenApi.component(Transfer, 'TokenTransfer')
320
+
313
321
  /** Page-level resources: opt-in counts plus valuation rate provenance. */
314
322
  export const Meta = z
315
323
  .object({
@@ -326,19 +334,26 @@ export namespace schema {
326
334
  })
327
335
  .check(z.describe('Page-level resources attached to this response.'))
328
336
 
337
+ const meta = OpenApi.component(Meta, 'TokenTransferListMeta')
338
+
329
339
  /** Page of TIP-20 token transfers across the chain, ordered by block then log index. */
330
- export const Response = z
331
- .object({
332
- data: z.array(Transfer).check(z.describe('The transfers in this page.')),
333
- // Response-wide `meta` carries the opt-in capped total count
334
- // (`include=totalCount`) and valuation rate provenance; per-row embeds
335
- // (`memo`, `token`) attach to each `data` item, not here.
336
- meta: z
337
- .optional(Meta)
338
- .check(z.describe('Page-level resources: opt-in counts and valuation rate provenance.')),
339
- nextCursor: Schema.NextCursor,
340
- })
341
- .check(z.describe('A page of TIP-20 token transfer events across the chain.'))
340
+ export const Response = OpenApi.component(
341
+ z
342
+ .object({
343
+ data: z.array(transfer).check(z.describe('The transfers in this page.')),
344
+ // Response-wide `meta` carries the opt-in capped total count
345
+ // (`include=totalCount`) and valuation rate provenance; per-row embeds
346
+ // (`memo`, `token`) attach to each `data` item, not here.
347
+ meta: z
348
+ .optional(meta)
349
+ .check(
350
+ z.describe('Page-level resources: opt-in counts and valuation rate provenance.'),
351
+ ),
352
+ nextCursor: Schema.NextCursor,
353
+ })
354
+ .check(z.describe('A page of TIP-20 token transfer events across the chain.')),
355
+ 'TokenTransferList',
356
+ )
342
357
  }
343
358
  }
344
359
 
@@ -364,7 +379,10 @@ export function transfers(options: transfers.Options = {}) {
364
379
  description: 'List token transfer events across Tempo.',
365
380
  operationId: 'getTransfers',
366
381
  responses: OpenApi.responses({
367
- errors: { 502: 'The indexer or Tempo RPC could not serve this request.' },
382
+ errors: {
383
+ 400: { codes: ['chain_id_invalid', 'chain_id_unsupported', 'query_invalid'] },
384
+ 502: 'The indexer or Tempo RPC could not serve this request.',
385
+ },
368
386
  success: {
369
387
  description: 'A page of token transfer events.',
370
388
  schema: schema.getTransfers.Response,
@@ -23,47 +23,55 @@ const tokenReadChunkSize = 20
23
23
  /** Zod schemas owned by the valuation handlers. */
24
24
  export namespace schema {
25
25
  /** A holding's nominal value in the requested denomination. */
26
- export const Value = z
27
- .object({
28
- amount: z
29
- .string()
30
- .check(
31
- z.regex(/^\d+(\.\d+)?$/),
32
- z.describe('The holding’s nominal value, as a decimal string in `currency`.'),
33
- z.meta({ examples: ['1.50'] }),
34
- ),
35
- currency: z
36
- .string()
37
- .check(
38
- z.describe('The denomination currency of this value.'),
39
- z.meta({ examples: ['USD'] }),
40
- ),
41
- })
42
- .check(z.describe('The holding’s nominal value in the requested denomination.'))
26
+ export const Value = OpenApi.component(
27
+ z
28
+ .object({
29
+ amount: z
30
+ .string()
31
+ .check(
32
+ z.regex(/^\d+(\.\d+)?$/),
33
+ z.describe('The holding’s nominal value, as a decimal string in `currency`.'),
34
+ z.meta({ examples: ['1.50'] }),
35
+ ),
36
+ currency: z
37
+ .string()
38
+ .check(
39
+ z.describe('The denomination currency of this value.'),
40
+ z.meta({ examples: ['USD'] }),
41
+ ),
42
+ })
43
+ .check(z.describe('The holding’s nominal value in the requested denomination.')),
44
+ 'ValuationValue',
45
+ )
43
46
 
44
47
  /** Rate provenance for a converted valuation. */
45
- export const Pricing = z
46
- .object({
47
- asOf: z.iso
48
- .datetime()
49
- .check(
50
- z.describe('Publication date of the rate set as an ISO 8601 timestamp.'),
51
- z.meta({ examples: ['2026-07-20T00:00:00.000Z'] }),
52
- ),
53
- basis: z
54
- .literal('nominal')
55
- .check(
56
- z.describe('Valuation basis: one token unit counts as one unit of its display currency.'),
57
- z.meta({ examples: ['nominal'] }),
58
- ),
59
- source: z
60
- .string()
61
- .check(
62
- z.describe('FX rate oracle that supplied the conversion rates.'),
63
- z.meta({ examples: ['ecb'] }),
64
- ),
65
- })
66
- .check(z.describe('Rate provenance for a converted valuation.'))
48
+ export const Pricing = OpenApi.component(
49
+ z
50
+ .object({
51
+ asOf: z.iso
52
+ .datetime()
53
+ .check(
54
+ z.describe('Publication date of the rate set as an ISO 8601 timestamp.'),
55
+ z.meta({ examples: ['2026-07-20T00:00:00.000Z'] }),
56
+ ),
57
+ basis: z
58
+ .literal('nominal')
59
+ .check(
60
+ z.describe(
61
+ 'Valuation basis: one token unit counts as one unit of its display currency.',
62
+ ),
63
+ z.meta({ examples: ['nominal'] }),
64
+ ),
65
+ source: z
66
+ .string()
67
+ .check(
68
+ z.describe('FX rate oracle that supplied the conversion rates.'),
69
+ z.meta({ examples: ['ecb'] }),
70
+ ),
71
+ })
72
+ .check(z.describe('Rate provenance for a converted valuation.')),
73
+ 'ValuationPricing',
74
+ )
67
75
 
68
76
  /** Schemas for the getAddressValuation operation. */
69
77
  export namespace getAddressValuation {
@@ -89,47 +97,50 @@ export namespace schema {
89
97
  .check(z.describe('Query parameters for valuing an account’s verified holdings.'))
90
98
 
91
99
  /** The nominal valuation of an account's verified holdings. */
92
- export const Response = z
93
- .object({
94
- address: Schema.Address.check(z.describe('The account address this valuation covers.')),
95
- amount: z
96
- .string()
97
- .check(
98
- z.regex(/^\d+(\.\d+)?$/),
99
- z.describe(
100
- 'The total value of the account’s verified holdings, as a decimal string in `currency`.',
100
+ export const Response = OpenApi.component(
101
+ z
102
+ .object({
103
+ address: Schema.Address.check(z.describe('The account address this valuation covers.')),
104
+ amount: z
105
+ .string()
106
+ .check(
107
+ z.regex(/^\d+(\.\d+)?$/),
108
+ z.describe(
109
+ 'The total value of the account’s verified holdings, as a decimal string in `currency`.',
110
+ ),
111
+ z.meta({ examples: ['160.50'] }),
101
112
  ),
102
- z.meta({ examples: ['160.50'] }),
103
- ),
104
- currency: z
105
- .string()
106
- .check(
107
- z.describe('The denomination currency of `amount`.'),
108
- z.meta({ examples: ['USD'] }),
109
- ),
110
- id: z
111
- .string()
112
- .check(
113
- z.describe('A stable resource ID for this valuation, equal to the account address.'),
114
- z.meta({ examples: ['0xbe058e1c4df8a4366a387bf595b284246a93039e'] }),
115
- ),
116
- pricing: z
117
- .nullable(Pricing)
118
- .check(
119
- z.describe(
120
- 'Rate provenance, or `null` when every valued holding was already denominated in `currency`.',
113
+ currency: z
114
+ .string()
115
+ .check(
116
+ z.describe('The denomination currency of `amount`.'),
117
+ z.meta({ examples: ['USD'] }),
121
118
  ),
122
- ),
123
- unpriced: z
124
- .array(z.string())
125
- .check(
126
- z.describe(
127
- 'Display currencies excluded from `amount` because the FX oracle has no rate for them.',
119
+ id: z
120
+ .string()
121
+ .check(
122
+ z.describe('A stable resource ID for this valuation, equal to the account address.'),
123
+ z.meta({ examples: ['0xbe058e1c4df8a4366a387bf595b284246a93039e'] }),
128
124
  ),
129
- z.meta({ examples: [['BTC']] }),
130
- ),
131
- })
132
- .check(z.describe('The nominal valuation of an account’s verified token holdings.'))
125
+ pricing: z
126
+ .nullable(Pricing)
127
+ .check(
128
+ z.describe(
129
+ 'Rate provenance, or `null` when every valued holding was already denominated in `currency`.',
130
+ ),
131
+ ),
132
+ unpriced: z
133
+ .array(z.string())
134
+ .check(
135
+ z.describe(
136
+ 'Display currencies excluded from `amount` because the FX oracle has no rate for them.',
137
+ ),
138
+ z.meta({ examples: [['BTC']] }),
139
+ ),
140
+ })
141
+ .check(z.describe('The nominal valuation of an account’s verified token holdings.')),
142
+ 'AddressValuation',
143
+ )
133
144
  }
134
145
  }
135
146
 
@@ -155,7 +166,12 @@ export function addresses(options: addresses.Options = {}) {
155
166
  'Values every verified TIP-20 token an account holds as one unit of its display currency, converts each currency into the requested denomination using the configured FX rates, and returns the total.',
156
167
  operationId: 'getAddressValuation',
157
168
  responses: OpenApi.responses({
158
- errors: { 502: 'Could not read balances or exchange rates from an upstream service.' },
169
+ errors: {
170
+ 400: {
171
+ codes: ['address_invalid', 'chain_id_invalid', 'chain_id_unsupported', 'query_invalid'],
172
+ },
173
+ 502: 'Could not read balances or exchange rates from an upstream service.',
174
+ },
159
175
  success: {
160
176
  description: 'The valuation of this account’s verified holdings.',
161
177
  schema: schema.getAddressValuation.Response,
@@ -130,6 +130,9 @@ describe('feature gate', () => {
130
130
  expect(catalogBody.data.map((eventType) => eventType.type)).not.toContain(
131
131
  'funding:deposit.updated',
132
132
  )
133
+ expect(catalogBody.data.map((eventType) => eventType.type)).not.toContain(
134
+ 'funding:transfer.updated',
135
+ )
133
136
  expect(created.status).toBe(400)
134
137
  })
135
138
  })
@@ -209,6 +212,7 @@ describe('access matrix', () => {
209
212
  [
210
213
  "block:created",
211
214
  "funding:deposit.updated",
215
+ "funding:transfer.updated",
212
216
  "log:emitted",
213
217
  "token:transfer",
214
218
  "transaction:included",
@@ -261,7 +265,7 @@ describe('CRUD lifecycle', () => {
261
265
  expect(body.error?.code).toBe('api_key_forbidden')
262
266
  })
263
267
 
264
- test('captures funding deposit ownership scope without reading the RPC head', async () => {
268
+ test('captures funding transfer ownership scope without reading the RPC head', async () => {
265
269
  const db = TestApp.database()
266
270
  const projectWriter = {
267
271
  id: 'key_funding_webhook_project',
@@ -275,7 +279,7 @@ describe('CRUD lifecycle', () => {
275
279
  {
276
280
  json: {
277
281
  destination: { type: 'url', url: 'https://example.com/funding' },
278
- eventType: 'funding:deposit.updated',
282
+ eventType: 'funding:transfer.updated',
279
283
  filters: { status: 'completed' },
280
284
  },
281
285
  },
@@ -341,7 +345,7 @@ describe('CRUD lifecycle', () => {
341
345
  chainId: 4217,
342
346
  destination: { type: 'url', url: 'https://example.com/project-b' },
343
347
  environment: 'production',
344
- eventType: 'funding:deposit.updated',
348
+ eventType: 'funding:transfer.updated',
345
349
  owner: { orgId: shared.orgId, type: 'api_key' },
346
350
  projectId: projectB.projectId,
347
351
  })
@@ -1158,8 +1162,12 @@ describe('retry delivery', () => {
1158
1162
  auth: { keys: [writer, reader, other] },
1159
1163
  db,
1160
1164
  })
1161
- const created = await app.v1.webhooks.$post({ json: validBody }, as(writer))
1162
- const { id } = await TestApp.json(created, Webhooks.schema.createWebhook.Response)
1165
+ const { id } = await Core.createSubscription(db, {
1166
+ chainId: 4217,
1167
+ destination: validBody.destination,
1168
+ eventType: validBody.eventType,
1169
+ owner: { orgId: writer.orgId, type: 'api_key' },
1170
+ })
1163
1171
  await Core.recordDelivery(db, {
1164
1172
  attempt: 1,
1165
1173
  createdAt: new Date(1_700_000_000_000).toISOString(),
@@ -1316,6 +1324,7 @@ describe('OpenAPI visibility', () => {
1316
1324
  "Log event",
1317
1325
  "Block event",
1318
1326
  "Funding deposit updated event",
1327
+ "Funding transfer updated event",
1319
1328
  "Ping (test delivery)",
1320
1329
  ]
1321
1330
  `)
@@ -1422,6 +1431,13 @@ describe('OpenAPI visibility', () => {
1422
1431
  ],
1423
1432
  "title": "Funding deposit subscription",
1424
1433
  },
1434
+ {
1435
+ "filters": [
1436
+ "id",
1437
+ "status",
1438
+ ],
1439
+ "title": "Funding transfer subscription",
1440
+ },
1425
1441
  ]
1426
1442
  `)
1427
1443
  })
@@ -18,6 +18,7 @@ import * as WebhookDestination from '../../../internal/WebhookDestination.js'
18
18
  import * as WebhookTransfer from '../../../internal/WebhookTransfer.js'
19
19
  import * as Webhooks from '../../../internal/Webhooks.js'
20
20
  import * as FundingDeposit from '../../../internal/funding/Deposit.js'
21
+ import * as FundingTransfer from '../../../internal/funding/Transfer.js'
21
22
  import * as Transactions from './transactions.js'
22
23
  import * as Transfers from './transfers.js'
23
24
 
@@ -42,6 +43,7 @@ const redactedSlackUrl = 'https://hooks.slack.com/…'
42
43
  export const eventTypes = [
43
44
  'block:created',
44
45
  'funding:deposit.updated',
46
+ 'funding:transfer.updated',
45
47
  'log:emitted',
46
48
  'token:transfer',
47
49
  'transaction:included',
@@ -50,6 +52,20 @@ export const eventTypes = [
50
52
  /** Event types a subscription can listen to. Derived from {@link eventTypes}. */
51
53
  export type EventType = (typeof eventTypes)[number]
52
54
 
55
+ /** Funding resource events produced by the API instead of chain scans. */
56
+ export const fundingEventTypes = [
57
+ 'funding:deposit.updated',
58
+ 'funding:transfer.updated',
59
+ ] as const satisfies readonly EventType[]
60
+
61
+ /** Event type carrying an owner-scoped funding resource. */
62
+ export type FundingEventType = (typeof fundingEventTypes)[number]
63
+
64
+ /** Returns whether an event type carries an owner-scoped funding resource. */
65
+ export function isFundingEventType(eventType: EventType): eventType is FundingEventType {
66
+ return (fundingEventTypes as readonly EventType[]).includes(eventType)
67
+ }
68
+
53
69
  /** Subscribable event types surfaced by `GET /webhooks/event-types`. */
54
70
  const eventTypeDescriptions = [
55
71
  {
@@ -62,6 +78,11 @@ const eventTypeDescriptions = [
62
78
  'A funding deposit materially changed after verified reconciliation, filterable by deposit address, recipient, or status.',
63
79
  type: 'funding:deposit.updated',
64
80
  },
81
+ {
82
+ description:
83
+ 'A funding transfer materially changed, filterable by transfer ID or lifecycle status.',
84
+ type: 'funding:transfer.updated',
85
+ },
65
86
  {
66
87
  description:
67
88
  'Any contract event log, filtered by emitting address, event signature/topics, or decoded arguments.',
@@ -465,6 +486,17 @@ export namespace schema {
465
486
  z.meta({ title: 'Funding deposit filters' }),
466
487
  )
467
488
 
489
+ /** `funding:transfer.updated` subscription filters. All are optional and AND-combined. */
490
+ export const FundingTransferFilters = z
491
+ .strictObject({
492
+ id: z.optional(FundingTransfer.schema.FundingTransfer.shape.id),
493
+ status: z.optional(FundingTransfer.schema.Status),
494
+ })
495
+ .check(
496
+ z.describe('Filters that narrow which funding transfer changes trigger this webhook.'),
497
+ z.meta({ title: 'Funding transfer filters' }),
498
+ )
499
+
468
500
  /**
469
501
  * Optional human context describing what a subscription is for. Surfaced by
470
502
  * destinations (Slack header + description, Better Stack log fields) and echoed
@@ -917,6 +949,9 @@ export namespace schema {
917
949
  /** Public funding deposit after a committed material change. */
918
950
  export const FundingDepositEvent = FundingDeposit.schema.FundingDeposit
919
951
 
952
+ /** Public funding transfer after a committed material change. */
953
+ export const FundingTransferEvent = FundingTransfer.schema.FundingTransfer
954
+
920
955
  /** A `ping` (synthetic test-delivery) payload, sent by `POST /webhooks/:id/ping`. */
921
956
  export const PingEvent = z
922
957
  .object({
@@ -982,6 +1017,13 @@ export namespace schema {
982
1017
  type: z.literal('funding:deposit.updated'),
983
1018
  })
984
1019
  .check(z.meta({ title: 'Funding deposit updated event' })),
1020
+ z
1021
+ .object({
1022
+ ...envelopeBase,
1023
+ data: FundingTransferEvent,
1024
+ type: z.literal('funding:transfer.updated'),
1025
+ })
1026
+ .check(z.meta({ title: 'Funding transfer updated event' })),
985
1027
  z
986
1028
  .object({ ...envelopeBase, data: PingEvent, type: z.literal('ping') })
987
1029
  .check(z.meta({ title: 'Ping (test delivery)' })),
@@ -1089,6 +1131,20 @@ export namespace schema {
1089
1131
  filters: z.optional(FundingDepositFilters),
1090
1132
  })
1091
1133
  .check(z.meta({ title: 'Funding deposit subscription' })),
1134
+ z
1135
+ .object({
1136
+ chainId: z.optional(Schema.ChainId).check(z.meta({ examples: [4217] })),
1137
+ context: z.optional(Context),
1138
+ destination: Destination,
1139
+ eventType: z
1140
+ .literal('funding:transfer.updated')
1141
+ .check(
1142
+ z.describe('Event type for committed funding transfer changes.'),
1143
+ z.meta({ examples: ['funding:transfer.updated'] }),
1144
+ ),
1145
+ filters: z.optional(FundingTransferFilters),
1146
+ })
1147
+ .check(z.meta({ title: 'Funding transfer subscription' })),
1092
1148
  ])
1093
1149
  .check(z.describe('Details for creating a webhook subscription.'))
1094
1150
 
@@ -1293,7 +1349,7 @@ export function webhooks(options: webhooks.Options = {}) {
1293
1349
  const hidden = !options.enabled
1294
1350
  const availableEventTypes = eventTypeDescriptions.filter(
1295
1351
  (eventType) =>
1296
- eventType.type !== 'funding:deposit.updated' ||
1352
+ !isFundingEventType(eventType.type) ||
1297
1353
  options.applicationEventTypes?.includes(eventType.type),
1298
1354
  )
1299
1355
  const availableEventTypeSet = new Set(availableEventTypes.map((eventType) => eventType.type))
@@ -1410,7 +1466,7 @@ export function webhooks(options: webhooks.Options = {}) {
1410
1466
  message: 'Webhook event type is not available in this deployment',
1411
1467
  status: 400,
1412
1468
  })
1413
- if (body.eventType === 'funding:deposit.updated') {
1469
+ if (isFundingEventType(body.eventType)) {
1414
1470
  if (principal?.type !== 'api_key') return unauthorized(c)
1415
1471
  if (
1416
1472
  !principal.apiKey.scopes.some(
@@ -1434,10 +1490,9 @@ export function webhooks(options: webhooks.Options = {}) {
1434
1490
  const maxPerOwner = webhook.maxPerOwner ?? defaultMaxPerOwner
1435
1491
  if ((await Webhooks.countSubscriptions(db, owner)) >= maxPerOwner)
1436
1492
  throw new Webhooks.LimitExceededError(maxPerOwner)
1437
- const startBlockNumber =
1438
- body.eventType === 'funding:deposit.updated'
1439
- ? undefined
1440
- : await getRpcHead(c.get('getClient')(chainId))
1493
+ const startBlockNumber = isFundingEventType(body.eventType)
1494
+ ? undefined
1495
+ : await getRpcHead(c.get('getClient')(chainId))
1441
1496
  const subscription = await Webhooks.createSubscription(
1442
1497
  db,
1443
1498
  {
@@ -2089,6 +2144,7 @@ export async function getRpcHead(client: Viem.getClient.ReturnType): Promise<num
2089
2144
  const filterSchemas = {
2090
2145
  'block:created': schema.BlockFilters,
2091
2146
  'funding:deposit.updated': schema.FundingDepositFilters,
2147
+ 'funding:transfer.updated': schema.FundingTransferFilters,
2092
2148
  'log:emitted': schema.LogFilters,
2093
2149
  'token:transfer': schema.TransferFilters,
2094
2150
  'transaction:included': schema.TxFilters,
@@ -2611,8 +2667,7 @@ function toPublic(subscription: Webhooks.Subscription) {
2611
2667
  ...(subscription.context === undefined ? {} : { context: subscription.context }),
2612
2668
  createdAt: subscription.createdAt,
2613
2669
  destination: redactDestination(subscription.destination),
2614
- ...(subscription.eventType === 'funding:deposit.updated' &&
2615
- subscription.environment !== undefined
2670
+ ...(isFundingEventType(subscription.eventType) && subscription.environment !== undefined
2616
2671
  ? { environment: subscription.environment }
2617
2672
  : {}),
2618
2673
  eventType: subscription.eventType,
@@ -335,7 +335,7 @@ describe('GET /v1/zones/withdrawals/:senderTag', () => {
335
335
  expect(response.status).toBe(403)
336
336
  expect(body.error.code).toBe('api_key_forbidden')
337
337
  expect(body.error.message).toBe(
338
- `Chain id ${runtime.zone.chainId} is a zone. Use an API key granting \`zone:${runtime.zone.chainId}:read\` or \`zone:${runtime.zone.chainId}:write\`.`,
338
+ `Chain ID ${runtime.zone.chainId} is a Zone. Use an API key granting \`zone:${runtime.zone.chainId}:read\` or \`zone:${runtime.zone.chainId}:write\`.`,
339
339
  )
340
340
  })
341
341
 
@@ -423,7 +423,7 @@ describe('GET /v1/zones/withdrawals/:senderTag', () => {
423
423
  },
424
424
  {
425
425
  "examples": [
426
- 1424310001,
426
+ 1424310003,
427
427
  ],
428
428
  "name": "chainId",
429
429
  "required": true,
@@ -43,7 +43,7 @@ export namespace schema {
43
43
  .strictObject({
44
44
  chainId: Schema.ChainId.check(
45
45
  z.describe('The chain id of the Zone where the withdrawal originated.'),
46
- z.meta({ examples: [1_424_310_001] }),
46
+ z.meta({ examples: [1_424_310_003] }),
47
47
  ),
48
48
  })
49
49
  .check(z.describe('Query parameters used to select the originating Zone.'))
@@ -3,6 +3,8 @@ import { Hono } from 'hono'
3
3
  import type * as App from '../../App.js'
4
4
  import type * as FundingDepositAddress from '../../internal/funding/DepositAddress.js'
5
5
  import type * as FundingProvider from '../../internal/funding/Provider.js'
6
+ import type * as FundingTransferReconciliation from '../../internal/funding/TransferReconciliation.js'
7
+ import type * as Webhooks from '../../internal/Webhooks.js'
6
8
  import * as Metadata from '../metadata.js'
7
9
  import { chains } from './routes/chains.js'
8
10
  import { depositAddresses } from './routes/deposit-addresses.js'
@@ -24,7 +26,7 @@ export function funding(options: funding.Options = {}) {
24
26
  .route('/', chains())
25
27
  .route('/', providers())
26
28
  .route('/', depositAddresses(options))
27
- .route('/', transfers())
29
+ .route('/', transfers(options))
28
30
  return Metadata.defaultChain(Metadata.attach(app, openapi))
29
31
  }
30
32
 
@@ -32,9 +34,17 @@ export declare namespace funding {
32
34
  /** Inbound funding route configuration. */
33
35
  type Options = {
34
36
  /** Enqueues one deposit address for asynchronous reconciliation. */
35
- dispatchReconciliation?:
37
+ dispatchDepositReconciliation?:
36
38
  | ((message: FundingProvider.Webhook.receive.Dispatchable) => Promise<void>)
37
39
  | undefined
40
+ /** Enqueues one registered transfer for destination reconciliation. */
41
+ dispatchTransferReconciliation?:
42
+ | ((message: FundingTransferReconciliation.Message) => Promise<void>)
43
+ | undefined
44
+ /** Enqueues webhook updates staged with transfer mutations. */
45
+ dispatchTransferUpdates?:
46
+ | ((references: readonly Webhooks.QueueReference[]) => Promise<number>)
47
+ | undefined
38
48
  /** Registers a created address with a source-chain observer. */
39
49
  registerDepositAddress?: ((address: FundingDepositAddress.Public) => Promise<void>) | undefined
40
50
  }