tapimo 0.12.0 → 0.13.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 (257) hide show
  1. package/dist/App.d.ts +5561 -5026
  2. package/dist/App.d.ts.map +1 -1
  3. package/dist/App.js +38 -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/admin/App.d.ts +123 -74
  10. package/dist/admin/App.d.ts.map +1 -1
  11. package/dist/admin/apps/api-keys.d.ts +80 -0
  12. package/dist/admin/apps/api-keys.d.ts.map +1 -1
  13. package/dist/admin/apps/api-keys.js +54 -0
  14. package/dist/admin/apps/api-keys.js.map +1 -1
  15. package/dist/admin/apps/earn-vaults.d.ts +15 -15
  16. package/dist/admin/apps/earn-vaults.js +1 -1
  17. package/dist/admin/apps/verified-tokens.d.ts +81 -81
  18. package/dist/admin/ui.generated.d.ts +1 -1
  19. package/dist/admin/ui.generated.d.ts.map +1 -1
  20. package/dist/admin/ui.generated.js +151 -151
  21. package/dist/admin/ui.generated.js.map +1 -1
  22. package/dist/apps/Zones.d.ts +16 -16
  23. package/dist/apps/Zones.js +4 -4
  24. package/dist/apps/data/App.js +18 -18
  25. package/dist/apps/data/App.js.map +1 -1
  26. package/dist/apps/data/ZoneSelection.d.ts +8 -8
  27. package/dist/apps/data/ZoneSelection.d.ts.map +1 -1
  28. package/dist/apps/data/ZoneSelection.js +1 -1
  29. package/dist/apps/data/ZoneSelection.js.map +1 -1
  30. package/dist/apps/data/routes/activities.d.ts +588 -584
  31. package/dist/apps/data/routes/activities.d.ts.map +1 -1
  32. package/dist/apps/data/routes/activities.js +1561 -1239
  33. package/dist/apps/data/routes/activities.js.map +1 -1
  34. package/dist/apps/data/routes/balances.d.ts +26 -26
  35. package/dist/apps/data/routes/balances.d.ts.map +1 -1
  36. package/dist/apps/data/routes/balances.js +43 -16
  37. package/dist/apps/data/routes/balances.js.map +1 -1
  38. package/dist/apps/data/routes/blocks.d.ts +44 -44
  39. package/dist/apps/data/routes/blocks.d.ts.map +1 -1
  40. package/dist/apps/data/routes/blocks.js +21 -11
  41. package/dist/apps/data/routes/blocks.js.map +1 -1
  42. package/dist/apps/data/routes/coingecko.d.ts +3 -3
  43. package/dist/apps/data/routes/earn.d.ts +18 -18
  44. package/dist/apps/data/routes/earn.js +13 -13
  45. package/dist/apps/data/routes/exchanges.d.ts +145 -145
  46. package/dist/apps/data/routes/fee-amm.d.ts +2 -2
  47. package/dist/apps/data/routes/receipts.d.ts +155 -55
  48. package/dist/apps/data/routes/receipts.d.ts.map +1 -1
  49. package/dist/apps/data/routes/receipts.js +28 -10
  50. package/dist/apps/data/routes/receipts.js.map +1 -1
  51. package/dist/apps/data/routes/tokenlist.d.ts +13 -13
  52. package/dist/apps/data/routes/tokens.d.ts +98 -98
  53. package/dist/apps/data/routes/tokens.d.ts.map +1 -1
  54. package/dist/apps/data/routes/tokens.js +51 -20
  55. package/dist/apps/data/routes/tokens.js.map +1 -1
  56. package/dist/apps/data/routes/transactions.d.ts +7 -2
  57. package/dist/apps/data/routes/transactions.d.ts.map +1 -1
  58. package/dist/apps/data/routes/transactions.js +37 -17
  59. package/dist/apps/data/routes/transactions.js.map +1 -1
  60. package/dist/apps/data/routes/transfers.d.ts +1 -1
  61. package/dist/apps/data/routes/transfers.d.ts.map +1 -1
  62. package/dist/apps/data/routes/transfers.js +18 -12
  63. package/dist/apps/data/routes/transfers.js.map +1 -1
  64. package/dist/apps/data/routes/valuation.d.ts +1 -1
  65. package/dist/apps/data/routes/valuation.d.ts.map +1 -1
  66. package/dist/apps/data/routes/valuation.js +12 -7
  67. package/dist/apps/data/routes/valuation.js.map +1 -1
  68. package/dist/apps/data/routes/verified-tokens.d.ts +3 -3
  69. package/dist/apps/data/routes/webhooks.d.ts +11 -11
  70. package/dist/apps/data/routes/zones.d.ts +14 -14
  71. package/dist/apps/data/routes/zones.js +1 -1
  72. package/dist/apps/funding/App.d.ts +11 -0
  73. package/dist/apps/funding/App.d.ts.map +1 -1
  74. package/dist/apps/funding/routes/deposit-addresses.d.ts.map +1 -1
  75. package/dist/apps/funding/routes/deposit-addresses.js +16 -11
  76. package/dist/apps/funding/routes/deposit-addresses.js.map +1 -1
  77. package/dist/apps/funding/routes/transfers.d.ts +60 -48
  78. package/dist/apps/funding/routes/transfers.d.ts.map +1 -1
  79. package/dist/apps/funding/routes/transfers.js +27 -19
  80. package/dist/apps/funding/routes/transfers.js.map +1 -1
  81. package/dist/apps/management/App.d.ts +4487 -3963
  82. package/dist/apps/management/App.d.ts.map +1 -1
  83. package/dist/apps/management/routes/api-keys.d.ts +710 -159
  84. package/dist/apps/management/routes/api-keys.d.ts.map +1 -1
  85. package/dist/apps/management/routes/api-keys.js +236 -4
  86. package/dist/apps/management/routes/api-keys.js.map +1 -1
  87. package/dist/apps/management/routes/faucet.d.ts +6 -6
  88. package/dist/apps/management/routes/invite-links.d.ts +42 -42
  89. package/dist/apps/management/routes/members.d.ts +30 -30
  90. package/dist/apps/management/routes/projects.d.ts +40 -40
  91. package/dist/apps/management/routes/usage.d.ts +24 -24
  92. package/dist/apps/management/routes/verified-token-requests.d.ts +1 -1
  93. package/dist/apps/management/routes/webhooks.d.ts +55 -55
  94. package/dist/db/Db.d.ts.map +1 -1
  95. package/dist/db/Db.js +12 -1
  96. package/dist/db/Db.js.map +1 -1
  97. package/dist/db/Schema.d.ts +3 -2
  98. package/dist/db/Schema.d.ts.map +1 -1
  99. package/dist/db/Schema.js +5 -2
  100. package/dist/db/Schema.js.map +1 -1
  101. package/dist/db/tables/fundingCatalog.d.ts +4 -2
  102. package/dist/db/tables/fundingCatalog.d.ts.map +1 -1
  103. package/dist/db/tables/fundingCatalog.js +5 -1
  104. package/dist/db/tables/fundingCatalog.js.map +1 -1
  105. package/dist/handlers/internal/utils.d.ts.map +1 -1
  106. package/dist/handlers/internal/utils.js +9 -0
  107. package/dist/handlers/internal/utils.js.map +1 -1
  108. package/dist/internal/Auth.d.ts +3 -1
  109. package/dist/internal/Auth.d.ts.map +1 -1
  110. package/dist/internal/Auth.js +6 -3
  111. package/dist/internal/Auth.js.map +1 -1
  112. package/dist/internal/EarnVaults.d.ts +3 -3
  113. package/dist/internal/EarnVaults.js +3 -3
  114. package/dist/internal/Fetch.d.ts +23 -0
  115. package/dist/internal/Fetch.d.ts.map +1 -0
  116. package/dist/internal/Fetch.js +26 -0
  117. package/dist/internal/Fetch.js.map +1 -0
  118. package/dist/internal/Log.d.ts +3 -1
  119. package/dist/internal/Log.d.ts.map +1 -1
  120. package/dist/internal/Log.js +16 -3
  121. package/dist/internal/Log.js.map +1 -1
  122. package/dist/internal/OpenApi.d.ts +5 -3
  123. package/dist/internal/OpenApi.d.ts.map +1 -1
  124. package/dist/internal/OpenApi.js +13 -3
  125. package/dist/internal/OpenApi.js.map +1 -1
  126. package/dist/internal/Response.d.ts +1 -1
  127. package/dist/internal/Response.d.ts.map +1 -1
  128. package/dist/internal/Schema.d.ts +6 -3
  129. package/dist/internal/Schema.d.ts.map +1 -1
  130. package/dist/internal/Schema.js +8 -2
  131. package/dist/internal/Schema.js.map +1 -1
  132. package/dist/internal/Store.d.ts +16 -3
  133. package/dist/internal/Store.d.ts.map +1 -1
  134. package/dist/internal/Store.js +82 -16
  135. package/dist/internal/Store.js.map +1 -1
  136. package/dist/internal/Tidx.d.ts.map +1 -1
  137. package/dist/internal/Tidx.js +7 -2
  138. package/dist/internal/Tidx.js.map +1 -1
  139. package/dist/internal/Timeout.d.ts +36 -0
  140. package/dist/internal/Timeout.d.ts.map +1 -0
  141. package/dist/internal/Timeout.js +37 -0
  142. package/dist/internal/Timeout.js.map +1 -0
  143. package/dist/internal/Timing.d.ts +9 -0
  144. package/dist/internal/Timing.d.ts.map +1 -1
  145. package/dist/internal/Timing.js +7 -0
  146. package/dist/internal/Timing.js.map +1 -1
  147. package/dist/internal/WebhookDestination.d.ts.map +1 -1
  148. package/dist/internal/WebhookDestination.js +3 -0
  149. package/dist/internal/WebhookDestination.js.map +1 -1
  150. package/dist/internal/funding/Action.d.ts +9 -0
  151. package/dist/internal/funding/Action.d.ts.map +1 -1
  152. package/dist/internal/funding/Action.js +16 -8
  153. package/dist/internal/funding/Action.js.map +1 -1
  154. package/dist/internal/funding/Catalog.d.ts +9 -2
  155. package/dist/internal/funding/Catalog.d.ts.map +1 -1
  156. package/dist/internal/funding/Catalog.js +19 -8
  157. package/dist/internal/funding/Catalog.js.map +1 -1
  158. package/dist/internal/funding/Provider.d.ts +68 -13
  159. package/dist/internal/funding/Provider.d.ts.map +1 -1
  160. package/dist/internal/funding/Provider.js +29 -8
  161. package/dist/internal/funding/Provider.js.map +1 -1
  162. package/dist/internal/funding/Transfer.d.ts +13 -12
  163. package/dist/internal/funding/Transfer.d.ts.map +1 -1
  164. package/dist/internal/funding/Transfer.js +23 -21
  165. package/dist/internal/funding/Transfer.js.map +1 -1
  166. package/dist/internal/funding/providers/stargate.d.ts +28 -9
  167. package/dist/internal/funding/providers/stargate.d.ts.map +1 -1
  168. package/dist/internal/funding/providers/stargate.js +251 -117
  169. package/dist/internal/funding/providers/stargate.js.map +1 -1
  170. package/dist/internal/index.d.ts +1 -0
  171. package/dist/internal/index.d.ts.map +1 -1
  172. package/dist/internal/index.js +1 -0
  173. package/dist/internal/index.js.map +1 -1
  174. package/package.json +2 -2
  175. package/src/App.test.ts +100 -0
  176. package/src/App.ts +42 -3
  177. package/src/Client.test-d.ts +46 -0
  178. package/src/Scope.test.ts +20 -0
  179. package/src/Scope.ts +16 -0
  180. package/src/admin/apps/api-keys.test.ts +75 -0
  181. package/src/admin/apps/api-keys.ts +64 -0
  182. package/src/admin/apps/earn-vaults.test.ts +1 -1
  183. package/src/admin/apps/earn-vaults.ts +1 -1
  184. package/src/admin/ui/src/lib/api-keys.ts +19 -0
  185. package/src/admin/ui/src/routes/api-keys.tsx +89 -2
  186. package/src/admin/ui.generated.ts +189 -151
  187. package/src/apps/Zones.test.ts +4 -4
  188. package/src/apps/Zones.ts +4 -4
  189. package/src/apps/composition.test.ts +1 -1
  190. package/src/apps/data/App.test.ts +41 -0
  191. package/src/apps/data/App.ts +18 -18
  192. package/src/apps/data/ZoneSelection.test.ts +2 -2
  193. package/src/apps/data/ZoneSelection.ts +8 -8
  194. package/src/apps/data/routes/activities.test.ts +1526 -12
  195. package/src/apps/data/routes/activities.ts +1774 -1356
  196. package/src/apps/data/routes/balances.ts +133 -97
  197. package/src/apps/data/routes/blocks.test.ts +533 -0
  198. package/src/apps/data/routes/blocks.ts +35 -16
  199. package/src/apps/data/routes/earn.test.ts +4 -2
  200. package/src/apps/data/routes/earn.ts +13 -13
  201. package/src/apps/data/routes/earn.zone-access.test.ts +6 -6
  202. package/src/apps/data/routes/receipts.ts +47 -16
  203. package/src/apps/data/routes/tokens.test.ts +578 -0
  204. package/src/apps/data/routes/tokens.ts +283 -225
  205. package/src/apps/data/routes/transactions.ts +68 -29
  206. package/src/apps/data/routes/transfers.test.ts +421 -0
  207. package/src/apps/data/routes/transfers.ts +45 -27
  208. package/src/apps/data/routes/valuation.ts +94 -78
  209. package/src/apps/data/routes/zones.test.ts +2 -2
  210. package/src/apps/data/routes/zones.ts +1 -1
  211. package/src/apps/funding/routes/deposit-addresses.test.ts +25 -3
  212. package/src/apps/funding/routes/deposit-addresses.ts +17 -12
  213. package/src/apps/funding/routes/quotes.test.ts +5 -9
  214. package/src/apps/funding/routes/transfers.test.ts +395 -8
  215. package/src/apps/funding/routes/transfers.ts +76 -59
  216. package/src/apps/management/routes/api-keys.test.ts +220 -0
  217. package/src/apps/management/routes/api-keys.ts +280 -3
  218. package/src/db/Db.ts +13 -1
  219. package/src/db/Schema.ts +5 -2
  220. package/src/db/tables/earnVaults.test.ts +9 -9
  221. package/src/db/tables/fundingCatalog.test.ts +16 -2
  222. package/src/db/tables/fundingCatalog.ts +9 -3
  223. package/src/handlers/internal/utils.test.ts +53 -0
  224. package/src/handlers/internal/utils.ts +15 -0
  225. package/src/internal/Auth.ts +12 -4
  226. package/src/internal/EarnVaults.capabilities.test.ts +2 -2
  227. package/src/internal/EarnVaults.test.ts +1 -1
  228. package/src/internal/EarnVaults.ts +3 -3
  229. package/src/internal/Fetch.test.ts +46 -0
  230. package/src/internal/Fetch.ts +56 -0
  231. package/src/internal/Log.test.ts +21 -0
  232. package/src/internal/Log.ts +20 -5
  233. package/src/internal/OpenApi.ts +14 -4
  234. package/src/internal/Response.ts +1 -1
  235. package/src/internal/Schema.test.ts +2 -0
  236. package/src/internal/Schema.ts +12 -2
  237. package/src/internal/Store.test.ts +178 -0
  238. package/src/internal/Store.ts +104 -18
  239. package/src/internal/Tidx.test.ts +2 -1
  240. package/src/internal/Tidx.ts +7 -2
  241. package/src/internal/Timeout.test.ts +35 -0
  242. package/src/internal/Timeout.ts +73 -0
  243. package/src/internal/Timing.ts +16 -0
  244. package/src/internal/WebhookDestination.ts +3 -0
  245. package/src/internal/funding/Action.test.ts +41 -1
  246. package/src/internal/funding/Action.ts +69 -41
  247. package/src/internal/funding/Catalog.test.ts +34 -0
  248. package/src/internal/funding/Catalog.ts +28 -11
  249. package/src/internal/funding/Provider.test.ts +73 -0
  250. package/src/internal/funding/Provider.ts +82 -28
  251. package/src/internal/funding/Transfer.ts +133 -110
  252. package/src/internal/funding/providers/index.test.ts +4 -167
  253. package/src/internal/funding/providers/relay.test.ts +2 -2
  254. package/src/internal/funding/providers/stargate.test.ts +163 -0
  255. package/src/internal/funding/providers/stargate.ts +359 -134
  256. package/src/internal/index.test.ts +1 -0
  257. package/src/internal/index.ts +1 -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,
