@xochi/widget 0.0.0-stage → 0.1.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 (585) hide show
  1. package/CHANGELOG.md +76 -0
  2. package/LICENSE +21 -0
  3. package/README.md +420 -2
  4. package/THIRD_PARTY_NOTICES.txt +44 -0
  5. package/dist/ConfiguratorApp.js +19 -0
  6. package/dist/EmbedApp.js +57 -0
  7. package/dist/assets/MonaspaceArgon-Bold-D9kWRRK5.woff2 +0 -0
  8. package/dist/assets/MonaspaceArgon-Light-Dt_6qXbW.woff2 +0 -0
  9. package/dist/assets/MonaspaceArgon-Medium-B1gMZwrU.woff2 +0 -0
  10. package/dist/assets/MonaspaceArgon-Regular-RS-2TGNg.woff2 +0 -0
  11. package/dist/assets/MonaspaceArgon-SemiBold-PYusZXE_.woff2 +0 -0
  12. package/dist/assets/MonaspaceNeon-Italic-C9u9eioB.woff2 +0 -0
  13. package/dist/assets/MonaspaceNeon-Light-CJkxpyfT.woff2 +0 -0
  14. package/dist/assets/MonaspaceNeon-Medium-DCChELAx.woff2 +0 -0
  15. package/dist/assets/MonaspaceNeon-Regular-BZtV1wRa.woff2 +0 -0
  16. package/dist/assets/MonaspaceXenon-Bold-KacFhGOf.woff2 +0 -0
  17. package/dist/assets/MonaspaceXenon-Medium-Dqqg-cnL.woff2 +0 -0
  18. package/dist/assets/MonaspaceXenon-Regular-BRsdKART.woff2 +0 -0
  19. package/dist/assets/MonaspaceXenon-SemiBold-DNjPl3uE.woff2 +0 -0
  20. package/dist/assets/alipay-3tx9-HPp.svg +1 -0
  21. package/dist/assets/arb-CCfLcB_X.svg +7 -0
  22. package/dist/assets/arc-Dy98eSCd.svg +10 -0
  23. package/dist/assets/aztec-DiLp9qTG.svg +4 -0
  24. package/dist/assets/base-Ch0ino36.svg +4 -0
  25. package/dist/assets/cashapp-lOg0DIt8.svg +1 -0
  26. package/dist/assets/chains/arbitrum.svg.js +4 -0
  27. package/dist/assets/chains/arc.svg.js +4 -0
  28. package/dist/assets/chains/aztec.svg.js +4 -0
  29. package/dist/assets/chains/base.svg.js +4 -0
  30. package/dist/assets/chains/ethereum.svg.js +4 -0
  31. package/dist/assets/chains/gnosis.png.js +4 -0
  32. package/dist/assets/chains/index.js +31 -0
  33. package/dist/assets/chains/optimism.svg.js +4 -0
  34. package/dist/assets/chains/polygon.svg.js +4 -0
  35. package/dist/assets/chains/robinhood.svg.js +4 -0
  36. package/dist/assets/chains/tron.svg.js +4 -0
  37. package/dist/assets/chains/xochi.svg.js +4 -0
  38. package/dist/assets/dai-XuyZLceZ.png +0 -0
  39. package/dist/assets/defillama-BU037Unq.svg +1 -0
  40. package/dist/assets/defillama.svg.js +4 -0
  41. package/dist/assets/eth-Dvbng9UB.svg +8 -0
  42. package/dist/assets/eurc-NI9zNgOQ.png +0 -0
  43. package/dist/assets/eure-BH9vpwcv.png +0 -0
  44. package/dist/assets/gnosis-fRzAZQFj.png +0 -0
  45. package/dist/assets/mercadopago-gjsFb6F7.svg +1 -0
  46. package/dist/assets/monzo-B9XD4bL5.png +0 -0
  47. package/dist/assets/monzo-SZnIdUKN.svg +1 -0
  48. package/dist/assets/monzo-dark-Bwzg90UC.png +0 -0
  49. package/dist/assets/n26-cANcjY2T.svg +1 -0
  50. package/dist/assets/op-DF67SbB6.png +0 -0
  51. package/dist/assets/optimism-B3cTNxEQ.svg +4 -0
  52. package/dist/assets/paypal-D8xqXEtN.svg +1 -0
  53. package/dist/assets/pol-uLmSo2O8.svg +3 -0
  54. package/dist/assets/rails/SOURCES.md +50 -0
  55. package/dist/assets/rails/alipay.svg.js +4 -0
  56. package/dist/assets/rails/cashapp.svg.js +4 -0
  57. package/dist/assets/rails/index.js +59 -0
  58. package/dist/assets/rails/mercadopago.svg.js +4 -0
  59. package/dist/assets/rails/monzo-dark.png.js +4 -0
  60. package/dist/assets/rails/monzo.png.js +4 -0
  61. package/dist/assets/rails/monzo.svg.js +4 -0
  62. package/dist/assets/rails/n26.svg.js +4 -0
  63. package/dist/assets/rails/paypal.svg.js +4 -0
  64. package/dist/assets/rails/revolut-dark.png.js +4 -0
  65. package/dist/assets/rails/revolut.png.js +4 -0
  66. package/dist/assets/rails/revolut.svg.js +4 -0
  67. package/dist/assets/rails/venmo.svg.js +4 -0
  68. package/dist/assets/rails/wise-dark.png.js +4 -0
  69. package/dist/assets/rails/wise.png.js +4 -0
  70. package/dist/assets/rails/wise.svg.js +4 -0
  71. package/dist/assets/rails/xmoney.svg.js +4 -0
  72. package/dist/assets/rails/zelle.svg.js +4 -0
  73. package/dist/assets/raxol-86FmC34h.png +0 -0
  74. package/dist/assets/revolut-CiBtyALA.png +0 -0
  75. package/dist/assets/revolut-D7qr5Vzs.svg +1 -0
  76. package/dist/assets/revolut-dark-RQdWGM_p.png +0 -0
  77. package/dist/assets/robinhood-DgdGTQ1I.svg +8 -0
  78. package/dist/assets/tokens/arb.svg.js +4 -0
  79. package/dist/assets/tokens/dai.png.js +4 -0
  80. package/dist/assets/tokens/eth.svg.js +4 -0
  81. package/dist/assets/tokens/eurc.png.js +4 -0
  82. package/dist/assets/tokens/eure.png.js +4 -0
  83. package/dist/assets/tokens/index.js +36 -0
  84. package/dist/assets/tokens/op.png.js +4 -0
  85. package/dist/assets/tokens/pol.svg.js +4 -0
  86. package/dist/assets/tokens/raxol.png.js +4 -0
  87. package/dist/assets/tokens/usdc.png.js +4 -0
  88. package/dist/assets/tokens/usdg.png.js +4 -0
  89. package/dist/assets/tokens/usdt.png.js +4 -0
  90. package/dist/assets/tokens/wbtc.png.js +4 -0
  91. package/dist/assets/tokens/wsteth.png.js +4 -0
  92. package/dist/assets/tokens/zchf.png.js +4 -0
  93. package/dist/assets/tron-Dtumyzha.svg +4 -0
  94. package/dist/assets/usdc-UHSd0FoM.png +0 -0
  95. package/dist/assets/usdg-Cd5nCzbC.png +0 -0
  96. package/dist/assets/usdt-3G3YdPq8.png +0 -0
  97. package/dist/assets/venmo-CMHeCn-D.svg +1 -0
  98. package/dist/assets/wbtc-CV8uE44Q.png +0 -0
  99. package/dist/assets/wise-BUOflsWL.svg +1 -0
  100. package/dist/assets/wise-JLpDvCdq.png +0 -0
  101. package/dist/assets/wise-dark-_Q8pbCom.png +0 -0
  102. package/dist/assets/wsteth-BamwtTCR.png +0 -0
  103. package/dist/assets/xmoney-CwY9KVlD.svg +1 -0
  104. package/dist/assets/xochi-DL2f8G4R.svg +4 -0
  105. package/dist/assets/zchf-BLBNdTGJ.png +0 -0
  106. package/dist/assets/zelle-t15cG4SB.svg +1 -0
  107. package/dist/browser.js +4 -0
  108. package/dist/components/AccountChip.js +29 -0
  109. package/dist/components/ActivityFeed.js +710 -0
  110. package/dist/components/AssetsStrip.js +133 -0
  111. package/dist/components/AuthorizedAgents.js +197 -0
  112. package/dist/components/Chevron.js +22 -0
  113. package/dist/components/ErrorDisplay.js +66 -0
  114. package/dist/components/InfoButton.js +27 -0
  115. package/dist/components/IntentTimeline.js +202 -0
  116. package/dist/components/LinksSignIn.js +26 -0
  117. package/dist/components/MobileSigningBanner.js +44 -0
  118. package/dist/components/PrivacyBars.js +44 -0
  119. package/dist/components/PrivacyPanel.js +99 -0
  120. package/dist/components/QuoteDetails.js +327 -0
  121. package/dist/components/ReceiptCommand.js +46 -0
  122. package/dist/components/SessionReloadBanner.js +19 -0
  123. package/dist/components/SolverRace.js +62 -0
  124. package/dist/components/StealthClaims.js +179 -0
  125. package/dist/components/SwapFlowModal.js +398 -0
  126. package/dist/components/Toast.js +40 -0
  127. package/dist/components/TokenIcon.js +21 -0
  128. package/dist/components/TokenSearchModal.js +331 -0
  129. package/dist/components/TransactionPreview.js +207 -0
  130. package/dist/components/WalletProvider.js +41 -0
  131. package/dist/components/WrapModal.js +192 -0
  132. package/dist/components/swap-flow/CantonEscrowPanel.js +28 -0
  133. package/dist/components/swap-flow/CantonEscrowStatus.js +160 -0
  134. package/dist/components/swap-flow/DepositInstructions.js +156 -0
  135. package/dist/components/swap-flow/QrCode.js +22 -0
  136. package/dist/components/swap-flow/SwapResult.js +323 -0
  137. package/dist/components/swap-flow/depositScreen.js +36 -0
  138. package/dist/components/widgetTabsContext.js +17 -0
  139. package/dist/config.js +132 -0
  140. package/dist/configurator-model.js +71 -0
  141. package/dist/configurator.js +11 -0
  142. package/dist/constants.js +53 -0
  143. package/dist/hooks/applyTheme.js +10 -0
  144. package/dist/hooks/useAgentRegistry.js +28 -0
  145. package/dist/hooks/useAgentStream.js +89 -0
  146. package/dist/hooks/useCantonEscrow.js +89 -0
  147. package/dist/hooks/useCapabilities.js +86 -0
  148. package/dist/hooks/useEmbedLook.js +23 -0
  149. package/dist/hooks/useFocusTrap.js +44 -0
  150. package/dist/hooks/useIntent.js +435 -0
  151. package/dist/hooks/useIntentStatusPoll.js +71 -0
  152. package/dist/hooks/useIntentStream.js +95 -0
  153. package/dist/hooks/useLocalActivity.js +114 -0
  154. package/dist/hooks/useLocalSends.js +15 -0
  155. package/dist/hooks/useLocalStorage.js +26 -0
  156. package/dist/hooks/useOrderHistory.js +307 -0
  157. package/dist/hooks/usePermit.js +131 -0
  158. package/dist/hooks/usePrices.js +49 -0
  159. package/dist/hooks/usePublicBalances.js +186 -0
  160. package/dist/hooks/useRampSummaries.js +19 -0
  161. package/dist/hooks/useRecipientBalance.js +98 -0
  162. package/dist/hooks/useSettlements.js +33 -0
  163. package/dist/hooks/useStealth.js +324 -0
  164. package/dist/hooks/useStealthClaim.js +183 -0
  165. package/dist/hooks/useStealthScanner.js +259 -0
  166. package/dist/hooks/useTheme.js +48 -0
  167. package/dist/hooks/useTierInfo.js +20 -0
  168. package/dist/hooks/useTrustScore.js +16 -0
  169. package/dist/hooks/useWalletSession.js +70 -0
  170. package/dist/hooks/useWrapEth.js +60 -0
  171. package/dist/index.js +41 -0
  172. package/dist/integration.js +19 -0
  173. package/dist/lib/activityValue.js +20 -0
  174. package/dist/lib/agentConnect.js +11 -0
  175. package/dist/lib/agentRegistry.js +83 -0
  176. package/dist/lib/agentStreamVerify.js +47 -0
  177. package/dist/lib/api.js +67 -0
  178. package/dist/lib/auth.js +8 -0
  179. package/dist/lib/authFetch.js +33 -0
  180. package/dist/lib/aztecTokens.js +13 -0
  181. package/dist/lib/balances.js +77 -0
  182. package/dist/lib/capabilities.js +40 -0
  183. package/dist/lib/claimSubmitPoll.js +63 -0
  184. package/dist/lib/debug.js +7 -0
  185. package/dist/lib/declineGuidance.js +31 -0
  186. package/dist/lib/displayFallbacks.js +25 -0
  187. package/dist/lib/eip712.js +38 -0
  188. package/dist/lib/errorCategory.js +200 -0
  189. package/dist/lib/errorReport.js +19 -0
  190. package/dist/lib/explorerLinks.js +30 -0
  191. package/dist/lib/feesLabel.js +19 -0
  192. package/dist/lib/glyphs.js +58 -0
  193. package/dist/lib/hostBridge.js +41 -0
  194. package/dist/lib/hostOrigin.js +52 -0
  195. package/dist/lib/intentAPI.js +39 -0
  196. package/dist/lib/linksSignIn.js +9 -0
  197. package/dist/lib/localActivity.js +247 -0
  198. package/dist/lib/localSends.js +129 -0
  199. package/dist/lib/mobileWallet.js +17 -0
  200. package/dist/lib/pairAvailability.js +29 -0
  201. package/dist/lib/paymentSummary.js +23 -0
  202. package/dist/lib/permits.js +27 -0
  203. package/dist/lib/priceImpact.js +101 -0
  204. package/dist/lib/providers.js +124 -0
  205. package/dist/lib/qr.js +20 -0
  206. package/dist/lib/quoteCost.js +34 -0
  207. package/dist/lib/quoteCountdown.js +24 -0
  208. package/dist/lib/rampHostGate.js +24 -0
  209. package/dist/lib/rampLifecycle.js +63 -0
  210. package/dist/lib/receiptCost.js +64 -0
  211. package/dist/lib/recipient/index.js +302 -0
  212. package/dist/lib/recipient/recent.js +47 -0
  213. package/dist/lib/recipientReceipt.js +16 -0
  214. package/dist/lib/reportClient.js +32 -0
  215. package/dist/lib/sessionExpiry.js +11 -0
  216. package/dist/lib/settlementAvailability.js +34 -0
  217. package/dist/lib/stealth.js +110 -0
  218. package/dist/lib/swapFlowPhase.js +52 -0
  219. package/dist/lib/swapStatusCopy.js +59 -0
  220. package/dist/lib/tradeLifecycle.js +40 -0
  221. package/dist/lib/tronlink.js +71 -0
  222. package/dist/lib/walletSession.js +87 -0
  223. package/dist/pages/Configurator.js +390 -0
  224. package/dist/pages/Trade.js +635 -0
  225. package/dist/pages/configurator/AllowedAssetsSection.js +98 -0
  226. package/dist/pages/configurator/AppearanceSection.js +44 -0
  227. package/dist/pages/configurator/CodeDock.js +140 -0
  228. package/dist/pages/configurator/DeveloperSection.js +40 -0
  229. package/dist/pages/configurator/IntegrationSection.js +105 -0
  230. package/dist/pages/configurator/LayoutSection.js +83 -0
  231. package/dist/pages/configurator/PolicyNote.js +7 -0
  232. package/dist/pages/configurator/PreviewStage.js +165 -0
  233. package/dist/pages/configurator/PrivacySection.js +54 -0
  234. package/dist/pages/configurator/RouteSection.js +211 -0
  235. package/dist/pages/configurator/Settings.js +35 -0
  236. package/dist/pages/configurator/SharedLinkBanner.js +25 -0
  237. package/dist/pages/configurator/SurfaceSection.js +124 -0
  238. package/dist/pages/configurator/WhatUsersSee.js +268 -0
  239. package/dist/pages/configurator/codeShown.js +8 -0
  240. package/dist/pages/configurator/configuratorUrl.js +33 -0
  241. package/dist/pages/configurator/paramsDraft.js +82 -0
  242. package/dist/pages/configurator/previewModel.js +10 -0
  243. package/dist/pages/configurator/previewQuote.js +109 -0
  244. package/dist/pages/configurator/routePicks.js +131 -0
  245. package/dist/pages/configurator/snippets.js +98 -0
  246. package/dist/pages/configurator/surfaceParams.js +51 -0
  247. package/dist/pages/configurator/useCodeCheck.js +79 -0
  248. package/dist/pages/configurator/useConfiguratorUrl.js +24 -0
  249. package/dist/pages/configurator/useMediaQuery.js +20 -0
  250. package/dist/pages/configurator/useParamsDraft.js +33 -0
  251. package/dist/pages/configurator/usePreviewFee.js +100 -0
  252. package/dist/pages/send/MetaAddressValue.js +28 -0
  253. package/dist/pages/send/Receive.js +168 -0
  254. package/dist/pages/send/RecentRecipients.js +23 -0
  255. package/dist/pages/send/RecipientChip.js +26 -0
  256. package/dist/pages/send/ScanRecipient.js +85 -0
  257. package/dist/pages/send/SendForm.js +516 -0
  258. package/dist/pages/send/SendPanel.js +30 -0
  259. package/dist/pages/send/ShieldedDisclosure.js +12 -0
  260. package/dist/pages/send/StealthInvite.js +27 -0
  261. package/dist/pages/send/addressSend.js +92 -0
  262. package/dist/pages/send/sendCopy.js +10 -0
  263. package/dist/pages/send/sendRetry.js +24 -0
  264. package/dist/pages/send/stealthRecipient.js +65 -0
  265. package/dist/pages/send/stealthSend.js +15 -0
  266. package/dist/pages/send/useAddressSend.js +257 -0
  267. package/dist/pages/send/useSendRecipient.js +61 -0
  268. package/dist/pages/trade/BuyPanel.js +70 -0
  269. package/dist/pages/trade/RampRecovery.js +41 -0
  270. package/dist/pages/trade/RecipientSheet.js +182 -0
  271. package/dist/pages/trade/Selectors.js +152 -0
  272. package/dist/pages/trade/SwapPanel.js +971 -0
  273. package/dist/pages/trade/WidgetTabs.js +109 -0
  274. package/dist/pages/trade/canton.js +122 -0
  275. package/dist/pages/trade/config.js +70 -0
  276. package/dist/pages/trade/embedNarrowing.js +25 -0
  277. package/dist/pages/trade/embedParams.js +532 -0
  278. package/dist/pages/trade/embedTheme.js +9 -0
  279. package/dist/pages/trade/orderMinimum.js +8 -0
  280. package/dist/pages/trade/resumeSwap.js +55 -0
  281. package/dist/pages/trade/settlementCopy.js +32 -0
  282. package/dist/pages/trade/useAmountFit.js +31 -0
  283. package/dist/pages/trade/useEmbedDefaults.js +18 -0
  284. package/dist/pages/trade/useSettlementGating.js +289 -0
  285. package/dist/pages/trade/useSwapAmount.js +191 -0
  286. package/dist/pages/trade/useSwapFlow.js +511 -0
  287. package/dist/pages/trade/useSwapPanel.js +475 -0
  288. package/dist/pages/trade/useSwapRoute.js +634 -0
  289. package/dist/pages/trade/useTronLinkFill.js +34 -0
  290. package/dist/pages/trade/zkMoney.js +46 -0
  291. package/dist/promiseWithResolvers.js +20 -0
  292. package/dist/ramp/availability/RailTiles.js +156 -0
  293. package/dist/ramp/availability/RampDisclosure.js +38 -0
  294. package/dist/ramp/availability/RampRails.js +170 -0
  295. package/dist/ramp/availability/model.js +207 -0
  296. package/dist/ramp/availability/useRampDiscovery.js +83 -0
  297. package/dist/ramp/offramp/CompletedPrerequisite.js +23 -0
  298. package/dist/ramp/offramp/OfframpActivityList.js +16 -0
  299. package/dist/ramp/offramp/OfframpRoute.js +222 -0
  300. package/dist/ramp/offramp/OfframpRouteReview.js +94 -0
  301. package/dist/ramp/offramp/PaymentAppSend.js +765 -0
  302. package/dist/ramp/offramp/localOfframps.js +101 -0
  303. package/dist/ramp/offramp/model.js +154 -0
  304. package/dist/ramp/offramp/port.js +134 -0
  305. package/dist/ramp/offramp/prerequisite.js +143 -0
  306. package/dist/ramp/offramp/useOfframp.js +505 -0
  307. package/dist/ramp/offramp/useOfframpRails.js +73 -0
  308. package/dist/ramp/peer/BuyOnramp.js +292 -0
  309. package/dist/ramp/peer/OnrampSteps.js +148 -0
  310. package/dist/ramp/peer/buyerDriver.js +461 -0
  311. package/dist/ramp/peer/discovery.js +231 -0
  312. package/dist/ramp/peer/environment.js +7 -0
  313. package/dist/ramp/peer/liveProvider.js +87 -0
  314. package/dist/ramp/peer/liveReads.js +488 -0
  315. package/dist/ramp/peer/maker.js +92 -0
  316. package/dist/ramp/peer/normalization.js +184 -0
  317. package/dist/ramp/peer/offramp.js +648 -0
  318. package/dist/ramp/peer/onramp.js +353 -0
  319. package/dist/ramp/peer/preview.js +52 -0
  320. package/dist/ramp/peer/protectedMapping.js +67 -0
  321. package/dist/ramp/peer/runtime.js +55 -0
  322. package/dist/ramp/peer/sdkMaker.js +107 -0
  323. package/dist/ramp/recovery/ResumeOnramp.js +153 -0
  324. package/dist/ramp/recovery/summaries.js +173 -0
  325. package/dist/ramp/route/OnrampRoute.js +255 -0
  326. package/dist/ramp/route/RampRouteSteps.js +148 -0
  327. package/dist/ramp/route/routeActivity.js +12 -0
  328. package/dist/ramp/route/useXochiRampDriver.js +203 -0
  329. package/dist/styles.css +17448 -0
  330. package/dist/styles.js +2 -0
  331. package/dist/types/ConfiguratorApp.d.ts +6 -0
  332. package/dist/types/EmbedApp.d.ts +2 -0
  333. package/dist/types/activity.js +50 -0
  334. package/dist/types/asset.d.ts +2 -0
  335. package/dist/types/assets/chains/index.d.ts +3 -0
  336. package/dist/types/assets/rails/index.d.ts +12 -0
  337. package/dist/types/assets/tokens/index.d.ts +1 -0
  338. package/dist/types/browser.d.ts +1 -0
  339. package/dist/types/components/AccountChip.d.ts +10 -0
  340. package/dist/types/components/ActivityFeed.d.ts +46 -0
  341. package/dist/types/components/AssetsStrip.d.ts +14 -0
  342. package/dist/types/components/AuthorizedAgents.d.ts +15 -0
  343. package/dist/types/components/Chevron.d.ts +16 -0
  344. package/dist/types/components/ErrorDisplay.d.ts +44 -0
  345. package/dist/types/components/InfoButton.d.ts +6 -0
  346. package/dist/types/components/IntentTimeline.d.ts +41 -0
  347. package/dist/types/components/LinksSignIn.d.ts +13 -0
  348. package/dist/types/components/MobileSigningBanner.d.ts +16 -0
  349. package/dist/types/components/PermitBadge.d.ts +17 -0
  350. package/dist/types/components/PrivacyBars.d.ts +12 -0
  351. package/dist/types/components/PrivacyPanel.d.ts +33 -0
  352. package/dist/types/components/QuoteDetails.d.ts +56 -0
  353. package/dist/types/components/RampActivityList.d.ts +14 -0
  354. package/dist/types/components/ReceiptCommand.d.ts +12 -0
  355. package/dist/types/components/SessionReloadBanner.d.ts +8 -0
  356. package/dist/types/components/SolverRace.d.ts +35 -0
  357. package/dist/types/components/StealthClaims.d.ts +51 -0
  358. package/dist/types/components/SwapFlowModal.d.ts +138 -0
  359. package/dist/types/components/Toast.d.ts +10 -0
  360. package/dist/types/components/TokenIcon.d.ts +17 -0
  361. package/dist/types/components/TokenSearchModal.d.ts +28 -0
  362. package/dist/types/components/TransactionPreview.d.ts +34 -0
  363. package/dist/types/components/WalletProvider.d.ts +12 -0
  364. package/dist/types/components/WrapModal.d.ts +19 -0
  365. package/dist/types/components/swap-flow/CantonEscrowPanel.d.ts +14 -0
  366. package/dist/types/components/swap-flow/CantonEscrowStatus.d.ts +30 -0
  367. package/dist/types/components/swap-flow/DepositInstructions.d.ts +75 -0
  368. package/dist/types/components/swap-flow/QrCode.d.ts +18 -0
  369. package/dist/types/components/swap-flow/SwapResult.d.ts +66 -0
  370. package/dist/types/components/swap-flow/depositScreen.d.ts +67 -0
  371. package/dist/types/components/widgetTabsContext.d.ts +21 -0
  372. package/dist/types/config.d.ts +104 -0
  373. package/dist/types/configurator-model.d.ts +9 -0
  374. package/dist/types/configurator.d.ts +3 -0
  375. package/dist/types/constants.d.ts +52 -0
  376. package/dist/types/hooks/applyTheme.d.ts +7 -0
  377. package/dist/types/hooks/useAgentRegistry.d.ts +13 -0
  378. package/dist/types/hooks/useAgentStream.d.ts +15 -0
  379. package/dist/types/hooks/useCantonEscrow.d.ts +40 -0
  380. package/dist/types/hooks/useCapabilities.d.ts +83 -0
  381. package/dist/types/hooks/useEmbedLook.d.ts +4 -0
  382. package/dist/types/hooks/useFocusTrap.d.ts +7 -0
  383. package/dist/types/hooks/useIntent.d.ts +156 -0
  384. package/dist/types/hooks/useIntentStatusPoll.d.ts +107 -0
  385. package/dist/types/hooks/useIntentStream.d.ts +34 -0
  386. package/dist/types/hooks/useLocalActivity.d.ts +22 -0
  387. package/dist/types/hooks/useLocalSends.d.ts +8 -0
  388. package/dist/types/hooks/useLocalStorage.d.ts +8 -0
  389. package/dist/types/hooks/useOrderHistory.d.ts +52 -0
  390. package/dist/types/hooks/usePermit.d.ts +84 -0
  391. package/dist/types/hooks/usePrices.d.ts +72 -0
  392. package/dist/types/hooks/usePublicBalances.d.ts +19 -0
  393. package/dist/types/hooks/useRampSummaries.d.ts +9 -0
  394. package/dist/types/hooks/useRecipientBalance.d.ts +58 -0
  395. package/dist/types/hooks/useSettlements.d.ts +14 -0
  396. package/dist/types/hooks/useStealth.d.ts +72 -0
  397. package/dist/types/hooks/useStealthClaim.d.ts +96 -0
  398. package/dist/types/hooks/useStealthScanner.d.ts +44 -0
  399. package/dist/types/hooks/useTheme.d.ts +29 -0
  400. package/dist/types/hooks/useTierInfo.d.ts +23 -0
  401. package/dist/types/hooks/useTrustScore.d.ts +16 -0
  402. package/dist/types/hooks/useWalletSession.d.ts +21 -0
  403. package/dist/types/hooks/useWrapEth.d.ts +21 -0
  404. package/dist/types/index.d.ts +6 -0
  405. package/dist/types/index.js +8 -0
  406. package/dist/types/integration.d.ts +9 -0
  407. package/dist/types/intent.js +85 -0
  408. package/dist/types/lib/activityValue.d.ts +16 -0
  409. package/dist/types/lib/agentConnect.d.ts +23 -0
  410. package/dist/types/lib/agentRegistry.d.ts +47 -0
  411. package/dist/types/lib/agentStreamVerify.d.ts +29 -0
  412. package/dist/types/lib/api.d.ts +41 -0
  413. package/dist/types/lib/auth.d.ts +6 -0
  414. package/dist/types/lib/authFetch.d.ts +14 -0
  415. package/dist/types/lib/aztecTokens.d.ts +15 -0
  416. package/dist/types/lib/balances.d.ts +88 -0
  417. package/dist/types/lib/capabilities.d.ts +3 -0
  418. package/dist/types/lib/claimSubmitPoll.d.ts +114 -0
  419. package/dist/types/lib/debug.d.ts +13 -0
  420. package/dist/types/lib/declineGuidance.d.ts +55 -0
  421. package/dist/types/lib/displayFallbacks.d.ts +7 -0
  422. package/dist/types/lib/eip712.d.ts +61 -0
  423. package/dist/types/lib/errorCategory.d.ts +48 -0
  424. package/dist/types/lib/errorReport.d.ts +15 -0
  425. package/dist/types/lib/explorerLinks.d.ts +67 -0
  426. package/dist/types/lib/feesLabel.d.ts +20 -0
  427. package/dist/types/lib/glyphs.d.ts +52 -0
  428. package/dist/types/lib/hostBridge.d.ts +11 -0
  429. package/dist/types/lib/hostOrigin.d.ts +30 -0
  430. package/dist/types/lib/intentAPI.d.ts +15 -0
  431. package/dist/types/lib/linksSignIn.d.ts +13 -0
  432. package/dist/types/lib/localActivity.d.ts +135 -0
  433. package/dist/types/lib/localSends.d.ts +55 -0
  434. package/dist/types/lib/mobileWallet.d.ts +27 -0
  435. package/dist/types/lib/pairAvailability.d.ts +106 -0
  436. package/dist/types/lib/paymentSummary.d.ts +18 -0
  437. package/dist/types/lib/permits.d.ts +25 -0
  438. package/dist/types/lib/priceImpact.d.ts +165 -0
  439. package/dist/types/lib/providers.d.ts +14 -0
  440. package/dist/types/lib/qr.d.ts +19 -0
  441. package/dist/types/lib/quoteCost.d.ts +45 -0
  442. package/dist/types/lib/quoteCountdown.d.ts +34 -0
  443. package/dist/types/lib/rampHostGate.d.ts +15 -0
  444. package/dist/types/lib/rampLifecycle.d.ts +20 -0
  445. package/dist/types/lib/receiptCost.d.ts +64 -0
  446. package/dist/types/lib/recipient/index.d.ts +33 -0
  447. package/dist/types/lib/recipient/recent.d.ts +5 -0
  448. package/dist/types/lib/recipientReceipt.d.ts +25 -0
  449. package/dist/types/lib/reportClient.d.ts +9 -0
  450. package/dist/types/lib/sessionExpiry.d.ts +11 -0
  451. package/dist/types/lib/settlementAvailability.d.ts +61 -0
  452. package/dist/types/lib/stealth.d.ts +75 -0
  453. package/dist/types/lib/swapFlowPhase.d.ts +76 -0
  454. package/dist/types/lib/swapStatusCopy.d.ts +57 -0
  455. package/dist/types/lib/tierProgressDisplay.d.ts +35 -0
  456. package/dist/types/lib/tierUnlock.d.ts +25 -0
  457. package/dist/types/lib/tradeLifecycle.d.ts +32 -0
  458. package/dist/types/lib/tronlink.d.ts +62 -0
  459. package/dist/types/lib/walletSession.d.ts +38 -0
  460. package/dist/types/pages/Configurator.d.ts +25 -0
  461. package/dist/types/pages/Trade.d.ts +36 -0
  462. package/dist/types/pages/configurator/AllowedAssetsSection.d.ts +17 -0
  463. package/dist/types/pages/configurator/AppearanceSection.d.ts +22 -0
  464. package/dist/types/pages/configurator/CodeDock.d.ts +19 -0
  465. package/dist/types/pages/configurator/DeveloperSection.d.ts +12 -0
  466. package/dist/types/pages/configurator/IntegrationSection.d.ts +20 -0
  467. package/dist/types/pages/configurator/LayoutSection.d.ts +20 -0
  468. package/dist/types/pages/configurator/PolicyNote.d.ts +6 -0
  469. package/dist/types/pages/configurator/PreviewStage.d.ts +22 -0
  470. package/dist/types/pages/configurator/PrivacySection.d.ts +16 -0
  471. package/dist/types/pages/configurator/RouteSection.d.ts +30 -0
  472. package/dist/types/pages/configurator/Settings.d.ts +25 -0
  473. package/dist/types/pages/configurator/SharedLinkBanner.d.ts +16 -0
  474. package/dist/types/pages/configurator/SurfaceSection.d.ts +5 -0
  475. package/dist/types/pages/configurator/WhatUsersSee.d.ts +30 -0
  476. package/dist/types/pages/configurator/codeShown.d.ts +15 -0
  477. package/dist/types/pages/configurator/configuratorUrl.d.ts +38 -0
  478. package/dist/types/pages/configurator/paramsDraft.d.ts +32 -0
  479. package/dist/types/pages/configurator/previewModel.d.ts +20 -0
  480. package/dist/types/pages/configurator/previewQuote.d.ts +96 -0
  481. package/dist/types/pages/configurator/routePicks.d.ts +75 -0
  482. package/dist/types/pages/configurator/snippets.d.ts +23 -0
  483. package/dist/types/pages/configurator/surfaceParams.d.ts +9 -0
  484. package/dist/types/pages/configurator/useCodeCheck.d.ts +56 -0
  485. package/dist/types/pages/configurator/useConfiguratorUrl.d.ts +21 -0
  486. package/dist/types/pages/configurator/useMediaQuery.d.ts +5 -0
  487. package/dist/types/pages/configurator/useParamsDraft.d.ts +29 -0
  488. package/dist/types/pages/configurator/usePreviewFee.d.ts +74 -0
  489. package/dist/types/pages/send/MetaAddressValue.d.ts +9 -0
  490. package/dist/types/pages/send/Receive.d.ts +3 -0
  491. package/dist/types/pages/send/RecentRecipients.d.ts +3 -0
  492. package/dist/types/pages/send/RecipientChip.d.ts +4 -0
  493. package/dist/types/pages/send/ScanRecipient.d.ts +3 -0
  494. package/dist/types/pages/send/SendForm.d.ts +17 -0
  495. package/dist/types/pages/send/SendPanel.d.ts +19 -0
  496. package/dist/types/pages/send/ShieldedDisclosure.d.ts +1 -0
  497. package/dist/types/pages/send/StealthInvite.d.ts +1 -0
  498. package/dist/types/pages/send/addressSend.d.ts +62 -0
  499. package/dist/types/pages/send/sendCopy.d.ts +9 -0
  500. package/dist/types/pages/send/sendRetry.d.ts +10 -0
  501. package/dist/types/pages/send/stealthRecipient.d.ts +37 -0
  502. package/dist/types/pages/send/stealthSend.d.ts +18 -0
  503. package/dist/types/pages/send/useAddressSend.d.ts +61 -0
  504. package/dist/types/pages/send/useSendRecipient.d.ts +13 -0
  505. package/dist/types/pages/trade/BuyPanel.d.ts +22 -0
  506. package/dist/types/pages/trade/RampRecovery.d.ts +22 -0
  507. package/dist/types/pages/trade/RecipientSheet.d.ts +11 -0
  508. package/dist/types/pages/trade/Selectors.d.ts +24 -0
  509. package/dist/types/pages/trade/SwapPanel.d.ts +34 -0
  510. package/dist/types/pages/trade/WidgetTabs.d.ts +46 -0
  511. package/dist/types/pages/trade/canton.d.ts +94 -0
  512. package/dist/types/pages/trade/config.d.ts +185 -0
  513. package/dist/types/pages/trade/embedNarrowing.d.ts +28 -0
  514. package/dist/types/pages/trade/embedParams.d.ts +299 -0
  515. package/dist/types/pages/trade/embedTheme.d.ts +14 -0
  516. package/dist/types/pages/trade/harness.d.ts +120 -0
  517. package/dist/types/pages/trade/orderMinimum.d.ts +5 -0
  518. package/dist/types/pages/trade/resumeSwap.d.ts +139 -0
  519. package/dist/types/pages/trade/settlementCopy.d.ts +42 -0
  520. package/dist/types/pages/trade/useAmountFit.d.ts +25 -0
  521. package/dist/types/pages/trade/useEmbedDefaults.d.ts +28 -0
  522. package/dist/types/pages/trade/useSettlementGating.d.ts +152 -0
  523. package/dist/types/pages/trade/useSwapAmount.d.ts +93 -0
  524. package/dist/types/pages/trade/useSwapFlow.d.ts +152 -0
  525. package/dist/types/pages/trade/useSwapPanel.d.ts +170 -0
  526. package/dist/types/pages/trade/useSwapRoute.d.ts +215 -0
  527. package/dist/types/pages/trade/useTronLinkFill.d.ts +13 -0
  528. package/dist/types/pages/trade/zkMoney.d.ts +28 -0
  529. package/dist/types/promiseWithResolvers.d.ts +12 -0
  530. package/dist/types/ramp/availability/RailTiles.d.ts +26 -0
  531. package/dist/types/ramp/availability/RampDisclosure.d.ts +9 -0
  532. package/dist/types/ramp/availability/RampRails.d.ts +27 -0
  533. package/dist/types/ramp/availability/model.d.ts +51 -0
  534. package/dist/types/ramp/availability/useRampDiscovery.d.ts +60 -0
  535. package/dist/types/ramp/offramp/CompletedPrerequisite.d.ts +5 -0
  536. package/dist/types/ramp/offramp/OfframpActivityList.d.ts +12 -0
  537. package/dist/types/ramp/offramp/OfframpRoute.d.ts +8 -0
  538. package/dist/types/ramp/offramp/OfframpRouteReview.d.ts +12 -0
  539. package/dist/types/ramp/offramp/PaymentAppSend.d.ts +27 -0
  540. package/dist/types/ramp/offramp/localOfframps.d.ts +58 -0
  541. package/dist/types/ramp/offramp/model.d.ts +46 -0
  542. package/dist/types/ramp/offramp/port.d.ts +55 -0
  543. package/dist/types/ramp/offramp/prerequisite.d.ts +271 -0
  544. package/dist/types/ramp/offramp/useOfframp.d.ts +87 -0
  545. package/dist/types/ramp/offramp/useOfframpRails.d.ts +36 -0
  546. package/dist/types/ramp/peer/BuyOnramp.d.ts +21 -0
  547. package/dist/types/ramp/peer/OnrampSteps.d.ts +32 -0
  548. package/dist/types/ramp/peer/buyerDriver.d.ts +48 -0
  549. package/dist/types/ramp/peer/discovery.d.ts +17 -0
  550. package/dist/types/ramp/peer/environment.d.ts +2 -0
  551. package/dist/types/ramp/peer/index.d.ts +14 -0
  552. package/dist/types/ramp/peer/liveProvider.d.ts +15 -0
  553. package/dist/types/ramp/peer/liveReads.d.ts +102 -0
  554. package/dist/types/ramp/peer/maker.d.ts +4 -0
  555. package/dist/types/ramp/peer/normalization.d.ts +33 -0
  556. package/dist/types/ramp/peer/offramp.d.ts +130 -0
  557. package/dist/types/ramp/peer/onramp.d.ts +134 -0
  558. package/dist/types/ramp/peer/preview.d.ts +14 -0
  559. package/dist/types/ramp/peer/protectedMapping.d.ts +22 -0
  560. package/dist/types/ramp/peer/runtime.d.ts +15 -0
  561. package/dist/types/ramp/peer/sdkMaker.d.ts +67 -0
  562. package/dist/types/ramp/peer/types.d.ts +64 -0
  563. package/dist/types/ramp/recovery/ResumeOnramp.d.ts +37 -0
  564. package/dist/types/ramp/recovery/summaries.d.ts +71 -0
  565. package/dist/types/ramp/route/OnrampRoute.d.ts +12 -0
  566. package/dist/types/ramp/route/RampRouteSteps.d.ts +16 -0
  567. package/dist/types/ramp/route/routeActivity.d.ts +4 -0
  568. package/dist/types/ramp/route/useXochiRampDriver.d.ts +22 -0
  569. package/dist/types/result.js +14 -0
  570. package/dist/types/styles.d.ts +1 -0
  571. package/dist/types/types/activity.d.ts +184 -0
  572. package/dist/types/types/index.d.ts +20 -0
  573. package/dist/types/types/intent.d.ts +85 -0
  574. package/dist/types/types/result.d.ts +53 -0
  575. package/dist/types/utils/format.d.ts +88 -0
  576. package/dist/types/wagmi.d.ts +142 -0
  577. package/dist/types/widgetLibModule.d.ts +8 -0
  578. package/dist/utils/format.js +109 -0
  579. package/dist/wagmi.js +188 -0
  580. package/dist/widgetLibModule.js +4 -0
  581. package/licenses/Monaspace-OFL-1.1.txt +93 -0
  582. package/licenses/assets.json +132 -0
  583. package/licenses/rainbowkit-MIT.txt +9 -0
  584. package/licenses/xochi-shared-MIT.txt +21 -0
  585. package/package.json +115 -4
