@xochi/widget 0.0.0-stage → 0.1.1
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 +79 -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 +68 -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 +408 -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 +230 -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 +325 -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 +485 -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 +203 -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 +202 -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 +972 -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 +17473 -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 +46 -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 +142 -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 +37 -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 +68 -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 +161 -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 +90 -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 +50 -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 +143 -0
- package/dist/types/widgetLibModule.d.ts +8 -0
- package/dist/utils/format.js +109 -0
- package/dist/wagmi.js +210 -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,635 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo, useState, useId, useRef, useEffect, useLayoutEffect } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useConnectModal } from "@rainbow-me/rainbowkit";
|
|
5
|
+
import { useAccount, useConfig } from "wagmi";
|
|
6
|
+
import { watchAccount } from "wagmi/actions";
|
|
7
|
+
import { useOrderHistory } from "../hooks/useOrderHistory.js";
|
|
8
|
+
import { useWalletSession } from "../hooks/useWalletSession.js";
|
|
9
|
+
import { useLocalActivity } from "../hooks/useLocalActivity.js";
|
|
10
|
+
import { useAgentRegistry } from "../hooks/useAgentRegistry.js";
|
|
11
|
+
import { useAgentStream } from "../hooks/useAgentStream.js";
|
|
12
|
+
import { useStealthClaim } from "../hooks/useStealthClaim.js";
|
|
13
|
+
import { useTrustScore } from "../hooks/useTrustScore.js";
|
|
14
|
+
import { useSettlements } from "../hooks/useSettlements.js";
|
|
15
|
+
import { useCapabilities } from "../hooks/useCapabilities.js";
|
|
16
|
+
import { useToast } from "../components/Toast.js";
|
|
17
|
+
import { AssetsStrip } from "../components/AssetsStrip.js";
|
|
18
|
+
import { MobileSigningBanner } from "../components/MobileSigningBanner.js";
|
|
19
|
+
import { ActivityFeed } from "../components/ActivityFeed.js";
|
|
20
|
+
import { PrivacyPanel } from "../components/PrivacyPanel.js";
|
|
21
|
+
import { StealthClaims } from "../components/StealthClaims.js";
|
|
22
|
+
import { AccountChip } from "../components/AccountChip.js";
|
|
23
|
+
import { useLocalSends } from "../hooks/useLocalSends.js";
|
|
24
|
+
import { useLocalOfframps } from "../ramp/offramp/OfframpActivityList.js";
|
|
25
|
+
import { useRampSummaries } from "../hooks/useRampSummaries.js";
|
|
26
|
+
import { SwapPanel } from "./trade/SwapPanel.js";
|
|
27
|
+
import { PaymentAppSend } from "../ramp/offramp/PaymentAppSend.js";
|
|
28
|
+
import { useRampHostGate, RAMP_HOST_GATE_COPY } from "../lib/rampHostGate.js";
|
|
29
|
+
import { BuyPanel } from "./trade/BuyPanel.js";
|
|
30
|
+
import { PurchaseRecovery, CashOutRecovery } from "./trade/RampRecovery.js";
|
|
31
|
+
import { useRecipientDeps } from "./send/useSendRecipient.js";
|
|
32
|
+
import { recallSendRecipient, rememberSendRecipient } from "./send/sendRetry.js";
|
|
33
|
+
import { classifyRecipientInput, resolveRecipient } from "../lib/recipient/index.js";
|
|
34
|
+
import { parseStealthMetaAddress, abbreviateMetaAddress } from "./send/stealthRecipient.js";
|
|
35
|
+
import { truncateAddress } from "../utils/format.js";
|
|
36
|
+
import { SendPanel } from "./send/SendPanel.js";
|
|
37
|
+
import { WidgetTabs, widgetTabIds } from "./trade/WidgetTabs.js";
|
|
38
|
+
import { STEALTH_CLAIM_LIVE, SHIELDED_ACCOUNTS_LIVE } from "./trade/config.js";
|
|
39
|
+
import { CLAIMS_HASH, claimsPath } from "./trade/embedParams.js";
|
|
40
|
+
import { widgetSurfaces } from "./trade/embedNarrowing.js";
|
|
41
|
+
import { WidgetTabsContext, ClaimInXochiAppContext, CLAIM_IN_XOCHI_APP } from "../components/widgetTabsContext.js";
|
|
42
|
+
import { HOST_WALLET_ID } from "../wagmi.js";
|
|
43
|
+
import { reportSwapFailure } from "../lib/reportClient.js";
|
|
44
|
+
import { buildHistoryFailureRef } from "../lib/swapFlowPhase.js";
|
|
45
|
+
import { mergeHistorySwap } from "../lib/localActivity.js";
|
|
46
|
+
import { getWalletSessionAddress, hasWalletSession, getWalletSessionGeneration, getWalletToken } from "../lib/walletSession.js";
|
|
47
|
+
import { getTokenInfoForChain } from "@xochi/client";
|
|
48
|
+
import { hostBridge } from "../lib/hostBridge.js";
|
|
49
|
+
import { parseEmbedParams } from "@xochi/widget-lib";
|
|
50
|
+
import { readWidgetEmbedConfig, APP_VERSION } from "../config.js";
|
|
51
|
+
const MIN_REFRESH_SPIN_MS = 550;
|
|
52
|
+
function useWalletUi(connection) {
|
|
53
|
+
const [walletUi, setWalletUi] = useState(() => connection?.walletUi() ?? "widget");
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (connection === null) {
|
|
56
|
+
setWalletUi("widget");
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
setWalletUi(connection.walletUi());
|
|
60
|
+
return connection.onWalletUi(setWalletUi);
|
|
61
|
+
}, [connection]);
|
|
62
|
+
return walletUi;
|
|
63
|
+
}
|
|
64
|
+
function Trade({
|
|
65
|
+
look,
|
|
66
|
+
hostConnection = hostBridge,
|
|
67
|
+
embed,
|
|
68
|
+
enableAgents = typeof window !== "undefined" && new URLSearchParams(window.location.search).get("agents") === "1"
|
|
69
|
+
}) {
|
|
70
|
+
const { isConnected, address, connector } = useAccount();
|
|
71
|
+
const config = useConfig();
|
|
72
|
+
const { showToast } = useToast();
|
|
73
|
+
const tabsShown = look.layout === "full";
|
|
74
|
+
const claimInXochiApp = !tabsShown && connector?.id === HOST_WALLET_ID;
|
|
75
|
+
const hostOwnsWalletUi = useWalletUi(hostConnection) === "host";
|
|
76
|
+
const requestHostConnect = useCallback(() => {
|
|
77
|
+
hostConnection?.requestConnect();
|
|
78
|
+
}, [hostConnection]);
|
|
79
|
+
const stealthClaim = useStealthClaim();
|
|
80
|
+
const { trustScore, verifyState } = useTrustScore();
|
|
81
|
+
const { features } = useCapabilities();
|
|
82
|
+
const {
|
|
83
|
+
orders,
|
|
84
|
+
isLoading: ordersLoading,
|
|
85
|
+
error: ordersError,
|
|
86
|
+
refresh: refreshOrders,
|
|
87
|
+
hasMore: hasMoreOrders,
|
|
88
|
+
loadMore: loadMoreOrders,
|
|
89
|
+
needsSignIn: historyNeedsSignIn
|
|
90
|
+
} = useOrderHistory();
|
|
91
|
+
const { state: sessionState, ensureSession } = useWalletSession();
|
|
92
|
+
const sessionWallet = getWalletSessionAddress() ?? void 0;
|
|
93
|
+
const { claimableCount, refresh: refreshSettlements } = useSettlements();
|
|
94
|
+
const handleActivitySignIn = useCallback(async () => {
|
|
95
|
+
const token = await ensureSession();
|
|
96
|
+
if (token) refreshOrders();
|
|
97
|
+
}, [ensureSession, refreshOrders]);
|
|
98
|
+
const handleSwapComplete = useCallback(
|
|
99
|
+
(item) => {
|
|
100
|
+
const from = getTokenInfoForChain(item.data.fromToken, item.data.fromChainId)?.symbol ?? item.data.fromToken;
|
|
101
|
+
const to = getTokenInfoForChain(item.data.toToken, item.data.toChainId)?.symbol ?? item.data.toToken;
|
|
102
|
+
const send = item.data.sendRecipientDisplay;
|
|
103
|
+
showToast(
|
|
104
|
+
send ? `Sent with ${send.mode} to ${send.label}` : item.data.swapRecipientLabel || item.data.recipientTag ? `Sent to ${item.data.swapRecipientLabel ?? `@${item.data.recipientTag}`}` : `${from} to ${to} swap complete`,
|
|
105
|
+
"success"
|
|
106
|
+
);
|
|
107
|
+
},
|
|
108
|
+
[showToast]
|
|
109
|
+
);
|
|
110
|
+
const { swaps: localSwaps, refresh: refreshLocal } = useLocalActivity({
|
|
111
|
+
onComplete: handleSwapComplete
|
|
112
|
+
});
|
|
113
|
+
const localSends = useLocalSends();
|
|
114
|
+
const localOfframps = useLocalOfframps();
|
|
115
|
+
const localRamps = useRampSummaries();
|
|
116
|
+
const { agents } = useAgentRegistry();
|
|
117
|
+
useAgentStream(agents);
|
|
118
|
+
const activities = useMemo(() => {
|
|
119
|
+
const serverSwaps = orders.map((order) => ({
|
|
120
|
+
id: order.id,
|
|
121
|
+
type: "swap",
|
|
122
|
+
timestamp: order.timestamp,
|
|
123
|
+
status: order.status === "completed" ? "completed" : order.status === "failed" || order.status === "expired" ? "failed" : "pending",
|
|
124
|
+
intentStatus: order.status,
|
|
125
|
+
data: {
|
|
126
|
+
fromChainId: order.fromChainId,
|
|
127
|
+
toChainId: order.toChainId,
|
|
128
|
+
fromToken: order.fromToken,
|
|
129
|
+
toToken: order.toToken,
|
|
130
|
+
fromAmount: order.fromAmount,
|
|
131
|
+
toAmount: order.toAmount,
|
|
132
|
+
tier: order.tier,
|
|
133
|
+
feeRate: order.feeRate,
|
|
134
|
+
txHash: order.txHash,
|
|
135
|
+
receivingTxHash: order.receivingTxHash,
|
|
136
|
+
isCrossChain: order.isCrossChain,
|
|
137
|
+
substatus: order.substatus,
|
|
138
|
+
...order.settlementType === "public" && {
|
|
139
|
+
settlementType: "public",
|
|
140
|
+
...order.recipientTag !== void 0 && { recipientTag: order.recipientTag }
|
|
141
|
+
},
|
|
142
|
+
// Stealth would also put the claim action on server rows, a change of its own.
|
|
143
|
+
...order.settlementType === "shielded" && {
|
|
144
|
+
settlementType: "shielded",
|
|
145
|
+
destinationType: "aztec"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
const byId = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const s of localSwaps) byId.set(s.id, s);
|
|
151
|
+
for (const s of serverSwaps) {
|
|
152
|
+
const local = byId.get(s.id);
|
|
153
|
+
const merged = mergeHistorySwap(s, local);
|
|
154
|
+
if (merged !== s && local) {
|
|
155
|
+
merged.data.sendRecipientDisplay = local.data.sendRecipientDisplay;
|
|
156
|
+
merged.data.stealthPayee = local.data.stealthPayee;
|
|
157
|
+
merged.data.swapRecipientLabel = local.data.swapRecipientLabel;
|
|
158
|
+
merged.data.swapRecipientRetryInput = local.data.swapRecipientRetryInput;
|
|
159
|
+
}
|
|
160
|
+
byId.set(s.id, merged);
|
|
161
|
+
}
|
|
162
|
+
return [...byId.values()].sort((a, b) => b.timestamp - a.timestamp);
|
|
163
|
+
}, [orders, localSwaps]);
|
|
164
|
+
const [isRefreshing, setIsRefreshing] = useState(false);
|
|
165
|
+
const refreshActivity = useCallback(() => {
|
|
166
|
+
setIsRefreshing(true);
|
|
167
|
+
const settled = Promise.allSettled([refreshOrders(), refreshLocal()]);
|
|
168
|
+
const floor = new Promise((resolve) => setTimeout(resolve, MIN_REFRESH_SPIN_MS));
|
|
169
|
+
void Promise.all([settled, floor]).then(() => setIsRefreshing(false));
|
|
170
|
+
}, [refreshOrders, refreshLocal]);
|
|
171
|
+
const { openConnectModal } = useConnectModal();
|
|
172
|
+
const rampGate = useRampHostGate();
|
|
173
|
+
const tabsBaseId = useId();
|
|
174
|
+
const modesBaseId = useId();
|
|
175
|
+
const [{ surfaces, fiatCurrency, fromChainId }] = useState(() => {
|
|
176
|
+
const config2 = tabsShown ? embed ?? readWidgetEmbedConfig() : {};
|
|
177
|
+
return {
|
|
178
|
+
surfaces: widgetSurfaces(config2),
|
|
179
|
+
fiatCurrency: config2.fiatCurrency,
|
|
180
|
+
fromChainId: parseEmbedParams(window.location.search).fromChainId
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
const tabShown = (tab) => !tabsShown || surfaces.tabs.includes(tab);
|
|
184
|
+
const swapShown = !tabsShown || surfaces.modes.includes("swap");
|
|
185
|
+
const fallbackTab = surfaces.tabs.find((t) => t !== "claims");
|
|
186
|
+
const claimsAvailable = tabsShown && STEALTH_CLAIM_LIVE && isConnected && tabShown("claims");
|
|
187
|
+
const [selectedTab, setSelectedTab] = useState(
|
|
188
|
+
() => surfaces.initialTab === "claims" ? fallbackTab ?? "claims" : surfaces.initialTab ?? "trade"
|
|
189
|
+
);
|
|
190
|
+
if (selectedTab === "claims" && !claimsAvailable && fallbackTab !== void 0)
|
|
191
|
+
setSelectedTab(fallbackTab);
|
|
192
|
+
const [tradeMode, setTradeMode] = useState(surfaces.initialMode ?? "swap");
|
|
193
|
+
const [claimsWanted, setClaimsWanted] = useState(
|
|
194
|
+
() => tabsShown && (window.location.hash === CLAIMS_HASH || surfaces.initialTab === "claims")
|
|
195
|
+
);
|
|
196
|
+
if (claimsWanted && claimsAvailable) {
|
|
197
|
+
setClaimsWanted(false);
|
|
198
|
+
setSelectedTab("claims");
|
|
199
|
+
}
|
|
200
|
+
const pendingSendRetry = useRef(void 0);
|
|
201
|
+
const cancelSendRetry = useCallback(() => pendingSendRetry.current?.abort(), []);
|
|
202
|
+
const selectTab = useCallback((tab) => {
|
|
203
|
+
if (tab !== "send") pendingSendRetry.current?.abort();
|
|
204
|
+
setClaimsWanted(false);
|
|
205
|
+
setSelectedTab(tab);
|
|
206
|
+
if (tab !== "send") {
|
|
207
|
+
setSendQuoteRecipient(void 0);
|
|
208
|
+
setRetryPrefill((prefill) => prefill?.fromSend ? null : prefill);
|
|
209
|
+
}
|
|
210
|
+
}, []);
|
|
211
|
+
const tabs = [
|
|
212
|
+
{ id: "trade", label: "Trade" },
|
|
213
|
+
{ id: "send", label: "Send" },
|
|
214
|
+
{ id: "activity", label: "Activity" }
|
|
215
|
+
].filter((t) => tabShown(t.id));
|
|
216
|
+
if (claimsAvailable)
|
|
217
|
+
tabs.push({
|
|
218
|
+
id: "claims",
|
|
219
|
+
label: "Claims",
|
|
220
|
+
count: claimableCount,
|
|
221
|
+
countLabel: "ready to claim"
|
|
222
|
+
});
|
|
223
|
+
const modeTabs = surfaces.modes.map((mode) => ({
|
|
224
|
+
id: mode,
|
|
225
|
+
label: mode === "onramp" ? "Buy" : mode === "offramp" ? "Cash out" : "Swap"
|
|
226
|
+
}));
|
|
227
|
+
const modePanelProps = (mode) => {
|
|
228
|
+
if (!tabsShown) return { className: "widget-panel" };
|
|
229
|
+
const ids = widgetTabIds(modesBaseId, mode);
|
|
230
|
+
return {
|
|
231
|
+
role: "tabpanel",
|
|
232
|
+
id: ids.panel,
|
|
233
|
+
"aria-labelledby": ids.tab,
|
|
234
|
+
hidden: tradeMode !== mode,
|
|
235
|
+
className: "widget-panel"
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
const panelProps = (tab) => {
|
|
239
|
+
if (!tabsShown) return { className: "widget-panel" };
|
|
240
|
+
const ids = widgetTabIds(tabsBaseId, tab);
|
|
241
|
+
return {
|
|
242
|
+
role: "tabpanel",
|
|
243
|
+
id: ids.panel,
|
|
244
|
+
"aria-labelledby": ids.tab,
|
|
245
|
+
hidden: selectedTab !== tab,
|
|
246
|
+
className: "widget-panel"
|
|
247
|
+
};
|
|
248
|
+
};
|
|
249
|
+
const [retryPrefill, setRetryPrefill] = useState(null);
|
|
250
|
+
const retryNonce = useRef(0);
|
|
251
|
+
const recipientDeps = useRecipientDeps();
|
|
252
|
+
const [sendRetry, setSendRetry] = useState();
|
|
253
|
+
useEffect(() => cancelSendRetry, [address, cancelSendRetry]);
|
|
254
|
+
const [sendQuoteRecipient, setSendQuoteRecipient] = useState();
|
|
255
|
+
const showSendQuote = sendQuoteRecipient !== void 0;
|
|
256
|
+
const tradeSwapMount = useRef(null);
|
|
257
|
+
const sendSwapMount = useRef(null);
|
|
258
|
+
const [swapSurface] = useState(() => {
|
|
259
|
+
const element = document.createElement("div");
|
|
260
|
+
element.className = "send-swap-mount";
|
|
261
|
+
return element;
|
|
262
|
+
});
|
|
263
|
+
useLayoutEffect(() => {
|
|
264
|
+
const target = selectedTab === "send" && showSendQuote ? sendSwapMount.current : tradeSwapMount.current;
|
|
265
|
+
if (target) target.append(swapSurface);
|
|
266
|
+
else swapSurface.remove();
|
|
267
|
+
}, [selectedTab, showSendQuote, swapShown, swapSurface]);
|
|
268
|
+
const [stealthSettledHere, setStealthSettledHere] = useState(false);
|
|
269
|
+
const handleStealthSettled = useCallback(() => {
|
|
270
|
+
refreshSettlements();
|
|
271
|
+
if (!tabsShown) {
|
|
272
|
+
setStealthSettledHere(true);
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
void stealthClaim.scan();
|
|
276
|
+
selectTab("claims");
|
|
277
|
+
}, [tabsShown, stealthClaim, refreshSettlements, selectTab]);
|
|
278
|
+
const handleClaimNudge = useCallback(() => {
|
|
279
|
+
if (stealthClaim.isInitialized) {
|
|
280
|
+
void stealthClaim.scan();
|
|
281
|
+
}
|
|
282
|
+
refreshSettlements();
|
|
283
|
+
selectTab("claims");
|
|
284
|
+
}, [stealthClaim, refreshSettlements, selectTab]);
|
|
285
|
+
const openClaims = useCallback(() => {
|
|
286
|
+
window.open(claimsPath(look.theme), "_blank", "noopener,noreferrer");
|
|
287
|
+
}, [look.theme]);
|
|
288
|
+
const stealthNeedsSignIn = isConnected && !!address && !hasWalletSession(address);
|
|
289
|
+
const stealthSignInRequest = useRef(null);
|
|
290
|
+
const [pendingStealthScan, setPendingStealthScan] = useState(null);
|
|
291
|
+
useEffect(() => {
|
|
292
|
+
const unsubscribe = watchAccount(config, {
|
|
293
|
+
onChange(account, previous) {
|
|
294
|
+
if (account.status !== "connected" || account.address?.toLowerCase() !== previous.address?.toLowerCase() || account.chainId !== previous.chainId || account.connector?.uid !== previous.connector?.uid) {
|
|
295
|
+
stealthSignInRequest.current = null;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return () => {
|
|
300
|
+
stealthSignInRequest.current = null;
|
|
301
|
+
unsubscribe();
|
|
302
|
+
};
|
|
303
|
+
}, [config]);
|
|
304
|
+
const handleStealthSignIn = useCallback(() => {
|
|
305
|
+
const request = {};
|
|
306
|
+
stealthSignInRequest.current = request;
|
|
307
|
+
void ensureSession().then((token) => {
|
|
308
|
+
if (token && stealthSignInRequest.current === request) {
|
|
309
|
+
setPendingStealthScan({ request, token, generation: getWalletSessionGeneration() });
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
}, [ensureSession]);
|
|
313
|
+
useEffect(() => {
|
|
314
|
+
if (!pendingStealthScan) return;
|
|
315
|
+
setPendingStealthScan(null);
|
|
316
|
+
if (stealthSignInRequest.current !== pendingStealthScan.request || sessionState !== "active" || getWalletToken() !== pendingStealthScan.token || getWalletSessionGeneration() !== pendingStealthScan.generation) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
stealthSignInRequest.current = null;
|
|
320
|
+
void stealthClaim.scan();
|
|
321
|
+
refreshSettlements();
|
|
322
|
+
}, [pendingStealthScan, sessionState, stealthClaim.scan, refreshSettlements]);
|
|
323
|
+
const handleRetrySwap = useCallback(
|
|
324
|
+
(item) => {
|
|
325
|
+
pendingSendRetry.current?.abort();
|
|
326
|
+
retryNonce.current += 1;
|
|
327
|
+
const prefill = {
|
|
328
|
+
nonce: retryNonce.current,
|
|
329
|
+
fromChainId: item.data.fromChainId,
|
|
330
|
+
toChainId: item.data.toChainId,
|
|
331
|
+
fromToken: item.data.fromToken,
|
|
332
|
+
toToken: item.data.toToken,
|
|
333
|
+
fromAmount: item.data.fromAmount,
|
|
334
|
+
settlement: item.data.settlementType,
|
|
335
|
+
stealthPayee: item.data.stealthPayee,
|
|
336
|
+
recipientTag: item.data.recipientTag,
|
|
337
|
+
refundAddress: item.data.deposit?.attested.refund_address ?? void 0
|
|
338
|
+
};
|
|
339
|
+
setSendQuoteRecipient(void 0);
|
|
340
|
+
const send = item.data.sendRecipientDisplay;
|
|
341
|
+
if (send) {
|
|
342
|
+
if (!surfaces.tabs.includes("send")) {
|
|
343
|
+
showToast("Send is unavailable in this widget.", "error");
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const remembered = recallSendRecipient(item.id);
|
|
347
|
+
const kind = classifyRecipientInput(send.retryInput ?? "");
|
|
348
|
+
const input = remembered?.input ?? (kind === "ens" || kind === "gns" || kind === "wns" || kind === "zkmoney" ? send.retryInput : void 0);
|
|
349
|
+
setRetryPrefill(null);
|
|
350
|
+
setSendRetry({ ...prefill, input, mode: send.mode });
|
|
351
|
+
selectTab("send");
|
|
352
|
+
const controller = new AbortController();
|
|
353
|
+
pendingSendRetry.current = controller;
|
|
354
|
+
const reopen = (recipient) => {
|
|
355
|
+
if (controller.signal.aborted) return;
|
|
356
|
+
const meta = parseStealthMetaAddress(recipient.stealthMetaAddress ?? "");
|
|
357
|
+
const incomingTag = recipient.shieldedAlias;
|
|
358
|
+
if (send.mode === "Stealth" ? !meta.ok : !incomingTag) return;
|
|
359
|
+
const display = {
|
|
360
|
+
mode: send.mode,
|
|
361
|
+
label: send.label,
|
|
362
|
+
retryInput: remembered ? void 0 : input
|
|
363
|
+
};
|
|
364
|
+
rememberSendRecipient(display, recipient);
|
|
365
|
+
setRetryPrefill({
|
|
366
|
+
...prefill,
|
|
367
|
+
fromSend: true,
|
|
368
|
+
sendRecipientDisplay: display,
|
|
369
|
+
settlement: send.mode === "Stealth" ? "stealth" : "public",
|
|
370
|
+
stealthRecipient: send.mode === "Stealth" && meta.ok ? meta.recipient : void 0,
|
|
371
|
+
recipientTag: send.mode === "Shielded" ? incomingTag : void 0
|
|
372
|
+
});
|
|
373
|
+
setSendQuoteRecipient(recipient);
|
|
374
|
+
};
|
|
375
|
+
if (remembered) {
|
|
376
|
+
reopen(remembered);
|
|
377
|
+
} else if (input && recipientDeps) {
|
|
378
|
+
void resolveRecipient(input, recipientDeps, controller.signal).then((result) => {
|
|
379
|
+
if (result.status === "resolved") reopen(result.recipient);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (item.data.swapRecipientLabel || prefill.stealthPayee === "other" || prefill.recipientTag) {
|
|
385
|
+
const input = item.data.swapRecipientRetryInput;
|
|
386
|
+
const kind = classifyRecipientInput(input ?? "");
|
|
387
|
+
setRetryPrefill({
|
|
388
|
+
...prefill,
|
|
389
|
+
recipientTag: void 0,
|
|
390
|
+
swapRecipientRetry: {
|
|
391
|
+
zkMoneyDestination: !!prefill.recipientTag,
|
|
392
|
+
input: kind === "ens" || kind === "gns" || kind === "wns" || kind === "zkmoney" ? input : void 0
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
} else {
|
|
396
|
+
setRetryPrefill(prefill);
|
|
397
|
+
}
|
|
398
|
+
setTradeMode("swap");
|
|
399
|
+
selectTab("trade");
|
|
400
|
+
},
|
|
401
|
+
[recipientDeps, selectTab, showToast, surfaces.tabs]
|
|
402
|
+
);
|
|
403
|
+
const handleSendQuote = (order, recipient) => {
|
|
404
|
+
pendingSendRetry.current?.abort();
|
|
405
|
+
retryNonce.current += 1;
|
|
406
|
+
const label = recipient.shieldedAlias ? `@${recipient.shieldedAlias}` : recipient.name ?? (recipient.address ? truncateAddress(recipient.address) : abbreviateMetaAddress(recipient.stealthMetaAddress ?? ""));
|
|
407
|
+
const display = {
|
|
408
|
+
label,
|
|
409
|
+
mode: recipient.shieldedAlias ? "Shielded" : "Stealth",
|
|
410
|
+
retryInput: recipient.shieldedAlias ? `${recipient.shieldedAlias}.zk.money` : recipient.kind === "ens" || recipient.kind === "gns" || recipient.kind === "wns" ? recipient.input : void 0
|
|
411
|
+
};
|
|
412
|
+
rememberSendRecipient(display, recipient);
|
|
413
|
+
setRetryPrefill({
|
|
414
|
+
...order,
|
|
415
|
+
nonce: retryNonce.current,
|
|
416
|
+
fromSend: true,
|
|
417
|
+
sendRecipientDisplay: display
|
|
418
|
+
});
|
|
419
|
+
setSendQuoteRecipient(recipient);
|
|
420
|
+
};
|
|
421
|
+
const handleReportSwap = useCallback(
|
|
422
|
+
(item) => {
|
|
423
|
+
const ref = buildHistoryFailureRef(item, address, APP_VERSION);
|
|
424
|
+
void reportSwapFailure(ref);
|
|
425
|
+
showToast("Thanks. Report received.", "success");
|
|
426
|
+
},
|
|
427
|
+
[address, showToast]
|
|
428
|
+
);
|
|
429
|
+
return /* @__PURE__ */ jsx(WidgetTabsContext, { value: tabsShown, children: /* @__PURE__ */ jsx(ClaimInXochiAppContext, { value: claimInXochiApp, children: /* @__PURE__ */ jsxs(
|
|
430
|
+
"main",
|
|
431
|
+
{
|
|
432
|
+
className: [
|
|
433
|
+
"launch-screen",
|
|
434
|
+
tabsShown ? "launch-screen--full" : null,
|
|
435
|
+
look.height === null ? null : "launch-screen--fixed"
|
|
436
|
+
].filter(Boolean).join(" "),
|
|
437
|
+
style: look.height === null ? void 0 : { height: `${look.height}px` },
|
|
438
|
+
children: [
|
|
439
|
+
/* @__PURE__ */ jsxs("div", { className: "widget-bar", children: [
|
|
440
|
+
tabsShown && /* @__PURE__ */ jsx(
|
|
441
|
+
WidgetTabs,
|
|
442
|
+
{
|
|
443
|
+
baseId: tabsBaseId,
|
|
444
|
+
tabs,
|
|
445
|
+
active: selectedTab,
|
|
446
|
+
onSelect: selectTab
|
|
447
|
+
}
|
|
448
|
+
),
|
|
449
|
+
!hostOwnsWalletUi && /* @__PURE__ */ jsx(AccountChip, {})
|
|
450
|
+
] }),
|
|
451
|
+
tabsShown && tabs.length === 0 && /* @__PURE__ */ jsx("p", { className: "send-note", role: "note", children: "This host has not enabled any section of the widget." }),
|
|
452
|
+
tabShown("trade") && /* @__PURE__ */ jsxs("div", { ...panelProps("trade"), children: [
|
|
453
|
+
tabsShown && /* @__PURE__ */ jsx("div", { className: "widget-bar", children: /* @__PURE__ */ jsx(
|
|
454
|
+
WidgetTabs,
|
|
455
|
+
{
|
|
456
|
+
baseId: modesBaseId,
|
|
457
|
+
tabs: modeTabs,
|
|
458
|
+
active: tradeMode,
|
|
459
|
+
onSelect: setTradeMode,
|
|
460
|
+
label: "Trade mode",
|
|
461
|
+
className: "widget-tabs trade-modes"
|
|
462
|
+
}
|
|
463
|
+
) }),
|
|
464
|
+
tabsShown && surfaces.modes.includes("onramp") && /* @__PURE__ */ jsx("div", { ...modePanelProps("onramp"), children: /* @__PURE__ */ jsx(
|
|
465
|
+
BuyPanel,
|
|
466
|
+
{
|
|
467
|
+
active: selectedTab === "trade" && tradeMode === "onramp",
|
|
468
|
+
fiatCurrency,
|
|
469
|
+
onConnectRequest: hostOwnsWalletUi ? requestHostConnect : openConnectModal
|
|
470
|
+
}
|
|
471
|
+
) }),
|
|
472
|
+
tabsShown && surfaces.modes.includes("offramp") && /* @__PURE__ */ jsx("div", { ...modePanelProps("offramp"), children: /* @__PURE__ */ jsx("div", { className: "send-card", children: rampGate === "ready" ? /* @__PURE__ */ jsx(
|
|
473
|
+
PaymentAppSend,
|
|
474
|
+
{
|
|
475
|
+
active: selectedTab === "trade" && tradeMode === "offramp",
|
|
476
|
+
fiatCurrency,
|
|
477
|
+
onConnectRequest: hostOwnsWalletUi ? requestHostConnect : openConnectModal
|
|
478
|
+
}
|
|
479
|
+
) : /* @__PURE__ */ jsx("p", { className: "ramp-resume__blocked", role: "status", children: RAMP_HOST_GATE_COPY[rampGate] }) }) }),
|
|
480
|
+
swapShown && /* @__PURE__ */ jsxs("div", { ...modePanelProps("swap"), children: [
|
|
481
|
+
/* @__PURE__ */ jsx("h2", { className: "sr-only", children: "Swap" }),
|
|
482
|
+
/* @__PURE__ */ jsx("div", { className: "send-swap-mount", ref: tradeSwapMount }),
|
|
483
|
+
/* @__PURE__ */ jsx(MobileSigningBanner, {}),
|
|
484
|
+
(claimableCount > 0 || !tabsShown && stealthSettledHere) && (claimInXochiApp ? (
|
|
485
|
+
// The host's wallet: no claim here or in a tab of the widget's own.
|
|
486
|
+
/* @__PURE__ */ jsxs("p", { className: "claims-nudge", role: "note", children: [
|
|
487
|
+
claimableCount > 0 ? `${claimableCount} ${claimableCount === 1 ? "payment is" : "payments are"} ready to claim. ` : "Your Stealth payment landed. ",
|
|
488
|
+
CLAIM_IN_XOCHI_APP
|
|
489
|
+
] })
|
|
490
|
+
) : /* @__PURE__ */ jsxs(
|
|
491
|
+
"button",
|
|
492
|
+
{
|
|
493
|
+
type: "button",
|
|
494
|
+
className: "claims-nudge",
|
|
495
|
+
onClick: tabsShown ? handleClaimNudge : openClaims,
|
|
496
|
+
children: [
|
|
497
|
+
claimableCount > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
498
|
+
/* @__PURE__ */ jsx("span", { className: "claims-nudge__count", children: claimableCount }),
|
|
499
|
+
claimableCount === 1 ? "payment is" : "payments are",
|
|
500
|
+
" ready to claim"
|
|
501
|
+
] }) : "Open Claims",
|
|
502
|
+
/* @__PURE__ */ jsx("span", { className: "claims-nudge__arrow", "aria-hidden": "true", children: "→" })
|
|
503
|
+
]
|
|
504
|
+
}
|
|
505
|
+
))
|
|
506
|
+
] })
|
|
507
|
+
] }),
|
|
508
|
+
tabsShown && tabShown("send") && /* @__PURE__ */ jsx("div", { ...panelProps("send"), children: /* @__PURE__ */ jsx(
|
|
509
|
+
SendPanel,
|
|
510
|
+
{
|
|
511
|
+
active: selectedTab === "send",
|
|
512
|
+
initialChain: fromChainId,
|
|
513
|
+
destinations: surfaces.destinations,
|
|
514
|
+
showQuote: showSendQuote,
|
|
515
|
+
retry: sendRetry,
|
|
516
|
+
onEditRetry: cancelSendRetry,
|
|
517
|
+
quoteMount: sendSwapMount,
|
|
518
|
+
onQuote: handleSendQuote,
|
|
519
|
+
onCloseQuote: () => {
|
|
520
|
+
setSendQuoteRecipient(void 0);
|
|
521
|
+
setRetryPrefill(null);
|
|
522
|
+
},
|
|
523
|
+
onConnectRequest: hostOwnsWalletUi ? requestHostConnect : void 0
|
|
524
|
+
}
|
|
525
|
+
) }),
|
|
526
|
+
(swapShown || retryPrefill) && createPortal(
|
|
527
|
+
/* @__PURE__ */ jsx(
|
|
528
|
+
SwapPanel,
|
|
529
|
+
{
|
|
530
|
+
prefill: retryPrefill,
|
|
531
|
+
sendRecipient: selectedTab === "send" ? sendQuoteRecipient : void 0,
|
|
532
|
+
onStealthSettled: handleStealthSettled,
|
|
533
|
+
onGoToClaims: tabsShown || claimInXochiApp ? void 0 : openClaims,
|
|
534
|
+
howItWorks: look.howItWorks && !(selectedTab === "send" && showSendQuote),
|
|
535
|
+
onConnectRequest: hostOwnsWalletUi ? requestHostConnect : void 0
|
|
536
|
+
}
|
|
537
|
+
),
|
|
538
|
+
swapSurface
|
|
539
|
+
),
|
|
540
|
+
tabsShown && tabShown("activity") && /* @__PURE__ */ jsxs("div", { ...panelProps("activity"), children: [
|
|
541
|
+
isConnected && /* @__PURE__ */ jsx(AssetsStrip, {}),
|
|
542
|
+
tabsShown && !surfaces.modes.includes("onramp") && /* @__PURE__ */ jsx(PurchaseRecovery, {}),
|
|
543
|
+
tabsShown && !surfaces.modes.includes("offramp") && /* @__PURE__ */ jsx(
|
|
544
|
+
CashOutRecovery,
|
|
545
|
+
{
|
|
546
|
+
items: localOfframps,
|
|
547
|
+
fiatCurrency,
|
|
548
|
+
active: selectedTab === "activity"
|
|
549
|
+
}
|
|
550
|
+
),
|
|
551
|
+
/* @__PURE__ */ jsx("section", { className: "launch-txlog", "aria-label": "Transaction log", children: !isConnected ? /* @__PURE__ */ jsxs("div", { className: "send-card", children: [
|
|
552
|
+
/* @__PURE__ */ jsx("p", { className: "send-note", children: "See your swaps, sends, purchases and cash outs here." }),
|
|
553
|
+
/* @__PURE__ */ jsx(
|
|
554
|
+
"button",
|
|
555
|
+
{
|
|
556
|
+
className: "submit-btn send-cta",
|
|
557
|
+
type: "button",
|
|
558
|
+
onClick: hostOwnsWalletUi ? requestHostConnect : openConnectModal,
|
|
559
|
+
children: "Connect wallet"
|
|
560
|
+
}
|
|
561
|
+
)
|
|
562
|
+
] }) : /* @__PURE__ */ jsx(
|
|
563
|
+
ActivityFeed,
|
|
564
|
+
{
|
|
565
|
+
activities,
|
|
566
|
+
localHistory: {
|
|
567
|
+
sends: localSends,
|
|
568
|
+
purchases: localRamps,
|
|
569
|
+
cashOuts: localOfframps
|
|
570
|
+
},
|
|
571
|
+
isLoading: ordersLoading || isRefreshing,
|
|
572
|
+
error: ordersError,
|
|
573
|
+
hasMore: hasMoreOrders,
|
|
574
|
+
isConnected,
|
|
575
|
+
enableAgents,
|
|
576
|
+
connectedWallet: address,
|
|
577
|
+
sessionWallet,
|
|
578
|
+
needsSignIn: historyNeedsSignIn,
|
|
579
|
+
isSigningIn: sessionState === "signing",
|
|
580
|
+
onSignIn: handleActivitySignIn,
|
|
581
|
+
onRefresh: refreshActivity,
|
|
582
|
+
onLoadMore: loadMoreOrders,
|
|
583
|
+
onReportSwap: handleReportSwap,
|
|
584
|
+
onRetrySwap: swapShown ? handleRetrySwap : void 0,
|
|
585
|
+
onClaimNudge: handleClaimNudge
|
|
586
|
+
}
|
|
587
|
+
) })
|
|
588
|
+
] }),
|
|
589
|
+
claimsAvailable && /* @__PURE__ */ jsx("div", { ...panelProps("claims"), children: /* @__PURE__ */ jsxs("section", { className: "launch-stealth", "aria-label": "Stealth receiving", children: [
|
|
590
|
+
/* @__PURE__ */ jsx(
|
|
591
|
+
PrivacyPanel,
|
|
592
|
+
{
|
|
593
|
+
trustScore,
|
|
594
|
+
disclosuresLive: features.verificationBetaLive,
|
|
595
|
+
shieldedAccountsLive: SHIELDED_ACCOUNTS_LIVE,
|
|
596
|
+
connectedProviders: verifyState?.connectedProviders ?? [],
|
|
597
|
+
isConnected,
|
|
598
|
+
stealthInitialized: stealthClaim.isInitialized,
|
|
599
|
+
stealthRegistered: stealthClaim.isRegistered,
|
|
600
|
+
onInitializeStealth: stealthClaim.initializeKeys,
|
|
601
|
+
onRegisterStealth: stealthClaim.registerMetaAddress,
|
|
602
|
+
stealthLoading: stealthClaim.isLoading
|
|
603
|
+
}
|
|
604
|
+
),
|
|
605
|
+
stealthClaim.isInitialized && /* @__PURE__ */ jsx(
|
|
606
|
+
StealthClaims,
|
|
607
|
+
{
|
|
608
|
+
payments: stealthClaim.payments,
|
|
609
|
+
isScanning: stealthClaim.isScanning,
|
|
610
|
+
isClaiming: stealthClaim.isClaiming,
|
|
611
|
+
isConfirming: stealthClaim.isConfirming,
|
|
612
|
+
isStealthReady: stealthClaim.keysReady,
|
|
613
|
+
onResign: stealthClaim.initializeKeys,
|
|
614
|
+
isResigning: stealthClaim.isLoading,
|
|
615
|
+
walletAddress: address,
|
|
616
|
+
error: stealthClaim.error,
|
|
617
|
+
lastScannedBlock: stealthClaim.lastScannedBlock,
|
|
618
|
+
hasScanned: stealthClaim.hasScanned,
|
|
619
|
+
needsSignIn: stealthNeedsSignIn,
|
|
620
|
+
isSigningIn: sessionState === "signing",
|
|
621
|
+
onSignIn: handleStealthSignIn,
|
|
622
|
+
claimableCount,
|
|
623
|
+
onScan: stealthClaim.scan,
|
|
624
|
+
onClaim: stealthClaim.claim,
|
|
625
|
+
onClaimAll: stealthClaim.claimAll
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
] }) })
|
|
629
|
+
]
|
|
630
|
+
}
|
|
631
|
+
) }) });
|
|
632
|
+
}
|
|
633
|
+
export {
|
|
634
|
+
Trade
|
|
635
|
+
};
|