@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,765 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useMemo, useState, useEffect, useId } from "react";
|
|
3
|
+
import { useAccount, useConfig } from "wagmi";
|
|
4
|
+
import { formatTokenAmount } from "../../utils/format.js";
|
|
5
|
+
import { usePublicBalances } from "../../hooks/usePublicBalances.js";
|
|
6
|
+
import { RampDisclosure, RampFacts } from "../availability/RampDisclosure.js";
|
|
7
|
+
import { RailTiles, RailChoice, UnavailableRails, RailTileContent } from "../availability/RailTiles.js";
|
|
8
|
+
import { OverallCard } from "../availability/RampRails.js";
|
|
9
|
+
import { getExplorerTxUrl } from "@xochi/client";
|
|
10
|
+
import { parseRampAmount, railCard, overallCard, formatRampTime } from "../availability/model.js";
|
|
11
|
+
import { usdcDecimal, canaryCapError, formatEstimate, payeeError, maskPayee, estimateSecondsLeft, formatUsdc, orderHeadline, progressSteps, canWithdraw, WALLET_ACTION_LABELS } from "./model.js";
|
|
12
|
+
import { OfframpPortContext, createLiveOfframpPort, BASE_CHAIN_ID } from "./port.js";
|
|
13
|
+
import { useOfframp } from "./useOfframp.js";
|
|
14
|
+
import { CompletedPrerequisite } from "./CompletedPrerequisite.js";
|
|
15
|
+
import { OfframpRoute } from "./OfframpRoute.js";
|
|
16
|
+
import { inspectOfframpPrerequisite } from "./prerequisite.js";
|
|
17
|
+
import { useOfframpRails } from "./useOfframpRails.js";
|
|
18
|
+
function useOfframpPort() {
|
|
19
|
+
const injected = useContext(OfframpPortContext);
|
|
20
|
+
const config = useConfig();
|
|
21
|
+
return useMemo(() => injected ?? createLiveOfframpPort(config), [injected, config]);
|
|
22
|
+
}
|
|
23
|
+
function PaymentAppSend({
|
|
24
|
+
active,
|
|
25
|
+
fiatCurrency = "USD",
|
|
26
|
+
onConnectRequest
|
|
27
|
+
}) {
|
|
28
|
+
const port = useOfframpPort();
|
|
29
|
+
const { address } = useAccount();
|
|
30
|
+
return /* @__PURE__ */ jsx(
|
|
31
|
+
WalletPaymentAppSend,
|
|
32
|
+
{
|
|
33
|
+
address,
|
|
34
|
+
port,
|
|
35
|
+
active,
|
|
36
|
+
fiatCurrency,
|
|
37
|
+
onConnectRequest
|
|
38
|
+
},
|
|
39
|
+
address
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function WalletPaymentAppSend({
|
|
43
|
+
active,
|
|
44
|
+
fiatCurrency = "USD",
|
|
45
|
+
address,
|
|
46
|
+
onConnectRequest,
|
|
47
|
+
port
|
|
48
|
+
}) {
|
|
49
|
+
const checkpoint = address ? inspectOfframpPrerequisite(address) : void 0;
|
|
50
|
+
const [route, setRoute] = useState();
|
|
51
|
+
const [routeAmount, setRouteAmount] = useState();
|
|
52
|
+
const funding = useMemo(
|
|
53
|
+
() => route ? (amount) => route.funded(amount) : checkpoint ? async () => false : void 0,
|
|
54
|
+
[route, !!checkpoint]
|
|
55
|
+
);
|
|
56
|
+
const flow = useOfframp(port, address, active, funding);
|
|
57
|
+
const [reviewDraft, setReviewDraft] = useState();
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (flow.view.kind === "order") setReviewDraft(void 0);
|
|
60
|
+
}, [flow.view.kind]);
|
|
61
|
+
const [editAmount, setEditAmount] = useState("");
|
|
62
|
+
const [editCurrency, setEditCurrency] = useState(fiatCurrency);
|
|
63
|
+
return /* @__PURE__ */ jsxs("section", { className: "ramp-rails", "aria-label": "Cash out", children: [
|
|
64
|
+
checkpoint && !route && flow.view.kind !== "edit" && /* @__PURE__ */ jsx(
|
|
65
|
+
OfframpRoute,
|
|
66
|
+
{
|
|
67
|
+
port,
|
|
68
|
+
onLock: () => {
|
|
69
|
+
},
|
|
70
|
+
onReceipt: setRoute,
|
|
71
|
+
onReady: (next, amount) => {
|
|
72
|
+
setRoute(next);
|
|
73
|
+
setRouteAmount(amount);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
address
|
|
77
|
+
),
|
|
78
|
+
route && /* @__PURE__ */ jsx(
|
|
79
|
+
CompletedPrerequisite,
|
|
80
|
+
{
|
|
81
|
+
receipt: route.snapshot().xochi?.transaction_hash ?? route.snapshot().operation_id,
|
|
82
|
+
wallet: address ?? "",
|
|
83
|
+
peerFailed: flow.view.kind === "order" && flow.view.order.stage === "before_deposit" && flow.view.order.snapshot.peer.state === "failed"
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
flow.view.kind === "edit" && /* @__PURE__ */ jsx(
|
|
87
|
+
EditStep,
|
|
88
|
+
{
|
|
89
|
+
flow,
|
|
90
|
+
account: address,
|
|
91
|
+
active,
|
|
92
|
+
fiatCurrency,
|
|
93
|
+
amountText: editAmount,
|
|
94
|
+
setAmountText: setEditAmount,
|
|
95
|
+
currency: editCurrency,
|
|
96
|
+
setCurrency: setEditCurrency,
|
|
97
|
+
onConnectRequest,
|
|
98
|
+
routeAmount,
|
|
99
|
+
onReceipt: setRoute,
|
|
100
|
+
onReady: (next, amount) => {
|
|
101
|
+
setRoute(next);
|
|
102
|
+
setRouteAmount(amount);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
address
|
|
106
|
+
),
|
|
107
|
+
flow.view.kind === "review" && /* @__PURE__ */ jsx(
|
|
108
|
+
ReviewStep,
|
|
109
|
+
{
|
|
110
|
+
flow,
|
|
111
|
+
quote: flow.view.quote,
|
|
112
|
+
draft: reviewDraft?.rail === flow.view.quote.offer.rail.id ? reviewDraft : { rail: flow.view.quote.offer.rail.id, payee: "", owned: false, accepted: false },
|
|
113
|
+
setDraft: setReviewDraft
|
|
114
|
+
}
|
|
115
|
+
),
|
|
116
|
+
flow.view.kind === "order" && /* @__PURE__ */ jsx(OrderStep, { flow, order: flow.view.order }),
|
|
117
|
+
flow.notice && /* @__PURE__ */ jsx("p", { className: "send-field__error", role: "alert", children: flow.notice })
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
function EditStep({
|
|
121
|
+
flow,
|
|
122
|
+
account,
|
|
123
|
+
active,
|
|
124
|
+
fiatCurrency,
|
|
125
|
+
routeAmount,
|
|
126
|
+
onConnectRequest,
|
|
127
|
+
amountText,
|
|
128
|
+
setAmountText,
|
|
129
|
+
currency,
|
|
130
|
+
setCurrency,
|
|
131
|
+
onReady,
|
|
132
|
+
onReceipt
|
|
133
|
+
}) {
|
|
134
|
+
const id = useId();
|
|
135
|
+
const port = useOfframpPort();
|
|
136
|
+
const settlement = useMemo(() => port.settlement(), [port]);
|
|
137
|
+
const [routeLocked, setRouteLocked] = useState(
|
|
138
|
+
() => !!(account && inspectOfframpPrerequisite(account))
|
|
139
|
+
);
|
|
140
|
+
const [source, setSource] = useState(
|
|
141
|
+
() => account && inspectOfframpPrerequisite(account) ? "other" : "base_usdc"
|
|
142
|
+
);
|
|
143
|
+
const { readBalanceOf } = usePublicBalances();
|
|
144
|
+
const balance = settlement ? readBalanceOf(BASE_CHAIN_ID, settlement.asset_id) : null;
|
|
145
|
+
const cap = port.canaryCap();
|
|
146
|
+
const max = balance !== null && cap !== void 0 && balance > BigInt(cap) ? BigInt(cap) : balance;
|
|
147
|
+
const [selected, setSelected] = useState();
|
|
148
|
+
useEffect(() => {
|
|
149
|
+
if (routeAmount) {
|
|
150
|
+
setSource("base_usdc");
|
|
151
|
+
setAmountText(usdcDecimal(routeAmount));
|
|
152
|
+
}
|
|
153
|
+
}, [routeAmount, setAmountText]);
|
|
154
|
+
const amount = parseRampAmount(amountText);
|
|
155
|
+
const amountInvalid = amountText.trim() !== "" && amount === void 0;
|
|
156
|
+
const overCap = canaryCapError(amount, port.canaryCap());
|
|
157
|
+
const { state, now, refresh } = useOfframpRails({
|
|
158
|
+
port,
|
|
159
|
+
runtime: flow.runtime,
|
|
160
|
+
settlement,
|
|
161
|
+
account,
|
|
162
|
+
amount: overCap ? void 0 : amount,
|
|
163
|
+
currency,
|
|
164
|
+
enabled: active && source === "base_usdc"
|
|
165
|
+
});
|
|
166
|
+
const cards = state.status === "done" && settlement && account && amount !== void 0 && !overCap && state.intent.exact.money.atomic === amount && state.intent.fiat.currency === currency && state.intent.recipient === account ? state.offers.map((offer) => ({
|
|
167
|
+
offer,
|
|
168
|
+
card: railCard(offer, state.intent, settlement, now)
|
|
169
|
+
})) : [];
|
|
170
|
+
const selectable = cards.filter((c) => c.card.selectable);
|
|
171
|
+
const blocked = cards.filter((c) => !c.card.selectable);
|
|
172
|
+
const chosen = selectable.find((c) => c.card.id === selected);
|
|
173
|
+
const lost = selected !== void 0 && chosen === void 0 && state.status === "done";
|
|
174
|
+
const currencies = [.../* @__PURE__ */ new Set([fiatCurrency, "USD"])];
|
|
175
|
+
const estimateFor = (offer) => state.status === "done" ? state.estimates.find((e) => e.offerId === offer.offer_id) : void 0;
|
|
176
|
+
let status;
|
|
177
|
+
if (!account)
|
|
178
|
+
status = onConnectRequest ? void 0 : "Connect a wallet and enter an amount to check availability.";
|
|
179
|
+
else if (!settlement)
|
|
180
|
+
status = "Peer’s Base USDC configuration is unavailable. Check again later.";
|
|
181
|
+
else if (lost) status = "That app is unavailable. Choose again.";
|
|
182
|
+
else if (flow.runtimeFailed)
|
|
183
|
+
status = "Cash out is unavailable for this wallet. Reconnect your wallet and check again.";
|
|
184
|
+
else if (account && amount === void 0 && !amountInvalid)
|
|
185
|
+
status = "Enter an amount to check payment apps.";
|
|
186
|
+
else if (overCap) status = overCap;
|
|
187
|
+
else if (state.status === "loading") status = "Checking payment apps…";
|
|
188
|
+
const sourcePicker = /* @__PURE__ */ jsxs("label", { className: "send-field", children: [
|
|
189
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__label", children: "Cash out from" }),
|
|
190
|
+
/* @__PURE__ */ jsxs(
|
|
191
|
+
"select",
|
|
192
|
+
{
|
|
193
|
+
className: "send-field__control",
|
|
194
|
+
value: source,
|
|
195
|
+
disabled: !!routeAmount || routeLocked,
|
|
196
|
+
onChange: (e) => {
|
|
197
|
+
setSource(e.target.value);
|
|
198
|
+
setSelected(void 0);
|
|
199
|
+
},
|
|
200
|
+
children: [
|
|
201
|
+
/* @__PURE__ */ jsx("option", { value: "base_usdc", children: "USDC on Base" }),
|
|
202
|
+
/* @__PURE__ */ jsx("option", { value: "other", children: "Another token or network" })
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
)
|
|
206
|
+
] });
|
|
207
|
+
return /* @__PURE__ */ jsx(Fragment, { children: source === "other" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
208
|
+
sourcePicker,
|
|
209
|
+
/* @__PURE__ */ jsx(
|
|
210
|
+
OfframpRoute,
|
|
211
|
+
{
|
|
212
|
+
port,
|
|
213
|
+
onReceipt,
|
|
214
|
+
onReady,
|
|
215
|
+
onLock: () => setRouteLocked(true)
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
219
|
+
/* @__PURE__ */ jsxs("div", { className: "send-form__row ramp-amount-row", children: [
|
|
220
|
+
/* @__PURE__ */ jsxs("label", { className: "send-field", children: [
|
|
221
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__label", children: "USDC to cash out" }),
|
|
222
|
+
/* @__PURE__ */ jsx(
|
|
223
|
+
"input",
|
|
224
|
+
{
|
|
225
|
+
className: "send-field__control",
|
|
226
|
+
inputMode: "decimal",
|
|
227
|
+
autoComplete: "off",
|
|
228
|
+
placeholder: "0.00",
|
|
229
|
+
value: amountText,
|
|
230
|
+
"aria-invalid": amountInvalid,
|
|
231
|
+
"aria-describedby": amountInvalid ? `${id}-amount-error` : void 0,
|
|
232
|
+
onChange: (e) => {
|
|
233
|
+
setAmountText(e.target.value);
|
|
234
|
+
setSelected(void 0);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
),
|
|
238
|
+
amountInvalid && /* @__PURE__ */ jsx("span", { id: `${id}-amount-error`, className: "send-field__error", children: "Enter a positive amount with at most 6 decimals." })
|
|
239
|
+
] }),
|
|
240
|
+
account && /* @__PURE__ */ jsx(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
type: "button",
|
|
244
|
+
className: "send-secondary",
|
|
245
|
+
disabled: !max,
|
|
246
|
+
onClick: () => {
|
|
247
|
+
if (!max) return;
|
|
248
|
+
setAmountText(usdcDecimal(max.toString()));
|
|
249
|
+
setSelected(void 0);
|
|
250
|
+
},
|
|
251
|
+
children: "Max"
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
currencies.length > 1 && /* @__PURE__ */ jsxs("label", { className: "send-field", children: [
|
|
255
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__label", children: "Receive in" }),
|
|
256
|
+
/* @__PURE__ */ jsx(
|
|
257
|
+
"select",
|
|
258
|
+
{
|
|
259
|
+
className: "send-field__control",
|
|
260
|
+
value: currency,
|
|
261
|
+
onChange: (e) => {
|
|
262
|
+
setCurrency(e.target.value);
|
|
263
|
+
setSelected(void 0);
|
|
264
|
+
},
|
|
265
|
+
children: currencies.map((c) => /* @__PURE__ */ jsx("option", { value: c, children: c }, c))
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
] })
|
|
269
|
+
] }),
|
|
270
|
+
sourcePicker,
|
|
271
|
+
/* @__PURE__ */ jsx(RampDisclosure, { direction: "offramp" }),
|
|
272
|
+
status && /* @__PURE__ */ jsx("p", { className: "send-note", role: "status", children: status }),
|
|
273
|
+
state.status === "done" && cards.length === 0 && /* @__PURE__ */ jsx(OverallCard, { ...overallCard(state.availability, "offramp") }),
|
|
274
|
+
/* @__PURE__ */ jsxs(RailTiles, { title: "Your account", guest: !account, untested: state.status !== "done", children: [
|
|
275
|
+
selectable.map(({ card, offer }) => {
|
|
276
|
+
const est = estimateFor(offer);
|
|
277
|
+
return /* @__PURE__ */ jsx(
|
|
278
|
+
RailChoice,
|
|
279
|
+
{
|
|
280
|
+
card,
|
|
281
|
+
name: card.name,
|
|
282
|
+
group: `${id}-rail`,
|
|
283
|
+
selected: chosen?.card.id === card.id,
|
|
284
|
+
status: est && est.receive.asset.kind === "fiat" ? formatEstimate(
|
|
285
|
+
est.receive.atomic,
|
|
286
|
+
est.receive.asset.currency,
|
|
287
|
+
est.receive.asset.decimals
|
|
288
|
+
) : void 0,
|
|
289
|
+
onSelect: () => setSelected(card.id)
|
|
290
|
+
},
|
|
291
|
+
card.id
|
|
292
|
+
);
|
|
293
|
+
}),
|
|
294
|
+
blocked.filter(
|
|
295
|
+
({ offer }) => offer.availability.state === "setup_required" && offer.availability.requirement_codes.includes("maker_account_setup")
|
|
296
|
+
).map(({ card, offer }) => /* @__PURE__ */ jsx(
|
|
297
|
+
AccountSetup,
|
|
298
|
+
{
|
|
299
|
+
flow,
|
|
300
|
+
rail: offer.rail.id,
|
|
301
|
+
name: card.name,
|
|
302
|
+
requirements: card.needs,
|
|
303
|
+
reason: card.reason,
|
|
304
|
+
onDone: refresh
|
|
305
|
+
},
|
|
306
|
+
card.id
|
|
307
|
+
))
|
|
308
|
+
] }),
|
|
309
|
+
/* @__PURE__ */ jsx(
|
|
310
|
+
UnavailableRails,
|
|
311
|
+
{
|
|
312
|
+
cards: blocked.filter(
|
|
313
|
+
({ offer }) => offer.availability.state !== "setup_required" || !offer.availability.requirement_codes.includes("maker_account_setup")
|
|
314
|
+
).map(({ card }) => card)
|
|
315
|
+
}
|
|
316
|
+
),
|
|
317
|
+
state.status === "done" && /* @__PURE__ */ jsx("button", { type: "button", className: "send-secondary", onClick: refresh, children: "Check again" }),
|
|
318
|
+
/* @__PURE__ */ jsx("div", { className: "ramp-bottom-action", children: !account && onConnectRequest ? /* @__PURE__ */ jsx("button", { type: "button", className: "submit-btn send-cta", onClick: onConnectRequest, children: "Connect wallet" }) : /* @__PURE__ */ jsx(
|
|
319
|
+
"button",
|
|
320
|
+
{
|
|
321
|
+
type: "button",
|
|
322
|
+
className: "submit-btn send-cta",
|
|
323
|
+
disabled: !chosen || overCap !== void 0 || state.status !== "done" || flow.busy !== false,
|
|
324
|
+
onClick: () => {
|
|
325
|
+
if (chosen && state.status === "done")
|
|
326
|
+
void flow.estimate(chosen.offer, state.intent);
|
|
327
|
+
},
|
|
328
|
+
children: flow.busy === "estimating" ? "Getting estimate..." : "Get estimate"
|
|
329
|
+
}
|
|
330
|
+
) })
|
|
331
|
+
] }) });
|
|
332
|
+
}
|
|
333
|
+
function PayeeFields({
|
|
334
|
+
rail,
|
|
335
|
+
value,
|
|
336
|
+
owned,
|
|
337
|
+
onValue,
|
|
338
|
+
onOwned,
|
|
339
|
+
error
|
|
340
|
+
}) {
|
|
341
|
+
const id = useId();
|
|
342
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
343
|
+
/* @__PURE__ */ jsxs("label", { className: "send-field", children: [
|
|
344
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__label", children: `Your own ${rail} account` }),
|
|
345
|
+
/* @__PURE__ */ jsx(
|
|
346
|
+
"input",
|
|
347
|
+
{
|
|
348
|
+
className: "send-field__control send-field__control--mono",
|
|
349
|
+
autoComplete: "off",
|
|
350
|
+
spellCheck: false,
|
|
351
|
+
value,
|
|
352
|
+
"aria-invalid": error !== void 0,
|
|
353
|
+
"aria-describedby": `${id}-hint`,
|
|
354
|
+
onChange: (e) => onValue(e.target.value)
|
|
355
|
+
}
|
|
356
|
+
),
|
|
357
|
+
/* @__PURE__ */ jsx("span", { id: `${id}-hint`, className: "send-field__hint", children: {
|
|
358
|
+
Venmo: "Enter your @username.",
|
|
359
|
+
Wise: "Enter your account email.",
|
|
360
|
+
Revolut: "Enter your Revolut tag."
|
|
361
|
+
}[rail] ?? "Enter the identifier for your account." }),
|
|
362
|
+
error && /* @__PURE__ */ jsx("span", { className: "send-field__error", children: error })
|
|
363
|
+
] }),
|
|
364
|
+
/* @__PURE__ */ jsxs("label", { className: "send-check", children: [
|
|
365
|
+
/* @__PURE__ */ jsx("input", { type: "checkbox", checked: owned, onChange: (e) => onOwned(e.target.checked) }),
|
|
366
|
+
/* @__PURE__ */ jsx("span", { children: `This ${rail} account belongs to me.` })
|
|
367
|
+
] })
|
|
368
|
+
] });
|
|
369
|
+
}
|
|
370
|
+
function AccountSetup({
|
|
371
|
+
flow,
|
|
372
|
+
rail,
|
|
373
|
+
name,
|
|
374
|
+
requirements,
|
|
375
|
+
reason,
|
|
376
|
+
onDone
|
|
377
|
+
}) {
|
|
378
|
+
const [open, setOpen] = useState(false);
|
|
379
|
+
const [value, setValue] = useState("");
|
|
380
|
+
const [owned, setOwned] = useState(false);
|
|
381
|
+
const error = value === "" ? void 0 : payeeError(value);
|
|
382
|
+
if (!open)
|
|
383
|
+
return /* @__PURE__ */ jsx("button", { type: "button", className: "ramp-tile", onClick: () => setOpen(true), children: /* @__PURE__ */ jsx(RailTileContent, { id: rail, name, status: "Set up first" }) });
|
|
384
|
+
return /* @__PURE__ */ jsxs(
|
|
385
|
+
"form",
|
|
386
|
+
{
|
|
387
|
+
className: "send-form ramp-tile-setup",
|
|
388
|
+
"aria-label": `Set up your ${name} account`,
|
|
389
|
+
onSubmit: (e) => {
|
|
390
|
+
e.preventDefault();
|
|
391
|
+
if (payeeError(value) || !owned) return;
|
|
392
|
+
void flow.setupAccount(rail, value).then((ok) => {
|
|
393
|
+
if (!ok) return;
|
|
394
|
+
setValue("");
|
|
395
|
+
setOpen(false);
|
|
396
|
+
onDone();
|
|
397
|
+
});
|
|
398
|
+
},
|
|
399
|
+
children: [
|
|
400
|
+
/* @__PURE__ */ jsx("p", { className: "send-note", children: reason }),
|
|
401
|
+
requirements.length > 0 && /* @__PURE__ */ jsxs("p", { className: "send-note", children: [
|
|
402
|
+
requirements.join(". "),
|
|
403
|
+
"."
|
|
404
|
+
] }),
|
|
405
|
+
/* @__PURE__ */ jsx(
|
|
406
|
+
PayeeFields,
|
|
407
|
+
{
|
|
408
|
+
rail: name,
|
|
409
|
+
value,
|
|
410
|
+
owned,
|
|
411
|
+
onValue: setValue,
|
|
412
|
+
onOwned: setOwned,
|
|
413
|
+
error
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
/* @__PURE__ */ jsx(
|
|
417
|
+
"button",
|
|
418
|
+
{
|
|
419
|
+
type: "submit",
|
|
420
|
+
className: "submit-btn send-cta",
|
|
421
|
+
disabled: !owned || payeeError(value) !== void 0 || flow.busy !== false,
|
|
422
|
+
children: "Register this account with Peer"
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
function ReviewStep({
|
|
430
|
+
flow,
|
|
431
|
+
quote,
|
|
432
|
+
draft,
|
|
433
|
+
setDraft
|
|
434
|
+
}) {
|
|
435
|
+
const consentId = useId();
|
|
436
|
+
const port = useOfframpPort();
|
|
437
|
+
const { preview } = quote;
|
|
438
|
+
const [now, setNow] = useState(() => port.now());
|
|
439
|
+
const { payee, owned, accepted } = draft;
|
|
440
|
+
const setPayee = (value) => setDraft({ ...draft, payee: value });
|
|
441
|
+
const setOwned = (value) => setDraft({ ...draft, owned: value });
|
|
442
|
+
const [confirmedMask, setConfirmedMask] = useState(
|
|
443
|
+
() => quote.registeredPayee ?? (draft.owned && !payeeError(draft.payee) ? maskPayee(draft.payee) : void 0)
|
|
444
|
+
);
|
|
445
|
+
const left = estimateSecondsLeft(preview, now);
|
|
446
|
+
const stale = left === 0;
|
|
447
|
+
const escrow = port.escrow();
|
|
448
|
+
useEffect(() => {
|
|
449
|
+
if (stale) return;
|
|
450
|
+
const at = Date.parse(preview.expires_at);
|
|
451
|
+
const timer = setTimeout(() => setNow(port.now()), Math.max(0, at - port.now()) + 1);
|
|
452
|
+
return () => clearTimeout(timer);
|
|
453
|
+
}, [port, preview, stale]);
|
|
454
|
+
const fiat = preview.receive.asset;
|
|
455
|
+
const fees = preview.fees.filter((f) => BigInt(f.money.atomic) > 0n);
|
|
456
|
+
const error = payee === "" ? void 0 : payeeError(payee);
|
|
457
|
+
const ready = confirmedMask !== void 0 && accepted && !stale && flow.busy === false;
|
|
458
|
+
return /* @__PURE__ */ jsxs("section", { className: "send-review", "aria-label": "Review cash-out", children: [
|
|
459
|
+
/* @__PURE__ */ jsxs("dl", { className: "send-review__facts", children: [
|
|
460
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
461
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "Platform" }),
|
|
462
|
+
/* @__PURE__ */ jsx("dd", { children: quote.railName })
|
|
463
|
+
] }),
|
|
464
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
465
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "You deposit" }),
|
|
466
|
+
/* @__PURE__ */ jsx("dd", { className: "send-review__amount", children: formatUsdc(preview.pay.atomic) })
|
|
467
|
+
] }),
|
|
468
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
469
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "Estimated payout" }),
|
|
470
|
+
/* @__PURE__ */ jsx("dd", { children: fiat.kind === "fiat" ? formatEstimate(preview.receive.atomic, fiat.currency, fiat.decimals) : "Unknown" })
|
|
471
|
+
] }),
|
|
472
|
+
fees.length > 0 && /* @__PURE__ */ jsxs("div", { children: [
|
|
473
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "Fees in the estimate" }),
|
|
474
|
+
/* @__PURE__ */ jsx("dd", { children: fees.map(
|
|
475
|
+
(f) => `${formatUsdc(f.money.atomic)} (${f.code === "peer_fee" ? "Peer fee" : f.code === "maker_fee" ? "Payment rate fee" : "Fee"})`
|
|
476
|
+
).join(", ") })
|
|
477
|
+
] }),
|
|
478
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
479
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "Estimate" }),
|
|
480
|
+
/* @__PURE__ */ jsx("dd", { role: "status", children: stale ? "Expired. Get a new estimate." : `Valid until ${formatRampTime(preview.expires_at)}` })
|
|
481
|
+
] }),
|
|
482
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
483
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "Payout account" }),
|
|
484
|
+
/* @__PURE__ */ jsx("dd", { className: "send-review__mono", children: confirmedMask ?? "Not entered yet" })
|
|
485
|
+
] }),
|
|
486
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
487
|
+
/* @__PURE__ */ jsx("dt", { className: "send-field__label", children: "Deposit destination" }),
|
|
488
|
+
/* @__PURE__ */ jsx("dd", { children: "Peer’s holding contract on Base" })
|
|
489
|
+
] }),
|
|
490
|
+
escrow && /* @__PURE__ */ jsxs("div", { children: [
|
|
491
|
+
/* @__PURE__ */ jsx("dt", { children: "Holding contract address" }),
|
|
492
|
+
/* @__PURE__ */ jsxs("dd", { children: [
|
|
493
|
+
/* @__PURE__ */ jsx("code", { className: "send-review__mono", children: escrow }),
|
|
494
|
+
/* @__PURE__ */ jsx(
|
|
495
|
+
"button",
|
|
496
|
+
{
|
|
497
|
+
type: "button",
|
|
498
|
+
className: "send-secondary",
|
|
499
|
+
onClick: () => void navigator.clipboard?.writeText(escrow).catch(() => {
|
|
500
|
+
}),
|
|
501
|
+
children: "Copy"
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
] })
|
|
505
|
+
] })
|
|
506
|
+
] }),
|
|
507
|
+
confirmedMask === void 0 ? /* @__PURE__ */ jsxs(
|
|
508
|
+
"form",
|
|
509
|
+
{
|
|
510
|
+
className: "send-form",
|
|
511
|
+
"aria-label": "Payout account",
|
|
512
|
+
onSubmit: (e) => {
|
|
513
|
+
e.preventDefault();
|
|
514
|
+
if (payeeError(payee) || !owned) return;
|
|
515
|
+
setConfirmedMask(maskPayee(payee));
|
|
516
|
+
},
|
|
517
|
+
children: [
|
|
518
|
+
/* @__PURE__ */ jsx(
|
|
519
|
+
PayeeFields,
|
|
520
|
+
{
|
|
521
|
+
rail: quote.railName,
|
|
522
|
+
value: payee,
|
|
523
|
+
owned,
|
|
524
|
+
onValue: setPayee,
|
|
525
|
+
onOwned: setOwned,
|
|
526
|
+
error
|
|
527
|
+
}
|
|
528
|
+
),
|
|
529
|
+
/* @__PURE__ */ jsx(
|
|
530
|
+
"button",
|
|
531
|
+
{
|
|
532
|
+
type: "submit",
|
|
533
|
+
className: "send-secondary",
|
|
534
|
+
disabled: !owned || payeeError(payee) !== void 0,
|
|
535
|
+
children: "Use this account"
|
|
536
|
+
}
|
|
537
|
+
)
|
|
538
|
+
]
|
|
539
|
+
}
|
|
540
|
+
) : !quote.registeredPayee && /* @__PURE__ */ jsx(
|
|
541
|
+
"button",
|
|
542
|
+
{
|
|
543
|
+
type: "button",
|
|
544
|
+
className: "send-secondary",
|
|
545
|
+
disabled: flow.busy !== false,
|
|
546
|
+
onClick: () => setConfirmedMask(void 0),
|
|
547
|
+
children: "Change account"
|
|
548
|
+
}
|
|
549
|
+
),
|
|
550
|
+
/* @__PURE__ */ jsx(RampFacts, { direction: "offramp", id: consentId }),
|
|
551
|
+
/* @__PURE__ */ jsxs("label", { className: "send-check", children: [
|
|
552
|
+
/* @__PURE__ */ jsx(
|
|
553
|
+
"input",
|
|
554
|
+
{
|
|
555
|
+
type: "checkbox",
|
|
556
|
+
checked: accepted,
|
|
557
|
+
"aria-describedby": consentId,
|
|
558
|
+
onChange: (e) => setDraft({ ...draft, accepted: e.target.checked })
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ jsx("span", { children: "I accept the cash-out terms." })
|
|
562
|
+
] }),
|
|
563
|
+
/* @__PURE__ */ jsxs("div", { className: "send-review__actions", children: [
|
|
564
|
+
/* @__PURE__ */ jsx(
|
|
565
|
+
"button",
|
|
566
|
+
{
|
|
567
|
+
type: "button",
|
|
568
|
+
className: "send-secondary",
|
|
569
|
+
disabled: flow.busy !== false,
|
|
570
|
+
onClick: flow.edit,
|
|
571
|
+
children: stale ? "Get a new estimate" : "Back"
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
/* @__PURE__ */ jsx(
|
|
575
|
+
"button",
|
|
576
|
+
{
|
|
577
|
+
type: "button",
|
|
578
|
+
className: "submit-btn send-cta",
|
|
579
|
+
disabled: !ready,
|
|
580
|
+
onClick: () => {
|
|
581
|
+
void flow.confirm(quote.registeredPayee ? void 0 : payee);
|
|
582
|
+
},
|
|
583
|
+
children: flow.busy === "confirming" ? "Confirming..." : "Confirm cash-out"
|
|
584
|
+
}
|
|
585
|
+
)
|
|
586
|
+
] })
|
|
587
|
+
] });
|
|
588
|
+
}
|
|
589
|
+
function OrderStep({ flow, order }) {
|
|
590
|
+
const port = useOfframpPort();
|
|
591
|
+
const { chainId } = useAccount();
|
|
592
|
+
const [hash, setHash] = useState("");
|
|
593
|
+
const [withdrawText, setWithdrawText] = useState();
|
|
594
|
+
const transaction = order.depositTransaction;
|
|
595
|
+
const baseReceipt = transaction ? getExplorerTxUrl(BASE_CHAIN_ID, transaction) : void 0;
|
|
596
|
+
const payout = order.estimatedPayout;
|
|
597
|
+
const delivered = order.amounts?.deliveredFiat;
|
|
598
|
+
const receivedPayment = order.phase === "delivering" || order.phase === "delivered" || order.amounts !== void 0 && BigInt(order.amounts.filled) > 0n || order.snapshot.peer.partial_result !== void 0;
|
|
599
|
+
const headline = orderHeadline(order.snapshot, order.phase, order.reason);
|
|
600
|
+
const steps = progressSteps(order.phase);
|
|
601
|
+
const leg = order.snapshot.peer;
|
|
602
|
+
const onBase = port.wallet.chainId() === BASE_CHAIN_ID;
|
|
603
|
+
const walletDue = leg.state === "action_required";
|
|
604
|
+
const needsHash = leg.state === "in_doubt" && order.pendingAction !== void 0;
|
|
605
|
+
const withdrawable = canWithdraw(order.snapshot, order.phase);
|
|
606
|
+
const withdrawValue = withdrawText ?? (order.amounts ? usdcDecimal(order.amounts.withdrawable) : "");
|
|
607
|
+
const withdrawAmount = parseRampAmount(withdrawValue);
|
|
608
|
+
const finished = order.snapshot.terminal || order.stage === "before_deposit" && leg.state === "failed";
|
|
609
|
+
return /* @__PURE__ */ jsxs("section", { className: "send-review", "aria-label": "Cash-out order", children: [
|
|
610
|
+
/* @__PURE__ */ jsx("h3", { className: "ramp-rail__name", children: `${formatUsdc(order.amount)} to your ${order.railName} account` }),
|
|
611
|
+
payout?.asset.kind === "fiat" && /* @__PURE__ */ jsxs("p", { className: "send-note", children: [
|
|
612
|
+
"Original estimate:",
|
|
613
|
+
" ",
|
|
614
|
+
formatEstimate(payout.atomic, payout.asset.currency, payout.asset.decimals)
|
|
615
|
+
] }),
|
|
616
|
+
order.payeeMask && !receivedPayment && /* @__PURE__ */ jsx("p", { className: "send-note", children: `Payout account ${order.payeeMask} (your own).` }),
|
|
617
|
+
/* @__PURE__ */ jsxs("div", { className: `ramp-order__headline ramp-order__headline--${headline.tone}`, role: "status", children: [
|
|
618
|
+
/* @__PURE__ */ jsx("strong", { children: headline.title }),
|
|
619
|
+
/* @__PURE__ */ jsx("span", { children: headline.detail })
|
|
620
|
+
] }),
|
|
621
|
+
receivedPayment && /* @__PURE__ */ jsxs("section", { className: "send-review ramp-receipt", "aria-label": "Payment receipt", children: [
|
|
622
|
+
/* @__PURE__ */ jsx("h4", { children: "Payment receipt" }),
|
|
623
|
+
delivered?.asset.kind === "fiat" && /* @__PURE__ */ jsxs("p", { children: [
|
|
624
|
+
"Fiat delivered:",
|
|
625
|
+
" ",
|
|
626
|
+
formatTokenAmount(
|
|
627
|
+
BigInt(delivered.atomic),
|
|
628
|
+
delivered.asset.decimals,
|
|
629
|
+
delivered.asset.decimals
|
|
630
|
+
),
|
|
631
|
+
" ",
|
|
632
|
+
delivered.asset.currency
|
|
633
|
+
] }),
|
|
634
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
635
|
+
"Check your ",
|
|
636
|
+
order.railName,
|
|
637
|
+
" for the payment."
|
|
638
|
+
] }),
|
|
639
|
+
order.payeeMask && /* @__PURE__ */ jsx("p", { className: "send-review__mono", children: order.payeeMask }),
|
|
640
|
+
baseReceipt && /* @__PURE__ */ jsx("a", { href: baseReceipt, target: "_blank", rel: "noopener noreferrer", children: "View Base transaction" })
|
|
641
|
+
] }),
|
|
642
|
+
order.amounts && /* @__PURE__ */ jsx("dl", { className: "send-review__facts", "aria-label": "Confirmed order totals", children: [
|
|
643
|
+
["Deposited", order.amounts.deposited],
|
|
644
|
+
["Paid out (USDC debited)", order.amounts.filled],
|
|
645
|
+
["Reserved by buyers", order.amounts.reserved],
|
|
646
|
+
["Available to withdraw", order.amounts.withdrawable],
|
|
647
|
+
["Returned to wallet", order.amounts.withdrawn]
|
|
648
|
+
].map(([label, amount]) => /* @__PURE__ */ jsxs("div", { children: [
|
|
649
|
+
/* @__PURE__ */ jsx("dt", { children: label }),
|
|
650
|
+
/* @__PURE__ */ jsx("dd", { children: formatUsdc(amount) })
|
|
651
|
+
] }, label)) }),
|
|
652
|
+
order.stage === "deposit" && order.phase !== "returned" && /* @__PURE__ */ jsx("ol", { className: "ramp-order__steps", "aria-label": "Order progress", children: steps.map((s) => /* @__PURE__ */ jsx(
|
|
653
|
+
"li",
|
|
654
|
+
{
|
|
655
|
+
className: `ramp-order__step ramp-order__step--${s.state}`,
|
|
656
|
+
"aria-current": s.state === "current" ? "step" : void 0,
|
|
657
|
+
children: `${s.label}${s.state === "done" ? " (done)" : s.state === "current" ? " (now)" : ""}`
|
|
658
|
+
},
|
|
659
|
+
s.id
|
|
660
|
+
)) }),
|
|
661
|
+
walletDue && /* @__PURE__ */ jsxs("div", { className: "send-form", children: [
|
|
662
|
+
/* @__PURE__ */ jsx("p", { className: "send-note", children: order.nextAction ? `Next wallet step: ${WALLET_ACTION_LABELS[order.nextAction]}.` : "Your wallet asks for each step separately: first, only if needed, to let Peer's escrow use exactly this USDC; then to create the deposit." }),
|
|
663
|
+
!onBase ? /* @__PURE__ */ jsx(
|
|
664
|
+
"button",
|
|
665
|
+
{
|
|
666
|
+
type: "button",
|
|
667
|
+
className: "submit-btn send-cta",
|
|
668
|
+
disabled: flow.busy !== false,
|
|
669
|
+
onClick: () => void flow.switchNetwork(),
|
|
670
|
+
children: flow.busy === "switching" ? "Switching..." : "Switch wallet to Base"
|
|
671
|
+
}
|
|
672
|
+
) : /* @__PURE__ */ jsx(
|
|
673
|
+
"button",
|
|
674
|
+
{
|
|
675
|
+
type: "button",
|
|
676
|
+
className: "submit-btn send-cta",
|
|
677
|
+
disabled: flow.busy !== false,
|
|
678
|
+
onClick: () => void flow.walletStep(),
|
|
679
|
+
children: flow.busy === "wallet" ? "Waiting for wallet..." : "Approve in wallet"
|
|
680
|
+
}
|
|
681
|
+
)
|
|
682
|
+
] }),
|
|
683
|
+
needsHash && /* @__PURE__ */ jsxs(
|
|
684
|
+
"form",
|
|
685
|
+
{
|
|
686
|
+
className: "send-form",
|
|
687
|
+
"aria-label": "Attach transaction",
|
|
688
|
+
onSubmit: (e) => {
|
|
689
|
+
e.preventDefault();
|
|
690
|
+
void flow.attachHash(hash);
|
|
691
|
+
},
|
|
692
|
+
children: [
|
|
693
|
+
/* @__PURE__ */ jsxs("label", { className: "send-field", children: [
|
|
694
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__label", children: "Transaction hash from your wallet" }),
|
|
695
|
+
/* @__PURE__ */ jsx(
|
|
696
|
+
"input",
|
|
697
|
+
{
|
|
698
|
+
className: "send-field__control send-field__control--mono",
|
|
699
|
+
autoComplete: "off",
|
|
700
|
+
spellCheck: false,
|
|
701
|
+
value: hash,
|
|
702
|
+
onChange: (e) => setHash(e.target.value)
|
|
703
|
+
}
|
|
704
|
+
),
|
|
705
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__hint", children: `For "${WALLET_ACTION_LABELS[order.pendingAction]}". Only that one transaction is reconciled; nothing is sent again.` })
|
|
706
|
+
] }),
|
|
707
|
+
/* @__PURE__ */ jsx("button", { type: "submit", className: "send-secondary", disabled: flow.busy !== false, children: "Attach and check" })
|
|
708
|
+
]
|
|
709
|
+
}
|
|
710
|
+
),
|
|
711
|
+
withdrawable && /* @__PURE__ */ jsxs(
|
|
712
|
+
"form",
|
|
713
|
+
{
|
|
714
|
+
className: "send-form",
|
|
715
|
+
"aria-label": "Withdraw unmatched USDC",
|
|
716
|
+
onSubmit: (e) => {
|
|
717
|
+
e.preventDefault();
|
|
718
|
+
if (withdrawAmount) void flow.prepareWithdrawal(withdrawAmount);
|
|
719
|
+
},
|
|
720
|
+
children: [
|
|
721
|
+
/* @__PURE__ */ jsxs("label", { className: "send-field", children: [
|
|
722
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__label", children: "USDC to withdraw" }),
|
|
723
|
+
/* @__PURE__ */ jsx(
|
|
724
|
+
"input",
|
|
725
|
+
{
|
|
726
|
+
className: "send-field__control",
|
|
727
|
+
inputMode: "decimal",
|
|
728
|
+
autoComplete: "off",
|
|
729
|
+
value: withdrawValue,
|
|
730
|
+
onChange: (e) => setWithdrawText(e.target.value)
|
|
731
|
+
}
|
|
732
|
+
),
|
|
733
|
+
/* @__PURE__ */ jsx("span", { className: "send-field__hint", children: "Only USDC no buyer has reserved can come back. A buyer mid-payment keeps their part." })
|
|
734
|
+
] }),
|
|
735
|
+
/* @__PURE__ */ jsx(
|
|
736
|
+
"button",
|
|
737
|
+
{
|
|
738
|
+
type: "submit",
|
|
739
|
+
className: "send-secondary",
|
|
740
|
+
disabled: !withdrawAmount || flow.busy !== false,
|
|
741
|
+
children: flow.busy === "withdrawing" ? "Preparing..." : "Prepare withdrawal"
|
|
742
|
+
}
|
|
743
|
+
)
|
|
744
|
+
]
|
|
745
|
+
}
|
|
746
|
+
),
|
|
747
|
+
/* @__PURE__ */ jsxs("div", { className: "send-review__actions", children: [
|
|
748
|
+
!finished && /* @__PURE__ */ jsx(
|
|
749
|
+
"button",
|
|
750
|
+
{
|
|
751
|
+
type: "button",
|
|
752
|
+
className: "send-secondary",
|
|
753
|
+
disabled: flow.busy !== false,
|
|
754
|
+
onClick: () => void flow.check(),
|
|
755
|
+
children: flow.busy === "checking" ? "Checking..." : "Check status"
|
|
756
|
+
}
|
|
757
|
+
),
|
|
758
|
+
finished && /* @__PURE__ */ jsx("button", { type: "button", className: "send-secondary", onClick: flow.startOver, children: "Start a new cash-out" })
|
|
759
|
+
] }),
|
|
760
|
+
/* @__PURE__ */ jsx("p", { className: "send-note", children: "It also appears in Activity." })
|
|
761
|
+
] });
|
|
762
|
+
}
|
|
763
|
+
export {
|
|
764
|
+
PaymentAppSend
|
|
765
|
+
};
|