@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,185 @@
1
+ /**
2
+ * Trade Page Configuration
3
+ *
4
+ * Token metadata comes from the public @xochi/client vocabulary.
5
+ * Balances are read live on-chain via usePublicBalances.
6
+ */
7
+ import type { ChainId, Token } from "../../types/intent.js";
8
+ import { DEFAULT_SLIPPAGE_BPS, type SelectableChainId } from "@xochi/client";
9
+ import { ARC_BROWSER_ENABLED as ARC_LIVE } from "../../config.js";
10
+ export { DEFAULT_SLIPPAGE_BPS };
11
+ /**
12
+ * Stealth settlement (send side). Gates the Stealth toggle so the UI only
13
+ * offers a settlement path the solver can honor end to end. Stealth (ERC-5564)
14
+ * has no trust-score gate; the flag reflects whether the send + receive path is
15
+ * shipped. While false, the trade UI presents stealth as coming soon (disabled
16
+ * toggle, hidden receive panel). Live: the prod worker enables the settle + claim handlers
17
+ * (STEALTH_SETTLEMENT_LIVE=true), the gas floor prices the sponsored 4337 claim
18
+ * leg (Riddler #560 / xochi#216), and the two-step client-signed claim shipped.
19
+ */
20
+ export declare const STEALTH_SETTLEMENT_LIVE: boolean;
21
+ /**
22
+ * Stealth RECEIVE side (scan + claim). Distinct from STEALTH_SETTLEMENT_LIVE
23
+ * (the send side): scanning reads the worker's ERC-5564 announcement index,
24
+ * which Riddler populates once it settles to a real counterfactual and emits the
25
+ * announcement. The rebuild has landed -- the scanner matches the counterfactual
26
+ * SimpleAccount (not the stealth EOA, #188/#170), and the two-step client-signed
27
+ * claim (prepare/submit) is wired end to end -- so the scan/claim UI is live.
28
+ */
29
+ export declare const STEALTH_CLAIM_LIVE: boolean;
30
+ /**
31
+ * Aztec L2 shielded settlement (send side). Per the accepted design
32
+ * (shielded-execution.md D1) the payout lands in a recipient-private Aztec
33
+ * account while the amount and token stay public, so no copy may claim it hides
34
+ * the amount. Gated on the pxe-bridge security review; do not name that review
35
+ * in any user-facing copy.
36
+ *
37
+ * The third privacy button is a shortcut to zk.money, not this direct
38
+ * settlement path. Its Ethereum DAI deposit stays Public. Direct Aztec
39
+ * settlement remains gated and tracked by xochi-widget#142.
40
+ *
41
+ * The SELECTION path is written and unit-tested with `live: true` inputs
42
+ * (served-availability gating, the wallet nudge, the served refusal reason in
43
+ * the title, the retry-prefill restore), so that much cannot rot before the
44
+ * flip. The SETTLEMENT path is not, and this flag does not make it appear.
45
+ * Flipping it alone would let a user pick Shielded and then read a confirm
46
+ * modal that says the payout arrives in Public, because there is no
47
+ * SHIELDED_DESTINATION: `destination` resolves to DEFAULT_DESTINATION for
48
+ * anything that is not stealth (useSwapPanel), TransactionPreview labels a
49
+ * `chain` destination "Public", and the local activity capture then records
50
+ * the order as public, which also defeats the shielded retry-prefill. Step 3
51
+ * below is real work, not a copy pass.
52
+ *
53
+ * FLIP CHECKLIST (server first, always: the UI must never advertise ahead of the
54
+ * solver):
55
+ * 1. Set SHIELDED_SETTLEMENT_LIVE = "true" in workers/api/wrangler.toml for the
56
+ * target env, deploy, and confirm a quote serves shielded available:true for
57
+ * a score >= 50 wallet and the Verified-tier reason below it.
58
+ * 2. Flip this const only alongside a direct-settlement UI; the current
59
+ * "Shielded" shortcut must keep routing to zk.money.
60
+ * 3. Wire the destination so the signed order and the screen agree: add a
61
+ * SHIELDED_DESTINATION, resolve it in useSwapPanel's `destination`, give
62
+ * TransactionPreview an honest label and a claim line that is not the
63
+ * ERC-4337 stealth wording, and widen the activity capture past
64
+ * `type === "stealth" ? "stealth" : "public"`.
65
+ * 4. Flip SHIELDED_ACCOUNTS_LIVE and give the PrivacyPanel row a live state.
66
+ * Today the row only renders while the flag is false, so flipping removes
67
+ * it rather than replacing it.
68
+ * 5. Copy pass: the caption steady-state line here, plus the surfaces that read
69
+ * "planned, not yet live" (UBIQUITOUS_LANGUAGE.md, whitepaper, appendix,
70
+ * one-pager, llms.txt, agents.json, the settlementType .describe()).
71
+ * 6. Regenerate the OpenAPI spec (npm run openapi:check).
72
+ *
73
+ * The `: boolean` annotation is load-bearing. Without it TS narrows to the literal
74
+ * `false` and marks every live branch unreachable.
75
+ */
76
+ export declare const SHIELDED_SETTLEMENT_LIVE: boolean;
77
+ /**
78
+ * Shielded RECEIVE side (shielded accounts). Distinct from
79
+ * SHIELDED_SETTLEMENT_LIVE the way STEALTH_CLAIM_LIVE is distinct from
80
+ * STEALTH_SETTLEMENT_LIVE: sending to a shielded note and holding or viewing a
81
+ * shielded balance are separate paths that can ship apart. While false the
82
+ * PrivacyPanel shows an inert "Shielded" status row with an Unavailable chip.
83
+ */
84
+ export declare const SHIELDED_ACCOUNTS_LIVE: boolean;
85
+ /**
86
+ * Tron as a cross-chain destination (EVM origin -> TRC-20 payout).
87
+ *
88
+ * Live: the solver quotes the corridor, and the whole path is wired. The
89
+ * recipient-address input renders for any non-EVM destination (SwapPanel), the
90
+ * schema accepts a Tron `to_chain_id`/`to_token`/`recipient_address`
91
+ * (`destinationChainId`, `destinationTokenAddress`, `recipientAddress`), the
92
+ * quote persists the recipient and binds it into the served EIP-712, and execute
93
+ * checks that binding verbatim (base58 is case-sensitive, so `recipient` and
94
+ * both token legs compare exactly -- see tron-destination.test.ts).
95
+ *
96
+ * The selector additionally narrows to `capabilities.chains`, so Tron only
97
+ * renders while the solver still advertises it; this flag does not override that.
98
+ *
99
+ * Note on economics: this corridor carries a fixed per-transfer network cost
100
+ * well above the $1 global floor, so the solver returns a per-route
101
+ * `min_fillable_usd` and the decline copy folds it in. Do not restate the figure
102
+ * here: it is live-priced solver-side and moving (axol-io/Riddler#841 takes the
103
+ * energy price off a stale constant, #843 makes it per-token, which together cut
104
+ * a USDC payout by roughly 7x). Read the served `min_fillable_usd`, never a
105
+ * number written in this file.
106
+ *
107
+ * The origin direction is live and independently narrowed by typed routes.
108
+ */
109
+ export declare const TRON_DESTINATION_LIVE: boolean;
110
+ /**
111
+ * Tron as a cross-chain origin (deposit route). The connected wallet remains
112
+ * EVM; the origin token, deposit address, and refund address are base58. Exact
113
+ * typed routes and deposit-attestation verification remain mandatory.
114
+ */
115
+ export declare const TRON_ORIGIN_LIVE: boolean;
116
+ /**
117
+ * Arc origin needs a browser-safe RPC for wallet operations. Arc destination
118
+ * needs no browser RPC and is offered when an exact typed route advertises it.
119
+ */
120
+ export { ARC_LIVE };
121
+ /** Gnosis is live, still narrowed by the exact typed capability routes. */
122
+ export declare const GNOSIS_LIVE: boolean;
123
+ /**
124
+ * Canton as a cross-chain destination: Base USDC -> Canton Coin, delivered to
125
+ * a Canton party the user types (xochi-sdk#116). Destination-only and public
126
+ * only; settled through the Base `RiddlerEscrow` (the deploy's `escrows` pin,
127
+ * `configureWidget`): the solver delivers, Riddler attests, the solver claims,
128
+ * or the taker refunds from `refundableAt` on.
129
+ *
130
+ * Off until the Worker forwards escrow quotes and status (`escrow`,
131
+ * `cantonUpdateId`), Riddler serves the corridor (axol-io/riddler#1469), and a
132
+ * staging run has reached a terminal status. Even on, Canton is offered only
133
+ * while the live capability matrix advertises it (`cvm`) with an exact route.
134
+ * Off, Canton is selectable nowhere: selectors, embed parameters, resume and
135
+ * local activity all refuse it, and no escrow pin reaches the machine.
136
+ */
137
+ export declare const CANTON_DESTINATION_LIVE: boolean;
138
+ /**
139
+ * Client launch gates remain necessary after a solver advertises a chain.
140
+ * `cantonLive` is `CANTON_DESTINATION_LIVE`; tests pass it to exercise both.
141
+ */
142
+ export declare function chainEnabledForRole(chainId: number, role: "origin" | "destination", cantonLive?: boolean): boolean;
143
+ export declare const TOKENS: Record<SelectableChainId, Token[]>;
144
+ /** Default source chain for new users */
145
+ export declare const DEFAULT_CHAIN_ID: ChainId;
146
+ /** "Ethereum", "Base or Ethereum", "Base, Ethereum or Arbitrum". */
147
+ export declare function joinChainNames(names: readonly string[]): string;
148
+ /**
149
+ * Default destination chain: Arbitrum.
150
+ *
151
+ * This used to be Ethereum L1, chosen so both Public and Stealth were available
152
+ * on first render (see stealthDestinationChains). That default was reversed in
153
+ * #425 because it
154
+ * put the most expensive destination in the supported set on the first screen a
155
+ * user sees.
156
+ *
157
+ * Cost is `max(floor(destination_chain), 0.22%)` and the floor is gas-derived:
158
+ * roughly $0.22 to an L1 destination against roughly $0.011 to an L2. Since the
159
+ * cost ceiling landed (MAX_COST_RATIO 0.015, xochi#429), that floor no longer
160
+ * shows up as a bad quote -- it shows up as a REFUSAL, so an L1 default meant a
161
+ * $1 order bounced with an "amount too small" notice out of the box. On an L2
162
+ * destination the same $1 order quotes at about 1.08%.
163
+ *
164
+ * An explicit Stealth choice shows live receive assets rather than silently
165
+ * moving the destination or changing the privacy choice.
166
+ */
167
+ export declare const DEFAULT_TO_CHAIN_ID: ChainId;
168
+ /**
169
+ * Find token by symbol in a chain.
170
+ *
171
+ * Reads the LOCAL `TOKENS` map, which is already keyed by `SelectableChainId`
172
+ * and carries `TRON_TOKENS`, rather than delegating to the shared EVM-only
173
+ * registry. Delegating meant every Tron lookup returned undefined, so the two
174
+ * callers that rebuild a panel from a stored record (the Retry prefill and
175
+ * `planResume`) could not express a Tron leg and refused the whole trade.
176
+ */
177
+ export declare const findTokenBySymbol: (chainId: SelectableChainId, symbol: string) => Token | undefined;
178
+ /**
179
+ * The tokens a fresh panel opens on: USDC on both default chains, a route the
180
+ * solver fills (stablecoins are the only supported source today). Read by the
181
+ * panel's initial state and by the frame URL parameters (embedParams.ts), which
182
+ * fall back to exactly these.
183
+ */
184
+ export declare const DEFAULT_FROM_TOKEN: Token;
185
+ export declare const DEFAULT_TO_TOKEN: Token;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Which tabs, Trade modes and Send destinations the frame offers, from the
3
+ * host's embed parameters (`readWidgetEmbedConfig`).
4
+ *
5
+ * Narrowing only removes surfaces; it never adds one or makes a rail usable
6
+ * (live Peer data alone decides that, in ramp/availability). A surface goes
7
+ * when the host leaves it out, and also when what it depends on is gone:
8
+ *
9
+ * - `rampProviders` without `peer` removes Buy and Cash out
10
+ * modes (Peer is the only ramp provider);
11
+ * - Stealth send hands its order to the Swap card, so it goes with Swap;
12
+ * - Trade with no mode left, or Send with no destination left, goes too.
13
+ *
14
+ * `initialTab` / `initialMode` pick among what is left and fall back to the
15
+ * usual defaults (Trade, Swap) when they name something that is not.
16
+ */
17
+ import type { WidgetEmbedConfig } from "../../config.js";
18
+ import { type SendDestinationKind, type TradeMode, type WidgetTabId } from "./WidgetTabs.js";
19
+ export interface WidgetSurfaces {
20
+ /** Tabs the host allows, in display order. Claims still needs its own live conditions. */
21
+ tabs: readonly WidgetTabId[];
22
+ modes: readonly TradeMode[];
23
+ destinations: readonly SendDestinationKind[];
24
+ initialTab: WidgetTabId | undefined;
25
+ initialMode: TradeMode | undefined;
26
+ initialDestination: SendDestinationKind | undefined;
27
+ }
28
+ export declare function widgetSurfaces(embed?: WidgetEmbedConfig): WidgetSurfaces;
@@ -0,0 +1,299 @@
1
+ /**
2
+ * Frame URL parameters: the defaults a host sets on `/embed` (xochi-widget#21).
3
+ *
4
+ * The configurator at `/` writes them (`embedOverrides` + `encodeEmbedParams`),
5
+ * the frame reads them once at load: the route, amount and settlement through
6
+ * `parseEmbedParams` + `resolveEmbedDefaults` (wired in useSwapPanel), the look
7
+ * through `embedLook` (wired in EmbedApp; the entry script applies a fixed
8
+ * theme even earlier, from embedTheme.ts). The host can then override only the
9
+ * theme with `XochiWidget.updateTheme`, without reloading or resetting the
10
+ * route, form or wallet. Every key, its syntax and encoding live in
11
+ * `@xochi/widget-lib`; capability resolution stays here.
12
+ *
13
+ * fromChain origin chain, decimal chain id fromChain=1
14
+ * toChain destination chain, decimal chain id toChain=1
15
+ * sell token sent, symbol (any case) sell=USDT
16
+ * buy token received, symbol (any case) buy=USDC
17
+ * amount amount sent, a plain decimal in `sell` amount=250
18
+ * settlement `public` or `stealth` settlement=stealth
19
+ * theme `light`, `dim`, `contrast` or `auto` theme=light
20
+ * layout `full` or `swap` (no Activity, Claims) layout=swap
21
+ * howItWorks `0` hides the How it works disclosure howItWorks=0
22
+ * height fixed frame height in px, 480 to 1600 height=640
23
+ * lock fields the user cannot change lock=sell,buy,amount
24
+ * fromChains chains the user may send from fromChains=8453,10
25
+ * toChains chains the user may receive on toChains=1
26
+ * sellTokens tokens the user may send sellTokens=USDC,USDT
27
+ * buyTokens tokens the user may receive buyTokens=USDC
28
+ * ref referral code (xochi#583) ref=PARTNER
29
+ * promo promo code (xochi#584) promo=LAUNCH10
30
+ *
31
+ * The route, amount and settlement are DEFAULTS: the user can change every one
32
+ * of them in the frame, unless `lock` names it (`fromChain`, `toChain`, `sell`,
33
+ * `buy`, `amount`), and only within the allow-lists. Each is checked against
34
+ * what the frame can honour right now, and anything it cannot is ignored in
35
+ * favour of today's default, silently:
36
+ *
37
+ * - a chain the frame does not offer in that direction (unknown, not
38
+ * renderable, or not served by the solver's capability matrix);
39
+ * - a token that is not on that chain, or that the solver does not take
40
+ * (`sell`) or deliver (`buy`) there;
41
+ * - a pair the solver cannot fill: unless Stealth was explicitly requested,
42
+ * the two tokens fall back to the chains' default coins, then the default
43
+ * route. Explicit Stealth keeps known, host-permitted deployments and amounts
44
+ * for display even if inventory is empty; only live exact routes authorize execution;
45
+ * - an amount that is not a plain positive decimal, has more decimals than
46
+ * the sell token, or belongs to a `sell` token that was itself ignored;
47
+ * - settlement is Stealth on supported routes unless explicitly Public.
48
+ * An explicit Stealth preference stays selected when blocked.
49
+ *
50
+ * The theme is the frame's look (src/styles/themes.css): `contrast` is the
51
+ * high-contrast theme, and `auto`, the default, follows the OS as the frame
52
+ * always has. The layout removes parts of the frame: `swap` drops the tab row
53
+ * (the account chip stays), `howItWorks=0` drops the disclosure under the
54
+ * card, and `height` lays the frame out at that height, scrolling inside it,
55
+ * for a host iframe of the same height. Every well-formed look and layout is
56
+ * honoured; any other value is ignored.
57
+ *
58
+ * Locks and allow-lists (xochi-widget#39) are client-side conveniences, not
59
+ * policy: a user who edits the URL or calls the API is not bound by them
60
+ * (publishable keys, xochi-fi/xochi#579, will carry them server-side). Each
61
+ * allow-list is intersected with what the frame offers on its leg; one that
62
+ * keeps nothing is ignored, and if together they leave no route the solver
63
+ * fills, all of them are ignored and the frame opens as if they were absent.
64
+ * A lock fixes the value the frame opens on, so locking an ignored value
65
+ * locks the default. Locking the amount locks the send token and chain too
66
+ * (the amount is denominated in them), and needs an amount to lock.
67
+ *
68
+ * With no route preset, prefer an executable trusted Stealth route when served.
69
+ *
70
+ * A cross-coin pair can only be confirmed by the LIVE matrix: the fallback
71
+ * served while it loads (or after it fails) lists no conversion pairs, and its
72
+ * silence is not the solver's verdict. Off the live matrix such a pair is kept,
73
+ * exactly as if the user had picked it, and the frame's own route check says
74
+ * it is still being checked.
75
+ *
76
+ * `ref` and `promo` are not defaults the user sees: the frame sends them on
77
+ * every quote (`@xochi/client` 0.1.8's `QuoteRequest.ref` / `.promo`) and the
78
+ * Worker decides. Each is 3 to 32 of `A-Z 0-9 _ -`, starting with a letter or
79
+ * digit, read in any case and sent uppercase; one of any other shape is
80
+ * ignored silently. A well-formed code the Worker cannot use never blocks a
81
+ * quote: it prices as if absent and carries a note, which the configurator
82
+ * shows and the frame does not.
83
+ */
84
+ import { type CapabilityState, type ResolvedRouteModel, type SelectableChainId } from "@xochi/client";
85
+ import type { SolverCapabilities as WidgetCapabilities } from "@xochi/signer";
86
+ import { type EmbedAllowField, type EmbedLayout, type EmbedLock, type EmbedParams, type EmbedSettlement, type EmbedTheme } from "@xochi/widget-lib";
87
+ import type { Token } from "../../types/intent.js";
88
+ /**
89
+ * The `EMBED_PARAM` fields this frame resolves (`explainEmbedDefaults`), and
90
+ * so the ones the configurator reads, writes and explains. `@xochi/widget-lib`
91
+ * defines more (look, locks, lists, codes); the frame ignores those until it
92
+ * resolves them, as it ignores any key it does not read.
93
+ */
94
+ export declare const FRAME_FIELDS: readonly ["fromChainId", "toChainId", "sellSymbol", "buySymbol", "amount", "settlement", "theme", "layout", "howItWorks", "height", "locks", "fromChains", "toChains", "sellTokens", "buyTokens", "ref", "promo"];
95
+ export type FrameField = (typeof FRAME_FIELDS)[number];
96
+ /** The parameters this frame resolves. */
97
+ export type FrameParams = Pick<EmbedParams, FrameField>;
98
+ /** Why typed `text` cannot be a code, or null when it can (or is empty, no code). */
99
+ export declare function codeProblem(text: string): string | null;
100
+ /**
101
+ * What each parameter takes, for messages: `takes` ends a sentence, and
102
+ * `example` is a whole `key=value` that the frame honours when typed on its own
103
+ * against the default route (tested), so following the advice never fails.
104
+ */
105
+ export declare const EMBED_PARAM_HINT: Record<FrameField, {
106
+ takes: string;
107
+ example: string;
108
+ }>;
109
+ /** What the frame opens on: every field resolved, nothing left to check. */
110
+ export interface EmbedDefaults {
111
+ fromChainId: SelectableChainId;
112
+ toChainId: SelectableChainId;
113
+ fromToken: Token;
114
+ toToken: Token;
115
+ /** The pay amount as typed into the panel; "" for none. */
116
+ amount: string;
117
+ settlement: EmbedSettlement;
118
+ theme: EmbedTheme;
119
+ layout: EmbedLayout;
120
+ /** Whether the How it works disclosure shows under the card. */
121
+ howItWorks: boolean;
122
+ /** A fixed frame height in px that scrolls inside, or null to grow as today. */
123
+ height: number | null;
124
+ /** The fields the user cannot change, in EMBED_LOCKS order. */
125
+ locks: readonly EmbedLock[];
126
+ /** The chains each leg may use, in offer order; null for any the frame offers. */
127
+ fromChains: readonly SelectableChainId[] | null;
128
+ toChains: readonly SelectableChainId[] | null;
129
+ /** The token symbols each leg may use, as the registry spells them; null for any. */
130
+ sellTokens: readonly string[] | null;
131
+ buyTokens: readonly string[] | null;
132
+ /** The referral and promo codes sent on every quote, uppercase; null for none. */
133
+ ref: string | null;
134
+ promo: string | null;
135
+ }
136
+ /** Static fallback while capabilities load; unconfigured openings may prefer Stealth. */
137
+ export declare const FRAME_DEFAULTS: EmbedDefaults;
138
+ /**
139
+ * Why a typed `text` cannot be the frame height, or null when it can (or is
140
+ * empty, the standard frame). Surrounding space is ignored, as when typed.
141
+ */
142
+ export declare function heightProblem(text: string): string | null;
143
+ /** The frame's look and layout: the options no matrix can refuse. */
144
+ export type EmbedLook = Pick<EmbedDefaults, "theme" | "layout" | "howItWorks" | "height">;
145
+ /**
146
+ * The look and layout the frame opens on. Every well-formed value is honoured,
147
+ * so this needs no capability matrix and the frame applies it before one loads.
148
+ */
149
+ export declare function embedLook(params: EmbedParams): EmbedLook;
150
+ /** The codes the frame sends on quote: no matrix can refuse them either. */
151
+ export type EmbedCodes = Pick<EmbedDefaults, "ref" | "promo">;
152
+ export declare function embedCodes(params: EmbedParams): EmbedCodes;
153
+ /** The look of a frame URL with no layout parameters: the full widget. */
154
+ export declare const FULL_LOOK: EmbedLook;
155
+ /**
156
+ * Why `amount` cannot be the pay amount in `token`, or null when it can.
157
+ * The frame drops a refused amount; the configurator shows the reason.
158
+ */
159
+ export declare function amountProblem(amount: string, token: Token): string | null;
160
+ /** Everything the resolver reads from the solver's capability matrix. */
161
+ export interface EmbedOffer {
162
+ sourceChainIds: readonly SelectableChainId[];
163
+ destinationChainIds: readonly SelectableChainId[];
164
+ originSymbols: readonly string[];
165
+ destinationSymbols: readonly string[];
166
+ capabilities: WidgetCapabilities;
167
+ /** The matrix is the solver's live answer, not the fallback. */
168
+ live: boolean;
169
+ /**
170
+ * Narrowed by a host's allow-lists (`restrictOffer`): the frame's own
171
+ * defaults then hold only where the lists allow them.
172
+ */
173
+ restricted?: boolean;
174
+ routeModel: ResolvedRouteModel;
175
+ }
176
+ /**
177
+ * The frame's offer under a capability matrix: the same chain lists the
178
+ * selectors render and the same token lists their menus narrow to.
179
+ */
180
+ export declare function embedOffer(capabilities: WidgetCapabilities, state: CapabilityState | boolean): EmbedOffer;
181
+ export declare function legTokens(offer: EmbedOffer, chainId: number, leg: "sell" | "buy"): readonly Token[];
182
+ interface Route {
183
+ fromChainId: SelectableChainId;
184
+ toChainId: SelectableChainId;
185
+ fromToken: Token;
186
+ toToken: Token;
187
+ }
188
+ export declare function routeFills(offer: EmbedOffer, route: Route): boolean;
189
+ /** Only an exact trusted live route may offer Stealth. */
190
+ export declare function stealthOffered(route: Route, capabilities: WidgetCapabilities, capabilityState: CapabilityState): boolean;
191
+ /** Why the frame ignores each requested value it does not open on. */
192
+ export type EmbedIgnored = Partial<Record<keyof EmbedParams, string>>;
193
+ /** A chain's display name, or "chain <id>" for one the registry does not name. */
194
+ export declare const chainName: (id: number) => string;
195
+ /** The allow-lists, as parameters ask for them or as the frame honours them. */
196
+ export type EmbedAllowLists = Pick<EmbedParams, EmbedAllowField>;
197
+ /** The distinct symbols a leg offers on any of `chainIds`, in registry order. */
198
+ export declare function legSymbols(offer: EmbedOffer, chainIds: readonly SelectableChainId[], leg: "sell" | "buy"): string[];
199
+ /**
200
+ * The offer narrowed to a host's allow-lists (xochi-widget#39). Each list is
201
+ * intersected with what its leg offers; a list that keeps nothing is ignored
202
+ * (and named in `ignored`). A chain left with no allowed token on its leg is
203
+ * dropped from the leg. `lists` is what the frame honours, null per absent or
204
+ * ignored list. The offer is `restricted` when any list applies.
205
+ */
206
+ export declare function restrictOffer(offer: EmbedOffer, asked: EmbedAllowLists): {
207
+ offer: EmbedOffer;
208
+ lists: Pick<EmbedDefaults, EmbedAllowField>;
209
+ ignored: EmbedIgnored;
210
+ };
211
+ /**
212
+ * Turn requested parameters into what the frame opens on, keeping each value
213
+ * only if the frame can honour it (rules in the module comment).
214
+ */
215
+ export declare function resolveEmbedDefaults(params: EmbedParams, offer: EmbedOffer): EmbedDefaults;
216
+ /**
217
+ * `resolveEmbedDefaults`, plus the reason for every requested value the frame
218
+ * ignores: the frame drops them silently, the configurator names them. Each
219
+ * reason is a clause with no closing full stop.
220
+ */
221
+ export declare function explainEmbedDefaults(params: EmbedParams, full: EmbedOffer): {
222
+ defaults: EmbedDefaults;
223
+ ignored: EmbedIgnored;
224
+ };
225
+ /**
226
+ * The fields that decide the swap panel's opening state, as the panel holds
227
+ * them. The look (`EmbedLook`) is not panel state, so it is not here.
228
+ */
229
+ export interface EmbedState {
230
+ fromChainId: number;
231
+ toChainId: number;
232
+ fromToken: {
233
+ address: string;
234
+ };
235
+ toToken: {
236
+ address: string;
237
+ };
238
+ amount: string;
239
+ settlement: string;
240
+ }
241
+ /** Whether two configurations open the swap panel identically (the look aside). */
242
+ export declare function sameEmbedDefaults(a: EmbedState, b: EmbedState): boolean;
243
+ /**
244
+ * The parameters that reopen this route and mode explicitly. Capability-dependent
245
+ * defaults must not replace a host's Public choice or selected destination.
246
+ */
247
+ export declare function embedOverrides(defaults: EmbedDefaults): EmbedParams;
248
+ /** What the panel lets the user change: the locks and allow-lists it opened on. */
249
+ export type EmbedPolicy = Pick<EmbedDefaults, "locks" | EmbedAllowField>;
250
+ /** The panel with no locks and no allow-lists, as it was before they existed. */
251
+ export declare const OPEN_POLICY: EmbedPolicy;
252
+ /** Whether a route keeps to the policy's allow-lists (locks are the caller's). */
253
+ export declare function policyAdmits(policy: EmbedPolicy, route: {
254
+ fromChainId: number;
255
+ toChainId: number;
256
+ fromSymbol: string;
257
+ toSymbol: string;
258
+ }): boolean;
259
+ /**
260
+ * Whether a route keeps every lock and list of what the frame opened on.
261
+ * `amount` is the amount it would show, or null for one a lock cannot accept
262
+ * (a Retry restores its own), which a locked amount refuses.
263
+ */
264
+ export declare function policyHolds(opened: EmbedDefaults, route: {
265
+ fromChainId: number;
266
+ toChainId: number;
267
+ fromSymbol: string;
268
+ toSymbol: string;
269
+ }, amount: string | null): boolean;
270
+ /**
271
+ * A leg's solver symbols narrowed to an allow-list (null: no list). An empty
272
+ * solver list means "no narrowing" (pairAvailability.ts), so the list itself
273
+ * stands in for it.
274
+ */
275
+ export declare function narrowSymbols(offered: readonly string[], allowed: readonly string[] | null): readonly string[];
276
+ /**
277
+ * Whether the policy lets a leg, now `current`, move to `chainId`: its chain is
278
+ * not locked elsewhere, the chain is listed, it carries an allowed token, and
279
+ * with the token locked it carries that token (a chain switch keeps the symbol
280
+ * only where it exists). The pickers and the route handlers read this one rule.
281
+ */
282
+ export declare function legChainAllowed(policy: EmbedPolicy, leg: "sell" | "buy", chainId: number, current: {
283
+ chainId: number;
284
+ symbol: string;
285
+ }): boolean;
286
+ /** Whether the policy lets a leg, now on `currentChainId`, take `token`. */
287
+ export declare function legTokenAllowed(policy: EmbedPolicy, leg: "sell" | "buy", token: {
288
+ chainId: number;
289
+ symbol: string;
290
+ }, currentChainId: number): boolean;
291
+ /** The fragment that opens the full frame on its Claims tab. */
292
+ export declare const CLAIMS_HASH = "#claims";
293
+ /**
294
+ * Where a frame without tabs (`layout=swap`) sends a stealth recipient to
295
+ * claim: the full widget in its own tab, in the same theme, on Claims. The
296
+ * route options are left out: the claim is the visit's whole purpose.
297
+ */
298
+ export declare function claimsPath(theme: EmbedTheme): string;
299
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The app theme each frame `theme` (xochi-fi/xochi-widget#37, defined by
3
+ * `@xochi/widget-lib`) applies. Kept apart from embedParams.ts, with no runtime
4
+ * imports of the frame's own, so the entry script can apply a fixed theme
5
+ * before the frame's chunk has loaded.
6
+ */
7
+ import type { EmbedTheme } from "@xochi/widget-lib";
8
+ import type { AppTheme } from "../../hooks/useTheme.js";
9
+ /**
10
+ * The app theme (useTheme.ts, themes.css) each look applies, or null for
11
+ * `auto`, which resolves it the way the frame always has. `contrast` is the
12
+ * app's high-contrast theme, which themes.css names `dark`.
13
+ */
14
+ export declare const EMBED_THEME_APP: Record<EmbedTheme, AppTheme | null>;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Real providers, no mocked hooks.
3
+ *
4
+ * The trade surface was untestable at runtime and so it was tested as TEXT: six
5
+ * suites under this directory `readFileSync`-ed `SwapPanel.tsx` / `useSwapPanel.ts`
6
+ * and asserted literal JSX substrings. Those pass when the control under test is
7
+ * wired to nothing, and go red on a rename or a Prettier setting -- which is why
8
+ * they blocked this refactor instead of protecting it.
9
+ *
10
+ * What made a render look impossible was the provider stack: wagmi, RainbowKit,
11
+ * react-query, the stealth provider and the toast provider, plus WalletConnect
12
+ * initialising inside the app's own `config`. None of that needs faking:
13
+ *
14
+ * - the wagmi config here is REAL, just built for a test (a `mock` connector
15
+ * instead of WalletConnect, so no relay socket opens and no 5s teardown);
16
+ * - the RPC transport is REAL viem, answering the two methods a render actually
17
+ * reaches (`eth_chainId` and `personal_sign`, the stealth key signature) and
18
+ * refusing the rest, so a test can never silently depend on live chain data;
19
+ * - `fetch` is stubbed at the PLATFORM boundary with `vi.stubGlobal`, the
20
+ * established pattern in this repo, rather than by mocking `useIntent` or
21
+ * `intentAPI`. The code under test is the code that ships.
22
+ *
23
+ * `vi.mock` is banned repo-wide (zero occurrences) and nothing here introduces
24
+ * one.
25
+ */
26
+ import type { ReactNode } from "react";
27
+ import { type RenderResult } from "@testing-library/react";
28
+ import { type Config } from "wagmi";
29
+ import type { Chain } from "viem";
30
+ /** The account every connected test runs as. */
31
+ export declare const TEST_ACCOUNT: "0x1111111111111111111111111111111111111111";
32
+ /**
33
+ * A chain that answers as an EMPTY wallet rather than as an outage.
34
+ *
35
+ * The distinction is about unhandled rejections, not realism. `usePublicBalances`
36
+ * reads every known public ERC-20 per chain plus native balances on an interval,
37
+ * and a render test unmounts mid-flight every time. When those reads rejected,
38
+ * viem's retry timer settled after teardown with no listener left, so a suite
39
+ * whose every assertion passed still reported unhandled errors and exited
40
+ * non-zero. Resolving zero gives these tests a genuinely empty wallet; failed
41
+ * or unread balances remain unknown in the hook.
42
+ *
43
+ * Still not a permissive stub: anything beyond a balance read or a signature
44
+ * throws, so a test cannot come to depend on chain state a CI box has no way to
45
+ * serve.
46
+ */
47
+ /**
48
+ * Mined transactions a test has declared, by hash: what `eth_getTransactionReceipt`
49
+ * answers. Empty unless a test puts a hash here (and clears it after), so no
50
+ * other suite can come to depend on a receipt it did not ask for.
51
+ */
52
+ export declare const harnessReceipts: Map<string, "success" | "reverted">;
53
+ export declare function makeTestConfig(tokenBalance?: bigint, hostWallet?: boolean, chains?: readonly [Chain, ...Chain[]]): Config;
54
+ interface RenderTradeOptions {
55
+ /** Connect the mock wallet before the first render (default: anonymous). */
56
+ connected?: boolean;
57
+ /**
58
+ * Connect on Base (the panel's default origin), then have the WALLET move
59
+ * itself here, the way a user flips networks inside the extension. An id
60
+ * outside CHAINS is a network this app has no config for (Metatarz's 31337):
61
+ * wagmi's `useChainId()` then stays on Base and only the connection reports
62
+ * the move (xochi#539). Requires `connected`.
63
+ */
64
+ walletChainId?: number;
65
+ /** What every ERC-20 `balanceOf` answers, in base units (default: an empty wallet). */
66
+ tokenBalance?: bigint;
67
+ /** The wallet is the embedding page's, lent over `@xochi/widget-lib` (default: false). */
68
+ hostWallet?: boolean;
69
+ /** Exercise the real capability-dependent opening instead of the order fixtures' corridor. */
70
+ automaticRoute?: boolean;
71
+ }
72
+ /**
73
+ * Render inside the real provider stack.
74
+ *
75
+ * Connects BEFORE the first render when asked, so the panel never observes an
76
+ * anonymous frame -- a connect after mount would have the component re-derive
77
+ * every gate mid-test and turn ordering into a flake.
78
+ */
79
+ export declare function renderTrade(ui: ReactNode, { connected, walletChainId, tokenBalance, hostWallet, automaticRoute, }?: RenderTradeOptions): Promise<RenderResult & {
80
+ config: Config;
81
+ }>;
82
+ /**
83
+ * Route `fetch` by URL substring. Anything unmatched rejects, which is how the
84
+ * app behaves offline (`useCapabilities` serves FALLBACK_CAPABILITIES, prices
85
+ * serve nothing) and keeps an unlisted endpoint from silently returning 200.
86
+ *
87
+ * A route either serves a fixed `body` or `answer`s the parsed JSON request
88
+ * body, for an endpoint whose reply must agree with the request: the machine
89
+ * refuses a quote whose `preview` flag does not match what it asked for, as
90
+ * the Worker's would.
91
+ */
92
+ export type StubbedRoute = {
93
+ status?: number;
94
+ } & ({
95
+ body: unknown;
96
+ answer?: undefined;
97
+ } | {
98
+ body?: undefined;
99
+ answer: (request: unknown) => unknown;
100
+ });
101
+ /** The stubbed `fetch`, typed as the platform's. */
102
+ export type FetchStub = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
103
+ export declare const L1_STEALTH_CAPABILITIES: StubbedRoute;
104
+ export interface ApiStubOptions {
105
+ /**
106
+ * Sees the method of every request the mock wallet forwards to its RPC, which
107
+ * is every wallet prompt it does not answer itself (`eth_signTypedData_v4`
108
+ * included), so a test can assert a prompt was never raised.
109
+ */
110
+ onWalletRpc?: (method: string) => void;
111
+ /**
112
+ * What the mock wallet answers for a prompt it would otherwise refuse, by
113
+ * method (e.g. the hash an approved `eth_sendTransaction` returns).
114
+ */
115
+ walletResults?: Readonly<Record<string, unknown>>;
116
+ /** Serve the typed default matrix when the test does not override capabilities. */
117
+ serveDefaultCapabilities?: boolean;
118
+ }
119
+ export declare function apiStub(routes: Record<string, StubbedRoute>, { onWalletRpc, walletResults, serveDefaultCapabilities }?: ApiStubOptions): FetchStub;
120
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Stable client-side guidance before quoting. Maximum size is deliberately not
3
+ * an input: live destination inventory belongs to the solver's quote decision.
4
+ */
5
+ export declare function minimumOrderNotice(amountUsd: number, minimumUsd: number): string | null;