@xochi/widget 0.0.0-stage → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +76 -0
- package/LICENSE +21 -0
- package/README.md +420 -2
- package/THIRD_PARTY_NOTICES.txt +44 -0
- package/dist/ConfiguratorApp.js +19 -0
- package/dist/EmbedApp.js +57 -0
- package/dist/assets/MonaspaceArgon-Bold-D9kWRRK5.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Light-Dt_6qXbW.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Medium-B1gMZwrU.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Regular-RS-2TGNg.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-SemiBold-PYusZXE_.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Italic-C9u9eioB.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Light-CJkxpyfT.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Medium-DCChELAx.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Regular-BZtV1wRa.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Bold-KacFhGOf.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Medium-Dqqg-cnL.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Regular-BRsdKART.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-SemiBold-DNjPl3uE.woff2 +0 -0
- package/dist/assets/alipay-3tx9-HPp.svg +1 -0
- package/dist/assets/arb-CCfLcB_X.svg +7 -0
- package/dist/assets/arc-Dy98eSCd.svg +10 -0
- package/dist/assets/aztec-DiLp9qTG.svg +4 -0
- package/dist/assets/base-Ch0ino36.svg +4 -0
- package/dist/assets/cashapp-lOg0DIt8.svg +1 -0
- package/dist/assets/chains/arbitrum.svg.js +4 -0
- package/dist/assets/chains/arc.svg.js +4 -0
- package/dist/assets/chains/aztec.svg.js +4 -0
- package/dist/assets/chains/base.svg.js +4 -0
- package/dist/assets/chains/ethereum.svg.js +4 -0
- package/dist/assets/chains/gnosis.png.js +4 -0
- package/dist/assets/chains/index.js +31 -0
- package/dist/assets/chains/optimism.svg.js +4 -0
- package/dist/assets/chains/polygon.svg.js +4 -0
- package/dist/assets/chains/robinhood.svg.js +4 -0
- package/dist/assets/chains/tron.svg.js +4 -0
- package/dist/assets/chains/xochi.svg.js +4 -0
- package/dist/assets/dai-XuyZLceZ.png +0 -0
- package/dist/assets/defillama-BU037Unq.svg +1 -0
- package/dist/assets/defillama.svg.js +4 -0
- package/dist/assets/eth-Dvbng9UB.svg +8 -0
- package/dist/assets/eurc-NI9zNgOQ.png +0 -0
- package/dist/assets/eure-BH9vpwcv.png +0 -0
- package/dist/assets/gnosis-fRzAZQFj.png +0 -0
- package/dist/assets/mercadopago-gjsFb6F7.svg +1 -0
- package/dist/assets/monzo-B9XD4bL5.png +0 -0
- package/dist/assets/monzo-SZnIdUKN.svg +1 -0
- package/dist/assets/monzo-dark-Bwzg90UC.png +0 -0
- package/dist/assets/n26-cANcjY2T.svg +1 -0
- package/dist/assets/op-DF67SbB6.png +0 -0
- package/dist/assets/optimism-B3cTNxEQ.svg +4 -0
- package/dist/assets/paypal-D8xqXEtN.svg +1 -0
- package/dist/assets/pol-uLmSo2O8.svg +3 -0
- package/dist/assets/rails/SOURCES.md +50 -0
- package/dist/assets/rails/alipay.svg.js +4 -0
- package/dist/assets/rails/cashapp.svg.js +4 -0
- package/dist/assets/rails/index.js +59 -0
- package/dist/assets/rails/mercadopago.svg.js +4 -0
- package/dist/assets/rails/monzo-dark.png.js +4 -0
- package/dist/assets/rails/monzo.png.js +4 -0
- package/dist/assets/rails/monzo.svg.js +4 -0
- package/dist/assets/rails/n26.svg.js +4 -0
- package/dist/assets/rails/paypal.svg.js +4 -0
- package/dist/assets/rails/revolut-dark.png.js +4 -0
- package/dist/assets/rails/revolut.png.js +4 -0
- package/dist/assets/rails/revolut.svg.js +4 -0
- package/dist/assets/rails/venmo.svg.js +4 -0
- package/dist/assets/rails/wise-dark.png.js +4 -0
- package/dist/assets/rails/wise.png.js +4 -0
- package/dist/assets/rails/wise.svg.js +4 -0
- package/dist/assets/rails/xmoney.svg.js +4 -0
- package/dist/assets/rails/zelle.svg.js +4 -0
- package/dist/assets/raxol-86FmC34h.png +0 -0
- package/dist/assets/revolut-CiBtyALA.png +0 -0
- package/dist/assets/revolut-D7qr5Vzs.svg +1 -0
- package/dist/assets/revolut-dark-RQdWGM_p.png +0 -0
- package/dist/assets/robinhood-DgdGTQ1I.svg +8 -0
- package/dist/assets/tokens/arb.svg.js +4 -0
- package/dist/assets/tokens/dai.png.js +4 -0
- package/dist/assets/tokens/eth.svg.js +4 -0
- package/dist/assets/tokens/eurc.png.js +4 -0
- package/dist/assets/tokens/eure.png.js +4 -0
- package/dist/assets/tokens/index.js +36 -0
- package/dist/assets/tokens/op.png.js +4 -0
- package/dist/assets/tokens/pol.svg.js +4 -0
- package/dist/assets/tokens/raxol.png.js +4 -0
- package/dist/assets/tokens/usdc.png.js +4 -0
- package/dist/assets/tokens/usdg.png.js +4 -0
- package/dist/assets/tokens/usdt.png.js +4 -0
- package/dist/assets/tokens/wbtc.png.js +4 -0
- package/dist/assets/tokens/wsteth.png.js +4 -0
- package/dist/assets/tokens/zchf.png.js +4 -0
- package/dist/assets/tron-Dtumyzha.svg +4 -0
- package/dist/assets/usdc-UHSd0FoM.png +0 -0
- package/dist/assets/usdg-Cd5nCzbC.png +0 -0
- package/dist/assets/usdt-3G3YdPq8.png +0 -0
- package/dist/assets/venmo-CMHeCn-D.svg +1 -0
- package/dist/assets/wbtc-CV8uE44Q.png +0 -0
- package/dist/assets/wise-BUOflsWL.svg +1 -0
- package/dist/assets/wise-JLpDvCdq.png +0 -0
- package/dist/assets/wise-dark-_Q8pbCom.png +0 -0
- package/dist/assets/wsteth-BamwtTCR.png +0 -0
- package/dist/assets/xmoney-CwY9KVlD.svg +1 -0
- package/dist/assets/xochi-DL2f8G4R.svg +4 -0
- package/dist/assets/zchf-BLBNdTGJ.png +0 -0
- package/dist/assets/zelle-t15cG4SB.svg +1 -0
- package/dist/browser.js +4 -0
- package/dist/components/AccountChip.js +29 -0
- package/dist/components/ActivityFeed.js +710 -0
- package/dist/components/AssetsStrip.js +133 -0
- package/dist/components/AuthorizedAgents.js +197 -0
- package/dist/components/Chevron.js +22 -0
- package/dist/components/ErrorDisplay.js +66 -0
- package/dist/components/InfoButton.js +27 -0
- package/dist/components/IntentTimeline.js +202 -0
- package/dist/components/LinksSignIn.js +26 -0
- package/dist/components/MobileSigningBanner.js +44 -0
- package/dist/components/PrivacyBars.js +44 -0
- package/dist/components/PrivacyPanel.js +99 -0
- package/dist/components/QuoteDetails.js +327 -0
- package/dist/components/ReceiptCommand.js +46 -0
- package/dist/components/SessionReloadBanner.js +19 -0
- package/dist/components/SolverRace.js +62 -0
- package/dist/components/StealthClaims.js +179 -0
- package/dist/components/SwapFlowModal.js +398 -0
- package/dist/components/Toast.js +40 -0
- package/dist/components/TokenIcon.js +21 -0
- package/dist/components/TokenSearchModal.js +331 -0
- package/dist/components/TransactionPreview.js +207 -0
- package/dist/components/WalletProvider.js +41 -0
- package/dist/components/WrapModal.js +192 -0
- package/dist/components/swap-flow/CantonEscrowPanel.js +28 -0
- package/dist/components/swap-flow/CantonEscrowStatus.js +160 -0
- package/dist/components/swap-flow/DepositInstructions.js +156 -0
- package/dist/components/swap-flow/QrCode.js +22 -0
- package/dist/components/swap-flow/SwapResult.js +323 -0
- package/dist/components/swap-flow/depositScreen.js +36 -0
- package/dist/components/widgetTabsContext.js +17 -0
- package/dist/config.js +132 -0
- package/dist/configurator-model.js +71 -0
- package/dist/configurator.js +11 -0
- package/dist/constants.js +53 -0
- package/dist/hooks/applyTheme.js +10 -0
- package/dist/hooks/useAgentRegistry.js +28 -0
- package/dist/hooks/useAgentStream.js +89 -0
- package/dist/hooks/useCantonEscrow.js +89 -0
- package/dist/hooks/useCapabilities.js +86 -0
- package/dist/hooks/useEmbedLook.js +23 -0
- package/dist/hooks/useFocusTrap.js +44 -0
- package/dist/hooks/useIntent.js +435 -0
- package/dist/hooks/useIntentStatusPoll.js +71 -0
- package/dist/hooks/useIntentStream.js +95 -0
- package/dist/hooks/useLocalActivity.js +114 -0
- package/dist/hooks/useLocalSends.js +15 -0
- package/dist/hooks/useLocalStorage.js +26 -0
- package/dist/hooks/useOrderHistory.js +307 -0
- package/dist/hooks/usePermit.js +131 -0
- package/dist/hooks/usePrices.js +49 -0
- package/dist/hooks/usePublicBalances.js +186 -0
- package/dist/hooks/useRampSummaries.js +19 -0
- package/dist/hooks/useRecipientBalance.js +98 -0
- package/dist/hooks/useSettlements.js +33 -0
- package/dist/hooks/useStealth.js +324 -0
- package/dist/hooks/useStealthClaim.js +183 -0
- package/dist/hooks/useStealthScanner.js +259 -0
- package/dist/hooks/useTheme.js +48 -0
- package/dist/hooks/useTierInfo.js +20 -0
- package/dist/hooks/useTrustScore.js +16 -0
- package/dist/hooks/useWalletSession.js +70 -0
- package/dist/hooks/useWrapEth.js +60 -0
- package/dist/index.js +41 -0
- package/dist/integration.js +19 -0
- package/dist/lib/activityValue.js +20 -0
- package/dist/lib/agentConnect.js +11 -0
- package/dist/lib/agentRegistry.js +83 -0
- package/dist/lib/agentStreamVerify.js +47 -0
- package/dist/lib/api.js +67 -0
- package/dist/lib/auth.js +8 -0
- package/dist/lib/authFetch.js +33 -0
- package/dist/lib/aztecTokens.js +13 -0
- package/dist/lib/balances.js +77 -0
- package/dist/lib/capabilities.js +40 -0
- package/dist/lib/claimSubmitPoll.js +63 -0
- package/dist/lib/debug.js +7 -0
- package/dist/lib/declineGuidance.js +31 -0
- package/dist/lib/displayFallbacks.js +25 -0
- package/dist/lib/eip712.js +38 -0
- package/dist/lib/errorCategory.js +200 -0
- package/dist/lib/errorReport.js +19 -0
- package/dist/lib/explorerLinks.js +30 -0
- package/dist/lib/feesLabel.js +19 -0
- package/dist/lib/glyphs.js +58 -0
- package/dist/lib/hostBridge.js +41 -0
- package/dist/lib/hostOrigin.js +52 -0
- package/dist/lib/intentAPI.js +39 -0
- package/dist/lib/linksSignIn.js +9 -0
- package/dist/lib/localActivity.js +247 -0
- package/dist/lib/localSends.js +129 -0
- package/dist/lib/mobileWallet.js +17 -0
- package/dist/lib/pairAvailability.js +29 -0
- package/dist/lib/paymentSummary.js +23 -0
- package/dist/lib/permits.js +27 -0
- package/dist/lib/priceImpact.js +101 -0
- package/dist/lib/providers.js +124 -0
- package/dist/lib/qr.js +20 -0
- package/dist/lib/quoteCost.js +34 -0
- package/dist/lib/quoteCountdown.js +24 -0
- package/dist/lib/rampHostGate.js +24 -0
- package/dist/lib/rampLifecycle.js +63 -0
- package/dist/lib/receiptCost.js +64 -0
- package/dist/lib/recipient/index.js +302 -0
- package/dist/lib/recipient/recent.js +47 -0
- package/dist/lib/recipientReceipt.js +16 -0
- package/dist/lib/reportClient.js +32 -0
- package/dist/lib/sessionExpiry.js +11 -0
- package/dist/lib/settlementAvailability.js +34 -0
- package/dist/lib/stealth.js +110 -0
- package/dist/lib/swapFlowPhase.js +52 -0
- package/dist/lib/swapStatusCopy.js +59 -0
- package/dist/lib/tradeLifecycle.js +40 -0
- package/dist/lib/tronlink.js +71 -0
- package/dist/lib/walletSession.js +87 -0
- package/dist/pages/Configurator.js +390 -0
- package/dist/pages/Trade.js +635 -0
- package/dist/pages/configurator/AllowedAssetsSection.js +98 -0
- package/dist/pages/configurator/AppearanceSection.js +44 -0
- package/dist/pages/configurator/CodeDock.js +140 -0
- package/dist/pages/configurator/DeveloperSection.js +40 -0
- package/dist/pages/configurator/IntegrationSection.js +105 -0
- package/dist/pages/configurator/LayoutSection.js +83 -0
- package/dist/pages/configurator/PolicyNote.js +7 -0
- package/dist/pages/configurator/PreviewStage.js +165 -0
- package/dist/pages/configurator/PrivacySection.js +54 -0
- package/dist/pages/configurator/RouteSection.js +211 -0
- package/dist/pages/configurator/Settings.js +35 -0
- package/dist/pages/configurator/SharedLinkBanner.js +25 -0
- package/dist/pages/configurator/SurfaceSection.js +124 -0
- package/dist/pages/configurator/WhatUsersSee.js +268 -0
- package/dist/pages/configurator/codeShown.js +8 -0
- package/dist/pages/configurator/configuratorUrl.js +33 -0
- package/dist/pages/configurator/paramsDraft.js +82 -0
- package/dist/pages/configurator/previewModel.js +10 -0
- package/dist/pages/configurator/previewQuote.js +109 -0
- package/dist/pages/configurator/routePicks.js +131 -0
- package/dist/pages/configurator/snippets.js +98 -0
- package/dist/pages/configurator/surfaceParams.js +51 -0
- package/dist/pages/configurator/useCodeCheck.js +79 -0
- package/dist/pages/configurator/useConfiguratorUrl.js +24 -0
- package/dist/pages/configurator/useMediaQuery.js +20 -0
- package/dist/pages/configurator/useParamsDraft.js +33 -0
- package/dist/pages/configurator/usePreviewFee.js +100 -0
- package/dist/pages/send/MetaAddressValue.js +28 -0
- package/dist/pages/send/Receive.js +168 -0
- package/dist/pages/send/RecentRecipients.js +23 -0
- package/dist/pages/send/RecipientChip.js +26 -0
- package/dist/pages/send/ScanRecipient.js +85 -0
- package/dist/pages/send/SendForm.js +516 -0
- package/dist/pages/send/SendPanel.js +30 -0
- package/dist/pages/send/ShieldedDisclosure.js +12 -0
- package/dist/pages/send/StealthInvite.js +27 -0
- package/dist/pages/send/addressSend.js +92 -0
- package/dist/pages/send/sendCopy.js +10 -0
- package/dist/pages/send/sendRetry.js +24 -0
- package/dist/pages/send/stealthRecipient.js +65 -0
- package/dist/pages/send/stealthSend.js +15 -0
- package/dist/pages/send/useAddressSend.js +257 -0
- package/dist/pages/send/useSendRecipient.js +61 -0
- package/dist/pages/trade/BuyPanel.js +70 -0
- package/dist/pages/trade/RampRecovery.js +41 -0
- package/dist/pages/trade/RecipientSheet.js +182 -0
- package/dist/pages/trade/Selectors.js +152 -0
- package/dist/pages/trade/SwapPanel.js +971 -0
- package/dist/pages/trade/WidgetTabs.js +109 -0
- package/dist/pages/trade/canton.js +122 -0
- package/dist/pages/trade/config.js +70 -0
- package/dist/pages/trade/embedNarrowing.js +25 -0
- package/dist/pages/trade/embedParams.js +532 -0
- package/dist/pages/trade/embedTheme.js +9 -0
- package/dist/pages/trade/orderMinimum.js +8 -0
- package/dist/pages/trade/resumeSwap.js +55 -0
- package/dist/pages/trade/settlementCopy.js +32 -0
- package/dist/pages/trade/useAmountFit.js +31 -0
- package/dist/pages/trade/useEmbedDefaults.js +18 -0
- package/dist/pages/trade/useSettlementGating.js +289 -0
- package/dist/pages/trade/useSwapAmount.js +191 -0
- package/dist/pages/trade/useSwapFlow.js +511 -0
- package/dist/pages/trade/useSwapPanel.js +475 -0
- package/dist/pages/trade/useSwapRoute.js +634 -0
- package/dist/pages/trade/useTronLinkFill.js +34 -0
- package/dist/pages/trade/zkMoney.js +46 -0
- package/dist/promiseWithResolvers.js +20 -0
- package/dist/ramp/availability/RailTiles.js +156 -0
- package/dist/ramp/availability/RampDisclosure.js +38 -0
- package/dist/ramp/availability/RampRails.js +170 -0
- package/dist/ramp/availability/model.js +207 -0
- package/dist/ramp/availability/useRampDiscovery.js +83 -0
- package/dist/ramp/offramp/CompletedPrerequisite.js +23 -0
- package/dist/ramp/offramp/OfframpActivityList.js +16 -0
- package/dist/ramp/offramp/OfframpRoute.js +222 -0
- package/dist/ramp/offramp/OfframpRouteReview.js +94 -0
- package/dist/ramp/offramp/PaymentAppSend.js +765 -0
- package/dist/ramp/offramp/localOfframps.js +101 -0
- package/dist/ramp/offramp/model.js +154 -0
- package/dist/ramp/offramp/port.js +134 -0
- package/dist/ramp/offramp/prerequisite.js +143 -0
- package/dist/ramp/offramp/useOfframp.js +505 -0
- package/dist/ramp/offramp/useOfframpRails.js +73 -0
- package/dist/ramp/peer/BuyOnramp.js +292 -0
- package/dist/ramp/peer/OnrampSteps.js +148 -0
- package/dist/ramp/peer/buyerDriver.js +461 -0
- package/dist/ramp/peer/discovery.js +231 -0
- package/dist/ramp/peer/environment.js +7 -0
- package/dist/ramp/peer/liveProvider.js +87 -0
- package/dist/ramp/peer/liveReads.js +488 -0
- package/dist/ramp/peer/maker.js +92 -0
- package/dist/ramp/peer/normalization.js +184 -0
- package/dist/ramp/peer/offramp.js +648 -0
- package/dist/ramp/peer/onramp.js +353 -0
- package/dist/ramp/peer/preview.js +52 -0
- package/dist/ramp/peer/protectedMapping.js +67 -0
- package/dist/ramp/peer/runtime.js +55 -0
- package/dist/ramp/peer/sdkMaker.js +107 -0
- package/dist/ramp/recovery/ResumeOnramp.js +153 -0
- package/dist/ramp/recovery/summaries.js +173 -0
- package/dist/ramp/route/OnrampRoute.js +255 -0
- package/dist/ramp/route/RampRouteSteps.js +148 -0
- package/dist/ramp/route/routeActivity.js +12 -0
- package/dist/ramp/route/useXochiRampDriver.js +203 -0
- package/dist/styles.css +17448 -0
- package/dist/styles.js +2 -0
- package/dist/types/ConfiguratorApp.d.ts +6 -0
- package/dist/types/EmbedApp.d.ts +2 -0
- package/dist/types/activity.js +50 -0
- package/dist/types/asset.d.ts +2 -0
- package/dist/types/assets/chains/index.d.ts +3 -0
- package/dist/types/assets/rails/index.d.ts +12 -0
- package/dist/types/assets/tokens/index.d.ts +1 -0
- package/dist/types/browser.d.ts +1 -0
- package/dist/types/components/AccountChip.d.ts +10 -0
- package/dist/types/components/ActivityFeed.d.ts +46 -0
- package/dist/types/components/AssetsStrip.d.ts +14 -0
- package/dist/types/components/AuthorizedAgents.d.ts +15 -0
- package/dist/types/components/Chevron.d.ts +16 -0
- package/dist/types/components/ErrorDisplay.d.ts +44 -0
- package/dist/types/components/InfoButton.d.ts +6 -0
- package/dist/types/components/IntentTimeline.d.ts +41 -0
- package/dist/types/components/LinksSignIn.d.ts +13 -0
- package/dist/types/components/MobileSigningBanner.d.ts +16 -0
- package/dist/types/components/PermitBadge.d.ts +17 -0
- package/dist/types/components/PrivacyBars.d.ts +12 -0
- package/dist/types/components/PrivacyPanel.d.ts +33 -0
- package/dist/types/components/QuoteDetails.d.ts +56 -0
- package/dist/types/components/RampActivityList.d.ts +14 -0
- package/dist/types/components/ReceiptCommand.d.ts +12 -0
- package/dist/types/components/SessionReloadBanner.d.ts +8 -0
- package/dist/types/components/SolverRace.d.ts +35 -0
- package/dist/types/components/StealthClaims.d.ts +51 -0
- package/dist/types/components/SwapFlowModal.d.ts +138 -0
- package/dist/types/components/Toast.d.ts +10 -0
- package/dist/types/components/TokenIcon.d.ts +17 -0
- package/dist/types/components/TokenSearchModal.d.ts +28 -0
- package/dist/types/components/TransactionPreview.d.ts +34 -0
- package/dist/types/components/WalletProvider.d.ts +12 -0
- package/dist/types/components/WrapModal.d.ts +19 -0
- package/dist/types/components/swap-flow/CantonEscrowPanel.d.ts +14 -0
- package/dist/types/components/swap-flow/CantonEscrowStatus.d.ts +30 -0
- package/dist/types/components/swap-flow/DepositInstructions.d.ts +75 -0
- package/dist/types/components/swap-flow/QrCode.d.ts +18 -0
- package/dist/types/components/swap-flow/SwapResult.d.ts +66 -0
- package/dist/types/components/swap-flow/depositScreen.d.ts +67 -0
- package/dist/types/components/widgetTabsContext.d.ts +21 -0
- package/dist/types/config.d.ts +104 -0
- package/dist/types/configurator-model.d.ts +9 -0
- package/dist/types/configurator.d.ts +3 -0
- package/dist/types/constants.d.ts +52 -0
- package/dist/types/hooks/applyTheme.d.ts +7 -0
- package/dist/types/hooks/useAgentRegistry.d.ts +13 -0
- package/dist/types/hooks/useAgentStream.d.ts +15 -0
- package/dist/types/hooks/useCantonEscrow.d.ts +40 -0
- package/dist/types/hooks/useCapabilities.d.ts +83 -0
- package/dist/types/hooks/useEmbedLook.d.ts +4 -0
- package/dist/types/hooks/useFocusTrap.d.ts +7 -0
- package/dist/types/hooks/useIntent.d.ts +156 -0
- package/dist/types/hooks/useIntentStatusPoll.d.ts +107 -0
- package/dist/types/hooks/useIntentStream.d.ts +34 -0
- package/dist/types/hooks/useLocalActivity.d.ts +22 -0
- package/dist/types/hooks/useLocalSends.d.ts +8 -0
- package/dist/types/hooks/useLocalStorage.d.ts +8 -0
- package/dist/types/hooks/useOrderHistory.d.ts +52 -0
- package/dist/types/hooks/usePermit.d.ts +84 -0
- package/dist/types/hooks/usePrices.d.ts +72 -0
- package/dist/types/hooks/usePublicBalances.d.ts +19 -0
- package/dist/types/hooks/useRampSummaries.d.ts +9 -0
- package/dist/types/hooks/useRecipientBalance.d.ts +58 -0
- package/dist/types/hooks/useSettlements.d.ts +14 -0
- package/dist/types/hooks/useStealth.d.ts +72 -0
- package/dist/types/hooks/useStealthClaim.d.ts +96 -0
- package/dist/types/hooks/useStealthScanner.d.ts +44 -0
- package/dist/types/hooks/useTheme.d.ts +29 -0
- package/dist/types/hooks/useTierInfo.d.ts +23 -0
- package/dist/types/hooks/useTrustScore.d.ts +16 -0
- package/dist/types/hooks/useWalletSession.d.ts +21 -0
- package/dist/types/hooks/useWrapEth.d.ts +21 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +8 -0
- package/dist/types/integration.d.ts +9 -0
- package/dist/types/intent.js +85 -0
- package/dist/types/lib/activityValue.d.ts +16 -0
- package/dist/types/lib/agentConnect.d.ts +23 -0
- package/dist/types/lib/agentRegistry.d.ts +47 -0
- package/dist/types/lib/agentStreamVerify.d.ts +29 -0
- package/dist/types/lib/api.d.ts +41 -0
- package/dist/types/lib/auth.d.ts +6 -0
- package/dist/types/lib/authFetch.d.ts +14 -0
- package/dist/types/lib/aztecTokens.d.ts +15 -0
- package/dist/types/lib/balances.d.ts +88 -0
- package/dist/types/lib/capabilities.d.ts +3 -0
- package/dist/types/lib/claimSubmitPoll.d.ts +114 -0
- package/dist/types/lib/debug.d.ts +13 -0
- package/dist/types/lib/declineGuidance.d.ts +55 -0
- package/dist/types/lib/displayFallbacks.d.ts +7 -0
- package/dist/types/lib/eip712.d.ts +61 -0
- package/dist/types/lib/errorCategory.d.ts +48 -0
- package/dist/types/lib/errorReport.d.ts +15 -0
- package/dist/types/lib/explorerLinks.d.ts +67 -0
- package/dist/types/lib/feesLabel.d.ts +20 -0
- package/dist/types/lib/glyphs.d.ts +52 -0
- package/dist/types/lib/hostBridge.d.ts +11 -0
- package/dist/types/lib/hostOrigin.d.ts +30 -0
- package/dist/types/lib/intentAPI.d.ts +15 -0
- package/dist/types/lib/linksSignIn.d.ts +13 -0
- package/dist/types/lib/localActivity.d.ts +135 -0
- package/dist/types/lib/localSends.d.ts +55 -0
- package/dist/types/lib/mobileWallet.d.ts +27 -0
- package/dist/types/lib/pairAvailability.d.ts +106 -0
- package/dist/types/lib/paymentSummary.d.ts +18 -0
- package/dist/types/lib/permits.d.ts +25 -0
- package/dist/types/lib/priceImpact.d.ts +165 -0
- package/dist/types/lib/providers.d.ts +14 -0
- package/dist/types/lib/qr.d.ts +19 -0
- package/dist/types/lib/quoteCost.d.ts +45 -0
- package/dist/types/lib/quoteCountdown.d.ts +34 -0
- package/dist/types/lib/rampHostGate.d.ts +15 -0
- package/dist/types/lib/rampLifecycle.d.ts +20 -0
- package/dist/types/lib/receiptCost.d.ts +64 -0
- package/dist/types/lib/recipient/index.d.ts +33 -0
- package/dist/types/lib/recipient/recent.d.ts +5 -0
- package/dist/types/lib/recipientReceipt.d.ts +25 -0
- package/dist/types/lib/reportClient.d.ts +9 -0
- package/dist/types/lib/sessionExpiry.d.ts +11 -0
- package/dist/types/lib/settlementAvailability.d.ts +61 -0
- package/dist/types/lib/stealth.d.ts +75 -0
- package/dist/types/lib/swapFlowPhase.d.ts +76 -0
- package/dist/types/lib/swapStatusCopy.d.ts +57 -0
- package/dist/types/lib/tierProgressDisplay.d.ts +35 -0
- package/dist/types/lib/tierUnlock.d.ts +25 -0
- package/dist/types/lib/tradeLifecycle.d.ts +32 -0
- package/dist/types/lib/tronlink.d.ts +62 -0
- package/dist/types/lib/walletSession.d.ts +38 -0
- package/dist/types/pages/Configurator.d.ts +25 -0
- package/dist/types/pages/Trade.d.ts +36 -0
- package/dist/types/pages/configurator/AllowedAssetsSection.d.ts +17 -0
- package/dist/types/pages/configurator/AppearanceSection.d.ts +22 -0
- package/dist/types/pages/configurator/CodeDock.d.ts +19 -0
- package/dist/types/pages/configurator/DeveloperSection.d.ts +12 -0
- package/dist/types/pages/configurator/IntegrationSection.d.ts +20 -0
- package/dist/types/pages/configurator/LayoutSection.d.ts +20 -0
- package/dist/types/pages/configurator/PolicyNote.d.ts +6 -0
- package/dist/types/pages/configurator/PreviewStage.d.ts +22 -0
- package/dist/types/pages/configurator/PrivacySection.d.ts +16 -0
- package/dist/types/pages/configurator/RouteSection.d.ts +30 -0
- package/dist/types/pages/configurator/Settings.d.ts +25 -0
- package/dist/types/pages/configurator/SharedLinkBanner.d.ts +16 -0
- package/dist/types/pages/configurator/SurfaceSection.d.ts +5 -0
- package/dist/types/pages/configurator/WhatUsersSee.d.ts +30 -0
- package/dist/types/pages/configurator/codeShown.d.ts +15 -0
- package/dist/types/pages/configurator/configuratorUrl.d.ts +38 -0
- package/dist/types/pages/configurator/paramsDraft.d.ts +32 -0
- package/dist/types/pages/configurator/previewModel.d.ts +20 -0
- package/dist/types/pages/configurator/previewQuote.d.ts +96 -0
- package/dist/types/pages/configurator/routePicks.d.ts +75 -0
- package/dist/types/pages/configurator/snippets.d.ts +23 -0
- package/dist/types/pages/configurator/surfaceParams.d.ts +9 -0
- package/dist/types/pages/configurator/useCodeCheck.d.ts +56 -0
- package/dist/types/pages/configurator/useConfiguratorUrl.d.ts +21 -0
- package/dist/types/pages/configurator/useMediaQuery.d.ts +5 -0
- package/dist/types/pages/configurator/useParamsDraft.d.ts +29 -0
- package/dist/types/pages/configurator/usePreviewFee.d.ts +74 -0
- package/dist/types/pages/send/MetaAddressValue.d.ts +9 -0
- package/dist/types/pages/send/Receive.d.ts +3 -0
- package/dist/types/pages/send/RecentRecipients.d.ts +3 -0
- package/dist/types/pages/send/RecipientChip.d.ts +4 -0
- package/dist/types/pages/send/ScanRecipient.d.ts +3 -0
- package/dist/types/pages/send/SendForm.d.ts +17 -0
- package/dist/types/pages/send/SendPanel.d.ts +19 -0
- package/dist/types/pages/send/ShieldedDisclosure.d.ts +1 -0
- package/dist/types/pages/send/StealthInvite.d.ts +1 -0
- package/dist/types/pages/send/addressSend.d.ts +62 -0
- package/dist/types/pages/send/sendCopy.d.ts +9 -0
- package/dist/types/pages/send/sendRetry.d.ts +10 -0
- package/dist/types/pages/send/stealthRecipient.d.ts +37 -0
- package/dist/types/pages/send/stealthSend.d.ts +18 -0
- package/dist/types/pages/send/useAddressSend.d.ts +61 -0
- package/dist/types/pages/send/useSendRecipient.d.ts +13 -0
- package/dist/types/pages/trade/BuyPanel.d.ts +22 -0
- package/dist/types/pages/trade/RampRecovery.d.ts +22 -0
- package/dist/types/pages/trade/RecipientSheet.d.ts +11 -0
- package/dist/types/pages/trade/Selectors.d.ts +24 -0
- package/dist/types/pages/trade/SwapPanel.d.ts +34 -0
- package/dist/types/pages/trade/WidgetTabs.d.ts +46 -0
- package/dist/types/pages/trade/canton.d.ts +94 -0
- package/dist/types/pages/trade/config.d.ts +185 -0
- package/dist/types/pages/trade/embedNarrowing.d.ts +28 -0
- package/dist/types/pages/trade/embedParams.d.ts +299 -0
- package/dist/types/pages/trade/embedTheme.d.ts +14 -0
- package/dist/types/pages/trade/harness.d.ts +120 -0
- package/dist/types/pages/trade/orderMinimum.d.ts +5 -0
- package/dist/types/pages/trade/resumeSwap.d.ts +139 -0
- package/dist/types/pages/trade/settlementCopy.d.ts +42 -0
- package/dist/types/pages/trade/useAmountFit.d.ts +25 -0
- package/dist/types/pages/trade/useEmbedDefaults.d.ts +28 -0
- package/dist/types/pages/trade/useSettlementGating.d.ts +152 -0
- package/dist/types/pages/trade/useSwapAmount.d.ts +93 -0
- package/dist/types/pages/trade/useSwapFlow.d.ts +152 -0
- package/dist/types/pages/trade/useSwapPanel.d.ts +170 -0
- package/dist/types/pages/trade/useSwapRoute.d.ts +215 -0
- package/dist/types/pages/trade/useTronLinkFill.d.ts +13 -0
- package/dist/types/pages/trade/zkMoney.d.ts +28 -0
- package/dist/types/promiseWithResolvers.d.ts +12 -0
- package/dist/types/ramp/availability/RailTiles.d.ts +26 -0
- package/dist/types/ramp/availability/RampDisclosure.d.ts +9 -0
- package/dist/types/ramp/availability/RampRails.d.ts +27 -0
- package/dist/types/ramp/availability/model.d.ts +51 -0
- package/dist/types/ramp/availability/useRampDiscovery.d.ts +60 -0
- package/dist/types/ramp/offramp/CompletedPrerequisite.d.ts +5 -0
- package/dist/types/ramp/offramp/OfframpActivityList.d.ts +12 -0
- package/dist/types/ramp/offramp/OfframpRoute.d.ts +8 -0
- package/dist/types/ramp/offramp/OfframpRouteReview.d.ts +12 -0
- package/dist/types/ramp/offramp/PaymentAppSend.d.ts +27 -0
- package/dist/types/ramp/offramp/localOfframps.d.ts +58 -0
- package/dist/types/ramp/offramp/model.d.ts +46 -0
- package/dist/types/ramp/offramp/port.d.ts +55 -0
- package/dist/types/ramp/offramp/prerequisite.d.ts +271 -0
- package/dist/types/ramp/offramp/useOfframp.d.ts +87 -0
- package/dist/types/ramp/offramp/useOfframpRails.d.ts +36 -0
- package/dist/types/ramp/peer/BuyOnramp.d.ts +21 -0
- package/dist/types/ramp/peer/OnrampSteps.d.ts +32 -0
- package/dist/types/ramp/peer/buyerDriver.d.ts +48 -0
- package/dist/types/ramp/peer/discovery.d.ts +17 -0
- package/dist/types/ramp/peer/environment.d.ts +2 -0
- package/dist/types/ramp/peer/index.d.ts +14 -0
- package/dist/types/ramp/peer/liveProvider.d.ts +15 -0
- package/dist/types/ramp/peer/liveReads.d.ts +102 -0
- package/dist/types/ramp/peer/maker.d.ts +4 -0
- package/dist/types/ramp/peer/normalization.d.ts +33 -0
- package/dist/types/ramp/peer/offramp.d.ts +130 -0
- package/dist/types/ramp/peer/onramp.d.ts +134 -0
- package/dist/types/ramp/peer/preview.d.ts +14 -0
- package/dist/types/ramp/peer/protectedMapping.d.ts +22 -0
- package/dist/types/ramp/peer/runtime.d.ts +15 -0
- package/dist/types/ramp/peer/sdkMaker.d.ts +67 -0
- package/dist/types/ramp/peer/types.d.ts +64 -0
- package/dist/types/ramp/recovery/ResumeOnramp.d.ts +37 -0
- package/dist/types/ramp/recovery/summaries.d.ts +71 -0
- package/dist/types/ramp/route/OnrampRoute.d.ts +12 -0
- package/dist/types/ramp/route/RampRouteSteps.d.ts +16 -0
- package/dist/types/ramp/route/routeActivity.d.ts +4 -0
- package/dist/types/ramp/route/useXochiRampDriver.d.ts +22 -0
- package/dist/types/result.js +14 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/types/activity.d.ts +184 -0
- package/dist/types/types/index.d.ts +20 -0
- package/dist/types/types/intent.d.ts +85 -0
- package/dist/types/types/result.d.ts +53 -0
- package/dist/types/utils/format.d.ts +88 -0
- package/dist/types/wagmi.d.ts +142 -0
- package/dist/types/widgetLibModule.d.ts +8 -0
- package/dist/utils/format.js +109 -0
- package/dist/wagmi.js +188 -0
- package/dist/widgetLibModule.js +4 -0
- package/licenses/Monaspace-OFL-1.1.txt +93 -0
- package/licenses/assets.json +132 -0
- package/licenses/rainbowkit-MIT.txt +9 -0
- package/licenses/xochi-shared-MIT.txt +21 -0
- package/package.json +115 -4
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { ShieldedDisclosure } from "../../pages/send/ShieldedDisclosure.js";
|
|
3
|
+
import { sentToRecipient } from "../../pages/send/sendCopy.js";
|
|
4
|
+
import { useState, useRef, useEffect } from "react";
|
|
5
|
+
import { isSelectableChainId, CHAIN_SHORT_NAMES, isTronChainId, getExplorerTxUrl } from "@xochi/client";
|
|
6
|
+
import { settlementTxChainId } from "../../lib/explorerLinks.js";
|
|
7
|
+
import { getErrorInfo, MAY_HAVE_MOVED_NOTICE } from "../../lib/errorCategory.js";
|
|
8
|
+
import { useCountdown } from "../ErrorDisplay.js";
|
|
9
|
+
import { formatFailureRef, supportMailto } from "../../lib/swapFlowPhase.js";
|
|
10
|
+
import { reportSwapFailure } from "../../lib/reportClient.js";
|
|
11
|
+
import { GLYPH } from "../../lib/glyphs.js";
|
|
12
|
+
import { ZKMONEY_ACTIVITY_URL, zkMoneyRefusal } from "../../pages/trade/zkMoney.js";
|
|
13
|
+
import { truncateAddress } from "../../utils/format.js";
|
|
14
|
+
import { useWidgetTabsShown, useClaimInXochiApp, CLAIM_IN_XOCHI_APP } from "../widgetTabsContext.js";
|
|
15
|
+
function formatFillMs(ms) {
|
|
16
|
+
return ms < 1e3 ? `${Math.round(ms)}ms` : `${(ms / 1e3).toFixed(2)}s`;
|
|
17
|
+
}
|
|
18
|
+
function TxLink({
|
|
19
|
+
chainId,
|
|
20
|
+
hash,
|
|
21
|
+
label
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsxs(
|
|
24
|
+
"a",
|
|
25
|
+
{
|
|
26
|
+
href: getExplorerTxUrl(chainId, hash),
|
|
27
|
+
target: "_blank",
|
|
28
|
+
rel: "noopener noreferrer",
|
|
29
|
+
className: "swap-result__txlink",
|
|
30
|
+
children: [
|
|
31
|
+
label,
|
|
32
|
+
" ",
|
|
33
|
+
GLYPH.external,
|
|
34
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in new tab)" })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function SwapResult({
|
|
40
|
+
variant,
|
|
41
|
+
isStealth,
|
|
42
|
+
stealthPayee,
|
|
43
|
+
sendRecipientDisplay,
|
|
44
|
+
swapRecipientLabel,
|
|
45
|
+
recipientTag,
|
|
46
|
+
substatus,
|
|
47
|
+
fromChainId,
|
|
48
|
+
toChainId,
|
|
49
|
+
isCrossChain,
|
|
50
|
+
txHash,
|
|
51
|
+
receivingTxHash,
|
|
52
|
+
settlementTxHash,
|
|
53
|
+
settlementChainId,
|
|
54
|
+
receivedAmount,
|
|
55
|
+
toSymbol,
|
|
56
|
+
fillMs,
|
|
57
|
+
failureRef,
|
|
58
|
+
errorCode,
|
|
59
|
+
errorCategory,
|
|
60
|
+
retryAfter,
|
|
61
|
+
refundReason,
|
|
62
|
+
refundAddress,
|
|
63
|
+
originTokens,
|
|
64
|
+
onRetry,
|
|
65
|
+
onClose,
|
|
66
|
+
onGoToClaims
|
|
67
|
+
}) {
|
|
68
|
+
const tabsShown = useWidgetTabsShown();
|
|
69
|
+
const claimInXochiApp = useClaimInXochiApp();
|
|
70
|
+
const [copied, setCopied] = useState(false);
|
|
71
|
+
const legacyChainId = settlementTxChainId(
|
|
72
|
+
fromChainId,
|
|
73
|
+
toChainId,
|
|
74
|
+
receivingTxHash,
|
|
75
|
+
variant === "refunded"
|
|
76
|
+
);
|
|
77
|
+
const useReceipt = variant !== "refunded" && !!settlementTxHash && isSelectableChainId(settlementChainId);
|
|
78
|
+
const settleChainId = useReceipt ? settlementChainId : legacyChainId;
|
|
79
|
+
const receiptHash = useReceipt ? settlementTxHash : txHash;
|
|
80
|
+
const stealthDelivered = isStealth === true && (useReceipt || substatus === "filled");
|
|
81
|
+
const structuredReason = failureRef && errorCode !== void 0 ? { message: failureRef.reason, code: errorCode, retryAfter } : null;
|
|
82
|
+
const tagLookupFailure = errorCategory === "tag_unresolved" || errorCategory === "tag_resolution_unavailable";
|
|
83
|
+
const tagCopy = tagLookupFailure && recipientTag ? zkMoneyRefusal(errorCategory, recipientTag) : null;
|
|
84
|
+
const info = failureRef ? getErrorInfo(tagCopy ?? structuredReason ?? failureRef.reason, originTokens, errorCategory) : null;
|
|
85
|
+
const countdown = useCountdown(info?.retryAfter);
|
|
86
|
+
const isWaitingForRetry = countdown !== null && countdown > 0;
|
|
87
|
+
const reportedFor = useRef(null);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if ((variant === "failed" || variant === "may-have-moved") && failureRef && reportedFor.current !== failureRef) {
|
|
90
|
+
reportedFor.current = failureRef;
|
|
91
|
+
void reportSwapFailure(failureRef);
|
|
92
|
+
}
|
|
93
|
+
}, [variant, failureRef]);
|
|
94
|
+
const copyDetails = () => {
|
|
95
|
+
if (!failureRef) return;
|
|
96
|
+
void navigator.clipboard.writeText(formatFailureRef(failureRef)).then(() => {
|
|
97
|
+
setCopied(true);
|
|
98
|
+
setTimeout(() => setCopied(false), 1500);
|
|
99
|
+
}).catch(() => {
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
if (variant === "success") {
|
|
103
|
+
return /* @__PURE__ */ jsxs("div", { className: "swap-result swap-result--success", children: [
|
|
104
|
+
/* @__PURE__ */ jsx("div", { className: "swap-result__icon swap-result__icon--success", "aria-hidden": "true", children: /* @__PURE__ */ jsxs(
|
|
105
|
+
"svg",
|
|
106
|
+
{
|
|
107
|
+
viewBox: "0 0 32 32",
|
|
108
|
+
width: "32",
|
|
109
|
+
height: "32",
|
|
110
|
+
fill: "none",
|
|
111
|
+
stroke: "currentColor",
|
|
112
|
+
strokeWidth: "2.5",
|
|
113
|
+
strokeLinecap: "round",
|
|
114
|
+
strokeLinejoin: "round",
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "16", r: "14" }),
|
|
117
|
+
/* @__PURE__ */ jsx("path", { d: "M10 16.5l4 4 8-8.5" })
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
) }),
|
|
121
|
+
/* @__PURE__ */ jsx("h3", { className: "swap-result__title", children: sendRecipientDisplay ? sentToRecipient(sendRecipientDisplay) : swapRecipientLabel ? `Sent to ${swapRecipientLabel}` : isStealth ? stealthPayee === "other" ? "Landed at the recipient's one-time stealth address" : "Landed at the one-time stealth address" : recipientTag !== void 0 ? `Sent to @${recipientTag}` : "Swap complete" }),
|
|
122
|
+
receivedAmount && /* @__PURE__ */ jsxs("p", { className: "swap-result__amount", children: [
|
|
123
|
+
sendRecipientDisplay || swapRecipientLabel || recipientTag || stealthPayee === "other" ? "" : "+",
|
|
124
|
+
receivedAmount,
|
|
125
|
+
" ",
|
|
126
|
+
toSymbol
|
|
127
|
+
] }),
|
|
128
|
+
(recipientTag || sendRecipientDisplay?.mode === "Shielded") && /* @__PURE__ */ jsx("p", { className: "swap-result__desc", children: /* @__PURE__ */ jsx(ShieldedDisclosure, {}) }),
|
|
129
|
+
fillMs != null && /* @__PURE__ */ jsxs("p", { className: "swap-result__settled", children: [
|
|
130
|
+
"Settled in ",
|
|
131
|
+
formatFillMs(fillMs)
|
|
132
|
+
] }),
|
|
133
|
+
isStealth && stealthPayee === "other" && /* @__PURE__ */ jsxs("div", { className: "swap-result__claim-step", children: [
|
|
134
|
+
/* @__PURE__ */ jsx("h4", { className: "swap-result__claim-title", children: "Next: the recipient claims it" }),
|
|
135
|
+
/* @__PURE__ */ jsx("p", { className: "swap-result__claim-note", children: "The funds wait at a one-time stealth address derived from the recipient's stealth meta-address. They find and claim it with their own stealth keys; there is nothing left for you to do." })
|
|
136
|
+
] }),
|
|
137
|
+
isStealth && stealthPayee !== "other" && /* @__PURE__ */ jsxs("div", { className: "swap-result__claim-step", children: [
|
|
138
|
+
/* @__PURE__ */ jsx("h4", { className: "swap-result__claim-title", children: "Next: claim the payment" }),
|
|
139
|
+
/* @__PURE__ */ jsxs("p", { className: "swap-result__claim-note", children: [
|
|
140
|
+
"The funds wait at a one-time address only the connected wallet can claim. Claiming is free and takes one signature. It can take a little while after delivery before the claim is ready.",
|
|
141
|
+
claimInXochiApp && ` ${CLAIM_IN_XOCHI_APP}`
|
|
142
|
+
] })
|
|
143
|
+
] }),
|
|
144
|
+
!isStealth && /* @__PURE__ */ jsxs("div", { className: "swap-result__links", children: [
|
|
145
|
+
receiptHash && /* @__PURE__ */ jsx(
|
|
146
|
+
TxLink,
|
|
147
|
+
{
|
|
148
|
+
chainId: settleChainId,
|
|
149
|
+
hash: receiptHash,
|
|
150
|
+
label: isCrossChain ? `View ${CHAIN_SHORT_NAMES[settleChainId]} tx` : "View transaction"
|
|
151
|
+
}
|
|
152
|
+
),
|
|
153
|
+
receivingTxHash && /* @__PURE__ */ jsx(
|
|
154
|
+
TxLink,
|
|
155
|
+
{
|
|
156
|
+
chainId: toChainId,
|
|
157
|
+
hash: receivingTxHash,
|
|
158
|
+
label: `View ${CHAIN_SHORT_NAMES[toChainId]} fill`
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
recipientTag !== void 0 && /* @__PURE__ */ jsxs(
|
|
162
|
+
"a",
|
|
163
|
+
{
|
|
164
|
+
href: ZKMONEY_ACTIVITY_URL,
|
|
165
|
+
target: "_blank",
|
|
166
|
+
rel: "noopener noreferrer",
|
|
167
|
+
className: "swap-result__txlink",
|
|
168
|
+
children: [
|
|
169
|
+
"Open zk.money ",
|
|
170
|
+
GLYPH.external,
|
|
171
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in new tab)" })
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] }),
|
|
176
|
+
isStealth && stealthPayee !== "other" && onGoToClaims ? /* @__PURE__ */ jsxs("div", { className: "swap-result__actions", children: [
|
|
177
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--cancel", onClick: onClose, children: "Done" }),
|
|
178
|
+
/* @__PURE__ */ jsx(
|
|
179
|
+
"button",
|
|
180
|
+
{
|
|
181
|
+
className: "modal-btn modal-btn--confirm swap-result__primary",
|
|
182
|
+
onClick: onGoToClaims,
|
|
183
|
+
children: "Claim payment"
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
] }) : /* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--confirm swap-result__primary", onClick: onClose, children: "Done" })
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
if (variant === "pending") {
|
|
190
|
+
return /* @__PURE__ */ jsxs("div", { className: "swap-result swap-result--pending", children: [
|
|
191
|
+
/* @__PURE__ */ jsx("div", { className: "swap-result__icon swap-result__icon--pending", "aria-hidden": "true", children: /* @__PURE__ */ jsxs(
|
|
192
|
+
"svg",
|
|
193
|
+
{
|
|
194
|
+
viewBox: "0 0 32 32",
|
|
195
|
+
width: "32",
|
|
196
|
+
height: "32",
|
|
197
|
+
fill: "none",
|
|
198
|
+
stroke: "currentColor",
|
|
199
|
+
strokeWidth: "2.5",
|
|
200
|
+
strokeLinecap: "round",
|
|
201
|
+
children: [
|
|
202
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "16", r: "14" }),
|
|
203
|
+
/* @__PURE__ */ jsx("path", { d: "M16 9v7l4 3" })
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
) }),
|
|
207
|
+
/* @__PURE__ */ jsx("h3", { className: "swap-result__title", children: sendRecipientDisplay ? stealthDelivered || useReceipt ? sentToRecipient(sendRecipientDisplay) : `Settling ${sendRecipientDisplay.mode} send` : swapRecipientLabel ? stealthDelivered || useReceipt ? `Sent to ${swapRecipientLabel}` : `Settling swap to ${swapRecipientLabel}` : isStealth ? stealthDelivered ? stealthPayee === "other" ? "Delivered with Stealth" : "Preparing the claim" : "Settling with Stealth" : useReceipt ? "Funds delivered" : "Still confirming" }),
|
|
208
|
+
/* @__PURE__ */ jsx("p", { className: "swap-result__desc", children: isStealth && stealthPayee === "other" ? stealthDelivered ? "The funds landed at a one-time stealth address only the recipient can spend from. They claim it with their own stealth keys; there is nothing to do. Safe to close this." : "Stealth payouts route to a one-time address only the recipient controls. When it lands, they claim it with their own stealth keys. Safe to close this." : isStealth ? stealthDelivered ? tabsShown ? "The funds landed at a one-time stealth address that only the connected wallet can spend from. The claim is still being set up; there is nothing to do. Safe to close this. It will show up in Claims when it is ready." : claimInXochiApp ? `The funds landed at a one-time stealth address that only the connected wallet can spend from. The claim is still being set up; there is nothing to do. Safe to close this. When it is ready: ${CLAIM_IN_XOCHI_APP}` : "The funds landed at a one-time stealth address that only the connected wallet can spend from. The claim is still being set up; there is nothing to do. Safe to close this, then claim it on the full widget when it is ready." : tabsShown ? "Stealth swaps route to a one-time address only the connected wallet controls. When it lands, claim it in the Claims tab to move it into the wallet. Your funds are safe. You can close this." : claimInXochiApp ? `Stealth swaps route to a one-time address only the connected wallet controls. When it lands: ${CLAIM_IN_XOCHI_APP} Your funds are safe. You can close this.` : "Stealth swaps route to a one-time address only the connected wallet controls. When it lands, claim it on the full widget, which opens in a new tab, to move it into the wallet. Your funds are safe. You can close this." : useReceipt ? tabsShown ? "Funds arrived. Finalizing the last step. Safe to close this and check Activity." : "Funds arrived. Finalizing the last step. Safe to close this." : tabsShown ? "This can take a moment. Safe to close this. Track it in the Activity tab." : "This can take a moment. Safe to close this." }),
|
|
209
|
+
receiptHash && !isStealth && /* @__PURE__ */ jsx("div", { className: "swap-result__links", children: /* @__PURE__ */ jsx(TxLink, { chainId: settleChainId, hash: receiptHash, label: "View transaction" }) }),
|
|
210
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--cancel swap-result__primary", onClick: onClose, children: "Close" })
|
|
211
|
+
] });
|
|
212
|
+
}
|
|
213
|
+
if (variant === "refunded") {
|
|
214
|
+
return /* @__PURE__ */ jsxs("div", { className: "swap-result swap-result--refunded", children: [
|
|
215
|
+
/* @__PURE__ */ jsx("div", { className: "swap-result__icon swap-result__icon--refunded", "aria-hidden": "true", children: /* @__PURE__ */ jsxs(
|
|
216
|
+
"svg",
|
|
217
|
+
{
|
|
218
|
+
viewBox: "0 0 32 32",
|
|
219
|
+
width: "32",
|
|
220
|
+
height: "32",
|
|
221
|
+
fill: "none",
|
|
222
|
+
stroke: "currentColor",
|
|
223
|
+
strokeWidth: "2.5",
|
|
224
|
+
strokeLinecap: "round",
|
|
225
|
+
strokeLinejoin: "round",
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "16", r: "14" }),
|
|
228
|
+
/* @__PURE__ */ jsx("path", { d: "M20 12h-6.5a3.5 3.5 0 0 0 0 7H16M16 9l-3 3 3 3" })
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
) }),
|
|
232
|
+
/* @__PURE__ */ jsx("h3", { className: "swap-result__title", children: "Deposit refunded" }),
|
|
233
|
+
/* @__PURE__ */ jsxs("p", { className: "swap-result__desc", children: [
|
|
234
|
+
refundReason && `${refundReason} `,
|
|
235
|
+
refundAddress ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
236
|
+
"The deposit was returned to",
|
|
237
|
+
" ",
|
|
238
|
+
/* @__PURE__ */ jsx("code", { title: refundAddress, children: truncateAddress(refundAddress) }),
|
|
239
|
+
"."
|
|
240
|
+
] }) : isTronChainId(fromChainId) ? /* @__PURE__ */ jsx(Fragment, { children: "The deposit was refunded. If you sent from an exchange, contact it if the refund is not credited." }) : !refundReason && "The deposit was returned to the sending address.",
|
|
241
|
+
" ",
|
|
242
|
+
"Get a new quote to try again."
|
|
243
|
+
] }),
|
|
244
|
+
/* @__PURE__ */ jsxs("div", { className: "swap-result__actions", children: [
|
|
245
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--cancel", onClick: onClose, children: "Close" }),
|
|
246
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--confirm", onClick: onRetry, children: "New quote" })
|
|
247
|
+
] })
|
|
248
|
+
] });
|
|
249
|
+
}
|
|
250
|
+
if (variant === "may-have-moved") {
|
|
251
|
+
return /* @__PURE__ */ jsxs("div", { className: "swap-result swap-result--failed", children: [
|
|
252
|
+
/* @__PURE__ */ jsx("div", { className: "swap-result__icon swap-result__icon--failed", "aria-hidden": "true", children: /* @__PURE__ */ jsxs(
|
|
253
|
+
"svg",
|
|
254
|
+
{
|
|
255
|
+
viewBox: "0 0 32 32",
|
|
256
|
+
width: "32",
|
|
257
|
+
height: "32",
|
|
258
|
+
fill: "none",
|
|
259
|
+
stroke: "currentColor",
|
|
260
|
+
strokeWidth: "2.5",
|
|
261
|
+
strokeLinecap: "round",
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "16", r: "14" }),
|
|
264
|
+
/* @__PURE__ */ jsx("path", { d: "M16 9v8M16 22v.5" })
|
|
265
|
+
]
|
|
266
|
+
}
|
|
267
|
+
) }),
|
|
268
|
+
/* @__PURE__ */ jsx("h3", { className: "swap-result__title", children: MAY_HAVE_MOVED_NOTICE.title }),
|
|
269
|
+
/* @__PURE__ */ jsx("p", { className: "swap-result__desc", children: MAY_HAVE_MOVED_NOTICE.detail }),
|
|
270
|
+
failureRef && /* @__PURE__ */ jsxs("div", { className: "swap-result__ref", children: [
|
|
271
|
+
/* @__PURE__ */ jsx("code", { className: "swap-result__ref-line", children: formatFailureRef(failureRef) }),
|
|
272
|
+
/* @__PURE__ */ jsxs("div", { className: "swap-result__ref-actions", children: [
|
|
273
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "btn btn--ghost btn--sm", onClick: copyDetails, children: copied ? "Copied" : "Copy details" }),
|
|
274
|
+
/* @__PURE__ */ jsx("a", { className: "btn btn--ghost btn--sm", href: supportMailto(failureRef), children: "Report" })
|
|
275
|
+
] })
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--cancel swap-result__primary", onClick: onClose, children: "Close" })
|
|
278
|
+
] });
|
|
279
|
+
}
|
|
280
|
+
return /* @__PURE__ */ jsxs("div", { className: "swap-result swap-result--failed", children: [
|
|
281
|
+
/* @__PURE__ */ jsx("div", { className: "swap-result__icon swap-result__icon--failed", "aria-hidden": "true", children: /* @__PURE__ */ jsxs(
|
|
282
|
+
"svg",
|
|
283
|
+
{
|
|
284
|
+
viewBox: "0 0 32 32",
|
|
285
|
+
width: "32",
|
|
286
|
+
height: "32",
|
|
287
|
+
fill: "none",
|
|
288
|
+
stroke: "currentColor",
|
|
289
|
+
strokeWidth: "2.5",
|
|
290
|
+
strokeLinecap: "round",
|
|
291
|
+
strokeLinejoin: "round",
|
|
292
|
+
children: [
|
|
293
|
+
/* @__PURE__ */ jsx("circle", { cx: "16", cy: "16", r: "14" }),
|
|
294
|
+
/* @__PURE__ */ jsx("path", { d: "M11 11l10 10M21 11L11 21" })
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
) }),
|
|
298
|
+
/* @__PURE__ */ jsx("h3", { className: "swap-result__title", children: info?.message ?? (sendRecipientDisplay ? "Send failed" : "Swap failed") }),
|
|
299
|
+
info?.suggestion && /* @__PURE__ */ jsx("p", { className: "swap-result__desc", children: info.suggestion }),
|
|
300
|
+
failureRef && !tagLookupFailure && /* @__PURE__ */ jsxs("div", { className: "swap-result__ref", children: [
|
|
301
|
+
/* @__PURE__ */ jsx("code", { className: "swap-result__ref-line", children: formatFailureRef(failureRef) }),
|
|
302
|
+
/* @__PURE__ */ jsxs("div", { className: "swap-result__ref-actions", children: [
|
|
303
|
+
/* @__PURE__ */ jsx("button", { type: "button", className: "btn btn--ghost btn--sm", onClick: copyDetails, children: copied ? "Copied" : "Copy details" }),
|
|
304
|
+
/* @__PURE__ */ jsx("a", { className: "btn btn--ghost btn--sm", href: supportMailto(failureRef), children: "Report" })
|
|
305
|
+
] })
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ jsxs("div", { className: "swap-result__actions", children: [
|
|
308
|
+
/* @__PURE__ */ jsx("button", { className: "modal-btn modal-btn--cancel", onClick: onClose, children: "Dismiss" }),
|
|
309
|
+
info?.canRetry !== false && /* @__PURE__ */ jsx(
|
|
310
|
+
"button",
|
|
311
|
+
{
|
|
312
|
+
className: "modal-btn modal-btn--confirm",
|
|
313
|
+
onClick: onRetry,
|
|
314
|
+
disabled: isWaitingForRetry,
|
|
315
|
+
children: isWaitingForRetry ? `Try again in ${countdown}s` : info?.retryLabel ?? "Try again"
|
|
316
|
+
}
|
|
317
|
+
)
|
|
318
|
+
] })
|
|
319
|
+
] });
|
|
320
|
+
}
|
|
321
|
+
export {
|
|
322
|
+
SwapResult
|
|
323
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { isSelectableChainId, isCantonDestinationChainId, getTokenInfoForChain } from "@xochi/client";
|
|
2
|
+
import { formatTokenAmount } from "../../utils/format.js";
|
|
3
|
+
function formatAttestedAmount(raw, decimals) {
|
|
4
|
+
if (!/^\d+$/.test(raw)) return void 0;
|
|
5
|
+
return formatTokenAmount(BigInt(raw), decimals, 6);
|
|
6
|
+
}
|
|
7
|
+
function buildDepositScreen(attested) {
|
|
8
|
+
if (!attested?.deposit_address) return null;
|
|
9
|
+
if (!isSelectableChainId(attested.from_chain_id)) return null;
|
|
10
|
+
if (!isSelectableChainId(attested.to_chain_id)) return null;
|
|
11
|
+
if (isCantonDestinationChainId(attested.from_chain_id)) return null;
|
|
12
|
+
if (isCantonDestinationChainId(attested.to_chain_id)) return null;
|
|
13
|
+
const fromChainId = attested.from_chain_id;
|
|
14
|
+
const toChainId = attested.to_chain_id;
|
|
15
|
+
const fromInfo = getTokenInfoForChain(attested.from_token, fromChainId);
|
|
16
|
+
const toInfo = getTokenInfoForChain(attested.to_token, toChainId);
|
|
17
|
+
if (!fromInfo || !toInfo) return null;
|
|
18
|
+
return {
|
|
19
|
+
depositAddress: attested.deposit_address,
|
|
20
|
+
fromAmount: attested.from_amount,
|
|
21
|
+
fromSymbol: fromInfo.symbol,
|
|
22
|
+
fromDecimals: fromInfo.decimals,
|
|
23
|
+
fromChainId,
|
|
24
|
+
toSymbol: toInfo.symbol,
|
|
25
|
+
toChainId,
|
|
26
|
+
receivedAmount: formatAttestedAmount(attested.to_amount, toInfo.decimals),
|
|
27
|
+
// Empty means the field bound nothing, which renders no address rather than
|
|
28
|
+
// falling back to a live one. See DepositInstructions.
|
|
29
|
+
payoutAddress: attested.recipient || void 0,
|
|
30
|
+
refundAddress: attested.refund_address || void 0,
|
|
31
|
+
depositDeadline: attested.deposit_deadline ?? void 0
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
buildDepositScreen
|
|
36
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createContext, useContext } from "react";
|
|
2
|
+
const WidgetTabsContext = createContext(true);
|
|
3
|
+
function useWidgetTabsShown() {
|
|
4
|
+
return useContext(WidgetTabsContext);
|
|
5
|
+
}
|
|
6
|
+
const ClaimInXochiAppContext = createContext(false);
|
|
7
|
+
function useClaimInXochiApp() {
|
|
8
|
+
return useContext(ClaimInXochiAppContext);
|
|
9
|
+
}
|
|
10
|
+
const CLAIM_IN_XOCHI_APP = "Claim it in the Xochi app with the receiving wallet.";
|
|
11
|
+
export {
|
|
12
|
+
CLAIM_IN_XOCHI_APP,
|
|
13
|
+
ClaimInXochiAppContext,
|
|
14
|
+
WidgetTabsContext,
|
|
15
|
+
useClaimInXochiApp,
|
|
16
|
+
useWidgetTabsShown
|
|
17
|
+
};
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { firstPartyOrigins } from "./lib/hostOrigin.js";
|
|
2
|
+
import { parseEmbedParams } from "@xochi/widget-lib";
|
|
3
|
+
import { SUPPORTED_CHAIN_IDS } from "@xochi/client";
|
|
4
|
+
let PEER_ENVIRONMENT = "production";
|
|
5
|
+
let PEER_REFERRAL_CODE;
|
|
6
|
+
let OFFRAMP_CANARY_CAP_ATOMIC;
|
|
7
|
+
let ONRAMP_CANARY_CAP_ATOMIC;
|
|
8
|
+
let API_URL = "https://api.xochi.fi";
|
|
9
|
+
let AUTH_API_URL = API_URL;
|
|
10
|
+
let isDevelopment = false;
|
|
11
|
+
let APP_VERSION = "dev";
|
|
12
|
+
let FIRST_PARTY_HOST_ORIGINS = [];
|
|
13
|
+
let HOST_ORIGIN;
|
|
14
|
+
let SITE_URL = "https://xochi.fi";
|
|
15
|
+
let WALLETCONNECT_PROJECT_ID = "a992784b090fa32d560ea6d4136d431f";
|
|
16
|
+
let RPC_URLS = {};
|
|
17
|
+
let ARC_BROWSER_RPC_URL;
|
|
18
|
+
let ARC_BROWSER_ENABLED = false;
|
|
19
|
+
let GNOSIS_ENABLED = false;
|
|
20
|
+
let RECIPIENT_RECEIPTS_LIVE = false;
|
|
21
|
+
let SOLVER_PIN = { erc3009Allowlist: [], permit2Allowlist: [], requirePin: false };
|
|
22
|
+
let PULL_RECIPIENTS;
|
|
23
|
+
let DEPOSIT_ATTESTATION_PIN = { signer: "" };
|
|
24
|
+
let ESCROW_PINS;
|
|
25
|
+
let configured = false;
|
|
26
|
+
function configureWidget(settings) {
|
|
27
|
+
if (configured)
|
|
28
|
+
throw new Error("Widget settings are immutable for this document; reload to change them.");
|
|
29
|
+
if (settings.peerEnvironment !== void 0 && !["production", "preproduction", "staging"].includes(settings.peerEnvironment))
|
|
30
|
+
throw new Error("Invalid Peer environment");
|
|
31
|
+
if (settings.peerReferralCode !== void 0 && !/^[A-Za-z0-9]{6}$/.test(settings.peerReferralCode))
|
|
32
|
+
throw new Error("Invalid Peer referral code");
|
|
33
|
+
if (settings.offrampCanaryCapAtomic !== void 0 && !/^[1-9][0-9]{0,30}$/.test(settings.offrampCanaryCapAtomic))
|
|
34
|
+
throw new Error("Invalid cash-out canary cap");
|
|
35
|
+
if (settings.onrampCanaryCapAtomic !== void 0 && !/^[1-9][0-9]{0,30}$/.test(settings.onrampCanaryCapAtomic))
|
|
36
|
+
throw new Error("Invalid purchase canary cap");
|
|
37
|
+
PEER_ENVIRONMENT = settings.peerEnvironment ?? "production";
|
|
38
|
+
PEER_REFERRAL_CODE = settings.peerReferralCode;
|
|
39
|
+
OFFRAMP_CANARY_CAP_ATOMIC = settings.offrampCanaryCapAtomic;
|
|
40
|
+
ONRAMP_CANARY_CAP_ATOMIC = settings.onrampCanaryCapAtomic;
|
|
41
|
+
API_URL = settings.apiUrl;
|
|
42
|
+
AUTH_API_URL = settings.authApiUrl || API_URL;
|
|
43
|
+
isDevelopment = settings.development ?? false;
|
|
44
|
+
APP_VERSION = settings.appVersion ?? "dev";
|
|
45
|
+
HOST_ORIGIN = settings.hostOrigin;
|
|
46
|
+
FIRST_PARTY_HOST_ORIGINS = firstPartyOrigins(settings.firstPartyHosts ?? "");
|
|
47
|
+
SITE_URL = settings.siteUrl || "https://xochi.fi";
|
|
48
|
+
WALLETCONNECT_PROJECT_ID = settings.walletConnectProjectId ?? WALLETCONNECT_PROJECT_ID;
|
|
49
|
+
RPC_URLS = Object.freeze({ ...settings.rpcUrls });
|
|
50
|
+
ARC_BROWSER_RPC_URL = settings.arcRpcUrl?.trim() || void 0;
|
|
51
|
+
ARC_BROWSER_ENABLED = settings.arcLive === true && ARC_BROWSER_RPC_URL !== void 0;
|
|
52
|
+
GNOSIS_ENABLED = settings.gnosisLive === true;
|
|
53
|
+
RECIPIENT_RECEIPTS_LIVE = settings.recipientReceiptsLive ?? false;
|
|
54
|
+
const normalize = (addresses) => Object.freeze(addresses.map((address) => address.trim().toLowerCase()).filter(Boolean));
|
|
55
|
+
SOLVER_PIN = Object.freeze({
|
|
56
|
+
erc3009Allowlist: normalize(settings.solverPin.erc3009Allowlist),
|
|
57
|
+
permit2Allowlist: normalize(settings.solverPin.permit2Allowlist),
|
|
58
|
+
requirePin: settings.solverPin.requirePin
|
|
59
|
+
});
|
|
60
|
+
PULL_RECIPIENTS = SOLVER_PIN.erc3009Allowlist.length === 0 ? void 0 : Object.fromEntries(
|
|
61
|
+
SUPPORTED_CHAIN_IDS.map((chainId) => [
|
|
62
|
+
chainId,
|
|
63
|
+
{
|
|
64
|
+
erc3009: SOLVER_PIN.erc3009Allowlist,
|
|
65
|
+
...SOLVER_PIN.permit2Allowlist.length > 0 ? { permit2: SOLVER_PIN.permit2Allowlist } : {}
|
|
66
|
+
}
|
|
67
|
+
])
|
|
68
|
+
);
|
|
69
|
+
DEPOSIT_ATTESTATION_PIN = Object.freeze({
|
|
70
|
+
signer: settings.depositAttestationSigner.trim().toLowerCase()
|
|
71
|
+
});
|
|
72
|
+
ESCROW_PINS = settings.escrows === void 0 ? void 0 : Object.freeze(
|
|
73
|
+
Object.fromEntries(
|
|
74
|
+
Object.entries(settings.escrows).map(([chainId, escrow]) => [chainId, escrow.trim()])
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
configured = true;
|
|
78
|
+
}
|
|
79
|
+
function requireWidgetConfiguration() {
|
|
80
|
+
if (!configured)
|
|
81
|
+
throw new Error("Call configureWidget(settings) before rendering the widget or configurator.");
|
|
82
|
+
}
|
|
83
|
+
const TIMEOUTS = {
|
|
84
|
+
quoteCacheTtl: 15e3,
|
|
85
|
+
requestTimeout: 15e3,
|
|
86
|
+
executeTimeout: 12e4,
|
|
87
|
+
balanceRefresh: 3e4,
|
|
88
|
+
quoteDebounce: 500,
|
|
89
|
+
toastDuration: 4e3,
|
|
90
|
+
clipboardFeedback: 2e3
|
|
91
|
+
};
|
|
92
|
+
const RETRY = { maxAttempts: 3, baseDelay: 1e3, maxDelay: 1e4 };
|
|
93
|
+
function readWidgetEmbedConfig(search = typeof window === "undefined" ? "" : window.location.search) {
|
|
94
|
+
const { initialTab, tabs, initialMode, modes, sendDestinations, fiatCurrency, rampProviders } = parseEmbedParams(search);
|
|
95
|
+
return {
|
|
96
|
+
...initialTab === void 0 || tabs !== void 0 && !tabs.includes(initialTab) ? {} : { initialTab },
|
|
97
|
+
...tabs === void 0 ? {} : { tabs },
|
|
98
|
+
...initialMode === void 0 || modes !== void 0 && !modes.includes(initialMode) ? {} : { initialMode },
|
|
99
|
+
...modes === void 0 ? {} : { modes },
|
|
100
|
+
...sendDestinations === void 0 ? {} : { sendDestinations },
|
|
101
|
+
...fiatCurrency === void 0 ? {} : { fiatCurrency },
|
|
102
|
+
...rampProviders === void 0 ? {} : { rampProviders }
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
export {
|
|
106
|
+
API_URL,
|
|
107
|
+
APP_VERSION,
|
|
108
|
+
ARC_BROWSER_ENABLED,
|
|
109
|
+
ARC_BROWSER_RPC_URL,
|
|
110
|
+
AUTH_API_URL,
|
|
111
|
+
DEPOSIT_ATTESTATION_PIN,
|
|
112
|
+
ESCROW_PINS,
|
|
113
|
+
FIRST_PARTY_HOST_ORIGINS,
|
|
114
|
+
GNOSIS_ENABLED,
|
|
115
|
+
HOST_ORIGIN,
|
|
116
|
+
OFFRAMP_CANARY_CAP_ATOMIC,
|
|
117
|
+
ONRAMP_CANARY_CAP_ATOMIC,
|
|
118
|
+
PEER_ENVIRONMENT,
|
|
119
|
+
PEER_REFERRAL_CODE,
|
|
120
|
+
PULL_RECIPIENTS,
|
|
121
|
+
RECIPIENT_RECEIPTS_LIVE,
|
|
122
|
+
RETRY,
|
|
123
|
+
RPC_URLS,
|
|
124
|
+
SITE_URL,
|
|
125
|
+
SOLVER_PIN,
|
|
126
|
+
TIMEOUTS,
|
|
127
|
+
WALLETCONNECT_PROJECT_ID,
|
|
128
|
+
configureWidget,
|
|
129
|
+
isDevelopment,
|
|
130
|
+
readWidgetEmbedConfig,
|
|
131
|
+
requireWidgetConfiguration
|
|
132
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { CLAIMS_HASH, EMBED_PARAM_HINT, FRAME_DEFAULTS, FRAME_FIELDS, FULL_LOOK, OPEN_POLICY, amountProblem, chainName, claimsPath, codeProblem, embedCodes, embedLook, embedOffer, embedOverrides, explainEmbedDefaults, heightProblem, legChainAllowed, legSymbols, legTokenAllowed, legTokens, narrowSymbols, policyAdmits, policyHolds, resolveEmbedDefaults, restrictOffer, routeFills, sameEmbedDefaults, stealthOffered } from "./pages/trade/embedParams.js";
|
|
2
|
+
import { EMBED_THEME_APP } from "./pages/trade/embedTheme.js";
|
|
3
|
+
import { VIEW_PARAM, configuratorSearch, readConfiguratorSearch } from "./pages/configurator/configuratorUrl.js";
|
|
4
|
+
import { FIELD_BY_KEY, PARAM_KEYS, paramsText, readParamsDraft } from "./pages/configurator/paramsDraft.js";
|
|
5
|
+
import { BACKDROP_KINDS, DEFAULT_BACKDROP, PHONE_WIDTH, PREVIEW_DEVICES } from "./pages/configurator/previewModel.js";
|
|
6
|
+
import { allowListPolicy, chainRefusal, changeRoute, flipRoute, offeredChain, routeRefusal, tokenAvailability } from "./pages/configurator/routePicks.js";
|
|
7
|
+
import { CODE_FORMATS, codeFor, htmlSnippet, rampSnippet, reactSnippet, widgetLibModuleUrl } from "./pages/configurator/snippets.js";
|
|
8
|
+
import { SURFACE_FIELDS, replaceSurfaceParams, surfaceParams, withSurfaceParams } from "./pages/configurator/surfaceParams.js";
|
|
9
|
+
import { SEND_DESTINATIONS, TRADE_MODES, WIDGET_TABS } from "@xochi/widget-lib";
|
|
10
|
+
export {
|
|
11
|
+
BACKDROP_KINDS,
|
|
12
|
+
CLAIMS_HASH,
|
|
13
|
+
CODE_FORMATS,
|
|
14
|
+
DEFAULT_BACKDROP,
|
|
15
|
+
SEND_DESTINATIONS as DESTINATIONS,
|
|
16
|
+
EMBED_PARAM_HINT,
|
|
17
|
+
EMBED_THEME_APP,
|
|
18
|
+
FIELD_BY_KEY,
|
|
19
|
+
FRAME_DEFAULTS,
|
|
20
|
+
FRAME_FIELDS,
|
|
21
|
+
FULL_LOOK,
|
|
22
|
+
TRADE_MODES as MODES,
|
|
23
|
+
OPEN_POLICY,
|
|
24
|
+
PARAM_KEYS,
|
|
25
|
+
PHONE_WIDTH,
|
|
26
|
+
PREVIEW_DEVICES,
|
|
27
|
+
SURFACE_FIELDS,
|
|
28
|
+
WIDGET_TABS as TABS,
|
|
29
|
+
VIEW_PARAM,
|
|
30
|
+
allowListPolicy,
|
|
31
|
+
amountProblem,
|
|
32
|
+
chainName,
|
|
33
|
+
chainRefusal,
|
|
34
|
+
changeRoute,
|
|
35
|
+
claimsPath,
|
|
36
|
+
codeFor,
|
|
37
|
+
codeProblem,
|
|
38
|
+
configuratorSearch,
|
|
39
|
+
embedCodes,
|
|
40
|
+
embedLook,
|
|
41
|
+
embedOffer,
|
|
42
|
+
embedOverrides,
|
|
43
|
+
explainEmbedDefaults,
|
|
44
|
+
flipRoute,
|
|
45
|
+
heightProblem,
|
|
46
|
+
htmlSnippet,
|
|
47
|
+
legChainAllowed,
|
|
48
|
+
legSymbols,
|
|
49
|
+
legTokenAllowed,
|
|
50
|
+
legTokens,
|
|
51
|
+
narrowSymbols,
|
|
52
|
+
offeredChain,
|
|
53
|
+
paramsText,
|
|
54
|
+
policyAdmits,
|
|
55
|
+
policyHolds,
|
|
56
|
+
rampSnippet,
|
|
57
|
+
reactSnippet,
|
|
58
|
+
readConfiguratorSearch,
|
|
59
|
+
readParamsDraft,
|
|
60
|
+
replaceSurfaceParams,
|
|
61
|
+
resolveEmbedDefaults,
|
|
62
|
+
restrictOffer,
|
|
63
|
+
routeFills,
|
|
64
|
+
routeRefusal,
|
|
65
|
+
sameEmbedDefaults,
|
|
66
|
+
stealthOffered,
|
|
67
|
+
surfaceParams,
|
|
68
|
+
tokenAvailability,
|
|
69
|
+
widgetLibModuleUrl,
|
|
70
|
+
withSurfaceParams
|
|
71
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { lazy } from "react";
|
|
2
|
+
import { requireWidgetConfiguration } from "./config.js";
|
|
3
|
+
import { configureWidget } from "./config.js";
|
|
4
|
+
const Configurator = lazy(async () => {
|
|
5
|
+
requireWidgetConfiguration();
|
|
6
|
+
return import("./ConfiguratorApp.js");
|
|
7
|
+
});
|
|
8
|
+
export {
|
|
9
|
+
Configurator,
|
|
10
|
+
configureWidget
|
|
11
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
const PALETTE = {
|
|
2
|
+
obsidian: "#0a0a0c",
|
|
3
|
+
mutedGold: "#a89a80",
|
|
4
|
+
mutedGoldBright: "#c4b496",
|
|
5
|
+
mutedGoldDark: "#7a6e5a"
|
|
6
|
+
};
|
|
7
|
+
const STORAGE_KEYS = {
|
|
8
|
+
/** User's verification state (score, attestations, timestamp). Read-only today. */
|
|
9
|
+
verifyState: "xochi_verify_state",
|
|
10
|
+
/** Cached attestations from identity providers */
|
|
11
|
+
attestations: "xochi_attestations",
|
|
12
|
+
/** UI theme preference */
|
|
13
|
+
theme: "xochi_theme",
|
|
14
|
+
/** Stealth key storage prefix */
|
|
15
|
+
stealthPrefix: "xochi:stealth:",
|
|
16
|
+
/** RETIRED: the settlement roadmap modal no longer exists, so nothing writes
|
|
17
|
+
* this anymore. Kept declared so the /cookies clear buttons still remove it
|
|
18
|
+
* from browsers that hold it (clearBucket only touches declared keys). */
|
|
19
|
+
settlementRoadmapSeen: "xochi_settlement_roadmap_seen",
|
|
20
|
+
/** Local-first swap activity log (prefix; per-wallet key appended) */
|
|
21
|
+
localActivityPrefix: "xochi_local_activity:",
|
|
22
|
+
/** Local-first log of public sends from the Send tab (prefix; per-wallet key appended) */
|
|
23
|
+
localSendsPrefix: "xochi_local_sends:",
|
|
24
|
+
/** Sanitized summaries of payment-app cash-outs (prefix; per-wallet). No payee or deposit data. */
|
|
25
|
+
localOfframpsPrefix: "xochi_local_offramps:",
|
|
26
|
+
/** Sanitized Peer onramp summaries; the S4 operation store keeps snapshots under `xochi:ramp/1:` */
|
|
27
|
+
localRamps: "xochi_local_ramps",
|
|
28
|
+
/** Intent ids whose flow modal the user closed, so it never auto-reopens (prefix; per-wallet) */
|
|
29
|
+
resumeDismissedPrefix: "xochi_resume_dismissed:",
|
|
30
|
+
/** Authorized-agent registry + per-agent stream capability (prefix; per-wallet) */
|
|
31
|
+
agentRegistryPrefix: "xochi_agent_registry:",
|
|
32
|
+
/** Mobile "open in your wallet's browser" signing hint dismissed */
|
|
33
|
+
mobileSigningHintDismissed: "xochi_mobile_signing_hint_dismissed",
|
|
34
|
+
// sessionStorage, not localStorage. Both clear when the tab closes. They live
|
|
35
|
+
// in the same table so the inventory covers every key the app writes, whichever
|
|
36
|
+
// store it lands in.
|
|
37
|
+
/** Passkey-issued JWT (sessionStorage; see src/lib/auth.ts) */
|
|
38
|
+
authToken: "xochi_auth_token",
|
|
39
|
+
/** Sign-In-With-Wallet session (sessionStorage; see src/lib/walletSession.ts) */
|
|
40
|
+
walletSession: "xochi_wallet_session"
|
|
41
|
+
};
|
|
42
|
+
const UI = {
|
|
43
|
+
CONNECT_WALLET: "Connect wallet",
|
|
44
|
+
CONNECT_PROMPT: "Connect wallet first",
|
|
45
|
+
CONNECT_TO_VIEW: "Connect wallet to view"
|
|
46
|
+
};
|
|
47
|
+
const AZTEC_CHAIN_ID = 0;
|
|
48
|
+
export {
|
|
49
|
+
AZTEC_CHAIN_ID,
|
|
50
|
+
PALETTE,
|
|
51
|
+
STORAGE_KEYS,
|
|
52
|
+
UI
|
|
53
|
+
};
|