@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.
- package/CHANGELOG.md +76 -0
- package/LICENSE +21 -0
- package/README.md +420 -2
- package/THIRD_PARTY_NOTICES.txt +44 -0
- package/dist/ConfiguratorApp.js +19 -0
- package/dist/EmbedApp.js +57 -0
- package/dist/assets/MonaspaceArgon-Bold-D9kWRRK5.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Light-Dt_6qXbW.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Medium-B1gMZwrU.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Regular-RS-2TGNg.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-SemiBold-PYusZXE_.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Italic-C9u9eioB.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Light-CJkxpyfT.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Medium-DCChELAx.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Regular-BZtV1wRa.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Bold-KacFhGOf.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Medium-Dqqg-cnL.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Regular-BRsdKART.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-SemiBold-DNjPl3uE.woff2 +0 -0
- package/dist/assets/alipay-3tx9-HPp.svg +1 -0
- package/dist/assets/arb-CCfLcB_X.svg +7 -0
- package/dist/assets/arc-Dy98eSCd.svg +10 -0
- package/dist/assets/aztec-DiLp9qTG.svg +4 -0
- package/dist/assets/base-Ch0ino36.svg +4 -0
- package/dist/assets/cashapp-lOg0DIt8.svg +1 -0
- package/dist/assets/chains/arbitrum.svg.js +4 -0
- package/dist/assets/chains/arc.svg.js +4 -0
- package/dist/assets/chains/aztec.svg.js +4 -0
- package/dist/assets/chains/base.svg.js +4 -0
- package/dist/assets/chains/ethereum.svg.js +4 -0
- package/dist/assets/chains/gnosis.png.js +4 -0
- package/dist/assets/chains/index.js +31 -0
- package/dist/assets/chains/optimism.svg.js +4 -0
- package/dist/assets/chains/polygon.svg.js +4 -0
- package/dist/assets/chains/robinhood.svg.js +4 -0
- package/dist/assets/chains/tron.svg.js +4 -0
- package/dist/assets/chains/xochi.svg.js +4 -0
- package/dist/assets/dai-XuyZLceZ.png +0 -0
- package/dist/assets/defillama-BU037Unq.svg +1 -0
- package/dist/assets/defillama.svg.js +4 -0
- package/dist/assets/eth-Dvbng9UB.svg +8 -0
- package/dist/assets/eurc-NI9zNgOQ.png +0 -0
- package/dist/assets/eure-BH9vpwcv.png +0 -0
- package/dist/assets/gnosis-fRzAZQFj.png +0 -0
- package/dist/assets/mercadopago-gjsFb6F7.svg +1 -0
- package/dist/assets/monzo-B9XD4bL5.png +0 -0
- package/dist/assets/monzo-SZnIdUKN.svg +1 -0
- package/dist/assets/monzo-dark-Bwzg90UC.png +0 -0
- package/dist/assets/n26-cANcjY2T.svg +1 -0
- package/dist/assets/op-DF67SbB6.png +0 -0
- package/dist/assets/optimism-B3cTNxEQ.svg +4 -0
- package/dist/assets/paypal-D8xqXEtN.svg +1 -0
- package/dist/assets/pol-uLmSo2O8.svg +3 -0
- package/dist/assets/rails/SOURCES.md +50 -0
- package/dist/assets/rails/alipay.svg.js +4 -0
- package/dist/assets/rails/cashapp.svg.js +4 -0
- package/dist/assets/rails/index.js +59 -0
- package/dist/assets/rails/mercadopago.svg.js +4 -0
- package/dist/assets/rails/monzo-dark.png.js +4 -0
- package/dist/assets/rails/monzo.png.js +4 -0
- package/dist/assets/rails/monzo.svg.js +4 -0
- package/dist/assets/rails/n26.svg.js +4 -0
- package/dist/assets/rails/paypal.svg.js +4 -0
- package/dist/assets/rails/revolut-dark.png.js +4 -0
- package/dist/assets/rails/revolut.png.js +4 -0
- package/dist/assets/rails/revolut.svg.js +4 -0
- package/dist/assets/rails/venmo.svg.js +4 -0
- package/dist/assets/rails/wise-dark.png.js +4 -0
- package/dist/assets/rails/wise.png.js +4 -0
- package/dist/assets/rails/wise.svg.js +4 -0
- package/dist/assets/rails/xmoney.svg.js +4 -0
- package/dist/assets/rails/zelle.svg.js +4 -0
- package/dist/assets/raxol-86FmC34h.png +0 -0
- package/dist/assets/revolut-CiBtyALA.png +0 -0
- package/dist/assets/revolut-D7qr5Vzs.svg +1 -0
- package/dist/assets/revolut-dark-RQdWGM_p.png +0 -0
- package/dist/assets/robinhood-DgdGTQ1I.svg +8 -0
- package/dist/assets/tokens/arb.svg.js +4 -0
- package/dist/assets/tokens/dai.png.js +4 -0
- package/dist/assets/tokens/eth.svg.js +4 -0
- package/dist/assets/tokens/eurc.png.js +4 -0
- package/dist/assets/tokens/eure.png.js +4 -0
- package/dist/assets/tokens/index.js +36 -0
- package/dist/assets/tokens/op.png.js +4 -0
- package/dist/assets/tokens/pol.svg.js +4 -0
- package/dist/assets/tokens/raxol.png.js +4 -0
- package/dist/assets/tokens/usdc.png.js +4 -0
- package/dist/assets/tokens/usdg.png.js +4 -0
- package/dist/assets/tokens/usdt.png.js +4 -0
- package/dist/assets/tokens/wbtc.png.js +4 -0
- package/dist/assets/tokens/wsteth.png.js +4 -0
- package/dist/assets/tokens/zchf.png.js +4 -0
- package/dist/assets/tron-Dtumyzha.svg +4 -0
- package/dist/assets/usdc-UHSd0FoM.png +0 -0
- package/dist/assets/usdg-Cd5nCzbC.png +0 -0
- package/dist/assets/usdt-3G3YdPq8.png +0 -0
- package/dist/assets/venmo-CMHeCn-D.svg +1 -0
- package/dist/assets/wbtc-CV8uE44Q.png +0 -0
- package/dist/assets/wise-BUOflsWL.svg +1 -0
- package/dist/assets/wise-JLpDvCdq.png +0 -0
- package/dist/assets/wise-dark-_Q8pbCom.png +0 -0
- package/dist/assets/wsteth-BamwtTCR.png +0 -0
- package/dist/assets/xmoney-CwY9KVlD.svg +1 -0
- package/dist/assets/xochi-DL2f8G4R.svg +4 -0
- package/dist/assets/zchf-BLBNdTGJ.png +0 -0
- package/dist/assets/zelle-t15cG4SB.svg +1 -0
- package/dist/browser.js +4 -0
- package/dist/components/AccountChip.js +29 -0
- package/dist/components/ActivityFeed.js +710 -0
- package/dist/components/AssetsStrip.js +133 -0
- package/dist/components/AuthorizedAgents.js +197 -0
- package/dist/components/Chevron.js +22 -0
- package/dist/components/ErrorDisplay.js +66 -0
- package/dist/components/InfoButton.js +27 -0
- package/dist/components/IntentTimeline.js +202 -0
- package/dist/components/LinksSignIn.js +26 -0
- package/dist/components/MobileSigningBanner.js +44 -0
- package/dist/components/PrivacyBars.js +44 -0
- package/dist/components/PrivacyPanel.js +99 -0
- package/dist/components/QuoteDetails.js +327 -0
- package/dist/components/ReceiptCommand.js +46 -0
- package/dist/components/SessionReloadBanner.js +19 -0
- package/dist/components/SolverRace.js +62 -0
- package/dist/components/StealthClaims.js +179 -0
- package/dist/components/SwapFlowModal.js +398 -0
- package/dist/components/Toast.js +40 -0
- package/dist/components/TokenIcon.js +21 -0
- package/dist/components/TokenSearchModal.js +331 -0
- package/dist/components/TransactionPreview.js +207 -0
- package/dist/components/WalletProvider.js +41 -0
- package/dist/components/WrapModal.js +192 -0
- package/dist/components/swap-flow/CantonEscrowPanel.js +28 -0
- package/dist/components/swap-flow/CantonEscrowStatus.js +160 -0
- package/dist/components/swap-flow/DepositInstructions.js +156 -0
- package/dist/components/swap-flow/QrCode.js +22 -0
- package/dist/components/swap-flow/SwapResult.js +323 -0
- package/dist/components/swap-flow/depositScreen.js +36 -0
- package/dist/components/widgetTabsContext.js +17 -0
- package/dist/config.js +132 -0
- package/dist/configurator-model.js +71 -0
- package/dist/configurator.js +11 -0
- package/dist/constants.js +53 -0
- package/dist/hooks/applyTheme.js +10 -0
- package/dist/hooks/useAgentRegistry.js +28 -0
- package/dist/hooks/useAgentStream.js +89 -0
- package/dist/hooks/useCantonEscrow.js +89 -0
- package/dist/hooks/useCapabilities.js +86 -0
- package/dist/hooks/useEmbedLook.js +23 -0
- package/dist/hooks/useFocusTrap.js +44 -0
- package/dist/hooks/useIntent.js +435 -0
- package/dist/hooks/useIntentStatusPoll.js +71 -0
- package/dist/hooks/useIntentStream.js +95 -0
- package/dist/hooks/useLocalActivity.js +114 -0
- package/dist/hooks/useLocalSends.js +15 -0
- package/dist/hooks/useLocalStorage.js +26 -0
- package/dist/hooks/useOrderHistory.js +307 -0
- package/dist/hooks/usePermit.js +131 -0
- package/dist/hooks/usePrices.js +49 -0
- package/dist/hooks/usePublicBalances.js +186 -0
- package/dist/hooks/useRampSummaries.js +19 -0
- package/dist/hooks/useRecipientBalance.js +98 -0
- package/dist/hooks/useSettlements.js +33 -0
- package/dist/hooks/useStealth.js +324 -0
- package/dist/hooks/useStealthClaim.js +183 -0
- package/dist/hooks/useStealthScanner.js +259 -0
- package/dist/hooks/useTheme.js +48 -0
- package/dist/hooks/useTierInfo.js +20 -0
- package/dist/hooks/useTrustScore.js +16 -0
- package/dist/hooks/useWalletSession.js +70 -0
- package/dist/hooks/useWrapEth.js +60 -0
- package/dist/index.js +41 -0
- package/dist/integration.js +19 -0
- package/dist/lib/activityValue.js +20 -0
- package/dist/lib/agentConnect.js +11 -0
- package/dist/lib/agentRegistry.js +83 -0
- package/dist/lib/agentStreamVerify.js +47 -0
- package/dist/lib/api.js +67 -0
- package/dist/lib/auth.js +8 -0
- package/dist/lib/authFetch.js +33 -0
- package/dist/lib/aztecTokens.js +13 -0
- package/dist/lib/balances.js +77 -0
- package/dist/lib/capabilities.js +40 -0
- package/dist/lib/claimSubmitPoll.js +63 -0
- package/dist/lib/debug.js +7 -0
- package/dist/lib/declineGuidance.js +31 -0
- package/dist/lib/displayFallbacks.js +25 -0
- package/dist/lib/eip712.js +38 -0
- package/dist/lib/errorCategory.js +200 -0
- package/dist/lib/errorReport.js +19 -0
- package/dist/lib/explorerLinks.js +30 -0
- package/dist/lib/feesLabel.js +19 -0
- package/dist/lib/glyphs.js +58 -0
- package/dist/lib/hostBridge.js +41 -0
- package/dist/lib/hostOrigin.js +52 -0
- package/dist/lib/intentAPI.js +39 -0
- package/dist/lib/linksSignIn.js +9 -0
- package/dist/lib/localActivity.js +247 -0
- package/dist/lib/localSends.js +129 -0
- package/dist/lib/mobileWallet.js +17 -0
- package/dist/lib/pairAvailability.js +29 -0
- package/dist/lib/paymentSummary.js +23 -0
- package/dist/lib/permits.js +27 -0
- package/dist/lib/priceImpact.js +101 -0
- package/dist/lib/providers.js +124 -0
- package/dist/lib/qr.js +20 -0
- package/dist/lib/quoteCost.js +34 -0
- package/dist/lib/quoteCountdown.js +24 -0
- package/dist/lib/rampHostGate.js +24 -0
- package/dist/lib/rampLifecycle.js +63 -0
- package/dist/lib/receiptCost.js +64 -0
- package/dist/lib/recipient/index.js +302 -0
- package/dist/lib/recipient/recent.js +47 -0
- package/dist/lib/recipientReceipt.js +16 -0
- package/dist/lib/reportClient.js +32 -0
- package/dist/lib/sessionExpiry.js +11 -0
- package/dist/lib/settlementAvailability.js +34 -0
- package/dist/lib/stealth.js +110 -0
- package/dist/lib/swapFlowPhase.js +52 -0
- package/dist/lib/swapStatusCopy.js +59 -0
- package/dist/lib/tradeLifecycle.js +40 -0
- package/dist/lib/tronlink.js +71 -0
- package/dist/lib/walletSession.js +87 -0
- package/dist/pages/Configurator.js +390 -0
- package/dist/pages/Trade.js +635 -0
- package/dist/pages/configurator/AllowedAssetsSection.js +98 -0
- package/dist/pages/configurator/AppearanceSection.js +44 -0
- package/dist/pages/configurator/CodeDock.js +140 -0
- package/dist/pages/configurator/DeveloperSection.js +40 -0
- package/dist/pages/configurator/IntegrationSection.js +105 -0
- package/dist/pages/configurator/LayoutSection.js +83 -0
- package/dist/pages/configurator/PolicyNote.js +7 -0
- package/dist/pages/configurator/PreviewStage.js +165 -0
- package/dist/pages/configurator/PrivacySection.js +54 -0
- package/dist/pages/configurator/RouteSection.js +211 -0
- package/dist/pages/configurator/Settings.js +35 -0
- package/dist/pages/configurator/SharedLinkBanner.js +25 -0
- package/dist/pages/configurator/SurfaceSection.js +124 -0
- package/dist/pages/configurator/WhatUsersSee.js +268 -0
- package/dist/pages/configurator/codeShown.js +8 -0
- package/dist/pages/configurator/configuratorUrl.js +33 -0
- package/dist/pages/configurator/paramsDraft.js +82 -0
- package/dist/pages/configurator/previewModel.js +10 -0
- package/dist/pages/configurator/previewQuote.js +109 -0
- package/dist/pages/configurator/routePicks.js +131 -0
- package/dist/pages/configurator/snippets.js +98 -0
- package/dist/pages/configurator/surfaceParams.js +51 -0
- package/dist/pages/configurator/useCodeCheck.js +79 -0
- package/dist/pages/configurator/useConfiguratorUrl.js +24 -0
- package/dist/pages/configurator/useMediaQuery.js +20 -0
- package/dist/pages/configurator/useParamsDraft.js +33 -0
- package/dist/pages/configurator/usePreviewFee.js +100 -0
- package/dist/pages/send/MetaAddressValue.js +28 -0
- package/dist/pages/send/Receive.js +168 -0
- package/dist/pages/send/RecentRecipients.js +23 -0
- package/dist/pages/send/RecipientChip.js +26 -0
- package/dist/pages/send/ScanRecipient.js +85 -0
- package/dist/pages/send/SendForm.js +516 -0
- package/dist/pages/send/SendPanel.js +30 -0
- package/dist/pages/send/ShieldedDisclosure.js +12 -0
- package/dist/pages/send/StealthInvite.js +27 -0
- package/dist/pages/send/addressSend.js +92 -0
- package/dist/pages/send/sendCopy.js +10 -0
- package/dist/pages/send/sendRetry.js +24 -0
- package/dist/pages/send/stealthRecipient.js +65 -0
- package/dist/pages/send/stealthSend.js +15 -0
- package/dist/pages/send/useAddressSend.js +257 -0
- package/dist/pages/send/useSendRecipient.js +61 -0
- package/dist/pages/trade/BuyPanel.js +70 -0
- package/dist/pages/trade/RampRecovery.js +41 -0
- package/dist/pages/trade/RecipientSheet.js +182 -0
- package/dist/pages/trade/Selectors.js +152 -0
- package/dist/pages/trade/SwapPanel.js +971 -0
- package/dist/pages/trade/WidgetTabs.js +109 -0
- package/dist/pages/trade/canton.js +122 -0
- package/dist/pages/trade/config.js +70 -0
- package/dist/pages/trade/embedNarrowing.js +25 -0
- package/dist/pages/trade/embedParams.js +532 -0
- package/dist/pages/trade/embedTheme.js +9 -0
- package/dist/pages/trade/orderMinimum.js +8 -0
- package/dist/pages/trade/resumeSwap.js +55 -0
- package/dist/pages/trade/settlementCopy.js +32 -0
- package/dist/pages/trade/useAmountFit.js +31 -0
- package/dist/pages/trade/useEmbedDefaults.js +18 -0
- package/dist/pages/trade/useSettlementGating.js +289 -0
- package/dist/pages/trade/useSwapAmount.js +191 -0
- package/dist/pages/trade/useSwapFlow.js +511 -0
- package/dist/pages/trade/useSwapPanel.js +475 -0
- package/dist/pages/trade/useSwapRoute.js +634 -0
- package/dist/pages/trade/useTronLinkFill.js +34 -0
- package/dist/pages/trade/zkMoney.js +46 -0
- package/dist/promiseWithResolvers.js +20 -0
- package/dist/ramp/availability/RailTiles.js +156 -0
- package/dist/ramp/availability/RampDisclosure.js +38 -0
- package/dist/ramp/availability/RampRails.js +170 -0
- package/dist/ramp/availability/model.js +207 -0
- package/dist/ramp/availability/useRampDiscovery.js +83 -0
- package/dist/ramp/offramp/CompletedPrerequisite.js +23 -0
- package/dist/ramp/offramp/OfframpActivityList.js +16 -0
- package/dist/ramp/offramp/OfframpRoute.js +222 -0
- package/dist/ramp/offramp/OfframpRouteReview.js +94 -0
- package/dist/ramp/offramp/PaymentAppSend.js +765 -0
- package/dist/ramp/offramp/localOfframps.js +101 -0
- package/dist/ramp/offramp/model.js +154 -0
- package/dist/ramp/offramp/port.js +134 -0
- package/dist/ramp/offramp/prerequisite.js +143 -0
- package/dist/ramp/offramp/useOfframp.js +505 -0
- package/dist/ramp/offramp/useOfframpRails.js +73 -0
- package/dist/ramp/peer/BuyOnramp.js +292 -0
- package/dist/ramp/peer/OnrampSteps.js +148 -0
- package/dist/ramp/peer/buyerDriver.js +461 -0
- package/dist/ramp/peer/discovery.js +231 -0
- package/dist/ramp/peer/environment.js +7 -0
- package/dist/ramp/peer/liveProvider.js +87 -0
- package/dist/ramp/peer/liveReads.js +488 -0
- package/dist/ramp/peer/maker.js +92 -0
- package/dist/ramp/peer/normalization.js +184 -0
- package/dist/ramp/peer/offramp.js +648 -0
- package/dist/ramp/peer/onramp.js +353 -0
- package/dist/ramp/peer/preview.js +52 -0
- package/dist/ramp/peer/protectedMapping.js +67 -0
- package/dist/ramp/peer/runtime.js +55 -0
- package/dist/ramp/peer/sdkMaker.js +107 -0
- package/dist/ramp/recovery/ResumeOnramp.js +153 -0
- package/dist/ramp/recovery/summaries.js +173 -0
- package/dist/ramp/route/OnrampRoute.js +255 -0
- package/dist/ramp/route/RampRouteSteps.js +148 -0
- package/dist/ramp/route/routeActivity.js +12 -0
- package/dist/ramp/route/useXochiRampDriver.js +203 -0
- package/dist/styles.css +17448 -0
- package/dist/styles.js +2 -0
- package/dist/types/ConfiguratorApp.d.ts +6 -0
- package/dist/types/EmbedApp.d.ts +2 -0
- package/dist/types/activity.js +50 -0
- package/dist/types/asset.d.ts +2 -0
- package/dist/types/assets/chains/index.d.ts +3 -0
- package/dist/types/assets/rails/index.d.ts +12 -0
- package/dist/types/assets/tokens/index.d.ts +1 -0
- package/dist/types/browser.d.ts +1 -0
- package/dist/types/components/AccountChip.d.ts +10 -0
- package/dist/types/components/ActivityFeed.d.ts +46 -0
- package/dist/types/components/AssetsStrip.d.ts +14 -0
- package/dist/types/components/AuthorizedAgents.d.ts +15 -0
- package/dist/types/components/Chevron.d.ts +16 -0
- package/dist/types/components/ErrorDisplay.d.ts +44 -0
- package/dist/types/components/InfoButton.d.ts +6 -0
- package/dist/types/components/IntentTimeline.d.ts +41 -0
- package/dist/types/components/LinksSignIn.d.ts +13 -0
- package/dist/types/components/MobileSigningBanner.d.ts +16 -0
- package/dist/types/components/PermitBadge.d.ts +17 -0
- package/dist/types/components/PrivacyBars.d.ts +12 -0
- package/dist/types/components/PrivacyPanel.d.ts +33 -0
- package/dist/types/components/QuoteDetails.d.ts +56 -0
- package/dist/types/components/RampActivityList.d.ts +14 -0
- package/dist/types/components/ReceiptCommand.d.ts +12 -0
- package/dist/types/components/SessionReloadBanner.d.ts +8 -0
- package/dist/types/components/SolverRace.d.ts +35 -0
- package/dist/types/components/StealthClaims.d.ts +51 -0
- package/dist/types/components/SwapFlowModal.d.ts +138 -0
- package/dist/types/components/Toast.d.ts +10 -0
- package/dist/types/components/TokenIcon.d.ts +17 -0
- package/dist/types/components/TokenSearchModal.d.ts +28 -0
- package/dist/types/components/TransactionPreview.d.ts +34 -0
- package/dist/types/components/WalletProvider.d.ts +12 -0
- package/dist/types/components/WrapModal.d.ts +19 -0
- package/dist/types/components/swap-flow/CantonEscrowPanel.d.ts +14 -0
- package/dist/types/components/swap-flow/CantonEscrowStatus.d.ts +30 -0
- package/dist/types/components/swap-flow/DepositInstructions.d.ts +75 -0
- package/dist/types/components/swap-flow/QrCode.d.ts +18 -0
- package/dist/types/components/swap-flow/SwapResult.d.ts +66 -0
- package/dist/types/components/swap-flow/depositScreen.d.ts +67 -0
- package/dist/types/components/widgetTabsContext.d.ts +21 -0
- package/dist/types/config.d.ts +104 -0
- package/dist/types/configurator-model.d.ts +9 -0
- package/dist/types/configurator.d.ts +3 -0
- package/dist/types/constants.d.ts +52 -0
- package/dist/types/hooks/applyTheme.d.ts +7 -0
- package/dist/types/hooks/useAgentRegistry.d.ts +13 -0
- package/dist/types/hooks/useAgentStream.d.ts +15 -0
- package/dist/types/hooks/useCantonEscrow.d.ts +40 -0
- package/dist/types/hooks/useCapabilities.d.ts +83 -0
- package/dist/types/hooks/useEmbedLook.d.ts +4 -0
- package/dist/types/hooks/useFocusTrap.d.ts +7 -0
- package/dist/types/hooks/useIntent.d.ts +156 -0
- package/dist/types/hooks/useIntentStatusPoll.d.ts +107 -0
- package/dist/types/hooks/useIntentStream.d.ts +34 -0
- package/dist/types/hooks/useLocalActivity.d.ts +22 -0
- package/dist/types/hooks/useLocalSends.d.ts +8 -0
- package/dist/types/hooks/useLocalStorage.d.ts +8 -0
- package/dist/types/hooks/useOrderHistory.d.ts +52 -0
- package/dist/types/hooks/usePermit.d.ts +84 -0
- package/dist/types/hooks/usePrices.d.ts +72 -0
- package/dist/types/hooks/usePublicBalances.d.ts +19 -0
- package/dist/types/hooks/useRampSummaries.d.ts +9 -0
- package/dist/types/hooks/useRecipientBalance.d.ts +58 -0
- package/dist/types/hooks/useSettlements.d.ts +14 -0
- package/dist/types/hooks/useStealth.d.ts +72 -0
- package/dist/types/hooks/useStealthClaim.d.ts +96 -0
- package/dist/types/hooks/useStealthScanner.d.ts +44 -0
- package/dist/types/hooks/useTheme.d.ts +29 -0
- package/dist/types/hooks/useTierInfo.d.ts +23 -0
- package/dist/types/hooks/useTrustScore.d.ts +16 -0
- package/dist/types/hooks/useWalletSession.d.ts +21 -0
- package/dist/types/hooks/useWrapEth.d.ts +21 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +8 -0
- package/dist/types/integration.d.ts +9 -0
- package/dist/types/intent.js +85 -0
- package/dist/types/lib/activityValue.d.ts +16 -0
- package/dist/types/lib/agentConnect.d.ts +23 -0
- package/dist/types/lib/agentRegistry.d.ts +47 -0
- package/dist/types/lib/agentStreamVerify.d.ts +29 -0
- package/dist/types/lib/api.d.ts +41 -0
- package/dist/types/lib/auth.d.ts +6 -0
- package/dist/types/lib/authFetch.d.ts +14 -0
- package/dist/types/lib/aztecTokens.d.ts +15 -0
- package/dist/types/lib/balances.d.ts +88 -0
- package/dist/types/lib/capabilities.d.ts +3 -0
- package/dist/types/lib/claimSubmitPoll.d.ts +114 -0
- package/dist/types/lib/debug.d.ts +13 -0
- package/dist/types/lib/declineGuidance.d.ts +55 -0
- package/dist/types/lib/displayFallbacks.d.ts +7 -0
- package/dist/types/lib/eip712.d.ts +61 -0
- package/dist/types/lib/errorCategory.d.ts +48 -0
- package/dist/types/lib/errorReport.d.ts +15 -0
- package/dist/types/lib/explorerLinks.d.ts +67 -0
- package/dist/types/lib/feesLabel.d.ts +20 -0
- package/dist/types/lib/glyphs.d.ts +52 -0
- package/dist/types/lib/hostBridge.d.ts +11 -0
- package/dist/types/lib/hostOrigin.d.ts +30 -0
- package/dist/types/lib/intentAPI.d.ts +15 -0
- package/dist/types/lib/linksSignIn.d.ts +13 -0
- package/dist/types/lib/localActivity.d.ts +135 -0
- package/dist/types/lib/localSends.d.ts +55 -0
- package/dist/types/lib/mobileWallet.d.ts +27 -0
- package/dist/types/lib/pairAvailability.d.ts +106 -0
- package/dist/types/lib/paymentSummary.d.ts +18 -0
- package/dist/types/lib/permits.d.ts +25 -0
- package/dist/types/lib/priceImpact.d.ts +165 -0
- package/dist/types/lib/providers.d.ts +14 -0
- package/dist/types/lib/qr.d.ts +19 -0
- package/dist/types/lib/quoteCost.d.ts +45 -0
- package/dist/types/lib/quoteCountdown.d.ts +34 -0
- package/dist/types/lib/rampHostGate.d.ts +15 -0
- package/dist/types/lib/rampLifecycle.d.ts +20 -0
- package/dist/types/lib/receiptCost.d.ts +64 -0
- package/dist/types/lib/recipient/index.d.ts +33 -0
- package/dist/types/lib/recipient/recent.d.ts +5 -0
- package/dist/types/lib/recipientReceipt.d.ts +25 -0
- package/dist/types/lib/reportClient.d.ts +9 -0
- package/dist/types/lib/sessionExpiry.d.ts +11 -0
- package/dist/types/lib/settlementAvailability.d.ts +61 -0
- package/dist/types/lib/stealth.d.ts +75 -0
- package/dist/types/lib/swapFlowPhase.d.ts +76 -0
- package/dist/types/lib/swapStatusCopy.d.ts +57 -0
- package/dist/types/lib/tierProgressDisplay.d.ts +35 -0
- package/dist/types/lib/tierUnlock.d.ts +25 -0
- package/dist/types/lib/tradeLifecycle.d.ts +32 -0
- package/dist/types/lib/tronlink.d.ts +62 -0
- package/dist/types/lib/walletSession.d.ts +38 -0
- package/dist/types/pages/Configurator.d.ts +25 -0
- package/dist/types/pages/Trade.d.ts +36 -0
- package/dist/types/pages/configurator/AllowedAssetsSection.d.ts +17 -0
- package/dist/types/pages/configurator/AppearanceSection.d.ts +22 -0
- package/dist/types/pages/configurator/CodeDock.d.ts +19 -0
- package/dist/types/pages/configurator/DeveloperSection.d.ts +12 -0
- package/dist/types/pages/configurator/IntegrationSection.d.ts +20 -0
- package/dist/types/pages/configurator/LayoutSection.d.ts +20 -0
- package/dist/types/pages/configurator/PolicyNote.d.ts +6 -0
- package/dist/types/pages/configurator/PreviewStage.d.ts +22 -0
- package/dist/types/pages/configurator/PrivacySection.d.ts +16 -0
- package/dist/types/pages/configurator/RouteSection.d.ts +30 -0
- package/dist/types/pages/configurator/Settings.d.ts +25 -0
- package/dist/types/pages/configurator/SharedLinkBanner.d.ts +16 -0
- package/dist/types/pages/configurator/SurfaceSection.d.ts +5 -0
- package/dist/types/pages/configurator/WhatUsersSee.d.ts +30 -0
- package/dist/types/pages/configurator/codeShown.d.ts +15 -0
- package/dist/types/pages/configurator/configuratorUrl.d.ts +38 -0
- package/dist/types/pages/configurator/paramsDraft.d.ts +32 -0
- package/dist/types/pages/configurator/previewModel.d.ts +20 -0
- package/dist/types/pages/configurator/previewQuote.d.ts +96 -0
- package/dist/types/pages/configurator/routePicks.d.ts +75 -0
- package/dist/types/pages/configurator/snippets.d.ts +23 -0
- package/dist/types/pages/configurator/surfaceParams.d.ts +9 -0
- package/dist/types/pages/configurator/useCodeCheck.d.ts +56 -0
- package/dist/types/pages/configurator/useConfiguratorUrl.d.ts +21 -0
- package/dist/types/pages/configurator/useMediaQuery.d.ts +5 -0
- package/dist/types/pages/configurator/useParamsDraft.d.ts +29 -0
- package/dist/types/pages/configurator/usePreviewFee.d.ts +74 -0
- package/dist/types/pages/send/MetaAddressValue.d.ts +9 -0
- package/dist/types/pages/send/Receive.d.ts +3 -0
- package/dist/types/pages/send/RecentRecipients.d.ts +3 -0
- package/dist/types/pages/send/RecipientChip.d.ts +4 -0
- package/dist/types/pages/send/ScanRecipient.d.ts +3 -0
- package/dist/types/pages/send/SendForm.d.ts +17 -0
- package/dist/types/pages/send/SendPanel.d.ts +19 -0
- package/dist/types/pages/send/ShieldedDisclosure.d.ts +1 -0
- package/dist/types/pages/send/StealthInvite.d.ts +1 -0
- package/dist/types/pages/send/addressSend.d.ts +62 -0
- package/dist/types/pages/send/sendCopy.d.ts +9 -0
- package/dist/types/pages/send/sendRetry.d.ts +10 -0
- package/dist/types/pages/send/stealthRecipient.d.ts +37 -0
- package/dist/types/pages/send/stealthSend.d.ts +18 -0
- package/dist/types/pages/send/useAddressSend.d.ts +61 -0
- package/dist/types/pages/send/useSendRecipient.d.ts +13 -0
- package/dist/types/pages/trade/BuyPanel.d.ts +22 -0
- package/dist/types/pages/trade/RampRecovery.d.ts +22 -0
- package/dist/types/pages/trade/RecipientSheet.d.ts +11 -0
- package/dist/types/pages/trade/Selectors.d.ts +24 -0
- package/dist/types/pages/trade/SwapPanel.d.ts +34 -0
- package/dist/types/pages/trade/WidgetTabs.d.ts +46 -0
- package/dist/types/pages/trade/canton.d.ts +94 -0
- package/dist/types/pages/trade/config.d.ts +185 -0
- package/dist/types/pages/trade/embedNarrowing.d.ts +28 -0
- package/dist/types/pages/trade/embedParams.d.ts +299 -0
- package/dist/types/pages/trade/embedTheme.d.ts +14 -0
- package/dist/types/pages/trade/harness.d.ts +120 -0
- package/dist/types/pages/trade/orderMinimum.d.ts +5 -0
- package/dist/types/pages/trade/resumeSwap.d.ts +139 -0
- package/dist/types/pages/trade/settlementCopy.d.ts +42 -0
- package/dist/types/pages/trade/useAmountFit.d.ts +25 -0
- package/dist/types/pages/trade/useEmbedDefaults.d.ts +28 -0
- package/dist/types/pages/trade/useSettlementGating.d.ts +152 -0
- package/dist/types/pages/trade/useSwapAmount.d.ts +93 -0
- package/dist/types/pages/trade/useSwapFlow.d.ts +152 -0
- package/dist/types/pages/trade/useSwapPanel.d.ts +170 -0
- package/dist/types/pages/trade/useSwapRoute.d.ts +215 -0
- package/dist/types/pages/trade/useTronLinkFill.d.ts +13 -0
- package/dist/types/pages/trade/zkMoney.d.ts +28 -0
- package/dist/types/promiseWithResolvers.d.ts +12 -0
- package/dist/types/ramp/availability/RailTiles.d.ts +26 -0
- package/dist/types/ramp/availability/RampDisclosure.d.ts +9 -0
- package/dist/types/ramp/availability/RampRails.d.ts +27 -0
- package/dist/types/ramp/availability/model.d.ts +51 -0
- package/dist/types/ramp/availability/useRampDiscovery.d.ts +60 -0
- package/dist/types/ramp/offramp/CompletedPrerequisite.d.ts +5 -0
- package/dist/types/ramp/offramp/OfframpActivityList.d.ts +12 -0
- package/dist/types/ramp/offramp/OfframpRoute.d.ts +8 -0
- package/dist/types/ramp/offramp/OfframpRouteReview.d.ts +12 -0
- package/dist/types/ramp/offramp/PaymentAppSend.d.ts +27 -0
- package/dist/types/ramp/offramp/localOfframps.d.ts +58 -0
- package/dist/types/ramp/offramp/model.d.ts +46 -0
- package/dist/types/ramp/offramp/port.d.ts +55 -0
- package/dist/types/ramp/offramp/prerequisite.d.ts +271 -0
- package/dist/types/ramp/offramp/useOfframp.d.ts +87 -0
- package/dist/types/ramp/offramp/useOfframpRails.d.ts +36 -0
- package/dist/types/ramp/peer/BuyOnramp.d.ts +21 -0
- package/dist/types/ramp/peer/OnrampSteps.d.ts +32 -0
- package/dist/types/ramp/peer/buyerDriver.d.ts +48 -0
- package/dist/types/ramp/peer/discovery.d.ts +17 -0
- package/dist/types/ramp/peer/environment.d.ts +2 -0
- package/dist/types/ramp/peer/index.d.ts +14 -0
- package/dist/types/ramp/peer/liveProvider.d.ts +15 -0
- package/dist/types/ramp/peer/liveReads.d.ts +102 -0
- package/dist/types/ramp/peer/maker.d.ts +4 -0
- package/dist/types/ramp/peer/normalization.d.ts +33 -0
- package/dist/types/ramp/peer/offramp.d.ts +130 -0
- package/dist/types/ramp/peer/onramp.d.ts +134 -0
- package/dist/types/ramp/peer/preview.d.ts +14 -0
- package/dist/types/ramp/peer/protectedMapping.d.ts +22 -0
- package/dist/types/ramp/peer/runtime.d.ts +15 -0
- package/dist/types/ramp/peer/sdkMaker.d.ts +67 -0
- package/dist/types/ramp/peer/types.d.ts +64 -0
- package/dist/types/ramp/recovery/ResumeOnramp.d.ts +37 -0
- package/dist/types/ramp/recovery/summaries.d.ts +71 -0
- package/dist/types/ramp/route/OnrampRoute.d.ts +12 -0
- package/dist/types/ramp/route/RampRouteSteps.d.ts +16 -0
- package/dist/types/ramp/route/routeActivity.d.ts +4 -0
- package/dist/types/ramp/route/useXochiRampDriver.d.ts +22 -0
- package/dist/types/result.js +14 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/types/activity.d.ts +184 -0
- package/dist/types/types/index.d.ts +20 -0
- package/dist/types/types/intent.d.ts +85 -0
- package/dist/types/types/result.d.ts +53 -0
- package/dist/types/utils/format.d.ts +88 -0
- package/dist/types/wagmi.d.ts +142 -0
- package/dist/types/widgetLibModule.d.ts +8 -0
- package/dist/utils/format.js +109 -0
- package/dist/wagmi.js +188 -0
- package/dist/widgetLibModule.js +4 -0
- package/licenses/Monaspace-OFL-1.1.txt +93 -0
- package/licenses/assets.json +132 -0
- package/licenses/rainbowkit-MIT.txt +9 -0
- package/licenses/xochi-shared-MIT.txt +21 -0
- 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
|
+
};
|