@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,40 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback, createContext, useContext } from "react";
|
|
3
|
+
import { TIMEOUTS } from "../config.js";
|
|
4
|
+
const ToastContext = createContext(null);
|
|
5
|
+
let toastId = 0;
|
|
6
|
+
function ToastProvider({ children }) {
|
|
7
|
+
const [toasts, setToasts] = useState([]);
|
|
8
|
+
const showToast = useCallback((message, type = "info") => {
|
|
9
|
+
const id = ++toastId;
|
|
10
|
+
setToasts((prev) => [...prev, { id, message, type }]);
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
13
|
+
}, TIMEOUTS.toastDuration);
|
|
14
|
+
}, []);
|
|
15
|
+
return /* @__PURE__ */ jsxs(ToastContext.Provider, { value: { showToast }, children: [
|
|
16
|
+
children,
|
|
17
|
+
/* @__PURE__ */ jsx(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
className: "toast-container",
|
|
21
|
+
role: "region",
|
|
22
|
+
"aria-live": "polite",
|
|
23
|
+
"aria-atomic": "true",
|
|
24
|
+
"aria-label": "Notifications",
|
|
25
|
+
children: toasts.map((toast) => /* @__PURE__ */ jsx("div", { className: `toast ${toast.type}`, role: "alert", children: /* @__PURE__ */ jsx("span", { className: "toast-message", children: toast.message }) }, toast.id))
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
] });
|
|
29
|
+
}
|
|
30
|
+
function useToast() {
|
|
31
|
+
const context = useContext(ToastContext);
|
|
32
|
+
if (!context) {
|
|
33
|
+
throw new Error("useToast must be used within a ToastProvider");
|
|
34
|
+
}
|
|
35
|
+
return context;
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
ToastProvider,
|
|
39
|
+
useToast
|
|
40
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TOKEN_ICONS } from "../assets/tokens/index.js";
|
|
3
|
+
function TokenIcon({ symbol, className, title }) {
|
|
4
|
+
const src = TOKEN_ICONS[symbol];
|
|
5
|
+
if (src) {
|
|
6
|
+
return /* @__PURE__ */ jsx("img", { src, alt: "", "aria-hidden": "true", className, title });
|
|
7
|
+
}
|
|
8
|
+
const letter = symbol ? symbol.charAt(0).toUpperCase() : "?";
|
|
9
|
+
return /* @__PURE__ */ jsx(
|
|
10
|
+
"span",
|
|
11
|
+
{
|
|
12
|
+
className: className ? `token-fallback ${className}` : "token-fallback",
|
|
13
|
+
title: title ?? symbol,
|
|
14
|
+
"aria-hidden": "true",
|
|
15
|
+
children: letter
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
TokenIcon
|
|
21
|
+
};
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { AZTEC_ICON, CHAIN_ICONS } from "../assets/chains/index.js";
|
|
5
|
+
import { useFocusTrap } from "../hooks/useFocusTrap.js";
|
|
6
|
+
import { PAIR_GLYPH } from "../lib/glyphs.js";
|
|
7
|
+
import { isSelectable, pairBadgeLabel, pairAvailabilityHint } from "../lib/pairAvailability.js";
|
|
8
|
+
import { TokenIcon } from "./TokenIcon.js";
|
|
9
|
+
import { EXTENDED_CHAIN_NAMES, CHAIN_SHORT_NAMES } from "@xochi/client";
|
|
10
|
+
const SHORT_NAMES = CHAIN_SHORT_NAMES;
|
|
11
|
+
function matchesSearch(query, token) {
|
|
12
|
+
const normalized = query.toLowerCase();
|
|
13
|
+
return token.symbol.toLowerCase().includes(normalized) || token.name.toLowerCase().includes(normalized);
|
|
14
|
+
}
|
|
15
|
+
function buildTokenList(chainIds, tokensByChain, selectedChainId, search, classify) {
|
|
16
|
+
const visibleChainIds = selectedChainId === null ? chainIds : [selectedChainId];
|
|
17
|
+
const advertisedTokens = visibleChainIds.flatMap((chainId) => tokensByChain.get(chainId) ?? []);
|
|
18
|
+
const matchedTokens = search ? advertisedTokens.filter((token) => matchesSearch(search, token)) : advertisedTokens;
|
|
19
|
+
const rows = matchedTokens.map((token) => ({ token, availability: classify(token) }));
|
|
20
|
+
return [
|
|
21
|
+
...rows.filter(({ availability }) => isSelectable(availability)),
|
|
22
|
+
...rows.filter(({ availability }) => !isSelectable(availability))
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
function tokenKey(token) {
|
|
26
|
+
return `${token.chainId}-${token.address}`;
|
|
27
|
+
}
|
|
28
|
+
function SearchIcon() {
|
|
29
|
+
return /* @__PURE__ */ jsxs(
|
|
30
|
+
"svg",
|
|
31
|
+
{
|
|
32
|
+
className: "token-search-input-icon",
|
|
33
|
+
viewBox: "0 0 16 16",
|
|
34
|
+
fill: "none",
|
|
35
|
+
stroke: "currentColor",
|
|
36
|
+
strokeWidth: "1.5",
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
"aria-hidden": "true",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "5" }),
|
|
41
|
+
/* @__PURE__ */ jsx("path", { d: "M11 11L14 14" })
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
function TokenSearchModal({
|
|
47
|
+
open,
|
|
48
|
+
onClose,
|
|
49
|
+
onSelect,
|
|
50
|
+
selectedToken,
|
|
51
|
+
chainIds,
|
|
52
|
+
tokensByChain,
|
|
53
|
+
classify,
|
|
54
|
+
initialChainId = null,
|
|
55
|
+
mode = "token",
|
|
56
|
+
onChainSelect,
|
|
57
|
+
chainBlockedReason,
|
|
58
|
+
zkMoney,
|
|
59
|
+
portalTarget
|
|
60
|
+
}) {
|
|
61
|
+
const initialVisibleChain = initialChainId !== null && chainIds.includes(initialChainId) ? initialChainId : null;
|
|
62
|
+
const [selectedChainId, setSelectedChainId] = useState(
|
|
63
|
+
initialVisibleChain
|
|
64
|
+
);
|
|
65
|
+
const [chainSearch, setChainSearch] = useState("");
|
|
66
|
+
const [tokenSearch, setTokenSearch] = useState("");
|
|
67
|
+
const [focusedIndex, setFocusedIndex] = useState(0);
|
|
68
|
+
const trapRef = useFocusTrap(open);
|
|
69
|
+
const tokenSearchRef = useRef(null);
|
|
70
|
+
const listRef = useRef(null);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!open) return;
|
|
73
|
+
setSelectedChainId(
|
|
74
|
+
initialChainId !== null && chainIds.includes(initialChainId) ? initialChainId : null
|
|
75
|
+
);
|
|
76
|
+
setChainSearch("");
|
|
77
|
+
setTokenSearch("");
|
|
78
|
+
setFocusedIndex(0);
|
|
79
|
+
if (mode === "token") {
|
|
80
|
+
requestAnimationFrame(() => tokenSearchRef.current?.focus());
|
|
81
|
+
}
|
|
82
|
+
}, [open, initialChainId, chainIds, mode]);
|
|
83
|
+
const normalizedChainSearch = chainSearch.trim().toLowerCase();
|
|
84
|
+
const filteredChains = useMemo(
|
|
85
|
+
() => chainIds.filter((chainId) => {
|
|
86
|
+
const name = EXTENDED_CHAIN_NAMES[chainId] ?? "";
|
|
87
|
+
const shortName = CHAIN_SHORT_NAMES[chainId] ?? "";
|
|
88
|
+
return normalizedChainSearch === "" || `${name} ${shortName}`.toLowerCase().includes(normalizedChainSearch);
|
|
89
|
+
}),
|
|
90
|
+
[chainIds, normalizedChainSearch]
|
|
91
|
+
);
|
|
92
|
+
const showAllNetwork = mode === "token" && (normalizedChainSearch === "" || "all".includes(normalizedChainSearch));
|
|
93
|
+
const showZkMoneyNetwork = mode === "chain" && zkMoney && (normalizedChainSearch === "" || "zk.money".includes(normalizedChainSearch));
|
|
94
|
+
const hasVisibleNetwork = showAllNetwork || Boolean(showZkMoneyNetwork) || filteredChains.length > 0;
|
|
95
|
+
const tokens = useMemo(
|
|
96
|
+
() => buildTokenList(chainIds, tokensByChain, selectedChainId, tokenSearch, classify),
|
|
97
|
+
[chainIds, tokensByChain, selectedChainId, tokenSearch, classify]
|
|
98
|
+
);
|
|
99
|
+
const showAllChains = selectedChainId === null;
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
setFocusedIndex(0);
|
|
102
|
+
}, [selectedChainId, tokenSearch]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!listRef.current) return;
|
|
105
|
+
const rows = listRef.current.querySelectorAll(".token-search-row");
|
|
106
|
+
rows[focusedIndex]?.scrollIntoView({ block: "nearest" });
|
|
107
|
+
}, [focusedIndex]);
|
|
108
|
+
const handleKeyDown = useCallback(
|
|
109
|
+
(event) => {
|
|
110
|
+
if (event.key === "Escape") {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
onClose();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (mode !== "token" || event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
|
|
116
|
+
const target = event.target;
|
|
117
|
+
if (!(target instanceof HTMLElement) || target !== tokenSearchRef.current && !target.classList.contains("token-search-row")) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
const delta = event.key === "ArrowDown" ? 1 : -1;
|
|
122
|
+
const next = target === tokenSearchRef.current ? event.key === "ArrowDown" ? 0 : Math.max(tokens.length - 1, 0) : Math.max(0, Math.min(focusedIndex + delta, tokens.length - 1));
|
|
123
|
+
setFocusedIndex(next);
|
|
124
|
+
requestAnimationFrame(() => {
|
|
125
|
+
const rows = listRef.current?.querySelectorAll(".token-search-row");
|
|
126
|
+
rows?.[next]?.focus();
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
[focusedIndex, mode, onClose, tokens.length]
|
|
130
|
+
);
|
|
131
|
+
const handleOverlayClick = useCallback(
|
|
132
|
+
(event) => {
|
|
133
|
+
if (event.target === event.currentTarget) onClose();
|
|
134
|
+
},
|
|
135
|
+
[onClose]
|
|
136
|
+
);
|
|
137
|
+
const selectChain = (chainId) => {
|
|
138
|
+
if (mode === "token") {
|
|
139
|
+
setSelectedChainId(chainId);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if ((chainBlockedReason?.(chainId) ?? null) === null) {
|
|
143
|
+
onChainSelect?.({ kind: "chain", chainId });
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
if (!open) return null;
|
|
147
|
+
const dialogLabel = mode === "chain" ? "Select network" : "Select token";
|
|
148
|
+
const portalRoot = portalTarget?.ownerDocument.body ?? document.body;
|
|
149
|
+
return createPortal(
|
|
150
|
+
/* @__PURE__ */ jsx(
|
|
151
|
+
"div",
|
|
152
|
+
{
|
|
153
|
+
ref: trapRef,
|
|
154
|
+
className: "token-search-modal",
|
|
155
|
+
onKeyDown: handleKeyDown,
|
|
156
|
+
onClick: handleOverlayClick,
|
|
157
|
+
role: "dialog",
|
|
158
|
+
"aria-modal": "true",
|
|
159
|
+
"aria-label": dialogLabel,
|
|
160
|
+
children: /* @__PURE__ */ jsxs(
|
|
161
|
+
"div",
|
|
162
|
+
{
|
|
163
|
+
className: `token-search-content${mode === "chain" ? " token-search-content--chain" : ""}`,
|
|
164
|
+
children: [
|
|
165
|
+
/* @__PURE__ */ jsxs("div", { className: "token-search-header", children: [
|
|
166
|
+
/* @__PURE__ */ jsx("span", { className: "token-search-title", children: dialogLabel }),
|
|
167
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "token-search-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M3 3l10 10M13 3L3 13" }) }) })
|
|
168
|
+
] }),
|
|
169
|
+
/* @__PURE__ */ jsxs(
|
|
170
|
+
"div",
|
|
171
|
+
{
|
|
172
|
+
className: `token-search-panels${mode === "chain" ? " token-search-panels--chain" : ""}`,
|
|
173
|
+
children: [
|
|
174
|
+
/* @__PURE__ */ jsxs("div", { className: "token-search-chains", children: [
|
|
175
|
+
/* @__PURE__ */ jsx("div", { className: "token-search-chain-search", children: /* @__PURE__ */ jsxs("div", { className: "token-search-input-container", children: [
|
|
176
|
+
/* @__PURE__ */ jsx(SearchIcon, {}),
|
|
177
|
+
/* @__PURE__ */ jsx(
|
|
178
|
+
"input",
|
|
179
|
+
{
|
|
180
|
+
className: "token-search-input",
|
|
181
|
+
type: "text",
|
|
182
|
+
placeholder: "Search networks",
|
|
183
|
+
value: chainSearch,
|
|
184
|
+
onChange: (event) => setChainSearch(event.target.value),
|
|
185
|
+
"aria-label": "Search networks"
|
|
186
|
+
}
|
|
187
|
+
)
|
|
188
|
+
] }) }),
|
|
189
|
+
showAllNetwork && /* @__PURE__ */ jsxs(
|
|
190
|
+
"button",
|
|
191
|
+
{
|
|
192
|
+
type: "button",
|
|
193
|
+
className: `token-search-chain-item ${selectedChainId === null ? "active" : ""}`,
|
|
194
|
+
onClick: () => setSelectedChainId(null),
|
|
195
|
+
"aria-current": selectedChainId === null ? "true" : void 0,
|
|
196
|
+
children: [
|
|
197
|
+
/* @__PURE__ */ jsx("svg", { className: "token-search-chain-all-icon", viewBox: "0 0 16 16", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2.5 2.5h4v4h-4zM9.5 2.5h4v4h-4zM2.5 9.5h4v4h-4zM9.5 9.5h4v4h-4z" }) }),
|
|
198
|
+
"All"
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
),
|
|
202
|
+
showZkMoneyNetwork && /* @__PURE__ */ jsxs(
|
|
203
|
+
"button",
|
|
204
|
+
{
|
|
205
|
+
type: "button",
|
|
206
|
+
className: `token-search-chain-item${zkMoney.selected ? " active" : ""}`,
|
|
207
|
+
"aria-current": zkMoney.selected ? "true" : void 0,
|
|
208
|
+
onClick: () => onChainSelect?.({ kind: "zk.money" }),
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsx("img", { src: AZTEC_ICON, alt: "", className: "token-search-chain-icon" }),
|
|
211
|
+
/* @__PURE__ */ jsx("span", { children: "zk.money" })
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
!hasVisibleNetwork && /* @__PURE__ */ jsx("div", { className: "token-search-empty", children: "No networks found" }),
|
|
216
|
+
filteredChains.map((chainId) => {
|
|
217
|
+
const blocked = mode === "chain" ? chainBlockedReason?.(chainId) ?? null : null;
|
|
218
|
+
const selected = selectedChainId === chainId && (mode !== "chain" || zkMoney?.selected !== true);
|
|
219
|
+
return /* @__PURE__ */ jsxs(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
type: "button",
|
|
223
|
+
className: `token-search-chain-item${selected ? " active" : ""}${blocked === null ? "" : " token-search-chain-item--blocked"}`,
|
|
224
|
+
onClick: () => selectChain(chainId),
|
|
225
|
+
"aria-current": selected ? "true" : void 0,
|
|
226
|
+
"aria-disabled": blocked === null ? void 0 : true,
|
|
227
|
+
title: blocked ?? void 0,
|
|
228
|
+
children: [
|
|
229
|
+
/* @__PURE__ */ jsx("img", { src: CHAIN_ICONS[chainId], alt: "", className: "token-search-chain-icon" }),
|
|
230
|
+
/* @__PURE__ */ jsxs("span", { className: "token-search-chain-copy", children: [
|
|
231
|
+
/* @__PURE__ */ jsx("span", { children: EXTENDED_CHAIN_NAMES[chainId] }),
|
|
232
|
+
blocked !== null && /* @__PURE__ */ jsx("span", { className: "token-search-chain-reason", children: blocked })
|
|
233
|
+
] })
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
chainId
|
|
237
|
+
);
|
|
238
|
+
})
|
|
239
|
+
] }),
|
|
240
|
+
mode === "token" && /* @__PURE__ */ jsxs("div", { className: "token-search-tokens", children: [
|
|
241
|
+
/* @__PURE__ */ jsx("div", { className: "token-search-input-wrap", children: /* @__PURE__ */ jsxs("div", { className: "token-search-input-container", children: [
|
|
242
|
+
/* @__PURE__ */ jsx(SearchIcon, {}),
|
|
243
|
+
/* @__PURE__ */ jsx(
|
|
244
|
+
"input",
|
|
245
|
+
{
|
|
246
|
+
ref: tokenSearchRef,
|
|
247
|
+
className: "token-search-input",
|
|
248
|
+
type: "text",
|
|
249
|
+
placeholder: "Search tokens",
|
|
250
|
+
value: tokenSearch,
|
|
251
|
+
onChange: (event) => setTokenSearch(event.target.value),
|
|
252
|
+
"aria-label": "Search tokens"
|
|
253
|
+
}
|
|
254
|
+
)
|
|
255
|
+
] }) }),
|
|
256
|
+
/* @__PURE__ */ jsx("div", { className: "token-search-section-label", children: tokenSearch ? "Results" : "All tokens" }),
|
|
257
|
+
/* @__PURE__ */ jsx("div", { className: "token-search-list", ref: listRef, children: tokens.length === 0 ? /* @__PURE__ */ jsx("div", { className: "token-search-empty", children: "No tokens found" }) : tokens.map(({ token, availability }, index) => {
|
|
258
|
+
const selected = selectedToken?.address === token.address && selectedToken.chainId === token.chainId;
|
|
259
|
+
const selectable = isSelectable(availability);
|
|
260
|
+
const badge = pairBadgeLabel(availability);
|
|
261
|
+
const hint = pairAvailabilityHint(availability, token.symbol);
|
|
262
|
+
return /* @__PURE__ */ jsxs(
|
|
263
|
+
"button",
|
|
264
|
+
{
|
|
265
|
+
type: "button",
|
|
266
|
+
className: `token-search-row${selected ? " selected" : ""}${index === focusedIndex && selectable ? " focused" : ""}${availability.state === "trust_locked" ? " token-search-row--locked" : availability.state === "unsupported" ? " token-search-row--unsupported" : ""}`,
|
|
267
|
+
tabIndex: index === focusedIndex ? 0 : -1,
|
|
268
|
+
onClick: () => selectable && onSelect(token),
|
|
269
|
+
onMouseEnter: () => selectable && setFocusedIndex(index),
|
|
270
|
+
onKeyDown: (event) => {
|
|
271
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
272
|
+
event.preventDefault();
|
|
273
|
+
if (selectable) onSelect(token);
|
|
274
|
+
},
|
|
275
|
+
"aria-disabled": !selectable,
|
|
276
|
+
title: hint ?? void 0,
|
|
277
|
+
children: [
|
|
278
|
+
/* @__PURE__ */ jsx(TokenIcon, { symbol: token.symbol, className: "token-search-row-icon" }),
|
|
279
|
+
/* @__PURE__ */ jsxs("div", { className: "token-search-row-info", children: [
|
|
280
|
+
/* @__PURE__ */ jsx("span", { className: "token-search-row-symbol", children: token.symbol }),
|
|
281
|
+
/* @__PURE__ */ jsx(
|
|
282
|
+
"span",
|
|
283
|
+
{
|
|
284
|
+
className: `token-search-row-name${availability.state === "unsupported" && availability.reason !== void 0 ? " token-search-row-name--reason" : ""}`,
|
|
285
|
+
children: hint ?? token.name
|
|
286
|
+
}
|
|
287
|
+
)
|
|
288
|
+
] }),
|
|
289
|
+
badge && /* @__PURE__ */ jsxs(
|
|
290
|
+
"span",
|
|
291
|
+
{
|
|
292
|
+
className: `token-search-row-badge token-search-row-badge--${availability.state === "trust_locked" ? "locked" : "unsupported"}`,
|
|
293
|
+
children: [
|
|
294
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: availability.state === "trust_locked" ? PAIR_GLYPH.locked : PAIR_GLYPH.unsupported }),
|
|
295
|
+
" ",
|
|
296
|
+
badge
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
),
|
|
300
|
+
availability.state === "available" && /* @__PURE__ */ jsx("span", { className: "token-search-row-glyph", "aria-hidden": "true", children: PAIR_GLYPH.available }),
|
|
301
|
+
showAllChains && /* @__PURE__ */ jsxs("div", { className: "token-search-row-chain", children: [
|
|
302
|
+
/* @__PURE__ */ jsx(
|
|
303
|
+
"img",
|
|
304
|
+
{
|
|
305
|
+
src: CHAIN_ICONS[token.chainId],
|
|
306
|
+
alt: "",
|
|
307
|
+
className: "token-search-row-chain-icon"
|
|
308
|
+
}
|
|
309
|
+
),
|
|
310
|
+
/* @__PURE__ */ jsx("span", { className: "token-search-row-chain-name", children: SHORT_NAMES[token.chainId] })
|
|
311
|
+
] })
|
|
312
|
+
]
|
|
313
|
+
},
|
|
314
|
+
tokenKey(token)
|
|
315
|
+
);
|
|
316
|
+
}) })
|
|
317
|
+
] })
|
|
318
|
+
]
|
|
319
|
+
}
|
|
320
|
+
)
|
|
321
|
+
]
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
}
|
|
325
|
+
),
|
|
326
|
+
portalRoot
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
export {
|
|
330
|
+
TokenSearchModal
|
|
331
|
+
};
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useId } from "react";
|
|
3
|
+
import { resolvePaymentMethod, PAYMENT_METHODS, paysNoGas } from "../types/intent.js";
|
|
4
|
+
import { safeBigInt, formatTokenAmount, payoutDisplayDecimals } from "../utils/format.js";
|
|
5
|
+
import { extractPullAmount, destinationDisclosure, EXTENDED_CHAIN_NAMES } from "@xochi/client";
|
|
6
|
+
import { usePrices } from "../hooks/usePrices.js";
|
|
7
|
+
import { quoteExpiryLabel } from "../lib/quoteCountdown.js";
|
|
8
|
+
import { servedFees } from "../lib/feesLabel.js";
|
|
9
|
+
import { paymentSummary } from "../lib/paymentSummary.js";
|
|
10
|
+
import { confirmSend } from "../pages/send/sendCopy.js";
|
|
11
|
+
import { ShieldedDisclosure } from "../pages/send/ShieldedDisclosure.js";
|
|
12
|
+
import { TokenIcon } from "./TokenIcon.js";
|
|
13
|
+
import { useWidgetTabsShown, useClaimInXochiApp } from "./widgetTabsContext.js";
|
|
14
|
+
import { AZTEC_ICON, CHAIN_ICONS } from "../assets/chains/index.js";
|
|
15
|
+
const usdLabel = (usd) => usd == null ? "--" : `$${usd.toFixed(2)}`;
|
|
16
|
+
function TransactionPreview({
|
|
17
|
+
quote,
|
|
18
|
+
fromAmount,
|
|
19
|
+
fromSymbol,
|
|
20
|
+
fromDecimals,
|
|
21
|
+
toSymbol,
|
|
22
|
+
toDecimals,
|
|
23
|
+
toChainId,
|
|
24
|
+
destination,
|
|
25
|
+
sendRecipientDisplay,
|
|
26
|
+
onConfirm,
|
|
27
|
+
onCancel,
|
|
28
|
+
isLoading,
|
|
29
|
+
permitType,
|
|
30
|
+
approval,
|
|
31
|
+
approvalMayNeedReset,
|
|
32
|
+
unlimitedApproval,
|
|
33
|
+
setUnlimitedApproval,
|
|
34
|
+
quoteExpiresIn
|
|
35
|
+
}) {
|
|
36
|
+
const approvalNoteId = useId();
|
|
37
|
+
const action = sendRecipientDisplay ? "send" : "swap";
|
|
38
|
+
const tabsShown = useWidgetTabsShown();
|
|
39
|
+
const claimInXochiApp = useClaimInXochiApp();
|
|
40
|
+
const { estimateUsd, prices } = usePrices();
|
|
41
|
+
const expiryLabel = isLoading ? null : quoteExpiryLabel(quoteExpiresIn);
|
|
42
|
+
const fromBigInt = safeBigInt(fromAmount);
|
|
43
|
+
const toAmount = safeBigInt(quote.toAmount);
|
|
44
|
+
const fromFormatted = formatTokenAmount(fromBigInt, fromDecimals, 6);
|
|
45
|
+
const toFormatted = formatTokenAmount(toAmount, toDecimals, 6);
|
|
46
|
+
const toLabel = formatTokenAmount(
|
|
47
|
+
toAmount,
|
|
48
|
+
toDecimals,
|
|
49
|
+
payoutDisplayDecimals(toAmount, toDecimals)
|
|
50
|
+
);
|
|
51
|
+
const pullAmount = quote.pullAuthorization ? extractPullAmount(quote.pullAuthorization) : null;
|
|
52
|
+
const pullMismatch = pullAmount !== null && pullAmount !== fromBigInt;
|
|
53
|
+
const pullAmountFormatted = pullMismatch && pullAmount !== null ? formatTokenAmount(pullAmount, fromDecimals, 6) : null;
|
|
54
|
+
const fromUsd = estimateUsd(fromFormatted, fromSymbol);
|
|
55
|
+
const toUsd = estimateUsd(toFormatted, toSymbol);
|
|
56
|
+
const inputTokens = (() => {
|
|
57
|
+
const value = Number(fromBigInt) / 10 ** fromDecimals;
|
|
58
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
59
|
+
})();
|
|
60
|
+
const fees = servedFees(quote, inputTokens, prices[fromSymbol]);
|
|
61
|
+
const destLabel = destinationDisclosure(destination).label;
|
|
62
|
+
const settlementVenue = destination.type === "aztec" ? { name: "zk.money", icon: AZTEC_ICON } : { name: EXTENDED_CHAIN_NAMES[toChainId], icon: CHAIN_ICONS[toChainId] };
|
|
63
|
+
const paymentMethod = resolvePaymentMethod(
|
|
64
|
+
quote.paymentMethod,
|
|
65
|
+
permitType,
|
|
66
|
+
quote.gasless,
|
|
67
|
+
quote.depositAddress
|
|
68
|
+
);
|
|
69
|
+
const paymentInfo = PAYMENT_METHODS[paymentMethod];
|
|
70
|
+
const approvalFirst = paymentInfo.gasless ? approval : "none";
|
|
71
|
+
const signCount = quote.pullAuthorization ? "twice" : "once";
|
|
72
|
+
const isDepositRoute = !!quote.depositAddress;
|
|
73
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
74
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-body", children: [
|
|
75
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-transfer", children: [
|
|
76
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-row tx-preview-row--out", children: [
|
|
77
|
+
/* @__PURE__ */ jsx("div", { className: "tx-preview-icon", children: /* @__PURE__ */ jsx(
|
|
78
|
+
"svg",
|
|
79
|
+
{
|
|
80
|
+
viewBox: "0 0 14 14",
|
|
81
|
+
width: "14",
|
|
82
|
+
height: "14",
|
|
83
|
+
fill: "none",
|
|
84
|
+
stroke: "currentColor",
|
|
85
|
+
strokeWidth: "2",
|
|
86
|
+
strokeLinecap: "round",
|
|
87
|
+
children: /* @__PURE__ */ jsx("path", { d: "M7 3v8M3 7l4 4 4-4" })
|
|
88
|
+
}
|
|
89
|
+
) }),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-content", children: [
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { className: "tx-preview-amount", children: [
|
|
92
|
+
/* @__PURE__ */ jsx(
|
|
93
|
+
TokenIcon,
|
|
94
|
+
{
|
|
95
|
+
symbol: fromSymbol,
|
|
96
|
+
className: "inline-token-icon inline-token-icon--lg"
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsxs("span", { className: "tx-preview-amount-num", children: [
|
|
100
|
+
fromFormatted,
|
|
101
|
+
" ",
|
|
102
|
+
fromSymbol
|
|
103
|
+
] })
|
|
104
|
+
] }),
|
|
105
|
+
/* @__PURE__ */ jsx("span", { className: "tx-preview-detail", children: isDepositRoute ? "sent manually" : "leaves the connected wallet" }),
|
|
106
|
+
/* @__PURE__ */ jsx("span", { className: "tx-preview-usd", children: usdLabel(fromUsd) })
|
|
107
|
+
] })
|
|
108
|
+
] }),
|
|
109
|
+
/* @__PURE__ */ jsx("div", { className: "tx-preview-arrow", children: /* @__PURE__ */ jsx(
|
|
110
|
+
"svg",
|
|
111
|
+
{
|
|
112
|
+
viewBox: "0 0 12 20",
|
|
113
|
+
width: "10",
|
|
114
|
+
height: "16",
|
|
115
|
+
fill: "none",
|
|
116
|
+
stroke: "currentColor",
|
|
117
|
+
strokeWidth: "1.5",
|
|
118
|
+
strokeLinecap: "round",
|
|
119
|
+
children: /* @__PURE__ */ jsx("path", { d: "M6 2v16M2 14l4 4 4-4" })
|
|
120
|
+
}
|
|
121
|
+
) }),
|
|
122
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-row tx-preview-row--in", children: [
|
|
123
|
+
/* @__PURE__ */ jsx("div", { className: "tx-preview-icon", children: /* @__PURE__ */ jsx(
|
|
124
|
+
"svg",
|
|
125
|
+
{
|
|
126
|
+
viewBox: "0 0 14 14",
|
|
127
|
+
width: "14",
|
|
128
|
+
height: "14",
|
|
129
|
+
fill: "none",
|
|
130
|
+
stroke: "currentColor",
|
|
131
|
+
strokeWidth: "2",
|
|
132
|
+
strokeLinecap: "round",
|
|
133
|
+
children: /* @__PURE__ */ jsx("path", { d: "M7 11V3M3 7l4-4 4 4" })
|
|
134
|
+
}
|
|
135
|
+
) }),
|
|
136
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-content", children: [
|
|
137
|
+
/* @__PURE__ */ jsxs("span", { className: "tx-preview-amount", children: [
|
|
138
|
+
/* @__PURE__ */ jsx(TokenIcon, { symbol: toSymbol, className: "inline-token-icon inline-token-icon--lg" }),
|
|
139
|
+
/* @__PURE__ */ jsxs("span", { className: "tx-preview-amount-num", children: [
|
|
140
|
+
toLabel,
|
|
141
|
+
" ",
|
|
142
|
+
toSymbol
|
|
143
|
+
] })
|
|
144
|
+
] }),
|
|
145
|
+
/* @__PURE__ */ jsx("span", { className: "tx-preview-detail", children: destination.recipientTag !== void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
146
|
+
"To @",
|
|
147
|
+
destination.recipientTag,
|
|
148
|
+
" on zk.money"
|
|
149
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
150
|
+
"arrives in ",
|
|
151
|
+
destLabel,
|
|
152
|
+
" on ",
|
|
153
|
+
settlementVenue.icon && /* @__PURE__ */ jsx("img", { src: settlementVenue.icon, alt: "", className: "inline-chain-icon" }),
|
|
154
|
+
settlementVenue.name
|
|
155
|
+
] }) }),
|
|
156
|
+
/* @__PURE__ */ jsx("span", { className: "tx-preview-usd", children: usdLabel(toUsd) })
|
|
157
|
+
] })
|
|
158
|
+
] })
|
|
159
|
+
] }),
|
|
160
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-summary", children: [
|
|
161
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-fees", children: [
|
|
162
|
+
pullAmountFormatted && /* @__PURE__ */ jsxs("div", { className: "tx-preview-fee-row", children: [
|
|
163
|
+
/* @__PURE__ */ jsx("span", { children: "Authorized to collect" }),
|
|
164
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
165
|
+
pullAmountFormatted,
|
|
166
|
+
" ",
|
|
167
|
+
fromSymbol
|
|
168
|
+
] })
|
|
169
|
+
] }),
|
|
170
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-fee-row", children: [
|
|
171
|
+
/* @__PURE__ */ jsx("span", { children: "Fees (incl. network)" }),
|
|
172
|
+
/* @__PURE__ */ jsx("span", { children: fees.label })
|
|
173
|
+
] })
|
|
174
|
+
] }),
|
|
175
|
+
(destination.recipientTag !== void 0 || destination.type === "aztec" && destination.shielded) && /* @__PURE__ */ jsx("p", { className: "tx-preview-claim-note", children: /* @__PURE__ */ jsx(ShieldedDisclosure, {}) }),
|
|
176
|
+
sendRecipientDisplay?.mode === "Stealth" ? /* @__PURE__ */ jsxs("p", { className: "tx-preview-claim-note", children: [
|
|
177
|
+
"Lands at a one-time stealth address controlled by ",
|
|
178
|
+
sendRecipientDisplay.label,
|
|
179
|
+
"’s keys."
|
|
180
|
+
] }) : !sendRecipientDisplay && quote.claimInfo ? /* @__PURE__ */ jsxs("div", { className: "tx-preview-claim-info", children: [
|
|
181
|
+
/* @__PURE__ */ jsx("span", { className: "tx-preview-claim-value", children: "No gas needed to claim" }),
|
|
182
|
+
/* @__PURE__ */ jsxs("span", { className: "tx-preview-claim-note", children: [
|
|
183
|
+
"Lands in a one-time account only the connected wallet controls.",
|
|
184
|
+
" ",
|
|
185
|
+
tabsShown ? "Claim anytime from the Claims tab." : claimInXochiApp ? "Claim anytime in the Xochi app with the receiving wallet." : "Claim anytime on the full widget, which opens in a new tab."
|
|
186
|
+
] })
|
|
187
|
+
] }) : null,
|
|
188
|
+
/* @__PURE__ */ jsxs("div", { className: "tx-preview-payment", children: [
|
|
189
|
+
/* @__PURE__ */ jsx("span", { className: "tx-preview-payment-label", children: "Payment" }),
|
|
190
|
+
/* @__PURE__ */ jsx(
|
|
191
|
+
"span",
|
|
192
|
+
{
|
|
193
|
+
className: `tx-preview-payment-value ${paysNoGas(paymentMethod, approval) ? "gasless" : ""}`,
|
|
194
|
+
children: paymentSummary(paymentMethod, false, approval)
|
|
195
|
+
}
|
|
196
|
+
)
|
|
197
|
+
] }),
|
|
198
|
+
permitType === "permit2" && !isDepositRoute && /* @__PURE__ */ jsxs("div", { className: "tx-preview-approval", children: [
|
|
199
|
+
approval !== "covered" && /* @__PURE__ */ jsxs("label", { className: "tx-preview-approval-choice", children: [
|
|
200
|
+
/* @__PURE__ */ jsx(
|
|
201
|
+
"input",
|
|
202
|
+
{
|
|
203
|
+
type: "checkbox",
|
|
204
|
+
checked: unlimitedApproval,
|
|
205
|
+
onChange: (event) => setUnlimitedApproval(event.currentTarget.checked),
|
|
206
|
+
disabled: isLoading,
|
|
207
|
+
"aria-describedby": approvalNoteId
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
"Unlimited approval"
|
|
211
|
+
] }),
|
|
212
|
+
/* @__PURE__ */ jsx("p", { id: approvalNoteId, className: "tx-preview-approval-note", children: approval === "covered" ? `Existing allowance covers this ${action}. Any existing unlimited approval stays active.` : unlimitedApproval ? `Allow Permit2 to spend an unlimited amount of ${fromSymbol}. This permission remains after this ${action}.` : `Approve this ${action}’s exact amount. Later transactions may need approval gas again.` }),
|
|
213
|
+
approval !== "covered" && /* @__PURE__ */ jsx("p", { className: "tx-preview-approval-note", children: approvalMayNeedReset ? "An existing non-zero allowance must be reset first, requiring another approval and gas." : "A sufficient existing allowance stays active." })
|
|
214
|
+
] })
|
|
215
|
+
] })
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ jsxs("div", { className: "modal-actions", children: [
|
|
218
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--cancel", onClick: onCancel, disabled: isLoading, children: "Cancel" }),
|
|
219
|
+
/* @__PURE__ */ jsxs("button", { className: "modal-btn modal-btn--confirm", onClick: onConfirm, disabled: isLoading, children: [
|
|
220
|
+
isLoading && /* @__PURE__ */ jsx("span", { className: "spinner spinner--small" }),
|
|
221
|
+
isDepositRoute ? "Continue" : isLoading ? "Signing..." : sendRecipientDisplay ? confirmSend(sendRecipientDisplay) : "Confirm swap"
|
|
222
|
+
] })
|
|
223
|
+
] }),
|
|
224
|
+
expiryLabel && /* @__PURE__ */ jsx("p", { className: "tx-preview-expiry", children: expiryLabel }),
|
|
225
|
+
/* @__PURE__ */ jsx("p", { className: "modal-note", children: isDepositRoute ? `Next: an address to send the ${fromSymbol} to. Nothing to sign.` : `Paid as quoted, or a full refund. ${approvalFirst === "required" ? `Next: approve ${fromSymbol} (gas), then sign ${signCount} in the wallet.` : approvalFirst === "unknown" ? `Next: sign ${signCount} in the wallet, after an approval (gas) if needed.` : `Next: sign ${signCount} in the wallet.`}` })
|
|
226
|
+
] });
|
|
227
|
+
}
|
|
228
|
+
export {
|
|
229
|
+
TransactionPreview
|
|
230
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { WagmiProvider } from "wagmi";
|
|
3
|
+
import { QueryClientProvider, QueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { RainbowKitProvider, lightTheme, darkTheme } from "@rainbow-me/rainbowkit";
|
|
5
|
+
import { config, createWagmiConfig } from "../wagmi.js";
|
|
6
|
+
import { PALETTE } from "../constants.js";
|
|
7
|
+
import { useResolvedTheme } from "../hooks/useTheme.js";
|
|
8
|
+
const queryClient = new QueryClient({
|
|
9
|
+
defaultOptions: {
|
|
10
|
+
queries: {
|
|
11
|
+
refetchOnWindowFocus: false,
|
|
12
|
+
retry: 1,
|
|
13
|
+
staleTime: 6e4
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const RAINBOW_THEMES = {
|
|
18
|
+
dim: darkTheme({
|
|
19
|
+
accentColor: PALETTE.mutedGold,
|
|
20
|
+
accentColorForeground: PALETTE.obsidian,
|
|
21
|
+
borderRadius: "small"
|
|
22
|
+
}),
|
|
23
|
+
dark: darkTheme({
|
|
24
|
+
accentColor: PALETTE.mutedGoldBright,
|
|
25
|
+
accentColorForeground: PALETTE.obsidian,
|
|
26
|
+
borderRadius: "small"
|
|
27
|
+
}),
|
|
28
|
+
light: lightTheme({
|
|
29
|
+
accentColor: PALETTE.mutedGoldDark,
|
|
30
|
+
accentColorForeground: "#ffffff",
|
|
31
|
+
borderRadius: "small"
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
function WalletProvider({ children, theme = null, hostWallet = null }) {
|
|
35
|
+
const resolvedTheme = useResolvedTheme(theme);
|
|
36
|
+
const wagmiConfig = hostWallet === null ? config : createWagmiConfig(hostWallet);
|
|
37
|
+
return /* @__PURE__ */ jsx(WagmiProvider, { config: wagmiConfig, reconnectOnMount: hostWallet === null, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(RainbowKitProvider, { locale: "en", theme: RAINBOW_THEMES[resolvedTheme], children }) }) });
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
WalletProvider
|
|
41
|
+
};
|