@@ -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.'))
@@ -65,6 +65,21 @@ type ContractResponse = {
65
65
  content?: Record<string, { schema: unknown }> | undefined
66
66
  }
67
67
 
68
+ type JsonSchema = {
69
+ $ref?: string | undefined
70
+ properties?: Record<string, JsonSchema> | undefined
71
+ }
72
+
73
+ type ComponentSpec = {
74
+ components: { schemas: Record<string, JsonSchema> }
75
+ }
76
+
77
+ function dereference(spec: ComponentSpec, schema: JsonSchema): JsonSchema {
78
+ if (!schema.$ref) return schema
79
+ const name = schema.$ref.split('/').at(-1)!
80
+ return spec.components.schemas[name]!
81
+ }
82
+
68
83
  test('publishes generator-ready funding deposit contracts', async () => {
69
84
  const spec = await (await create({ auth: false }).request('/openapi.json')).json()
70
85
  const depositAddressPath = Object.keys(spec.paths).find(
@@ -126,9 +141,10 @@ test('publishes generator-ready funding deposit contracts', async () => {
126
141
  addressList: spec.components.schemas.FundingDepositAddressList.properties.data.items,
127
142
  createResponse: spec.components.schemas.CreateFundingDepositAddressResponse.anyOf,
128
143
  createdAddress: {
129
- feeToken:
130
- spec.components.schemas.CreatedFundingDepositAddress.properties.fees.items.properties
131
- .token,
144
+ feeToken: dereference(
145
+ spec,
146
+ spec.components.schemas.CreatedFundingDepositAddress.properties.fees.items,
147
+ ).properties!['token'],
132
148
  quote: spec.components.schemas.CreatedFundingDepositAddress.properties.quote,
133
149
  },
134
150
  deposit: {
@@ -278,6 +294,7 @@ test('publishes generator-ready funding deposit contracts', async () => {
278
294
  "502": {
279
295
  "$ref": "#/components/schemas/UpstreamError",
280
296
  },
297
+ "504": "#/components/responses/RequestTimeout",
281
298
  },
282
299
  "operationId": "createFundingDepositAddress",
283
300
  "request": {
@@ -306,6 +323,7 @@ test('publishes generator-ready funding deposit contracts', async () => {
306
323
  "502": {
307
324
  "$ref": "#/components/schemas/UpstreamError",
308
325
  },
326
+ "504": "#/components/responses/RequestTimeout",
309
327
  },
310
328
  "operationId": "getFundingDepositAddress",
311
329
  "request": undefined,
@@ -332,6 +350,7 @@ test('publishes generator-ready funding deposit contracts', async () => {
332
350
  "502": {
333
351
  "$ref": "#/components/schemas/UpstreamError",
334
352
  },
353
+ "504": "#/components/responses/RequestTimeout",
335
354
  },
336
355
  "operationId": "getFundingDeposit",
337
356
  "request": undefined,
@@ -355,6 +374,7 @@ test('publishes generator-ready funding deposit contracts', async () => {
355
374
  "502": {
356
375
  "$ref": "#/components/schemas/UpstreamError",
357
376
  },
377
+ "504": "#/components/responses/RequestTimeout",
358
378
  },
359
379
  "operationId": "listFundingDepositAddresses",
360
380
  "request": undefined,
@@ -378,6 +398,7 @@ test('publishes generator-ready funding deposit contracts', async () => {
378
398
  "502": {
379
399
  "$ref": "#/components/schemas/UpstreamError",
380
400
  },
401
+ "504": "#/components/responses/RequestTimeout",
381
402
  },
382
403
  "operationId": "listFundingDeposits",
383
404
  "request": undefined,
@@ -410,6 +431,7 @@ test('publishes generator-ready funding deposit contracts', async () => {
410
431
  "502": {
411
432
  "$ref": "#/components/schemas/UpstreamError",
412
433
  },
434
+ "504": "#/components/responses/RequestTimeout",
413
435
  },
414
436
  "operationId": "reconcileFundingDepositAddress",
415
437
  "request": undefined,
@@ -700,8 +700,6 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
700
700
  refundAddress,
701
701
  result,
702
702
  } = selected
703
- const feeToken = (side: 'destination' | 'source') =>
704
- side === 'source' ? selectedCandidate.sourceToken : selectedCandidate.destinationToken
705
703
  const created = await db.transaction(async (tx) => {
706
704
  const stored = await FundingDepositAddress.createOrGet(tx, {
707
705
  apiKeyId: principal.id,
@@ -741,16 +739,23 @@ export function depositAddresses(options: depositAddresses.Options = {}) {
741
739
  currency: selectedCandidate.destinationToken.currency,
742
740
  decimals: selectedCandidate.destinationToken.decimals,
743
741
  }),
744
- fees: result.fees.map((fee) => ({
745
- amount: Value.tokenAmount({
746
- baseUnits: fee.amount,
747
- currency: feeToken(fee.side).currency,
748
- decimals: feeToken(fee.side).decimals,
749
- }),
750
- side: fee.side,
751
- token: feeToken(fee.side),
752
- type: 'provider',
753
- })),
742
+ fees: result.fees.map((fee) => {
743
+ const token =
744
+ fee.token ??
745
+ (fee.side === 'source'
746
+ ? selectedCandidate.sourceToken
747
+ : selectedCandidate.destinationToken)
748
+ return {
749
+ amount: Value.tokenAmount({
750
+ baseUnits: fee.amount,
751
+ currency: token.currency,
752
+ decimals: token.decimals,
753
+ }),
754
+ side: fee.side,
755
+ token,
756
+ type: 'provider',
757
+ }
758
+ }),
754
759
  quote: {
755
760
  ...(result.expiresAt === undefined ? {} : { expiresAt: result.expiresAt }),
756
761
  sampledAt: result.sampledAt,
@@ -36,10 +36,7 @@ const providers = [
36
36
  integratorId: 'squid-integrator-id',
37
37
  userAddress: '0x1111111111111111111111111111111111111111',
38
38
  }),
39
- Stargate.stargate({
40
- apiKey: 'layerzero-api-key',
41
- userAddress: '0x1111111111111111111111111111111111111111',
42
- }),
39
+ Stargate.stargate(),
43
40
  Symbiosis.symbiosis({ userAddress: '0x1111111111111111111111111111111111111111' }),
44
41
  ] as const
45
42
 
@@ -195,8 +192,8 @@ describe('GET /funding/quotes', () => {
195
192
  id: 'base-usdc-tempo-usdce-stargate',
196
193
  provider: { id: 'stargate', name: 'Stargate' },
197
194
  quality: {
198
- liquiditySource: 'providerQuote',
199
- sourceDetail: 'stargate:value-transfer-v1:bus',
195
+ liquiditySource: 'onchain',
196
+ sourceDetail: 'stargate:oft-v2:taxi',
200
197
  tier: 'liquid',
201
198
  },
202
199
  })
@@ -536,9 +533,8 @@ function stargateProvider() {
536
533
  destinationAmountMin: '999100',
537
534
  destinationAmount: '999600',
538
535
  quality: {
539
- estimatedSeconds: 28,
540
- liquiditySource: 'providerQuote',
541
- sourceDetail: 'stargate:value-transfer-v1:bus',
536
+ liquiditySource: 'onchain',
537
+ sourceDetail: 'stargate:oft-v2:taxi',
542
538
  tier: 'liquid',
543
539
  },
544
540
  sampledAt: '2026-01-01T00:00:00Z',