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
@@ -87,104 +87,117 @@ export namespace schema {
87
87
  )
88
88
 
89
89
  /** A TIP-20 balance with raw and formatted amounts. Unresolvable token metadata omits the row. */
90
- export const Balance = Schema.describe(
91
- z.object({
92
- amount: z
93
- .string()
94
- .check(
95
- z.regex(/^\d+$/),
96
- z.describe(
97
- 'A non-negative whole number, given as a decimal string so very large token amounts keep full precision. Expressed in the smallest unit of the token.',
90
+ export const Balance = OpenApi.component(
91
+ Schema.describe(
92
+ z.object({
93
+ amount: z
94
+ .string()
95
+ .check(
96
+ z.regex(/^\d+$/),
97
+ z.describe(
98
+ 'A non-negative whole number, given as a decimal string so very large token amounts keep full precision. Expressed in the smallest unit of the token.',
99
+ ),
100
+ z.meta({ examples: ['1500000'] }),
98
101
  ),
99
- z.meta({ examples: ['1500000'] }),
100
- ),
101
- currency: z
102
- .string()
103
- .check(
104
- z.describe(
105
- 'The currency label for this balance, such as `USD` for a USD-denominated token.',
102
+ currency: z
103
+ .string()
104
+ .check(
105
+ z.describe(
106
+ 'The currency label for this balance, such as `USD` for a USD-denominated token.',
107
+ ),
108
+ z.meta({ examples: ['USD'] }),
106
109
  ),
107
- z.meta({ examples: ['USD'] }),
108
- ),
109
- decimals: z
110
- .number()
111
- .check(
112
- z.int(),
113
- z.nonnegative(),
114
- z.describe(
115
- 'The number of decimal places used to convert this balance between base units and human-readable form.',
110
+ decimals: z
111
+ .number()
112
+ .check(
113
+ z.int(),
114
+ z.nonnegative(),
115
+ z.describe(
116
+ 'The number of decimal places used to convert this balance between base units and human-readable form.',
117
+ ),
118
+ z.meta({ examples: [6] }),
116
119
  ),
117
- z.meta({ examples: [6] }),
118
- ),
119
- feeEligible: z
120
- .optional(z.boolean())
121
- .check(
122
- z.describe(
123
- 'Whether this token can be used to pay transaction fees on Tempo: `true` when ' +
124
- 'the token is verified and has a Fee AMM pool, or is the default fee token ' +
125
- '(`pathUSD`). Lets you identify fee-payable holdings without a separate ' +
126
- '`/fee-amm/pools` query. Omitted (best-effort) when the fee-token lookup ' +
127
- 'is unavailable.',
120
+ feeEligible: z
121
+ .optional(z.boolean())
122
+ .check(
123
+ z.describe(
124
+ 'Whether this token can be used to pay transaction fees on Tempo: `true` when ' +
125
+ 'the token is verified and has a Fee AMM pool, or is the default fee token ' +
126
+ '(`pathUSD`). Lets you identify fee-payable holdings without a separate ' +
127
+ '`/fee-amm/pools` query. Omitted (best-effort) when the fee-token lookup ' +
128
+ 'is unavailable.',
129
+ ),
130
+ z.meta({ examples: [true] }),
128
131
  ),
129
- z.meta({ examples: [true] }),
130
- ),
131
- formatted: z
132
- .string()
133
- .check(
134
- z.describe(
135
- 'The same balance in human-readable decimal form, using this balance’s `decimals`.',
132
+ formatted: z
133
+ .string()
134
+ .check(
135
+ z.describe(
136
+ 'The same balance in human-readable decimal form, using this balance’s `decimals`.',
137
+ ),
138
+ z.meta({ examples: ['1.5'] }),
136
139
  ),
137
- z.meta({ examples: ['1.5'] }),
138
- ),
139
- id: z
140
- .string()
141
- .check(
142
- z.describe(
143
- 'A stable resource ID for this balance, equal to the token contract address.',
140
+ id: z
141
+ .string()
142
+ .check(
143
+ z.describe(
144
+ 'A stable resource ID for this balance, equal to the token contract address.',
145
+ ),
146
+ z.meta({ examples: ['0x20c0000000000000000000008f5425160ebe5525'] }),
144
147
  ),
145
- z.meta({ examples: ['0x20c0000000000000000000008f5425160ebe5525'] }),
146
- ),
147
- token: Tokens.schema.Token,
148
- valuation: z
149
- .optional(z.nullable(Valuation.schema.Value))
150
- .check(
151
- z.describe(
152
- 'The holding’s nominal value when `valuation.currency` is requested, or `null` when ' +
153
- 'the token is unverified, its display currency has no rate, or rates were unavailable.',
148
+ token: Tokens.schema.Token,
149
+ valuation: z
150
+ .optional(z.nullable(Valuation.schema.Value))
151
+ .check(
152
+ z.describe(
153
+ 'The holding’s nominal value when `valuation.currency` is requested, or `null` when ' +
154
+ 'the token is unverified, its display currency has no rate, or rates were unavailable.',
155
+ ),
154
156
  ),
155
- ),
156
- }),
157
- 'One TIP-20 token balance held by this account, with both raw and human-readable amounts.',
157
+ }),
158
+ 'One TIP-20 token balance held by this account, with both raw and human-readable amounts.',
159
+ ),
160
+ 'Balance',
158
161
  )
159
162
 
160
163
  /** Page-level resources: opt-in counts plus valuation rate provenance. */
161
- export const Meta = z
162
- .object({
163
- valuation: z
164
- .optional(Valuation.schema.Pricing)
165
- .check(
166
- z.describe(
167
- 'Rate provenance for row valuations. Present when conversion rates were ' +
168
- 'consulted; absent when every value was identity-valued or rates were unavailable.',
164
+ export const Meta = OpenApi.component(
165
+ z
166
+ .object({
167
+ valuation: z
168
+ .optional(Valuation.schema.Pricing)
169
+ .check(
170
+ z.describe(
171
+ 'Rate provenance for row valuations. Present when conversion rates were ' +
172
+ 'consulted; absent when every value was identity-valued or rates were unavailable.',
173
+ ),
169
174
  ),
170
- ),
171
- totalCount: z.optional(Schema.TotalCount),
172
- totalCountCapped: z.optional(Schema.TotalCountCapped),
173
- })
174
- .check(z.describe('Page-level resources attached to this response.'))
175
+ totalCount: z.optional(Schema.TotalCount),
176
+ totalCountCapped: z.optional(Schema.TotalCountCapped),
177
+ })
178
+ .check(z.describe('Page-level resources attached to this response.')),
179
+ 'BalanceListMeta',
180
+ )
175
181
 
176
182
  /** Page of TIP-20 token balances held by an address, ordered by amount descending. */
177
- export const Response = z
178
- .object({
179
- data: z
180
- .array(Balance)
181
- .check(z.describe('The balances in this page, ordered from largest to smallest amount.')),
182
- meta: z
183
- .optional(Meta)
184
- .check(z.describe('Page-level resources: opt-in counts and valuation rate provenance.')),
185
- nextCursor: Schema.NextCursor,
186
- })
187
- .check(z.describe('A page of TIP-20 token balances held by this account.'))
183
+ export const Response = OpenApi.component(
184
+ z
185
+ .object({
186
+ data: z
187
+ .array(Balance)
188
+ .check(
189
+ z.describe('The balances in this page, ordered from largest to smallest amount.'),
190
+ ),
191
+ meta: z
192
+ .optional(Meta)
193
+ .check(
194
+ z.describe('Page-level resources: opt-in counts and valuation rate provenance.'),
195
+ ),
196
+ nextCursor: Schema.NextCursor,
197
+ })
198
+ .check(z.describe('A page of TIP-20 token balances held by this account.')),
199
+ 'BalanceList',
200
+ )
188
201
  }
189
202
 
190
203
  /** Schemas for the getAddressBalance operation. */
@@ -213,9 +226,7 @@ export namespace schema {
213
226
  .check(z.describe('Query parameters for reading one account token balance.'))
214
227
 
215
228
  /** A single TIP-20 token balance held by an address. */
216
- export const Response = getAddressBalances.Balance.check(
217
- z.describe('One TIP-20 token balance held by this account.'),
218
- )
229
+ export const Response = getAddressBalances.Balance
219
230
  }
220
231
  }
221
232
 
@@ -242,7 +253,17 @@ export function addresses(options: addresses.Options = {}) {
242
253
  'Lists how much of each TIP-20 token an account holds, ordered from largest to smallest balance. Amounts are returned in raw base units and human-readable form. Pass `valuation.currency` to include nominal values.',
243
254
  operationId: 'getAddressBalances',
244
255
  responses: OpenApi.responses({
245
- errors: { 502: 'Could not read balance or token data from an upstream service.' },
256
+ errors: {
257
+ 400: {
258
+ codes: [
259
+ 'address_invalid',
260
+ 'chain_id_invalid',
261
+ 'chain_id_unsupported',
262
+ 'query_invalid',
263
+ ],
264
+ },
265
+ 502: 'Could not read balance or token data from an upstream service.',
266
+ },
246
267
  success: {
247
268
  description: 'A page of token balances for this account.',
248
269
  schema: schema.getAddressBalances.Response,
@@ -318,6 +339,14 @@ export function addresses(options: addresses.Options = {}) {
318
339
  operationId: 'getAddressBalance',
319
340
  responses: OpenApi.responses({
320
341
  errors: {
342
+ 400: {
343
+ codes: [
344
+ 'address_invalid',
345
+ 'chain_id_invalid',
346
+ 'chain_id_unsupported',
347
+ 'query_invalid',
348
+ ],
349
+ },
321
350
  404: {
322
351
  description: 'The token is not a registered TIP-20 token.',
323
352
  codes: ['token_not_found'],
@@ -517,16 +546,23 @@ async function getAddressBalances(
517
546
  const caller = c.get('zones').has(chainId) ? address : undefined
518
547
  return Timing.time(c, 'balances_rpc', async () => {
519
548
  // Concurrent reads enter viem's shared batch window and become one
520
- // deployless multicall. A failed read fails the request rather than serving
521
- // a stale or partial balance page.
549
+ // deployless multicall. Missing contracts are stale indexed candidates;
550
+ // other read failures still fail the request.
522
551
  const results = await Promise.all(
523
552
  holdings.map(async (holding) => {
524
- const call = Actions.token.getBalance.call(client, {
525
- account: address,
526
- token: holding.address,
527
- })
528
- const amount = await client.readContract({ ...call, account: caller })
529
- return amount === 0n ? undefined : { address: holding.address, amount: amount.toString() }
553
+ try {
554
+ const call = Actions.token.getBalance.call(client, {
555
+ account: address,
556
+ token: holding.address,
557
+ })
558
+ const amount = await client.readContract({ ...call, account: caller })
559
+ return amount === 0n
560
+ ? undefined
561
+ : { address: holding.address, amount: amount.toString() }
562
+ } catch (cause) {
563
+ if (!(await client.getCode({ address: holding.address }))) return undefined
564
+ throw cause
565
+ }
530
566
  }),
531
567
  )
532
568
  const rows = results.filter((holding) => holding !== undefined)