@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,61 @@
1
+ /**
2
+ * EIP-712 Utilities
3
+ *
4
+ * Shared helpers for EIP-712 typed data signing with wagmi/viem.
5
+ */
6
+ import type { Eip712TypedData } from "../types/intent.js";
7
+ /**
8
+ * Filter out EIP712Domain from types object.
9
+ * Wagmi/viem handles the domain type automatically.
10
+ */
11
+ export declare function filterEip712Types(types: Record<string, Array<{
12
+ name: string;
13
+ type: string;
14
+ }>>): Record<string, Array<{
15
+ name: string;
16
+ type: string;
17
+ }>>;
18
+ /**
19
+ * Format the solver-served domain for wagmi's signTypedData.
20
+ *
21
+ * Signs the domain VERBATIM: the Riddler XochiIntent v3 domain is
22
+ * { name, version, chainId, salt } with NO verifyingContract, while legacy Xochi
23
+ * structs and token-pull domains carry verifyingContract and no salt. viem
24
+ * derives the EIP712Domain type from exactly the fields present here, so a field
25
+ * only ever appears when the served domain set it -- reshaping to a fixed field
26
+ * set (dropping salt, injecting verifyingContract) would change the domain
27
+ * separator and strand every signature against the digest Riddler rebuilds.
28
+ *
29
+ * Only chainId may be overridden to the connected wallet's chain; the user must
30
+ * be on the origin chain to sign, so that is a no-op in the correct case.
31
+ */
32
+ export declare function formatDomainForWagmi(domain: Eip712TypedData["domain"], overrideChainId?: number): {
33
+ name: string;
34
+ version?: string;
35
+ chainId: number;
36
+ verifyingContract?: `0x${string}`;
37
+ salt?: `0x${string}`;
38
+ };
39
+ /**
40
+ * Check if an error indicates user rejection of a signature request.
41
+ */
42
+ export declare function isUserRejection(error: unknown): boolean;
43
+ /**
44
+ * Prepare EIP-712 typed data for signing with wagmi.
45
+ * Returns the formatted domain, filtered types, primaryType, and message.
46
+ */
47
+ export declare function prepareTypedDataForSigning(eip712Data: Eip712TypedData, overrideChainId?: number): {
48
+ domain: {
49
+ name: string;
50
+ version?: string;
51
+ chainId: number;
52
+ verifyingContract?: `0x${string}`;
53
+ salt?: `0x${string}`;
54
+ };
55
+ types: Record<string, {
56
+ name: string;
57
+ type: string;
58
+ }[]>;
59
+ primaryType: string;
60
+ message: Record<string, unknown>;
61
+ };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * The frame's words for a failure.
3
+ *
4
+ * Which failure it is, and whether a retry can succeed, is `@xochi/client`'s
5
+ * `classifyFailure`; this module only words each kind and picks its glyph.
6
+ * Callers that report errors keep the original string in their reference
7
+ * payload: the copy is not the cause.
8
+ */
9
+ import { type StructuredError } from "@xochi/client";
10
+ /**
11
+ * Display guidance only. Callers with live capabilities pass
12
+ * `useCapabilities().originTokens`; the default preserves offline widget copy.
13
+ */
14
+ export declare function supportedOriginCopy(originTokens?: readonly string[]): string;
15
+ export interface ErrorInfo {
16
+ message: string;
17
+ suggestion?: string;
18
+ canRetry: boolean;
19
+ retryLabel?: string;
20
+ category: string;
21
+ art?: string;
22
+ }
23
+ /** Title of the below-the-minimum decline. */
24
+ export declare const AMOUNT_TOO_SMALL_TITLE = "Amount too small";
25
+ /**
26
+ * The `may-have-moved` ending's copy, wherever it shows: the order failed after
27
+ * it was sent with no `not_executed` marker, so it never sits beside a Retry.
28
+ */
29
+ export declare const MAY_HAVE_MOVED_NOTICE: {
30
+ readonly title: "Funds may have moved";
31
+ readonly detail: "This order did not complete. Check Activity before trading again.";
32
+ };
33
+ /** Category -> status glyph, from the shared vocabulary (src/lib/glyphs.ts). */
34
+ export declare const ERROR_ART: Record<string, string>;
35
+ /**
36
+ * True when this error is the below-the-minimum decline. Reads the message
37
+ * whatever its HTTP code, as the panel's minimum guidance does.
38
+ */
39
+ export declare function isAmountTooSmall(error: string | StructuredError | null): boolean;
40
+ /**
41
+ * The copy for `error`. `errorCategory` is the declined quote's, passed only
42
+ * when `error` came from that quote.
43
+ */
44
+ export declare function getErrorInfo(error: string | StructuredError, originTokens?: readonly string[], errorCategory?: string): ErrorInfo & {
45
+ retryAfter?: number;
46
+ code?: number;
47
+ reason?: string;
48
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Classify a caught error for @xochi/client, which never sees an Error object
3
+ * (its messages are JSON so a session can be logged and replayed).
4
+ */
5
+ import type { ErrorReport } from "@xochi/client";
6
+ /**
7
+ * An ApiError becomes a StructuredError so the UI can categorize by code or
8
+ * machine category and (on 429/503) run the retry countdown; any other Error
9
+ * degrades to its message; a non-Error throw carries no value, and the machine
10
+ * supplies the fallback copy for the step that failed. `notAccepted` is set only from
11
+ * `ApiError.notAccepted` (`@xochi/client`'s transport: the Worker's
12
+ * not-accepted execute answer), never from anything else: it is the one flag
13
+ * that lets the machine resend an execute (client README "Fund safety").
14
+ */
15
+ export declare function reportError(err: unknown): ErrorReport;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Explorer links for a swap's two legs.
3
+ *
4
+ * A cross-chain swap settles on two chains: the deposit (source) leg sits on
5
+ * `from_chain`, the fill (destination) leg on `to_chain`. Each hash must link to
6
+ * the explorer of the chain it is actually on. `getExplorerTxUrl` builds the URL
7
+ * for a given chain; this helper picks the right chain per leg so the two never
8
+ * cross (the fill hash must not point at the source explorer, and vice versa).
9
+ */
10
+ import type { SelectableChainId } from "../types/intent.js";
11
+ /**
12
+ * Legacy fallback: infer the chain the primary settlement hash (`tx_hash`) lives
13
+ * on, for records that predate Riddler #632's explicit `settlementChainId`.
14
+ *
15
+ * Riddler reported a cross-chain settlement as the DESTINATION fill and put that
16
+ * hash in `tx_hash` (leaving `receiving_tx_hash` null), so by default `tx_hash`
17
+ * is on `toChainId`, not the origin -- linking it to `fromChainId` produced the
18
+ * wrong-chain explorer URL (a Base link for an Ethereum fill). Two cases move it
19
+ * back to the origin: a refund (funds return to where they came from), and the
20
+ * case where Riddler ALSO returns an explicit `receivingTxHash` -- then that fill
21
+ * hash carries the destination and `tx_hash` is the origin deposit. Generic so
22
+ * callers can pass `ChainId` or `SelectableChainId`. Prefer `settlementChainId`
23
+ * (explicit, no inference) whenever it is available.
24
+ */
25
+ export declare function settlementTxChainId<T>(fromChainId: T, toChainId: T, receivingTxHash: string | null | undefined, isRefunded?: boolean): T;
26
+ export interface SwapExplorerLinkInput {
27
+ /**
28
+ * Selectable, not EVM-only. `getExplorerTxUrl` has always accepted a Tron id
29
+ * and the settlement branch below already narrows with `isSelectableChainId`;
30
+ * the leg types were the only thing that could not express a Tron leg, which
31
+ * is what kept Tron swaps out of the activity feed entirely.
32
+ */
33
+ fromChainId: SelectableChainId;
34
+ toChainId: SelectableChainId;
35
+ /** Primary settlement hash. Its chain is resolved by `settlementTxChainId`. */
36
+ txHash: string | null;
37
+ /** Fill/destination leg hash, on `toChainId` (cross-chain only). */
38
+ receivingTxHash?: string | null;
39
+ /**
40
+ * Public destination fill receipt (Riddler #632). When present it is the
41
+ * authoritative destination link on an explicit chain (`settlementChainId`), so
42
+ * no source/dest inference is needed -- this is the common public cross-chain
43
+ * fill the legacy heuristic missed (it required `receivingTxHash`, which Riddler
44
+ * leaves null for public fills).
45
+ */
46
+ settlementTxHash?: string | null;
47
+ /** Explicit chain the settlement receipt lives on (Riddler #632). */
48
+ settlementChainId?: SelectableChainId | null;
49
+ /** True for a refunded order: the settlement tx is on `fromChainId`. */
50
+ isRefunded?: boolean;
51
+ /**
52
+ * A Canton destination's attested update id (`escrow.cantonUpdateId`). Canton
53
+ * has no transaction hash, so its destination link is this update on ccview.
54
+ */
55
+ cantonUpdateId?: string | null;
56
+ }
57
+ export interface SwapExplorerLinks {
58
+ /** Deposit-leg link on the source chain (null when no deposit hash). */
59
+ source: string | null;
60
+ /**
61
+ * Fill-leg link on the destination chain. Present only for a cross-chain swap
62
+ * that has a recorded fill hash; a same-chain swap has no second leg, so this
63
+ * stays null and the caller renders no extra link.
64
+ */
65
+ destination: string | null;
66
+ }
67
+ export declare function swapExplorerLinks(input: SwapExplorerLinkInput): SwapExplorerLinks;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The "Fees (incl. network)" figure, shared by the quote panel drawer, the
3
+ * confirm modal and the configurator's "What users see" panel (through
4
+ * quoteCost), so they can never show different numbers for one quote.
5
+ *
6
+ * Served by the worker and by nothing else (`cost_bps`, read through the
7
+ * receipt decoder `costOf`). The network minimum is inside it, hence "incl.
8
+ * network". Absent means UNKNOWN and says so: a fabricated zero would read as a
9
+ * free trade.
10
+ */
11
+ import type { QuoteResponse } from "../types/intent.js";
12
+ export interface ServedFees {
13
+ /** Served cost in bps, or null when the worker served none. */
14
+ bps: number | null;
15
+ /** Dollar value of the fees, or null when no honest figure exists. */
16
+ usd: number | null;
17
+ /** "~$2.20 (0.22%)", "0.22%" without a dollar figure, or "Unavailable". */
18
+ label: string;
19
+ }
20
+ export declare function servedFees(quote: QuoteResponse, inputTokens: number | null, inputPriceUsd: number | undefined): ServedFees;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Glyph vocabulary -- the single source of truth for UI symbols.
3
+ *
4
+ * Like the color tokens in base.css, every symbol gets ONE semantic name here
5
+ * instead of being typed inline at the call site. All glyphs are terminal-native
6
+ * monochrome Unicode (the same class as the theme toggle's circles), never emoji.
7
+ *
8
+ * Block disclosure toggles are NOT here: they use the <Chevron> SVG component,
9
+ * which rotates on open rather than swapping a character. The one inline
10
+ * exception is GLYPH.more, which trails a line of text that is itself the
11
+ * toggle (the quote's rate line) and is rotated by CSS on open.
12
+ */
13
+ /** Directional / relational glyphs. */
14
+ export declare const GLYPH: {
15
+ /** A relates to / becomes B: "USDC -> WETH", "Swap X -> Y". */
16
+ readonly flow: "→";
17
+ /** Opens elsewhere (new tab, block explorer). */
18
+ readonly external: "↗";
19
+ /** Separates facts on one compact line: "Base -> Robinhood . Public". */
20
+ readonly sep: "·";
21
+ /** The quote reprices on its own: "(refresh) 23s". */
22
+ readonly refresh: "↻";
23
+ /** Trails a line of text that opens more detail (rotated by CSS on open). */
24
+ readonly more: "›";
25
+ };
26
+ /**
27
+ * Graded cost marks. ASCII on purpose: U+26A0 has emoji presentation on some
28
+ * platforms. A mark never travels without a word for screen readers, and the
29
+ * severe one also carries a visible word.
30
+ */
31
+ export declare const SEVERITY_GLYPH: {
32
+ readonly warning: "!";
33
+ readonly severe: "!!";
34
+ };
35
+ /**
36
+ * Row markers for the three pair-availability states (the token sheet's
37
+ * chevron / lock / slash). Redundant non-color cues beside the badge and hint
38
+ * text, aria-hidden everywhere (the state text is already part of the row's
39
+ * accessible name). `[/]` deliberately matches STATUS_GLYPH.forbidden: both
40
+ * mean "blocked, and no user action changes it".
41
+ */
42
+ export declare const PAIR_GLYPH: {
43
+ readonly available: ">";
44
+ readonly locked: "[*]";
45
+ readonly unsupported: "[/]";
46
+ };
47
+ /**
48
+ * Status markers for error/status blocks. The bracket frame is the terminal
49
+ * signature; the inner glyph is the non-color redundant cue (color alone is not
50
+ * an accessible signal). Keyed by error category. Consumed by ERROR_ART.
51
+ */
52
+ export declare const STATUS_GLYPH: Record<string, string>;
@@ -0,0 +1,11 @@
1
+ import { type HostConnection, type HostConnectionOptions } from "@xochi/widget-lib";
2
+ /** One iframe owns one bridge. Importing the public package never starts a handshake. */
3
+ export declare let hostBridge: HostConnection | null;
4
+ export declare function isFirstPartyHost(bridge: HostConnection): boolean;
5
+ export interface HostBridgeLease {
6
+ readonly bridge: HostConnection | null;
7
+ /** Preserved consumers may restart before React receives the replacement lease. */
8
+ readonly active: boolean;
9
+ stop(): void;
10
+ }
11
+ export declare function startHostBridge(options?: HostConnectionOptions, firstPartyHosts?: readonly string[]): HostBridgeLease;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Whether the page framing this one is first party, decided from what the browser
3
+ * reports about the parent, never from anything the parent says: no URL or embed
4
+ * param and no message field is read.
5
+ *
6
+ * The evidence is `MessageEvent.origin` on messages whose `source` is
7
+ * `window.parent`. The browser sets it to the sending document's origin, and it is
8
+ * the value `@xochi/widget-lib`'s `connectToHost` pins as the host origin and names
9
+ * as `targetOrigin` on every bridge message, wallet requests included: a pinned
10
+ * origin is always one recorded here. Where the browser exposes
11
+ * `location.ancestorOrigins` (Chromium, Safari; not Firefox), its parent entry must
12
+ * agree. The host is first party only while every origin the parent has posted
13
+ * from is on the build's list, and it has posted at least once.
14
+ */
15
+ /**
16
+ * The first-party host list from a space-separated build value. An entry that is
17
+ * not an explicit origin is dropped (and logged), so it never widens the list.
18
+ */
19
+ export declare function firstPartyOrigins(value: string): readonly string[];
20
+ export interface HostOriginWatch {
21
+ /** Whether the framing page is first party, as the module header defines it. */
22
+ firstParty(): boolean;
23
+ /** Stop listening. */
24
+ stop(): void;
25
+ }
26
+ /**
27
+ * Record the origin of every message `win.parent` posts to `win`. Start it before
28
+ * the bridge on `win` so no message reaches the bridge unrecorded.
29
+ */
30
+ export declare function watchHostOrigin(win: Window, allowed: readonly string[]): HostOriginWatch;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The widget's Xochi API clients: one authenticated, one anonymous.
3
+ *
4
+ * Transport (quote cache, dedup, retry, Retry-After, single-attempt execute,
5
+ * status decoding) lives in `@xochi/client`; this module only wires it to the
6
+ * widget's config, session tokens, debug logging and session-expiry banner.
7
+ */
8
+ export declare const intentAPI: import("@xochi/client").XochiClient;
9
+ /**
10
+ * The same transport with no credential: it never sends a bearer token, even
11
+ * when a wallet or passkey session is stored. For the configurator's visitor
12
+ * preview ("What users see"), which must price what an anonymous visitor is
13
+ * shown and must not attach the integrator's own session to it.
14
+ */
15
+ export declare const anonymousIntentAPI: import("@xochi/client").XochiClient;
@@ -0,0 +1,13 @@
1
+ export type LinksRecoveryKind = "none" | "sign_in" | "switch_wallet";
2
+ /**
3
+ * The owner recovery a withheld row offers. A read token never makes the legs
4
+ * readable (SPEC §5.1, 0.11.0: before shielded is offered, a read not
5
+ * authenticated as the intent wallet's session gets the status-only view,
6
+ * token or not), so only an owner wallet session lifts `legsWithheld`.
7
+ */
8
+ export declare function linksRecoveryKind(facts: {
9
+ legsWithheld: boolean;
10
+ ownerWallet: string | undefined;
11
+ connectedWallet: string | undefined;
12
+ sessionWallet: string | undefined;
13
+ }): LinksRecoveryKind;
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Local-first swap activity log.
3
+ *
4
+ * Trading is wallet-first: a connected wallet quotes/signs/executes with no
5
+ * passkey, so the Member-gated `GET /api/intent/history` returns nothing for
6
+ * most users and the activity feed reads empty. This persists each submitted
7
+ * swap to localStorage (keyed per wallet) so the feed reflects the user's own
8
+ * trades immediately. Per-intent status is public (`GET /api/intent/:id/status`),
9
+ * so non-terminal records can be refreshed without a Member token
10
+ * (see useLocalActivity). Server history still merges on top when present.
11
+ */
12
+ import type { SwapActivityItem, ActivityStatus } from "../types/activity.js";
13
+ import type { IntentStatus } from "../types/intent.js";
14
+ import { type IntentStatusResult } from "@xochi/client";
15
+ /**
16
+ * Should a local `failed` + no-txHash record be corrected to `status`? True only
17
+ * when the server proves the intent actually progressed past quoting; a
18
+ * pre-execution or failed/expired server status leaves the local record as-is.
19
+ */
20
+ export declare function isHealableServerStatus(status: IntentStatus): boolean;
21
+ /**
22
+ * Is a local record in a pre-dispatch state the worker may have swept? Used to
23
+ * decide whether a definitive 404 should terminalize the record (#271).
24
+ */
25
+ export declare function isSweepablePreDispatch(status: IntentStatus): boolean;
26
+ /** Collapse a granular intent status into the feed's coarse status. */
27
+ export declare function toActivityStatus(status: IntentStatus): ActivityStatus;
28
+ /** Preserve recovery-only facts without attaching them to another trade. */
29
+ export declare function mergeHistorySwap(server: SwapActivityItem, local: SwapActivityItem | undefined): SwapActivityItem;
30
+ type Listener = () => void;
31
+ export declare function subscribeLocalActivity(listener: Listener): () => void;
32
+ /** Read the wallet's local swaps, newest first. */
33
+ export declare function listLocalSwaps(address: string | undefined): SwapActivityItem[];
34
+ /**
35
+ * What a `/status` poll returned for a record, as `useLocalActivity` sees it.
36
+ *
37
+ * Deliberately the API client's own result type rather than a local restatement.
38
+ * The restatement had every field optional, so a new REQUIRED field on
39
+ * `IntentStatusData` was silently dropped here with no type error. Aliasing means
40
+ * the shape can only grow in one place, and every caller (tests included) has to
41
+ * account for the growth.
42
+ */
43
+ export type PolledStatus = IntentStatusResult;
44
+ /** Is this a substatus this build models? See KNOWN_SUBSTATUSES. */
45
+ export declare function isKnownSubstatus(substatus: string): boolean;
46
+ /**
47
+ * Decide what a stored swap record becomes after a `/status` poll, or null to
48
+ * leave it untouched.
49
+ *
50
+ * Extracted from `useLocalActivity.refresh` so it can be tested directly: this
51
+ * is the recovery path for a swap whose tab died mid-flight (#339). On mobile a
52
+ * deep-link to the wallet backgrounds the tab and the OS often evicts it, so the
53
+ * in-memory poll in `useIntent` never resumes and the modal is frozen on
54
+ * whatever phase last rendered -- even though the solver settled. The persisted
55
+ * record is the only thing that survives, and this is what advances it on the
56
+ * next load.
57
+ *
58
+ * It is also the ONLY trust boundary between the status response and persisted
59
+ * client state, so it validates rather than adopts: the id must match, the status
60
+ * move must be legal, the fill substatus must be one this build models, and the
61
+ * settlement chain must be one the app can render. Everything that fails a check
62
+ * is dropped and the record keeps what it had.
63
+ *
64
+ * Three cases, and the distinctions matter more than the merge:
65
+ *
66
+ * - transient failure (null): change nothing and retry on the next tick.
67
+ * - definitive 404: only a swept PRE-DISPATCH quote legitimately vanishes, so
68
+ * terminalize just those as `expired`. A dispatched record that 404s may
69
+ * actually have completed, so it is left alone rather than false-failed.
70
+ * - a real status: adopt it, including a terminal one. This is the case that
71
+ * unfreezes #339.
72
+ */
73
+ export declare function reconcileLocalSwap(record: SwapActivityItem, polled: PolledStatus): SwapActivityItem | null;
74
+ /**
75
+ * Do two wallet addresses refer to the same account? Storage keys are lowercased
76
+ * (see `keyFor`), so ownership comparisons must be too. A missing address on
77
+ * either side is never a match, which keeps every caller fail-closed.
78
+ */
79
+ export declare function isSameWallet(a: string | undefined, b: string | undefined): boolean;
80
+ /**
81
+ * Re-poll every non-terminal record for `owner`, persist what the server says,
82
+ * and return the refreshed list -- or null when the wallet moved on mid-poll.
83
+ *
84
+ * `isCurrentOwner` is the cancellation token and is the reason this is a function
85
+ * rather than a loop inside the hook. A status poll is open for up to
86
+ * `TIMEOUTS.requestTimeout` (15s) while the poll interval is 4s, so a request
87
+ * opened for wallet A routinely resolves after the user has switched to wallet B.
88
+ * Without the token the caller then renders A's rows (token pair, amounts, tx
89
+ * hashes) into B's feed and fires B's completion toast for A's swap -- on a shared
90
+ * device, one user's trades shown to another. So ownership is re-checked after
91
+ * every await: before persisting each record and again before handing back a list.
92
+ */
93
+ export declare function refreshLocalSwaps(owner: string, getStatus: (intentId: string) => Promise<PolledStatus>, isCurrentOwner: () => boolean): Promise<SwapActivityItem[] | null>;
94
+ /**
95
+ * Insert or update a swap record by intent id. A newer status/txHash from a live
96
+ * status poll overwrites the stored copy; the list stays capped and newest-first.
97
+ */
98
+ export declare function upsertLocalSwap(address: string | undefined, item: SwapActivityItem): void;
99
+ export declare function isResumableIntentStatus(status: IntentStatus): boolean;
100
+ /**
101
+ * How long a dispatched-but-unsettled record stays eligible to reopen the flow.
102
+ * Past this it stays in the activity feed (where it still polls) but stops
103
+ * hijacking a fresh visit: a day-old swap is something to look up, not something
104
+ * the user is mid-way through.
105
+ */
106
+ export declare const RESUME_MAX_AGE_MS: number;
107
+ /**
108
+ * Remember that the user closed this swap's flow modal, so it is never
109
+ * auto-reopened again. Closing is an explicit "I am done watching this"; the
110
+ * activity feed keeps advancing the swap and toasts on completion regardless.
111
+ *
112
+ * `status` is the intent's status at the moment of the close, and it is required
113
+ * because a dismissal is only meaningful once the swap has actually been
114
+ * DISPATCHED. The intent id is minted at QUOTE time and reused verbatim by
115
+ * execute, so a dismissal written when the user merely opens the confirm modal
116
+ * and backs out lands on the very id their real swap then runs under: from then
117
+ * on `findResumableSwap` skips it forever and the resume feature never fires for
118
+ * that trade. Gating on `isResumableIntentStatus` makes an ungated (pre-dispatch)
119
+ * dismissal unrepresentable rather than relying on every caller to remember.
120
+ */
121
+ export declare function dismissResumableSwap(address: string | undefined, intentId: string, status: IntentStatus): void;
122
+ /**
123
+ * The swap whose flow modal should be restored on load, if any.
124
+ *
125
+ * On mobile a wallet deep-link backgrounds the tab and the OS may evict it, so
126
+ * the in-memory intent is gone on return and the modal the user was watching
127
+ * never comes back -- it reads as "the app didn't register that I signed", even
128
+ * though the swap settled server-side. The dispatched record is already
129
+ * persisted here, so the view can be rebuilt from it.
130
+ *
131
+ * Newest first, so a user with two in flight resumes the one they most recently
132
+ * started. Returns null rather than throwing on an unusable record.
133
+ */
134
+ export declare function findResumableSwap(address: string | undefined, now?: number): SwapActivityItem | null;
135
+ export {};
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Local-first log of public sends (the Send tab's `address` destination).
3
+ *
4
+ * Follows the swap log's conventions (lib/localActivity.ts): one localStorage
5
+ * entry per wallet, newest first, capped, with a pub/sub so a write from the
6
+ * Send panel updates the Activity tab live. A separate key rather than rows in
7
+ * the swap log: every swap row is an intent the feed polls `/status` for, and a
8
+ * plain transfer has no intent, so mixing them would poll ids that do not exist.
9
+ *
10
+ * What is stored is only what the user already saw on the review screen plus
11
+ * the public transaction hash the wallet returned. localStorage is not a trust
12
+ * boundary, so every row is shape-checked on the way out and a malformed one is
13
+ * dropped rather than rendered.
14
+ */
15
+ export type SendStatus = "pending" | "completed" | "failed";
16
+ export interface SendActivityItem {
17
+ /** The transaction hash: one row per broadcast transaction. */
18
+ id: string;
19
+ type: "send";
20
+ timestamp: number;
21
+ status: SendStatus;
22
+ data: {
23
+ chainId: number;
24
+ /** ERC-20 contract address. */
25
+ token: string;
26
+ symbol: string;
27
+ decimals: number;
28
+ /** Canonical unsigned base-10 atomic units. */
29
+ amount: string;
30
+ recipient: string;
31
+ txHash: string;
32
+ };
33
+ }
34
+ type Listener = () => void;
35
+ export declare function subscribeLocalSends(listener: Listener): () => void;
36
+ /** The row if it has exactly the stored shape, otherwise null. */
37
+ export declare function parseSendRecord(value: unknown): SendActivityItem | null;
38
+ /** The wallet's local sends, newest first. */
39
+ export declare function listLocalSends(address: string | undefined): SendActivityItem[];
40
+ /** Insert a send, or update its status by transaction hash (keeping its time). */
41
+ export declare function upsertLocalSend(address: string | undefined, item: SendActivityItem): boolean;
42
+ /** One unresolved wallet boundary per wallet, separate from confirmed-hash Activity. */
43
+ export interface SendAttempt {
44
+ wallet: string;
45
+ timestamp: number;
46
+ data: Omit<SendActivityItem["data"], "txHash">;
47
+ hash?: string;
48
+ candidateHash?: string;
49
+ }
50
+ export declare function readSendAttempt(wallet: string): SendAttempt | null;
51
+ export declare function saveSendAttempt(attempt: SendAttempt): void;
52
+ export declare function clearSendAttempt(wallet: string): void;
53
+ /** Serialize wallet-boundary and reconciliation writes across same-origin tabs when supported. */
54
+ export declare function withSendAttemptLock(wallet: string, run: () => Promise<void>): Promise<void>;
55
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Mobile wallet helpers.
3
+ *
4
+ * On a mobile browser (Safari/Chrome/DuckDuckGo), connecting MetaMask goes through
5
+ * the WalletConnect relay and deep-links out to the MetaMask app. Privacy browsers
6
+ * (DuckDuckGo, Brave, Safari-with-ITP) partition storage aggressively, which breaks
7
+ * the WC session so a sign request never reaches the wallet ("MetaMask opens but no
8
+ * prompt"). The reliable path is to run inside the wallet's OWN in-app browser,
9
+ * where the provider is injected and signing needs no relay round-trip.
10
+ *
11
+ * These helpers detect that situation.
12
+ */
13
+ /** Best-effort mobile detection from the user agent. */
14
+ export declare function isMobileUserAgent(ua?: string): boolean;
15
+ /**
16
+ * True when the page is already running inside a wallet's in-app browser (an
17
+ * injected EIP-1193 provider is present). In that case signing is reliable and the
18
+ * "open in your wallet" hint must NOT show. On desktop the extension also injects
19
+ * `window.ethereum`, but the hint is mobile-gated, so this stays correct there.
20
+ */
21
+ export declare function isInjectedWalletBrowser(win?: unknown): boolean;
22
+ /**
23
+ * Whether to surface the "open in a wallet browser" hint: a mobile browser that is
24
+ * NOT already an injected wallet browser (so it would otherwise fall back to the
25
+ * fragile WalletConnect relay).
26
+ */
27
+ export declare function shouldOfferInAppBrowser(win?: unknown, ua?: string): boolean;