@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,971 @@
1
+ import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useClaimInXochiApp } from "../../components/widgetTabsContext.js";
3
+ import { useState, useEffect, useRef, useId } from "react";
4
+ import { InfoButton } from "../../components/InfoButton.js";
5
+ import { STATUS_GLYPH } from "../../lib/glyphs.js";
6
+ import { truncateServedReason } from "../../lib/declineGuidance.js";
7
+ import { formatTokenAmount } from "../../utils/format.js";
8
+ import { EXTENDED_CHAIN_NAMES, isTronChainId, MAX_PRICE_IMPACT_PERCENT, QUOTE_BUSY_STATES, ESTIMATED_CROSS_CHAIN_SEC, ESTIMATED_SINGLE_CHAIN_SEC } from "@xochi/client";
9
+ import { joinChainNames } from "./config.js";
10
+ import { STEALTH_PRIVACY_LIMITS, SHIELDED_DESCRIPTION, SHIELDED_DEPOSIT_NOTE, SETTLEMENT_FIX_LINE, MODE_META } from "./settlementCopy.js";
11
+ import { RecipientChip } from "../send/RecipientChip.js";
12
+ import { MetaAddressValue } from "../send/MetaAddressValue.js";
13
+ import { TokenSelector } from "./Selectors.js";
14
+ import { PrivacyBars } from "../../components/PrivacyBars.js";
15
+ import { QuoteDetails } from "../../components/QuoteDetails.js";
16
+ import { ErrorDisplay } from "../../components/ErrorDisplay.js";
17
+ import { WrapModal } from "../../components/WrapModal.js";
18
+ import { SwapFlowModal } from "../../components/SwapFlowModal.js";
19
+ import { useCapabilities } from "../../hooks/useCapabilities.js";
20
+ import { recipientLabel, RecipientSheet } from "./RecipientSheet.js";
21
+ import { useSwapPanel } from "./useSwapPanel.js";
22
+ import { useTronLinkFill } from "./useTronLinkFill.js";
23
+ import { useAmountFit } from "./useAmountFit.js";
24
+ import { ROUTE_LIST_UNAVAILABLE } from "./useSwapRoute.js";
25
+ import { normalizeZkMoneyTag, ZKMONEY_ACCOUNT_URL, zkMoneyRefusal } from "./zkMoney.js";
26
+ import { CANTON_RECIPIENT_HINT, CANTON_READINESS_NOTE, cantonDecline } from "./canton.js";
27
+ function AmountRevealToggle({
28
+ fit,
29
+ controls
30
+ }) {
31
+ if (!fit.truncated && !fit.expanded) return null;
32
+ return /* @__PURE__ */ jsx(
33
+ "button",
34
+ {
35
+ type: "button",
36
+ className: "amount-reveal",
37
+ "aria-expanded": fit.expanded,
38
+ "aria-controls": controls,
39
+ onClick: fit.toggle,
40
+ children: fit.expanded ? "Show less" : "Show all"
41
+ }
42
+ );
43
+ }
44
+ function SwapPanel({
45
+ prefill,
46
+ sendRecipient,
47
+ onStealthSettled,
48
+ onGoToClaims,
49
+ howItWorks = true,
50
+ onConnectRequest
51
+ } = {}) {
52
+ const {
53
+ settlement,
54
+ handleSettlementChange,
55
+ setupStealth,
56
+ stealthSetupLoading,
57
+ stealthSetupError,
58
+ notice,
59
+ stealthClickable,
60
+ stealthFix,
61
+ settlementFix,
62
+ stealthChains,
63
+ stealthRefusalReason,
64
+ intent,
65
+ fromToken,
66
+ toToken,
67
+ fromChainId,
68
+ toChainId,
69
+ amount,
70
+ handleAmountChange,
71
+ handlePreset,
72
+ currentBalance,
73
+ isConnected,
74
+ address,
75
+ openConnectModal,
76
+ showWrapNudge,
77
+ nativeEthDisplay,
78
+ showWrap,
79
+ setShowWrap,
80
+ swapTurns,
81
+ isCrossChain,
82
+ outputAmount,
83
+ payoutField,
84
+ amountBigInt,
85
+ isNonEvmDest,
86
+ swapRecipient,
87
+ swapRecipientIssue,
88
+ recipientRetryFailed,
89
+ recipientRetryPending,
90
+ selectSwapRecipient,
91
+ trustScore,
92
+ recipientAddress,
93
+ setRecipientAddress,
94
+ recipientInvalid,
95
+ recipientCheck,
96
+ sentRecipient,
97
+ cantonDestination,
98
+ zkMoneyDestination,
99
+ zkMoneyOffered,
100
+ zkMoneyBlockedReason,
101
+ handleZkMoneySelect,
102
+ zkMoneyTag,
103
+ isNonEvmOrigin,
104
+ refundAddress,
105
+ setRefundAddress,
106
+ refundError,
107
+ refundInvalid,
108
+ routeCheck,
109
+ routeBlocked,
110
+ thinDestination,
111
+ canSwitchDestination,
112
+ switchToPreferredDestination,
113
+ recipientBalance,
114
+ destinationBalance,
115
+ orderOutOfBounds,
116
+ orderBoundsNotice,
117
+ excessiveSlippage,
118
+ amountGuidance,
119
+ handleIncreaseToMinimum,
120
+ stealthUnavailable,
121
+ stealthRequestRejected,
122
+ insufficientBalance,
123
+ originTokens,
124
+ cta,
125
+ quoteStale,
126
+ needsChainSwitch,
127
+ handleMarketSubmit,
128
+ handleConfirmSwap,
129
+ handleCancelSign,
130
+ handleCloseFlow,
131
+ handleStartOver,
132
+ retryQuote,
133
+ resumedDeposit,
134
+ handleSwapTokens,
135
+ flipBlockedReason,
136
+ handleFromChainChange,
137
+ handleToChainChange,
138
+ handleFromTokenChange,
139
+ handleToTokenChange,
140
+ showExplainer,
141
+ setShowExplainer,
142
+ flowOpen,
143
+ flowReopenable,
144
+ flowDestination,
145
+ flowStealthPayee,
146
+ stealthRecipient,
147
+ clearStealthRecipient,
148
+ executionStartTime,
149
+ policy,
150
+ sourceChainIds,
151
+ destinationChainIds,
152
+ destinationPickerMode,
153
+ stealthDestinationGuidance,
154
+ stealthHintChainIds,
155
+ originTokensByChain,
156
+ destinationTokensByChain,
157
+ classifyOriginToken,
158
+ classifyDestinationToken,
159
+ originChainBlockedReason,
160
+ destinationChainBlockedReason
161
+ } = useSwapPanel(prefill, onStealthSettled, sendRecipient);
162
+ const [recipientSheetOpen, setRecipientSheetOpen] = useState(false);
163
+ useEffect(() => {
164
+ if (recipientRetryFailed) setRecipientSheetOpen(true);
165
+ }, [recipientRetryFailed]);
166
+ const recipientTrigger = useRef(null);
167
+ const { features } = useCapabilities();
168
+ const toLabel = swapRecipient ? swapRecipient.name ?? recipientLabel(swapRecipient.input) : zkMoneyDestination && zkMoneyTag ? `@${zkMoneyTag}` : void 0;
169
+ const stealthChainNames = joinChainNames(
170
+ stealthChains.map((chainId) => EXTENDED_CHAIN_NAMES[chainId])
171
+ );
172
+ const liveStealthChainNames = joinChainNames(
173
+ (stealthDestinationGuidance?.chainIds ?? []).map((chainId) => EXTENDED_CHAIN_NAMES[chainId])
174
+ );
175
+ const stealthDestinationIssue = stealthDestinationGuidance !== null && (stealthDestinationGuidance.status !== "live" || !stealthDestinationGuidance.selectedPairSupported);
176
+ const stealthHintChainNames = joinChainNames(
177
+ stealthHintChainIds.map((chainId) => EXTENDED_CHAIN_NAMES[chainId])
178
+ );
179
+ const connectWallet = onConnectRequest ?? openConnectModal;
180
+ const setupAction = !sendRecipient && !swapRecipientIssue && settlementFix === "setup" && !needsChainSwitch && !flowReopenable && !routeBlocked && !flowOpen;
181
+ const destinationFixExplained = stealthDestinationGuidance !== null && (stealthFix === "destination" || stealthFix === "route_loading" || stealthFix === "route_unavailable");
182
+ const stealthFixLine = destinationFixExplained || stealthFix === "wallet" || stealthFix === null ? null : stealthFix === "destination" ? `Choose ${stealthChainNames}` : SETTLEMENT_FIX_LINE[stealthFix];
183
+ const claimInXochiApp = useClaimInXochiApp();
184
+ const locked = (field) => !!sendRecipient || policy.locks.includes(field);
185
+ const sendMode = sendRecipient?.shieldedAlias ? "Shielded" : "Stealth";
186
+ const sendQuoteMatches = !sendRecipient || fromChainId === prefill?.fromChainId && toChainId === prefill?.toChainId && fromToken.address === prefill?.fromToken && toToken.address === prefill?.toToken && amountBigInt.toString() === prefill?.fromAmount && (sendMode === "Shielded" ? zkMoneyDestination && zkMoneyTag === normalizeZkMoneyTag(sendRecipient.shieldedAlias ?? "") : settlement === "stealth" && !!stealthRecipient && stealthRecipient.encoded === prefill?.stealthRecipient?.encoded);
187
+ const payFit = useAmountFit(amount);
188
+ const lockedPayFit = useAmountFit(amount);
189
+ const sendFit = locked("amount") ? lockedPayFit : payFit;
190
+ const receiveFit = useAmountFit(payoutField);
191
+ const guestStealth = !isConnected && !zkMoneyDestination && settlement === "stealth" && amountBigInt > 0n;
192
+ const originBalanceLabel = currentBalance !== null ? `${formatTokenAmount(currentBalance, fromToken.decimals, 2)} ${fromToken.symbol}` : `-- ${fromToken.symbol}`;
193
+ const recipientFill = useTronLinkFill();
194
+ const refundFill = useTronLinkFill();
195
+ const { receipt } = intent;
196
+ const showReceipt = receipt.quote.kind === "ready";
197
+ const receiptRefreshing = receipt.quote.kind === "ready" && receipt.quote.refreshing;
198
+ const quoteErrorCategory = intent.quote?.errorCategory || (typeof intent.error === "object" ? intent.error?.errorCategory : void 0);
199
+ const cantonRefusal = cantonDestination && intent.error ? cantonDecline(quoteErrorCategory) : null;
200
+ const explainerId = useId();
201
+ const settlementCaptionId = useId();
202
+ const shieldedBlockedId = useId();
203
+ const selectedMode = zkMoneyDestination ? "shielded" : settlement;
204
+ const selectedModeFix = selectedMode === "stealth" && !swapRecipientIssue ? stealthFixLine : null;
205
+ return /* @__PURE__ */ jsxs("div", { className: "trade-card", children: [
206
+ /* @__PURE__ */ jsxs("div", { className: `trade-card__body ${showReceipt ? "trade-card__body--split" : ""}`, children: [
207
+ /* @__PURE__ */ jsxs("div", { className: "trade-card__form", children: [
208
+ sendRecipient ? /* @__PURE__ */ jsxs("section", { className: "stealth-payee-note", "aria-label": `${sendMode} recipient`, children: [
209
+ /* @__PURE__ */ jsx(RecipientChip, { recipient: sendRecipient }),
210
+ /* @__PURE__ */ jsxs("strong", { children: [
211
+ /* @__PURE__ */ jsx(PrivacyBars, { count: sendMode === "Shielded" ? 3 : 2, active: true }),
212
+ " ",
213
+ sendMode
214
+ ] }),
215
+ sendQuoteMatches && /* @__PURE__ */ jsxs("p", { children: [
216
+ "From ",
217
+ EXTENDED_CHAIN_NAMES[fromChainId],
218
+ " to ",
219
+ EXTENDED_CHAIN_NAMES[toChainId]
220
+ ] }),
221
+ /* @__PURE__ */ jsx("p", { children: sendMode === "Stealth" ? STEALTH_PRIVACY_LIMITS : SHIELDED_DESCRIPTION }),
222
+ sendMode === "Shielded" && /* @__PURE__ */ jsx("p", { children: SHIELDED_DEPOSIT_NOTE })
223
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "trade-settlement", children: [
224
+ /* @__PURE__ */ jsxs("div", { className: "trade-header", children: [
225
+ /* @__PURE__ */ jsxs(
226
+ "div",
227
+ {
228
+ className: "order-type-toggle order-type-toggle--privacy",
229
+ role: "group",
230
+ "aria-label": "Settlement privacy",
231
+ "aria-describedby": settlementCaptionId,
232
+ children: [
233
+ /* @__PURE__ */ jsx(
234
+ "button",
235
+ {
236
+ className: `type-btn type-btn--privacy ${!zkMoneyDestination && settlement === "public" ? "active" : ""}`,
237
+ onClick: () => handleSettlementChange("public"),
238
+ "aria-pressed": !zkMoneyDestination && settlement === "public",
239
+ children: /* @__PURE__ */ jsxs("span", { className: "type-btn__head", children: [
240
+ /* @__PURE__ */ jsx(
241
+ PrivacyBars,
242
+ {
243
+ count: 1,
244
+ active: !zkMoneyDestination && settlement === "public"
245
+ }
246
+ ),
247
+ "Public"
248
+ ] })
249
+ }
250
+ ),
251
+ /* @__PURE__ */ jsx(
252
+ "button",
253
+ {
254
+ className: `type-btn type-btn--privacy ${!zkMoneyDestination && settlement === "stealth" ? "active" : ""}`,
255
+ onClick: () => handleSettlementChange("stealth"),
256
+ "aria-pressed": !zkMoneyDestination && settlement === "stealth",
257
+ disabled: !stealthClickable,
258
+ "aria-describedby": stealthHintChainNames ? "stealth-destinations" : void 0,
259
+ title: stealthFix === "route" && stealthRefusalReason ? (
260
+ // The solver's own sentence for the refusal (R16), capped
261
+ // like every surface that renders upstream prose.
262
+ truncateServedReason(stealthRefusalReason)
263
+ ) : stealthFix === "route_unavailable" ? "Stealth route data could not be loaded" : stealthFix === "route_loading" ? "Loading Stealth routes" : void 0,
264
+ children: /* @__PURE__ */ jsxs("span", { className: "type-btn__head", children: [
265
+ /* @__PURE__ */ jsx(
266
+ PrivacyBars,
267
+ {
268
+ count: 2,
269
+ active: !zkMoneyDestination && settlement === "stealth"
270
+ }
271
+ ),
272
+ "Stealth"
273
+ ] })
274
+ }
275
+ ),
276
+ /* @__PURE__ */ jsx(
277
+ "button",
278
+ {
279
+ className: `type-btn type-btn--privacy ${zkMoneyDestination ? "active" : ""}`,
280
+ onClick: handleZkMoneySelect,
281
+ "aria-pressed": zkMoneyDestination,
282
+ disabled: !zkMoneyOffered,
283
+ "aria-describedby": !zkMoneyOffered ? shieldedBlockedId : void 0,
284
+ children: /* @__PURE__ */ jsxs("span", { className: "type-btn__head", children: [
285
+ /* @__PURE__ */ jsx(PrivacyBars, { count: 3, active: zkMoneyDestination }),
286
+ /* @__PURE__ */ jsx("span", { children: "Shielded" })
287
+ ] })
288
+ }
289
+ )
290
+ ]
291
+ }
292
+ ),
293
+ /* @__PURE__ */ jsx("div", { className: "header-actions", children: howItWorks && /* @__PURE__ */ jsx(
294
+ InfoButton,
295
+ {
296
+ label: "How it works",
297
+ expanded: showExplainer,
298
+ controls: explainerId,
299
+ onClick: () => setShowExplainer((open) => !open)
300
+ }
301
+ ) })
302
+ ] }),
303
+ howItWorks && /* @__PURE__ */ jsx("div", { id: explainerId, className: "trade-explainer", hidden: !showExplainer, children: showExplainer && /* @__PURE__ */ jsxs("ul", { className: "trade-explainer__note", children: [
304
+ /* @__PURE__ */ jsx("li", { children: "The order skips the public mempool." }),
305
+ /* @__PURE__ */ jsx("li", { children: "A solver fills it at the quoted price." }),
306
+ !isNonEvmOrigin && !zkMoneyDestination && /* @__PURE__ */ jsx("li", { children: "No deposits, no account. Sign from your own wallet." }),
307
+ /* @__PURE__ */ jsx("li", { children: "Privacy is part of the trading fee, never an extra charge." }),
308
+ /* @__PURE__ */ jsx("li", { children: "The fee pays the solver, Xochi and the app or agent that routed the order." })
309
+ ] }) }),
310
+ /* @__PURE__ */ jsxs(
311
+ "p",
312
+ {
313
+ id: settlementCaptionId,
314
+ className: `type-btn__meta${selectedModeFix ? " type-btn__meta--fix" : ""}`,
315
+ role: "status",
316
+ children: [
317
+ selectedModeFix ?? MODE_META[selectedMode],
318
+ selectedMode === "shielded" && /* @__PURE__ */ jsx("span", { className: "shielded-deposit-note", children: SHIELDED_DEPOSIT_NOTE })
319
+ ]
320
+ }
321
+ ),
322
+ !zkMoneyOffered && /* @__PURE__ */ jsx("span", { id: shieldedBlockedId, className: "sr-only", children: zkMoneyBlockedReason ?? "Unavailable" })
323
+ ] }),
324
+ !sendRecipient && stealthHintChainNames && /* @__PURE__ */ jsxs("div", { id: "stealth-destinations", className: "sr-only", children: [
325
+ "Stealth destinations: ",
326
+ /* @__PURE__ */ jsxs("strong", { children: [
327
+ stealthHintChainNames,
328
+ " only."
329
+ ] })
330
+ ] }),
331
+ zkMoneyDestination && (!sendRecipient || isTronChainId(fromChainId)) && /* @__PURE__ */ jsxs("div", { className: "zkmoney-privacy", children: [
332
+ isTronChainId(fromChainId) && /* @__PURE__ */ jsx("p", { children: "Your TRON send is public." }),
333
+ /* @__PURE__ */ jsxs(
334
+ "a",
335
+ {
336
+ hidden: !!sendRecipient,
337
+ href: ZKMONEY_ACCOUNT_URL,
338
+ target: "_blank",
339
+ rel: "noopener noreferrer",
340
+ children: [
341
+ "Need a zk.money account? Create one ",
342
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "↗" }),
343
+ /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in new tab)" })
344
+ ]
345
+ }
346
+ )
347
+ ] }),
348
+ /* @__PURE__ */ jsx("div", { className: "settlement-caption", "aria-live": "polite", "data-notice": notice ?? void 0, children: !sendRecipient && !zkMoneyDestination && settlement === "stealth" && stealthFix === "setup" && !swapRecipientIssue ? /* @__PURE__ */ jsxs("div", { className: "settlement-caption__notice", children: [
349
+ /* @__PURE__ */ jsx("span", { children: stealthSetupError ?? "Sign once to set up Stealth." }),
350
+ /* @__PURE__ */ jsx("button", { type: "button", onClick: () => handleSettlementChange("public"), children: "Use Public instead" })
351
+ ] }) : notice === "shielded_soon" || settlement === "shielded" ? /* @__PURE__ */ jsx("span", { children: "Shielded is unavailable for this route." }) : null }),
352
+ !sendRecipient && !swapRecipient && stealthRecipient && settlement === "stealth" && /* @__PURE__ */ jsxs("section", { className: "stealth-payee-note", "aria-label": "Stealth recipient", children: [
353
+ /* @__PURE__ */ jsxs("p", { children: [
354
+ /* @__PURE__ */ jsx("strong", { children: "Pays someone else's stealth keys." }),
355
+ " The payout lands at a one-time address only they can find and claim. It will not appear in your Claims."
356
+ ] }),
357
+ /* @__PURE__ */ jsx(MetaAddressValue, { encoded: stealthRecipient.encoded }),
358
+ /* @__PURE__ */ jsx("p", { children: STEALTH_PRIVACY_LIMITS }),
359
+ /* @__PURE__ */ jsx("button", { type: "button", className: "send-secondary", onClick: clearStealthRecipient, children: "Pay my own keys instead" })
360
+ ] }),
361
+ /* @__PURE__ */ jsxs("div", { className: "input-group", children: [
362
+ /* @__PURE__ */ jsxs("div", { className: "input-header", children: [
363
+ /* @__PURE__ */ jsxs("span", { className: "input-header__lead", children: [
364
+ /* @__PURE__ */ jsx("label", { className: "input-label", htmlFor: "swap-pay-amount", children: "Pay" }),
365
+ /* @__PURE__ */ jsx(AmountRevealToggle, { fit: sendFit, controls: "swap-pay-row" })
366
+ ] }),
367
+ isConnected && (locked("amount") ? /* @__PURE__ */ jsxs("span", { className: "balance-display balance-display--static", children: [
368
+ "Balance: ",
369
+ originBalanceLabel
370
+ ] }) : /* @__PURE__ */ jsxs("span", { className: "balance-display balance-display--static balance-display--with-max", children: [
371
+ "Balance: ",
372
+ originBalanceLabel,
373
+ /* @__PURE__ */ jsx(
374
+ "button",
375
+ {
376
+ type: "button",
377
+ className: "balance-max",
378
+ onClick: () => handlePreset(100),
379
+ disabled: currentBalance === null || currentBalance === 0n,
380
+ "aria-label": `Use max balance: ${originBalanceLabel}`,
381
+ children: "Max"
382
+ }
383
+ )
384
+ ] }))
385
+ ] }),
386
+ /* @__PURE__ */ jsxs(
387
+ "div",
388
+ {
389
+ id: "swap-pay-row",
390
+ className: `input-row ${sendFit.expanded ? "input-row--expanded" : ""}`,
391
+ children: [
392
+ locked("amount") ? (
393
+ // Set by the host (`lock=amount`): a value, not a control.
394
+ /* @__PURE__ */ jsx("span", { className: "amount-fit", style: lockedPayFit.style, children: /* @__PURE__ */ jsx(
395
+ "output",
396
+ {
397
+ ref: lockedPayFit.ref,
398
+ id: "swap-pay-amount",
399
+ className: "amount-input amount-input--locked",
400
+ title: lockedPayFit.truncated ? `${amount} ${fromToken.symbol}` : void 0,
401
+ children: amount
402
+ }
403
+ ) })
404
+ ) : /* @__PURE__ */ jsx("span", { className: "amount-fit", style: payFit.style, children: /* @__PURE__ */ jsx(
405
+ "input",
406
+ {
407
+ ref: payFit.ref,
408
+ title: payFit.truncated ? `${amount} ${fromToken.symbol}` : void 0,
409
+ id: "swap-pay-amount",
410
+ type: "text",
411
+ className: "amount-input",
412
+ placeholder: "0",
413
+ value: amount,
414
+ onChange: (e) => handleAmountChange(e.target.value),
415
+ inputMode: "decimal"
416
+ }
417
+ ) }),
418
+ sendRecipient ? /* @__PURE__ */ jsx("span", { className: "token-symbol", children: fromToken.symbol }) : /* @__PURE__ */ jsx(
419
+ TokenSelector,
420
+ {
421
+ chainId: fromChainId,
422
+ value: fromToken,
423
+ onChange: handleFromTokenChange,
424
+ onChainChange: handleFromChainChange,
425
+ showChain: true,
426
+ isSource: true,
427
+ policy,
428
+ chainIds: sourceChainIds,
429
+ tokensByChain: originTokensByChain,
430
+ classify: classifyOriginToken,
431
+ chainBlockedReason: originChainBlockedReason
432
+ }
433
+ )
434
+ ]
435
+ }
436
+ )
437
+ ] }),
438
+ !sendRecipient && showWrapNudge && /* @__PURE__ */ jsxs("div", { className: "wrap-nudge", role: "note", children: [
439
+ /* @__PURE__ */ jsx("span", { className: "wrap-nudge__icon", "aria-hidden": "true", children: "i" }),
440
+ /* @__PURE__ */ jsxs("p", { className: "wrap-nudge__text", children: [
441
+ "Xochi trades WETH, not native ETH. Wrap the ",
442
+ nativeEthDisplay,
443
+ " ETH 1:1 to trade it."
444
+ ] }),
445
+ /* @__PURE__ */ jsx(
446
+ "button",
447
+ {
448
+ type: "button",
449
+ className: "wrap-nudge__action",
450
+ onClick: () => setShowWrap(true),
451
+ children: "Wrap"
452
+ }
453
+ )
454
+ ] }),
455
+ !sendRecipient && /* @__PURE__ */ jsx("div", { className: "swap-divider", children: /* @__PURE__ */ jsx(
456
+ "button",
457
+ {
458
+ className: "swap-btn",
459
+ onClick: handleSwapTokens,
460
+ disabled: flipBlockedReason !== null,
461
+ "aria-label": "Swap direction",
462
+ title: flipBlockedReason ?? "Swap direction",
463
+ children: /* @__PURE__ */ jsxs(
464
+ "svg",
465
+ {
466
+ className: "swap-icon-svg",
467
+ viewBox: "0 0 20 16",
468
+ width: "18",
469
+ height: "15",
470
+ fill: "none",
471
+ stroke: "currentColor",
472
+ strokeWidth: "1.5",
473
+ strokeLinecap: "round",
474
+ strokeLinejoin: "round",
475
+ style: { transform: `rotate(${swapTurns * 180}deg)` },
476
+ "aria-hidden": "true",
477
+ children: [
478
+ /* @__PURE__ */ jsx("path", { d: "M5 6L10 1L15 6" }),
479
+ /* @__PURE__ */ jsx("path", { d: "M5 10L10 15L15 10" })
480
+ ]
481
+ }
482
+ )
483
+ }
484
+ ) }),
485
+ /* @__PURE__ */ jsxs("div", { className: "input-group", children: [
486
+ /* @__PURE__ */ jsxs("div", { className: "input-header", children: [
487
+ /* @__PURE__ */ jsxs("span", { className: "input-header__lead", children: [
488
+ /* @__PURE__ */ jsx("label", { className: "input-label", htmlFor: "swap-receive-amount", children: "Receive" }),
489
+ /* @__PURE__ */ jsx(AmountRevealToggle, { fit: receiveFit, controls: "swap-receive-row" })
490
+ ] }),
491
+ !sendRecipient && (!swapRecipient || isNonEvmDest) && isConnected && !zkMoneyDestination && !cantonDestination && /* @__PURE__ */ jsxs(
492
+ "span",
493
+ {
494
+ className: "balance-display balance-display--static",
495
+ "aria-label": destinationBalance === null ? `${toToken.symbol} balance on ${EXTENDED_CHAIN_NAMES[toChainId]} is unavailable` : `Wallet holds ${formatTokenAmount(destinationBalance, toToken.decimals, 2)} ${toToken.symbol} on ${EXTENDED_CHAIN_NAMES[toChainId]}`,
496
+ children: [
497
+ "Balance:",
498
+ " ",
499
+ destinationBalance === null ? `-- ${toToken.symbol}` : `${formatTokenAmount(destinationBalance, toToken.decimals, 2)} ${toToken.symbol}`
500
+ ]
501
+ }
502
+ )
503
+ ] }),
504
+ !sendRecipient && !isNonEvmDest && /* @__PURE__ */ jsxs(
505
+ "button",
506
+ {
507
+ ref: recipientTrigger,
508
+ className: "swap-recipient-trigger",
509
+ type: "button",
510
+ "aria-haspopup": "dialog",
511
+ "aria-expanded": recipientSheetOpen,
512
+ disabled: flowOpen || flowReopenable,
513
+ onClick: () => setRecipientSheetOpen(true),
514
+ children: [
515
+ /* @__PURE__ */ jsx("span", { children: "To:" }),
516
+ " ",
517
+ /* @__PURE__ */ jsx("span", { children: recipientRetryPending ? "Resolving recipient…" : recipientRetryFailed ? "Choose recipient" : toLabel || (zkMoneyDestination && zkMoneyTag ? `@${zkMoneyTag}` : "Your wallet") })
518
+ ]
519
+ }
520
+ ),
521
+ recipientSheetOpen && /* @__PURE__ */ jsx(
522
+ RecipientSheet,
523
+ {
524
+ selected: swapRecipient,
525
+ mode: selectedMode,
526
+ onSelect: selectSwapRecipient,
527
+ onClose: () => setRecipientSheetOpen(false),
528
+ portalTarget: recipientTrigger.current
529
+ }
530
+ ),
531
+ /* @__PURE__ */ jsxs("div", { className: "settlement-caption", role: "status", children: [
532
+ zkMoneyDestination && /* @__PURE__ */ jsx("div", { children: "Receive changes to DAI on zk.money." }),
533
+ recipientRetryFailed && /* @__PURE__ */ jsx("div", { children: "Choose the recipient again." }),
534
+ swapRecipientIssue ?? (zkMoneyDestination && !sendRecipient && !zkMoneyTag ? "Choose a zk.money alias." : null),
535
+ swapRecipientIssue && selectedMode === "stealth" && swapRecipient?.address && /* @__PURE__ */ jsx("div", { className: "settlement-caption__notice", children: /* @__PURE__ */ jsx(
536
+ "button",
537
+ {
538
+ type: "button",
539
+ onClick: () => selectSwapRecipient(swapRecipient, "public"),
540
+ children: "Use Public instead"
541
+ }
542
+ ) })
543
+ ] }),
544
+ stealthDestinationGuidance && (!sendRecipient || stealthDestinationIssue) && /* @__PURE__ */ jsx("div", { id: "stealth-destination-guidance", className: "settlement-caption", role: "status", children: stealthDestinationGuidance.status === "checking" ? "Checking Stealth routes…" : stealthDestinationGuidance.status === "unavailable" ? /* @__PURE__ */ jsxs(Fragment, { children: [
545
+ "Stealth routes couldn't be verified.",
546
+ routeCheck.status === "unknown" && /* @__PURE__ */ jsx("div", { className: "settlement-caption__notice", children: /* @__PURE__ */ jsx(
547
+ "button",
548
+ {
549
+ type: "button",
550
+ onClick: routeCheck.retry,
551
+ disabled: routeCheck.retrying,
552
+ children: routeCheck.retrying ? "Retrying..." : "Retry"
553
+ }
554
+ ) })
555
+ ] }) : stealthDestinationGuidance.chainIds.length === 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
556
+ "No live Stealth destinations are available for ",
557
+ fromToken.symbol,
558
+ " on",
559
+ " ",
560
+ EXTENDED_CHAIN_NAMES[fromChainId],
561
+ " within this widget's settings."
562
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
563
+ !stealthDestinationGuidance.selectedPairSupported && /* @__PURE__ */ jsxs(Fragment, { children: [
564
+ fromToken.symbol,
565
+ " on ",
566
+ EXTENDED_CHAIN_NAMES[fromChainId],
567
+ " to",
568
+ " ",
569
+ toToken.symbol,
570
+ " on ",
571
+ EXTENDED_CHAIN_NAMES[toChainId],
572
+ " isn't a live Stealth pair.",
573
+ " "
574
+ ] }),
575
+ !sendRecipient && !stealthDestinationGuidance.selectedPairSupported && /* @__PURE__ */ jsxs(Fragment, { children: [
576
+ "Choose ",
577
+ liveStealthChainNames,
578
+ "."
579
+ ] })
580
+ ] }) }),
581
+ /* @__PURE__ */ jsxs(
582
+ "div",
583
+ {
584
+ id: "swap-receive-row",
585
+ className: `input-row ${intent.status === "quoting" ? "quoting" : ""} ${receiveFit.expanded ? "input-row--expanded" : ""}`,
586
+ children: [
587
+ /* @__PURE__ */ jsx("span", { className: "amount-fit", style: receiveFit.style, children: /* @__PURE__ */ jsx(
588
+ "input",
589
+ {
590
+ ref: receiveFit.ref,
591
+ id: "swap-receive-amount",
592
+ type: "text",
593
+ className: "amount-input output",
594
+ placeholder: guestStealth ? "" : "0",
595
+ value: guestStealth ? "" : payoutField,
596
+ "aria-describedby": stealthDestinationGuidance ? "stealth-destination-guidance" : void 0,
597
+ readOnly: true,
598
+ tabIndex: -1,
599
+ onClick: receiveFit.truncated || receiveFit.expanded ? receiveFit.toggle : void 0,
600
+ title: receiveFit.truncated ? `${outputAmount} ${toToken.symbol}` : void 0,
601
+ "aria-label": receiveFit.truncated ? `Amount to receive: ${outputAmount} ${toToken.symbol}` : "Amount to receive"
602
+ }
603
+ ) }),
604
+ sendRecipient ? /* @__PURE__ */ jsx("span", { className: "token-symbol", children: toToken.symbol }) : /* @__PURE__ */ jsx(
605
+ TokenSelector,
606
+ {
607
+ chainId: toChainId,
608
+ value: toToken,
609
+ onChange: handleToTokenChange,
610
+ onChainChange: handleToChainChange,
611
+ showChain: true,
612
+ isSource: false,
613
+ policy,
614
+ chainIds: destinationChainIds,
615
+ tokensByChain: destinationTokensByChain,
616
+ classify: classifyDestinationToken,
617
+ chainBlockedReason: destinationChainBlockedReason,
618
+ liveStealthDestination: destinationPickerMode === "stealth",
619
+ zkMoney: zkMoneyOffered ? { selected: zkMoneyDestination, onSelect: handleZkMoneySelect } : void 0
620
+ }
621
+ )
622
+ ]
623
+ }
624
+ ),
625
+ isNonEvmOrigin && /* @__PURE__ */ jsxs("div", { className: "recipient-field", children: [
626
+ /* @__PURE__ */ jsxs("div", { className: "recipient-field__head", children: [
627
+ /* @__PURE__ */ jsxs("label", { className: "recipient-field__label", htmlFor: "swap-refund", children: [
628
+ EXTENDED_CHAIN_NAMES[fromChainId],
629
+ " refund address (optional)"
630
+ ] }),
631
+ isTronChainId(fromChainId) && /* @__PURE__ */ jsx(
632
+ "button",
633
+ {
634
+ type: "button",
635
+ className: "recipient-field__pick",
636
+ onClick: () => void refundFill.fill(setRefundAddress),
637
+ disabled: refundFill.busy,
638
+ children: refundFill.busy ? "Asking..." : "Use TronLink"
639
+ }
640
+ )
641
+ ] }),
642
+ /* @__PURE__ */ jsx(
643
+ "input",
644
+ {
645
+ id: "swap-refund",
646
+ type: "text",
647
+ className: `recipient-field__input ${refundInvalid ? "recipient-field__input--invalid" : ""}`,
648
+ placeholder: isTronChainId(fromChainId) ? "T..." : "Refund address",
649
+ value: refundAddress,
650
+ onChange: (e) => {
651
+ setRefundAddress(e.target.value);
652
+ refundFill.clearNote();
653
+ },
654
+ autoComplete: "off",
655
+ autoCorrect: "off",
656
+ spellCheck: false,
657
+ "aria-invalid": refundInvalid
658
+ }
659
+ ),
660
+ refundInvalid && refundError ? /* @__PURE__ */ jsx("span", { className: "recipient-field__error", children: refundError }) : refundFill.note ? /* @__PURE__ */ jsx(
661
+ "span",
662
+ {
663
+ className: refundFill.note.tone === "error" ? "recipient-field__error" : "recipient-field__hint",
664
+ children: refundFill.note.text
665
+ }
666
+ ) : /* @__PURE__ */ jsx("span", { className: "recipient-field__hint", children: "If the swap cannot go through, we send it back here. Use a self-custody wallet, not an exchange. Leave blank to send it back to the sending address." })
667
+ ] }),
668
+ thinDestination && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
669
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
670
+ /* @__PURE__ */ jsxs("div", { className: "error-text", children: [
671
+ /* @__PURE__ */ jsx("span", { className: "error-title", children: thinDestination.headline }),
672
+ /* @__PURE__ */ jsx("span", { className: "error-suggestion", children: thinDestination.detail }),
673
+ !sendRecipient && canSwitchDestination && /* @__PURE__ */ jsx(
674
+ "button",
675
+ {
676
+ type: "button",
677
+ className: "btn btn--ghost btn--sm settlement-fallback-btn",
678
+ onClick: switchToPreferredDestination,
679
+ children: thinDestination.action
680
+ }
681
+ )
682
+ ] })
683
+ ] }) }),
684
+ /* @__PURE__ */ jsx("div", { className: "type-btn__meta", role: "status", children: guestStealth && "Connect a wallet to price Stealth" }),
685
+ isNonEvmDest && /* @__PURE__ */ jsxs("div", { className: "recipient-field", children: [
686
+ /* @__PURE__ */ jsxs("div", { className: "recipient-field__head", children: [
687
+ /* @__PURE__ */ jsxs("label", { className: "recipient-field__label", htmlFor: "swap-recipient", children: [
688
+ EXTENDED_CHAIN_NAMES[toChainId],
689
+ " recipient",
690
+ " ",
691
+ cantonDestination ? "party" : "address"
692
+ ] }),
693
+ isTronChainId(toChainId) && /* @__PURE__ */ jsx(
694
+ "button",
695
+ {
696
+ type: "button",
697
+ className: "recipient-field__pick",
698
+ onClick: () => void recipientFill.fill(setRecipientAddress),
699
+ disabled: recipientFill.busy,
700
+ children: recipientFill.busy ? "Asking..." : "Use TronLink"
701
+ }
702
+ )
703
+ ] }),
704
+ /* @__PURE__ */ jsx(
705
+ "input",
706
+ {
707
+ id: "swap-recipient",
708
+ type: "text",
709
+ className: `recipient-field__input ${recipientInvalid && sentRecipient.length > 0 ? "recipient-field__input--invalid" : ""}`,
710
+ placeholder: isTronChainId(toChainId) ? "T..." : cantonDestination ? "name::1220... (public only)" : "Recipient address",
711
+ value: recipientAddress,
712
+ onChange: (e) => {
713
+ setRecipientAddress(e.target.value);
714
+ recipientFill.clearNote();
715
+ },
716
+ autoComplete: "off",
717
+ autoCorrect: "off",
718
+ autoCapitalize: "none",
719
+ spellCheck: false,
720
+ "aria-invalid": recipientInvalid && sentRecipient.length > 0,
721
+ "aria-describedby": cantonDestination ? "swap-recipient-readiness" : void 0
722
+ }
723
+ ),
724
+ recipientInvalid && sentRecipient.length > 0 && recipientCheck.error ? /* @__PURE__ */ jsx("span", { className: "recipient-field__error", children: recipientCheck.error }) : recipientFill.note ? /* @__PURE__ */ jsx(
725
+ "span",
726
+ {
727
+ className: recipientFill.note.tone === "error" ? "recipient-field__error" : "recipient-field__hint",
728
+ children: recipientFill.note.text
729
+ }
730
+ ) : cantonDestination ? /* @__PURE__ */ jsx("span", { className: "recipient-field__hint", children: CANTON_RECIPIENT_HINT }) : recipientBalance.available ? (
731
+ // Confirmation that the address is real and in use. A zero is
732
+ // normal (fresh address, first payment), so it is stated
733
+ // plainly and never styled as a problem.
734
+ /* @__PURE__ */ jsxs("span", { className: "recipient-field__hint", children: [
735
+ "This address holds",
736
+ " ",
737
+ formatTokenAmount(recipientBalance.balance ?? 0n, toToken.decimals, 2),
738
+ " ",
739
+ toToken.symbol,
740
+ "."
741
+ ] })
742
+ ) : /* @__PURE__ */ jsxs("span", { className: "recipient-field__hint", children: [
743
+ "Where should we send the ",
744
+ toToken.symbol,
745
+ "? Paste the",
746
+ " ",
747
+ EXTENDED_CHAIN_NAMES[toChainId],
748
+ " address."
749
+ ] }),
750
+ cantonDestination && /* @__PURE__ */ jsx("span", { id: "swap-recipient-readiness", className: "recipient-field__hint", children: CANTON_READINESS_NOTE })
751
+ ] })
752
+ ] })
753
+ ] }),
754
+ sendQuoteMatches && intent.quote && showReceipt && /* @__PURE__ */ jsx(
755
+ "div",
756
+ {
757
+ className: `trade-card__receipt ${receiptRefreshing ? "trade-card__receipt--refreshing" : ""}`,
758
+ "aria-busy": receiptRefreshing,
759
+ children: /* @__PURE__ */ jsx(
760
+ QuoteDetails,
761
+ {
762
+ quote: intent.quote,
763
+ fromAmount: intent.quotedFromAmount ?? amountBigInt.toString(),
764
+ fromSymbol: fromToken.symbol,
765
+ fromDecimals: fromToken.decimals,
766
+ toSymbol: toToken.symbol,
767
+ toDecimals: toToken.decimals,
768
+ fromChainId,
769
+ toChainId,
770
+ permitType: intent.permitType,
771
+ approval: intent.approval,
772
+ settlement,
773
+ trustScore,
774
+ trustEconomicsLive: features.trustEconomicsLive,
775
+ quoteExpiresIn: intent.quoteExpiresIn,
776
+ recipientTag: intent.quote?.recipientTag,
777
+ swapRecipientLabel: flowDestination.swapRecipientLabel,
778
+ sendRecipientLabel: flowDestination.sendRecipientDisplay?.label,
779
+ sendMode: sendRecipient ? sendMode : void 0
780
+ }
781
+ )
782
+ }
783
+ ),
784
+ /* @__PURE__ */ jsxs("div", { className: "trade-card__actions", children: [
785
+ !stealthDestinationIssue && routeCheck.status === "checking" && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
786
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
787
+ /* @__PURE__ */ jsx("div", { className: "error-text", children: /* @__PURE__ */ jsx("span", { className: "error-title", children: "Loading routes" }) })
788
+ ] }) }),
789
+ !stealthDestinationIssue && routeCheck.status === "unsupported" && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
790
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
791
+ /* @__PURE__ */ jsxs("div", { className: "error-text", children: [
792
+ /* @__PURE__ */ jsx("span", { className: "error-title", children: "Route not supported" }),
793
+ /* @__PURE__ */ jsx("span", { className: "error-suggestion", children: routeCheck.notice })
794
+ ] })
795
+ ] }) }),
796
+ !stealthDestinationIssue && routeCheck.status === "unknown" && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
797
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
798
+ /* @__PURE__ */ jsxs("div", { className: "error-text", children: [
799
+ /* @__PURE__ */ jsx("span", { className: "error-title", children: "Route list unavailable" }),
800
+ /* @__PURE__ */ jsx("span", { className: "error-suggestion", children: ROUTE_LIST_UNAVAILABLE }),
801
+ /* @__PURE__ */ jsx(
802
+ "button",
803
+ {
804
+ type: "button",
805
+ className: "btn btn--ghost btn--sm settlement-fallback-btn",
806
+ onClick: routeCheck.retry,
807
+ disabled: routeCheck.retrying,
808
+ children: routeCheck.retrying ? "Retrying..." : "Retry"
809
+ }
810
+ )
811
+ ] })
812
+ ] }) }),
813
+ !routeBlocked && orderOutOfBounds && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
814
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
815
+ /* @__PURE__ */ jsxs("div", { className: "error-text", children: [
816
+ /* @__PURE__ */ jsx("span", { className: "error-title", children: "Amount out of range" }),
817
+ /* @__PURE__ */ jsx("span", { className: "error-suggestion", children: orderBoundsNotice })
818
+ ] })
819
+ ] }) }),
820
+ !routeBlocked && !orderOutOfBounds && excessiveSlippage && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
821
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
822
+ /* @__PURE__ */ jsxs("div", { className: "error-text", children: [
823
+ /* @__PURE__ */ jsx("span", { className: "error-title", children: "Amount too small to be worth it" }),
824
+ /* @__PURE__ */ jsxs("span", { className: "error-suggestion", children: [
825
+ "Over ",
826
+ MAX_PRICE_IMPACT_PERCENT,
827
+ "% of this trade would go to fees and network costs. Increase the amount so more is received."
828
+ ] })
829
+ ] })
830
+ ] }) }),
831
+ !routeBlocked && !orderOutOfBounds && !excessiveSlippage && !flowOpen && !stealthDestinationIssue && stealthUnavailable && /* @__PURE__ */ jsx("div", { className: "error-display error-display--liquidity", role: "status", children: /* @__PURE__ */ jsxs("div", { className: "error-content", children: [
832
+ /* @__PURE__ */ jsx("span", { className: "error-icon", children: STATUS_GLYPH.liquidity }),
833
+ /* @__PURE__ */ jsxs("div", { className: "error-text", children: [
834
+ /* @__PURE__ */ jsx("span", { className: "error-title", children: "Stealth isn't available for this route" }),
835
+ /* @__PURE__ */ jsx("span", { className: "error-suggestion", children: sendRecipient ? "Go back to Send to change the route." : stealthRefusalReason ? truncateServedReason(stealthRefusalReason) : "Try the Public route." }),
836
+ !sendRecipient && /* @__PURE__ */ jsx(
837
+ "button",
838
+ {
839
+ type: "button",
840
+ className: "btn btn--ghost btn--sm settlement-fallback-btn",
841
+ onClick: () => handleSettlementChange("public"),
842
+ children: "Use Public instead"
843
+ }
844
+ )
845
+ ] })
846
+ ] }) }),
847
+ !routeBlocked && !orderOutOfBounds && !excessiveSlippage && !flowOpen && !stealthUnavailable && intent.error && amountGuidance && /* @__PURE__ */ jsxs("div", { className: "decline-guidance", role: "status", children: [
848
+ /* @__PURE__ */ jsx("span", { className: "decline-guidance__title", children: "This route needs a larger amount" }),
849
+ /* @__PURE__ */ jsx("p", { className: "decline-guidance__body", children: truncateServedReason(
850
+ typeof intent.error === "string" ? intent.error : intent.error.message
851
+ ) }),
852
+ locked("amount") ? /* @__PURE__ */ jsx("p", { className: "decline-guidance__hint", children: "The site embedding this widget sets the amount." }) : amountGuidance.prefillAmount !== null && amountGuidance.minimumUsd !== null ? /* @__PURE__ */ jsxs(
853
+ "button",
854
+ {
855
+ type: "button",
856
+ className: "btn btn--primary btn--sm decline-guidance__cta",
857
+ onClick: handleIncreaseToMinimum,
858
+ children: [
859
+ "Increase to at least $",
860
+ amountGuidance.minimumUsd.toFixed(2)
861
+ ]
862
+ }
863
+ ) : /* @__PURE__ */ jsx("p", { className: "decline-guidance__hint", children: "Increase the amount and re-quote." }),
864
+ amountGuidance.fineprintUsd !== null && /* @__PURE__ */ jsxs("p", { className: "decline-guidance__fineprint", children: [
865
+ "Route minimums move with network costs; the live floor is about $",
866
+ amountGuidance.fineprintUsd.toFixed(2),
867
+ "."
868
+ ] })
869
+ ] }),
870
+ !flowOpen && !QUOTE_BUSY_STATES.includes(intent.status) && cantonRefusal && /* @__PURE__ */ jsxs("div", { className: "decline-guidance", role: "status", children: [
871
+ /* @__PURE__ */ jsx("span", { className: "decline-guidance__title", children: cantonRefusal.title }),
872
+ /* @__PURE__ */ jsx("p", { className: "decline-guidance__body", children: cantonRefusal.detail }),
873
+ cantonRefusal.requote && /* @__PURE__ */ jsx(
874
+ "button",
875
+ {
876
+ type: "button",
877
+ className: "btn btn--primary btn--sm decline-guidance__cta",
878
+ onClick: retryQuote,
879
+ disabled: intent.status === "quoting",
880
+ children: "Get a new quote"
881
+ }
882
+ )
883
+ ] }),
884
+ sendQuoteMatches && !routeBlocked && !orderOutOfBounds && !excessiveSlippage && !flowOpen && !QUOTE_BUSY_STATES.includes(intent.status) && !stealthUnavailable && !amountGuidance && !cantonRefusal && intent.error && /* @__PURE__ */ jsx(
885
+ ErrorDisplay,
886
+ {
887
+ error: zkMoneyDestination && zkMoneyRefusal(quoteErrorCategory, zkMoneyTag) || intent.error,
888
+ onRetry: retryQuote,
889
+ isRetrying: intent.status === "quoting",
890
+ originTokens,
891
+ errorCategory: quoteErrorCategory,
892
+ mayHaveMoved: intent.receipt.phase === "may-have-moved"
893
+ }
894
+ ),
895
+ !sendRecipient && !routeBlocked && !orderOutOfBounds && !excessiveSlippage && !flowOpen && stealthRequestRejected && /* @__PURE__ */ jsxs("div", { className: "settlement-fallback", role: "status", children: [
896
+ /* @__PURE__ */ jsx("span", { className: "settlement-fallback-note", children: "Try the Public route." }),
897
+ /* @__PURE__ */ jsx(
898
+ "button",
899
+ {
900
+ type: "button",
901
+ className: "btn btn--ghost btn--sm settlement-fallback-btn",
902
+ onClick: () => handleSettlementChange("public"),
903
+ children: "Use Public instead"
904
+ }
905
+ )
906
+ ] }),
907
+ /* @__PURE__ */ jsxs(
908
+ "button",
909
+ {
910
+ className: `submit-btn ${intent.isLoading ? "loading" : ""} ${!isConnected ? "submit-btn--connect" : ""}`,
911
+ "data-state": isConnected ? intent.status : void 0,
912
+ disabled: !!sendRecipient && isConnected && !flowReopenable && (!sendQuoteMatches || cta.action === "useMax") || setupAction && stealthSetupLoading || isConnected && // A pending network switch keeps the button live (it triggers the
913
+ // switch); every other guard still disables it. So does an
914
+ // in-flight order with the modal closed: the click reopens the
915
+ // progress view (Phase 5), and the guards below are about
916
+ // submitting a NEW order.
917
+ !setupAction && !needsChainSwitch && !flowReopenable && // "Use max (...)" is an action, not a blocked submit.
918
+ cta.action !== "useMax" && (intent.isLoading || // A dead "Insufficient balance" / "Balance not loaded" CTA.
919
+ insufficientBalance || // The held quote is for a previous amount; the re-quote decides.
920
+ quoteStale && intent.canSign && !intent.canAllocateDepositRoute || routeBlocked || orderOutOfBounds || settlementFix !== null || recipientInvalid || // A refund address is optional, but a WRONG one must not be
921
+ // submitted: it only gets used when the swap already failed, so
922
+ // a bad value would surface as a lost refund, not a failed swap.
923
+ refundInvalid || excessiveSlippage || !intent.canSign && !intent.canAllocateDepositRoute && amountBigInt > 0n),
924
+ onClick: !isConnected ? connectWallet : setupAction ? () => void setupStealth() : cta.action === "useMax" ? () => handlePreset(100) : () => void handleMarketSubmit(),
925
+ children: [
926
+ intent.isLoading && /* @__PURE__ */ jsx("span", { className: "spinner spinner--small" }),
927
+ setupAction ? stealthSetupLoading ? "Setting up Stealth..." : stealthSetupError ? "Retry Stealth setup" : "Set up Stealth" : cta.label
928
+ ]
929
+ }
930
+ )
931
+ ] })
932
+ ] }),
933
+ /* @__PURE__ */ jsx(
934
+ SwapFlowModal,
935
+ {
936
+ open: flowOpen,
937
+ intent,
938
+ fromAmount: amountBigInt.toString(),
939
+ fromSymbol: fromToken.symbol,
940
+ fromDecimals: fromToken.decimals,
941
+ toSymbol: toToken.symbol,
942
+ toDecimals: toToken.decimals,
943
+ receivedAmount: outputAmount,
944
+ fromChainId,
945
+ toChainId,
946
+ destination: flowDestination,
947
+ swapRecipientLabel: flowDestination.swapRecipientLabel,
948
+ stealthPayee: flowStealthPayee,
949
+ isCrossChain,
950
+ estimatedDuration: isCrossChain ? ESTIMATED_CROSS_CHAIN_SEC : ESTIMATED_SINGLE_CHAIN_SEC,
951
+ startTime: executionStartTime || void 0,
952
+ wallet: address,
953
+ resumedDeposit,
954
+ onConfirm: handleConfirmSwap,
955
+ onCancelSign: handleCancelSign,
956
+ onSignPull: intent.signPull,
957
+ onRetry: retryQuote,
958
+ onClose: handleCloseFlow,
959
+ onStartOver: handleStartOver,
960
+ onGoToClaims: flowDestination.type !== "stealth" || flowStealthPayee === "other" || claimInXochiApp ? void 0 : onGoToClaims ?? (() => {
961
+ handleCloseFlow();
962
+ onStealthSettled?.();
963
+ })
964
+ }
965
+ ),
966
+ /* @__PURE__ */ jsx(WrapModal, { open: showWrap, onClose: () => setShowWrap(false) })
967
+ ] });
968
+ }
969
+ export {
970
+ SwapPanel
971
+ };