@@ -0,0 +1,104 @@
1
+ import { type EmbedParams } from "@xochi/widget-lib";
2
+ import { type PinnedEscrows, type PinnedPullRecipients } from "@xochi/client";
3
+ /** Deployment settings only. Trading policy and security checks remain in the public packages. */
4
+ export interface WidgetSettings {
5
+ apiUrl: string;
6
+ /** Non-production Peer deployments require explicit host configuration. */
7
+ peerEnvironment?: "production" | "preproduction" | "staging";
8
+ /**
9
+ * Peer referral code (six alphanumeric characters) attached to payment-app
10
+ * cash-out deposits. Unset by default, and then no code is sent. Enable only
11
+ * after legal sign-off on Peer referral income; never hard-coded.
12
+ */
13
+ peerReferralCode?: string;
14
+ /**
15
+ * Per-operation canary cap: the most Base USDC (canonical atomic units, e.g.
16
+ * "5000000" for 5 USDC) one payment-app cash-out may deposit. Unset means no
17
+ * cap beyond Peer's own live limits.
18
+ */
19
+ offrampCanaryCapAtomic?: string;
20
+ /**
21
+ * The Buy equivalent: the most Base USDC (canonical atomic units) one Peer
22
+ * purchase may receive. Unset means no cap beyond Peer's own live limits.
23
+ */
24
+ onrampCanaryCapAtomic?: string;
25
+ authApiUrl?: string;
26
+ development?: boolean;
27
+ appVersion?: string;
28
+ siteUrl?: string;
29
+ /** Require this exact parent origin for iframe bridge messages when configured. */
30
+ hostOrigin?: string;
31
+ /** Space-separated explicit origins allowed to relay Stealth setup. */
32
+ firstPartyHosts?: string;
33
+ walletConnectProjectId?: string;
34
+ rpcUrls?: Partial<Record<"mainnet" | "arbitrum" | "optimism" | "base" | "polygon" | "robinhood" | "gnosis", string>>;
35
+ arcRpcUrl?: string;
36
+ arcLive?: boolean;
37
+ gnosisLive?: boolean;
38
+ recipientReceiptsLive?: boolean;
39
+ /** Independently provisioned addresses, never populated from API capabilities. */
40
+ solverPin: {
41
+ erc3009Allowlist: readonly string[];
42
+ permit2Allowlist: readonly string[];
43
+ requirePin: boolean;
44
+ };
45
+ depositAttestationSigner: string;
46
+ /**
47
+ * The deploy's `RiddlerEscrow` per origin chain, from a deployment manifest
48
+ * the operator reviewed (Base MainNet: `{ 8453: "0x4438...feCb" }`), never
49
+ * from API capabilities or a quote. Only escrow quotes bind to it, and only
50
+ * while `CANTON_DESTINATION_LIVE` is on; absent, every escrow quote is refused.
51
+ */
52
+ escrows?: PinnedEscrows;
53
+ }
54
+ export declare let PEER_ENVIRONMENT: NonNullable<WidgetSettings["peerEnvironment"]>;
55
+ export declare let PEER_REFERRAL_CODE: string | undefined;
56
+ export declare let OFFRAMP_CANARY_CAP_ATOMIC: string | undefined;
57
+ export declare let ONRAMP_CANARY_CAP_ATOMIC: string | undefined;
58
+ export declare let API_URL: string;
59
+ export declare let AUTH_API_URL: string;
60
+ export declare let isDevelopment: boolean;
61
+ export declare let APP_VERSION: string;
62
+ export declare let FIRST_PARTY_HOST_ORIGINS: readonly string[];
63
+ export declare let HOST_ORIGIN: string | undefined;
64
+ export declare let SITE_URL: string;
65
+ export declare let WALLETCONNECT_PROJECT_ID: string;
66
+ export declare let RPC_URLS: NonNullable<WidgetSettings["rpcUrls"]>;
67
+ export declare let ARC_BROWSER_RPC_URL: string | undefined;
68
+ export declare let ARC_BROWSER_ENABLED: boolean;
69
+ export declare let GNOSIS_ENABLED: boolean;
70
+ export declare let RECIPIENT_RECEIPTS_LIVE: boolean;
71
+ export declare let SOLVER_PIN: {
72
+ erc3009Allowlist: readonly string[];
73
+ permit2Allowlist: readonly string[];
74
+ requirePin: boolean;
75
+ };
76
+ export declare let PULL_RECIPIENTS: PinnedPullRecipients | undefined;
77
+ export declare let DEPOSIT_ATTESTATION_PIN: {
78
+ signer: string;
79
+ };
80
+ export declare let ESCROW_PINS: PinnedEscrows | undefined;
81
+ /** Configure once per document, before rendering either lazy public entry point. */
82
+ export declare function configureWidget(settings: WidgetSettings): void;
83
+ export declare function requireWidgetConfiguration(): void;
84
+ export declare const TIMEOUTS: {
85
+ readonly quoteCacheTtl: 15000;
86
+ readonly requestTimeout: 15000;
87
+ readonly executeTimeout: 120000;
88
+ readonly balanceRefresh: 30000;
89
+ readonly quoteDebounce: 500;
90
+ readonly toastDuration: 4000;
91
+ readonly clipboardFeedback: 2000;
92
+ };
93
+ export declare const RETRY: {
94
+ readonly maxAttempts: 3;
95
+ readonly baseDelay: 1000;
96
+ readonly maxDelay: 10000;
97
+ };
98
+ /** UI defaults and restrictions only; live capabilities remain the execution authority.
99
+ * Read on mount (including after updateParams navigates the existing iframe).
100
+ * Trade amount is intentionally excluded from this ramp/IA config surface.
101
+ */
102
+ export type WidgetEmbedConfig = Pick<EmbedParams, "initialTab" | "tabs" | "initialMode" | "modes" | "sendDestinations" | "fiatCurrency" | "rampProviders">;
103
+ /** Read the shared embed contract, preserving empty lists after legacy entries are dropped. */
104
+ export declare function readWidgetEmbedConfig(search?: string): WidgetEmbedConfig;
@@ -0,0 +1,9 @@
1
+ /** Pure configuration, URL, route-selection and code-generation operations. */
2
+ export * from "./pages/trade/embedParams.js";
3
+ export { EMBED_THEME_APP } from "./pages/trade/embedTheme.js";
4
+ export * from "./pages/configurator/configuratorUrl.js";
5
+ export * from "./pages/configurator/paramsDraft.js";
6
+ export * from "./pages/configurator/previewModel.js";
7
+ export * from "./pages/configurator/routePicks.js";
8
+ export * from "./pages/configurator/snippets.js";
9
+ export * from "./pages/configurator/surfaceParams.js";
@@ -0,0 +1,3 @@
1
+ export { configureWidget, type WidgetSettings } from "./config.js";
2
+ /** The configurator previews /embed in an iframe; it never mounts trading providers. */
3
+ export declare const Configurator: import("react").LazyExoticComponent<typeof import("./ConfiguratorApp.js").default>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Application Constants
3
+ *
4
+ * LocalStorage keys and frontend-specific constants. Chain, trading and
5
+ * validation constants come from `@xochi/client`.
6
+ */
7
+ export declare const PALETTE: {
8
+ readonly obsidian: "#0a0a0c";
9
+ readonly pearlCream: "#e8e4dc";
10
+ readonly mutedGold: "#a89a80";
11
+ readonly mutedGoldBright: "#c4b496";
12
+ readonly mutedGoldDark: "#7a6e5a";
13
+ };
14
+ export declare const STORAGE_KEYS: {
15
+ /** User's verification state (score, attestations, timestamp). Read-only today. */
16
+ readonly verifyState: "xochi_verify_state";
17
+ /** Cached attestations from identity providers */
18
+ readonly attestations: "xochi_attestations";
19
+ /** UI theme preference */
20
+ readonly theme: "xochi_theme";
21
+ /** Stealth key storage prefix */
22
+ readonly stealthPrefix: "xochi:stealth:";
23
+ /** RETIRED: the settlement roadmap modal no longer exists, so nothing writes
24
+ * this anymore. Kept declared so the /cookies clear buttons still remove it
25
+ * from browsers that hold it (clearBucket only touches declared keys). */
26
+ readonly settlementRoadmapSeen: "xochi_settlement_roadmap_seen";
27
+ /** Local-first swap activity log (prefix; per-wallet key appended) */
28
+ readonly localActivityPrefix: "xochi_local_activity:";
29
+ /** Local-first log of public sends from the Send tab (prefix; per-wallet key appended) */
30
+ readonly localSendsPrefix: "xochi_local_sends:";
31
+ /** Sanitized summaries of payment-app cash-outs (prefix; per-wallet). No payee or deposit data. */
32
+ readonly localOfframpsPrefix: "xochi_local_offramps:";
33
+ /** Sanitized Peer onramp summaries; the S4 operation store keeps snapshots under `xochi:ramp/1:` */
34
+ readonly localRamps: "xochi_local_ramps";
35
+ /** Intent ids whose flow modal the user closed, so it never auto-reopens (prefix; per-wallet) */
36
+ readonly resumeDismissedPrefix: "xochi_resume_dismissed:";
37
+ /** Authorized-agent registry + per-agent stream capability (prefix; per-wallet) */
38
+ readonly agentRegistryPrefix: "xochi_agent_registry:";
39
+ /** Mobile "open in your wallet's browser" signing hint dismissed */
40
+ readonly mobileSigningHintDismissed: "xochi_mobile_signing_hint_dismissed";
41
+ /** Passkey-issued JWT (sessionStorage; see src/lib/auth.ts) */
42
+ readonly authToken: "xochi_auth_token";
43
+ /** Sign-In-With-Wallet session (sessionStorage; see src/lib/walletSession.ts) */
44
+ readonly walletSession: "xochi_wallet_session";
45
+ };
46
+ export declare const UI: {
47
+ readonly CONNECT_WALLET: "Connect wallet";
48
+ readonly CONNECT_PROMPT: "Connect wallet first";
49
+ readonly CONNECT_TO_VIEW: "Connect wallet to view";
50
+ };
51
+ /** Virtual chain ID for Aztec/Xochi private layer */
52
+ export declare const AZTEC_CHAIN_ID: 0;
@@ -0,0 +1,7 @@
1
+ import type { AppTheme } from "./useTheme.js";
2
+ /**
3
+ * Put `theme` on <html>, where themes.css reads it: dim is the `:root`
4
+ * default, so it is the attribute's absence. No runtime imports, so the entry
5
+ * script can call it before any chunk loads (main.tsx).
6
+ */
7
+ export declare function applyTheme(theme: AppTheme): void;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * useAgentRegistry Hook
3
+ *
4
+ * Reactive view of the connected wallet's authorized-agent registry
5
+ * (see lib/agentRegistry). Purely client-side; nothing here touches the server.
6
+ */
7
+ import { type AuthorizedAgent, type AuthorizeInput } from "../lib/agentRegistry.js";
8
+ export interface UseAgentRegistryReturn {
9
+ agents: AuthorizedAgent[];
10
+ authorize: (input: AuthorizeInput) => void;
11
+ revoke: (agentWallet: string) => void;
12
+ }
13
+ export declare function useAgentRegistry(): UseAgentRegistryReturn;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * useAgentStream Hook
3
+ *
4
+ * Subscribes to each authorized agent's capability topic and feeds verified
5
+ * agent activity into the local activity log (tagged "agent"), so the user
6
+ * watches their own agents work in real time. Each event is verified
7
+ * client-side against the mandate the user holds before it is trusted; the
8
+ * server never learns the link. See `agent-stream-design.md`.
9
+ *
10
+ * Verified rows are upserted into the same per-wallet local store as the user's
11
+ * own swaps, so rendering, status polling, dedup, and persistence come for free
12
+ * (useLocalActivity picks them up via its subscription).
13
+ */
14
+ import type { AuthorizedAgent } from "../lib/agentRegistry.js";
15
+ export declare function useAgentStream(agents: AuthorizedAgent[]): void;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * useCantonEscrow
3
+ *
4
+ * The Base `RiddlerEscrow` side of a Canton order: reads the lock for the
5
+ * order from the deploy's PINNED escrow (`ESCROW_PINS`, never the status
6
+ * poll's `escrow.address`), and sends the permissionless refund from the
7
+ * connected wallet once it opens.
8
+ *
9
+ * The lock is the authority on `refundableAt` and on claimed / refunded; the
10
+ * status poll's escrow fields carry Riddler's attestation (`cantonUpdateId`).
11
+ * `cantonEscrowView` combines the two; nothing here reads a balance.
12
+ *
13
+ * The lock is re-read while the order is open, because a refund opens hours
14
+ * after the status poll has stopped (`refundableAt = fillDeadline +
15
+ * claimWindow`), and a returning tab must still find it.
16
+ */
17
+ import type { Address, Hex } from "viem";
18
+ import { type EscrowStatusData } from "@xochi/client";
19
+ import { type CantonEscrowView } from "../pages/trade/canton.js";
20
+ export interface UseCantonEscrowParams {
21
+ /** The order's origin chain: the escrow is the pin for it. */
22
+ fromChainId: number;
23
+ /** The order id: the verified quote's, else the status poll's. */
24
+ orderId: string | null;
25
+ /** The latest status poll's escrow fields (`IntentState.escrow`). */
26
+ escrow: EscrowStatusData | null;
27
+ }
28
+ export interface UseCantonEscrowReturn {
29
+ view: CantonEscrowView;
30
+ /** The pinned escrow for the origin chain, or null when none is pinned. */
31
+ escrowAddress: Address | null;
32
+ /** Send `refund(orderId)` from the connected wallet. Only while `view.refundOpen`. */
33
+ refund: () => Promise<void>;
34
+ refunding: boolean;
35
+ refundTxHash: Hex | null;
36
+ refundError: string | null;
37
+ /** The last lock read failed: refund timing is unknown until one succeeds. */
38
+ lockReadFailed: boolean;
39
+ }
40
+ export declare function useCantonEscrow({ fromChainId, orderId, escrow, }: UseCantonEscrowParams): UseCantonEscrowReturn;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * useCapabilities Hook
3
+ *
4
+ * Fetches the solver capability matrix from the worker API
5
+ * (`GET /api/capabilities`, a proxy of Riddler's `/xochi/capabilities`),
6
+ * parses it once with `@xochi/signer`'s `parseCapabilities`, and exposes that
7
+ * model plus the token lists the trade UI reads (see `lib/capabilities`).
8
+ *
9
+ * Degrade policy: a `stale` envelope (Riddler unreachable, the worker's last
10
+ * live matrix) is the solver's matrix and is served as such, though not as
11
+ * live. A `fallback` envelope carries no solver data -- notably no
12
+ * `stealth_chains` -- so it is an error here: react-query keeps the matrix it
13
+ * already holds instead of replacing it, which is what stops a capabilities
14
+ * blip from dropping Base stealth. With nothing held (loading, or every read
15
+ * failed) the hook serves `FALLBACK_CAPABILITIES`, which reproduces the legacy
16
+ * hardcoded lists -- a solver outage looks like the pre-capabilities UI, never
17
+ * a dead selector -- and leaves the stealth chains unknown. `source` and
18
+ * `isLive` tell the caller which world it is in, and `isLoading` / `isError`
19
+ * tell it WHY it is on the fallback: the fallback carries no conversion pairs,
20
+ * so a caller must not read its absences as the solver's verdict while the
21
+ * real list is still on its way or failed to load. `retry` re-fetches on
22
+ * demand, since the scheduled refetch is 5 minutes out.
23
+ *
24
+ * The same response carries Xochi's server-owned trust launch flags
25
+ * (`features`, xochi#656 / xochi#669). They fail closed: every flag is off
26
+ * while loading, on any error, and when the envelope omits them.
27
+ */
28
+ import { type SolverCapabilities } from "@xochi/signer";
29
+ import { type TrustFeatureFlags } from "@xochi/client";
30
+ import type { CapabilityState } from "@xochi/client";
31
+ interface CapabilitiesResponse {
32
+ source: "live" | "stale" | "fallback";
33
+ capabilities: unknown;
34
+ features?: unknown;
35
+ }
36
+ /**
37
+ * Where the matrix the hook serves came from. `live`: the solver now. `stale`:
38
+ * the worker's last live copy while Riddler is unreachable. `fallback`: no
39
+ * solver matrix on hand, so the stealth chains are unknown.
40
+ */
41
+ export type CapabilitiesSource = CapabilitiesResponse["source"];
42
+ /**
43
+ * The served matrix, or null when the trade UI could not render it and should
44
+ * degrade to `FALLBACK_CAPABILITIES`. The signer parses any object, reading a
45
+ * body that says nothing as an empty matrix; a matrix with no token list, or no
46
+ * chain in a VM this widget can trade from, would leave every selector dead.
47
+ * Canton (`cvm`) does not count: it is a destination only.
48
+ */
49
+ export declare function parseWidgetCapabilities(raw: unknown): SolverCapabilities | null;
50
+ export interface UseCapabilitiesReturn {
51
+ /** Parsed capability matrix (fallback while loading / on error). */
52
+ capabilities: SolverCapabilities;
53
+ /** Token symbols the solver can pull on the origin leg. */
54
+ originTokens: readonly string[];
55
+ /** Token symbols the solver can deliver on the destination leg. */
56
+ destinationTokens: readonly string[];
57
+ /** True when the data came from the live solver, false on stale or fallback. */
58
+ isLive: boolean;
59
+ /**
60
+ * `live` or `stale`: a solver matrix is held, so its stealth chains are the
61
+ * solver's. `fallback`: none is (loading, or every read failed), so
62
+ * `capabilities` is the static fallback and the stealth chains are unknown.
63
+ */
64
+ source: CapabilitiesSource;
65
+ /** Whether the current snapshot is live, stale, fallback metadata, or a failed read. */
66
+ state: CapabilityState;
67
+ /** The first fetch (including react-query's retries) is still in flight. */
68
+ isLoading: boolean;
69
+ /**
70
+ * The latest fetch failed, or answered with the worker's fallback. Any data
71
+ * held is from an earlier success, so this alone does not mean the fallback
72
+ * is served; `source` says that.
73
+ */
74
+ isError: boolean;
75
+ /** A fetch is in flight right now: the first load, a retry or a refetch. */
76
+ isFetching: boolean;
77
+ /** Fetch the matrix again now, rather than on the 5-minute schedule. */
78
+ retry: () => void;
79
+ /** Server-owned trust launch flags; all off until the server says otherwise. */
80
+ features: TrustFeatureFlags;
81
+ }
82
+ export declare function useCapabilities(): UseCapabilitiesReturn;
83
+ export {};
@@ -0,0 +1,4 @@
1
+ import { type HostConnection } from "@xochi/widget-lib";
2
+ import { type EmbedLook } from "../pages/trade/embedParams.js";
3
+ /** URL layout stays fixed; only the host's theme can change in a mounted frame. */
4
+ export declare function useEmbedLook(bridge: HostConnection | null): EmbedLook;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Traps focus inside a modal dialog.
3
+ * - Focuses the first focusable element on mount
4
+ * - Wraps Tab/Shift+Tab at boundaries
5
+ * - Restores focus to trigger element on unmount
6
+ */
7
+ export declare function useFocusTrap<T extends HTMLElement>(active?: boolean): import("react").RefObject<T | null>;
@@ -0,0 +1,156 @@
1
+ /**
2
+ * useIntent: the React interpreter for @xochi/client.
3
+ *
4
+ * The quote -> sign -> execute -> status lifecycle is the machine's
5
+ * (`update(model, msg) -> [model, effects]`, `view(model) -> Receipt`). This
6
+ * hook owns none of its decisions. It does three things:
7
+ *
8
+ * 1. Tells the machine what React knows: the panel's trade, the connected
9
+ * wallet, tab visibility, the intent stream. Every message is stamped with
10
+ * `Date.now()` and `document.hidden`, so the machine reads no clock itself.
11
+ * 2. Performs the effects the machine asks for -- intentAPI calls, wagmi
12
+ * signatures, the permit approval, the deposit-attestation proof, timers,
13
+ * log lines -- and feeds each outcome back as a message.
14
+ * 3. Renders: the model's fields in the shape the trade panel has always
15
+ * read, plus `receipt` (`view(model)`).
16
+ */
17
+ import { type EscrowStatusData, type Receipt, type StructuredError, type StoredDepositAttestation } from "@xochi/client";
18
+ import type { IntentStatus, QuoteResponse, ChainId, SelectableChainId, SettlementType, RaceWebSocketMessage, PermitType, OriginApproval } from "../types/intent.js";
19
+ export interface UseIntentParams {
20
+ fromChainId: SelectableChainId;
21
+ toChainId: SelectableChainId;
22
+ fromToken: string;
23
+ toToken: string;
24
+ settlementPreference: SettlementType;
25
+ /** The exact current live route advertises the requested settlement mode. */
26
+ settlementAuthorized: boolean;
27
+ trustScore?: number;
28
+ slippageBps?: number;
29
+ /** Recipient on the destination chain (non-EVM routes); omit for EVM. */
30
+ recipientAddress?: string;
31
+ /**
32
+ * zk.money tag (no `@`, lowercased) in place of a recipient; the Worker
33
+ * resolves it and binds the address into the quote. Omit otherwise.
34
+ */
35
+ recipientTag?: string;
36
+ /**
37
+ * Refund destination on the ORIGIN chain (deposit-route origins only).
38
+ * Omit for EVM origins, which refund to the connected wallet.
39
+ */
40
+ refundAddress?: string;
41
+ /** Stealth meta-address for stealth settlements */
42
+ stealthMetaAddress?: {
43
+ spendingPubKey: string;
44
+ viewingPubKey: string;
45
+ chainId: ChainId;
46
+ };
47
+ /** Pause the pre-expiry quote auto-refresh (e.g. while a confirm modal is open). */
48
+ paused?: boolean;
49
+ /** Independently reviewed legs keep their held quote until expiry; refresh only on a user action. */
50
+ manualQuoteRefresh?: boolean;
51
+ /** Referral and promo codes the host set on the frame (`ref`, `promo`), sent on every quote. */
52
+ ref?: string;
53
+ promo?: string;
54
+ }
55
+ export interface UseIntentReturn {
56
+ status: IntentStatus;
57
+ quote: QuoteResponse | null;
58
+ error: string | StructuredError | null;
59
+ /** Plain-language refund explanation; non-null only on a `refunded` status. */
60
+ refundReason: string | null;
61
+ txHash: string | null;
62
+ receivingTxHash: string | null;
63
+ /** Public fill receipt (Riddler #632) + its chain; drives the receipt CTA + settled state. */
64
+ settlementTxHash: string | null;
65
+ settlementChainId: ChainId | null;
66
+ /** Riddler's granular fill substatus; see IntentState.substatus (xochi#376). */
67
+ substatus: string | null;
68
+ reconciling: boolean;
69
+ intentId: string | null;
70
+ quoteId: string | null;
71
+ /** Wallet account this quote was bound to; owns the local activity log entry. */
72
+ quotedAddress: string | null;
73
+ /**
74
+ * Pay amount (base units) the held quote was requested at. Receipt figures
75
+ * derive from THIS, not the live input field; see IntentState.
76
+ */
77
+ quotedFromAmount: string | null;
78
+ /**
79
+ * The VERIFIED deposit binding (signed fields + signature). Persist THIS with
80
+ * the swap record: a resumed deposit address must be re-proven, not trusted
81
+ * because it came from our own storage. Null on any non-deposit route.
82
+ */
83
+ attestedDeposit: StoredDepositAttestation | null;
84
+ /** The status poll has hit its ceiling and stopped for this intent. */
85
+ pollExhausted: boolean;
86
+ /**
87
+ * The latest status read was the status-only view (`legs_withheld`): its
88
+ * on-chain legs go only to a wallet session for the intent's owner (SPEC §5.1).
89
+ * Null before any status read of this intent: there is no verdict yet.
90
+ */
91
+ legsWithheld: boolean | null;
92
+ /**
93
+ * The latest status poll's escrow fields (`IntentState.escrow`), on an
94
+ * escrow order; null elsewhere. A Canton order's progress is read off these
95
+ * and the lock, never off `status` alone.
96
+ */
97
+ escrow: EscrowStatusData | null;
98
+ /** What the user is told about this trade: `view(model)`. */
99
+ receipt: Receipt;
100
+ isLoading: boolean;
101
+ canSign: boolean;
102
+ canAllocateDepositRoute: boolean;
103
+ feeRate: string;
104
+ tierName: string;
105
+ permitType: PermitType;
106
+ /** Whether the pull needs an approval transaction first, from the on-chain allowance. */
107
+ approval: OriginApproval;
108
+ isApproving: boolean;
109
+ requestQuote: (amount: string) => void;
110
+ /** Allocate the currently priced Tron route. Idempotent across transient retries. */
111
+ allocateDepositRoute: () => Promise<boolean>;
112
+ sign: () => void;
113
+ /**
114
+ * Stop waiting on a wallet prompt and keep the reviewed quote available.
115
+ * True when the sign ceremony ended; false when the intent had already left
116
+ * `signing` (the wallet answered and the execute went out first).
117
+ */
118
+ cancelSign: () => boolean;
119
+ /** Second signing step (deep-link wallets): sign the origin pull, then execute. */
120
+ signPull: () => void;
121
+ reset: () => void;
122
+ /**
123
+ * Adopt an already-dispatched intent the hook has no memory of, so its status
124
+ * poll re-arms and drives it to a terminal state. For restoring a swap a
125
+ * mobile tab lost to eviction during a wallet round-trip (xochi#339); the id,
126
+ * status and owner all come from the persisted local activity record.
127
+ *
128
+ * `owner` is the wallet the record was filed under, and becomes the adopted
129
+ * intent's `quotedAddress`. It is not optional: see `buildResumedState`.
130
+ *
131
+ * `depositDeadline` is the persisted deposit-acceptance window on a deposit
132
+ * route, and is what the status poll sizes its ceiling from. Omit or pass null
133
+ * on a pull route.
134
+ */
135
+ resume: (intentId: string, status: IntentStatus, owner: string, depositDeadline?: number | null) => void;
136
+ /** True while awaiting the user's explicit tap for the pull signature (step 2). */
137
+ awaitingPull: boolean;
138
+ /** True while the pull signature prompt (step 2) is in flight. */
139
+ isSigningPull: boolean;
140
+ quoteExpiresIn: number | null;
141
+ refreshQuote: (forceRefresh?: boolean) => void;
142
+ /**
143
+ * Live race telemetry for the in-flight intent, empty until Riddler emits
144
+ * frames for the route (and always empty when the quote carried no stream
145
+ * topic). DISPLAY ONLY: status truth is unchanged by anything here.
146
+ */
147
+ raceEvents: RaceWebSocketMessage[];
148
+ /**
149
+ * Measured solver fill time in ms (submit -> filled), for the success
150
+ * receipt. Excludes wallet-signing time. Null when it cannot be measured
151
+ * honestly -- a poll-only completion, or no fill yet -- and the receipt then
152
+ * shows nothing rather than a number rounded to the poll interval.
153
+ */
154
+ fillMs: number | null;
155
+ }
156
+ export declare function useIntent(params: UseIntentParams): UseIntentReturn;
@@ -0,0 +1,107 @@
1
+ /**
2
+ * useIntentStatusPoll Hook
3
+ *
4
+ * The ONE in-flight status poll. Owns cadence, the give-up ceiling, the
5
+ * foreground snap-forward and cancellation; the caller owns only what to do
6
+ * with each result.
7
+ *
8
+ * WHY IT EXISTS (DEBT-015). Three hooks used to run their own `setInterval`
9
+ * against the same `GET /api/intent/:id/status`, at the same cadence, kept in
10
+ * sync by a comment ("matches useIntent's STATUS_POLL_MS", "matches the local
11
+ * feed"). They were not feature-equivalent, and the asymmetry was the bug:
12
+ *
13
+ * - `useIntent` had a ceiling, a reconcile escalation and a visibility
14
+ * handler,
15
+ * - `useLocalActivity` had the visibility handler but NO ceiling, so its
16
+ * interval ran as long as any record was non-terminal,
17
+ * - `useOrderHistory` had neither, so it polled forever AND came back from a
18
+ * backgrounded tab stale.
19
+ *
20
+ * The same stuck intent was therefore bounded on one path, unbounded on the
21
+ * second, and unbounded-and-stale on the third -- and on /trade all three mount,
22
+ * so one in-flight swap drew three timers at 4s. `useLocalActivity` already
23
+ * recorded what divergence between these paths costs: "This effect used to carry
24
+ * its own inline copy of that merge, which is how the dropped-receipt bug got
25
+ * written twice."
26
+ *
27
+ * The bounded-poll backstop for the CLAUDE.md "Status-vocabulary sync" rule (an
28
+ * unmapped terminal status stranding an intent non-terminal, xochi#297/#300) now
29
+ * has exactly one client implementation instead of three, only one of which had
30
+ * it.
31
+ */
32
+ /**
33
+ * What one poll may report back.
34
+ *
35
+ * `"stop"` ends the poll immediately (a terminal status), so the consumer never
36
+ * has to reach for its own `clearInterval`. `"progress"` means the poll observed
37
+ * a change and refills the give-up budget: the ceiling then means what it says,
38
+ * ~10 min of no observable change, and a feed whose rows keep advancing is
39
+ * never frozen mid-swap by it. `undefined` means nothing changed, and spends an
40
+ * attempt.
41
+ *
42
+ * `undefined` rather than `void`: a `void` member of a union is meaningless to
43
+ * the type system (it is a return-position-only type) and eslint rejects it.
44
+ * An `async` consumer that simply returns nothing still satisfies this.
45
+ */
46
+ export type StatusPollVerdict = undefined | "progress" | "stop";
47
+ export interface StatusPollContext {
48
+ /**
49
+ * 1-based count of polls performed in the current arming, including a
50
+ * foreground snap-forward. Resets when `key` changes and NOT on `"progress"`
51
+ * -- it is a poll count, not the give-up budget, because useIntent's
52
+ * reconcile escalation counts polls within a phase.
53
+ */
54
+ attempt: number;
55
+ /**
56
+ * Aborted on teardown (unmount, `active` going false, a `key` change) and
57
+ * when the poll stops. MUST be checked after every await before touching
58
+ * state: without it a resolved request writes into an unmounted tree, and a
59
+ * request opened under one wallet applies under the next.
60
+ */
61
+ signal: AbortSignal;
62
+ }
63
+ export interface UseIntentStatusPollOptions {
64
+ /**
65
+ * Poll only while true. Going false tears the timer down; coming back true
66
+ * arms a fresh budget.
67
+ */
68
+ active: boolean;
69
+ /**
70
+ * Identity of the work being polled. A change re-arms: fresh poll counter,
71
+ * fresh ceiling, fresh interval phase. useIntent passes `id:status` (the
72
+ * ceiling and the reconcile escalation are both per-phase); the feeds pass
73
+ * their pending-id set plus a refresh epoch, so a user pressing Refresh
74
+ * re-arms an exhausted poll.
75
+ *
76
+ * It is NOT how progress restores the budget -- that is the `"progress"`
77
+ * verdict. The feeds' key inverted the two: a status merely advancing
78
+ * (executing -> bridging) leaves the same pending-id set, so the key never
79
+ * changed, and both feeds stopped polling for the life of the mount with
80
+ * their rows still rendered as in flight.
81
+ */
82
+ key: string;
83
+ /** Named in the ceiling warning, so a stopped poll is attributable. */
84
+ label: string;
85
+ /** One poll. Return `"stop"` on a terminal status, `"progress"` on a change. */
86
+ onPoll: (ctx: StatusPollContext) => StatusPollVerdict | Promise<StatusPollVerdict>;
87
+ /**
88
+ * Attempts allowed in this arming, read ONCE at arm time.
89
+ *
90
+ * A thunk on purpose: useIntent's ceiling is derived from `Date.now()` and the
91
+ * attested deposit deadline, so a plain number would be a new value on every
92
+ * render and re-arm the interval -- which resets the attempt counter and turns
93
+ * the ceiling it is trying to express back into an unbounded poll. Reading it
94
+ * at arm time is also the whole fact: the deadline is fixed for the life of a
95
+ * phase. Defaults to the flat 10-minute ceiling.
96
+ */
97
+ ceiling?: () => number;
98
+ /** Called once when the ceiling stops the poll, for consumer-visible state. */
99
+ onExhausted?: () => void;
100
+ /**
101
+ * Poll immediately on arming as well as on the interval. Default true. False
102
+ * for a consumer that already refreshes on mount, so arming does not double
103
+ * the request.
104
+ */
105
+ immediate?: boolean;
106
+ }
107
+ export declare function useIntentStatusPoll({ active, key, label, onPoll, ceiling, onExhausted, immediate, }: UseIntentStatusPollOptions): void;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * useIntentStream Hook
3
+ *
4
+ * Subscribes to an intent's stream topic while a swap is in flight and feeds two
5
+ * consumers:
6
+ *
7
+ * 1. lifecycle frames (`type: "status"`, the worker's IntentStatusFrame) ->
8
+ * `onStatus` (useIntent's shared handleStatusUpdate) via mapStatusFrame,
9
+ * so the modal advances through the in-flight steps the moment the worker
10
+ * broadcasts a transition instead of waiting up to STATUS_POLL_MS.
11
+ * 2. race frames (`race_started` / `solver_bid` / `race_won`) -> an
12
+ * accumulated, deduped list for the SolverRace view.
13
+ *
14
+ * KEYED ON THE MINTED TOPIC, NOT THE intentId. The topic is 16 bytes of entropy
15
+ * served once with the quote; the intentId is public by construction (it is in
16
+ * `/api/intent/:id/status` paths, worker logs and Riddler's spans), and the
17
+ * relay replays its recent buffer to every new subscriber. Subscribing by id
18
+ * would therefore have made every in-flight swap readable by anyone who had seen
19
+ * a log line. No topic means no stream, and the poll below carries the swap on
20
+ * its own -- it must never fall back to the id.
21
+ *
22
+ * The stream is an accelerator and never a source of truth. The status poll in
23
+ * useIntent keeps running underneath (D1 + polling is the durable path), so a
24
+ * dead socket costs at most one poll interval of latency, which is why the
25
+ * reconnect attempts are bounded and give up quietly.
26
+ */
27
+ import { type IntentWebSocketMessage, type RaceWebSocketMessage } from "../types/intent.js";
28
+ export interface UseIntentStreamReturn {
29
+ /** Ordered race frames for the current intent (deduped, capped). */
30
+ raceEvents: RaceWebSocketMessage[];
31
+ /** True while a socket is open. Informational: the poll still runs. */
32
+ connected: boolean;
33
+ }
34
+ export declare function useIntentStream(streamTopic: string | null | undefined, active: boolean, onStatus: (msg: IntentWebSocketMessage) => void): UseIntentStreamReturn;