@xochi/widget 0.0.0-stage → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +79 -0
- package/LICENSE +21 -0
- package/README.md +420 -2
- package/THIRD_PARTY_NOTICES.txt +44 -0
- package/dist/ConfiguratorApp.js +19 -0
- package/dist/EmbedApp.js +57 -0
- package/dist/assets/MonaspaceArgon-Bold-D9kWRRK5.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Light-Dt_6qXbW.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Medium-B1gMZwrU.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-Regular-RS-2TGNg.woff2 +0 -0
- package/dist/assets/MonaspaceArgon-SemiBold-PYusZXE_.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Italic-C9u9eioB.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Light-CJkxpyfT.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Medium-DCChELAx.woff2 +0 -0
- package/dist/assets/MonaspaceNeon-Regular-BZtV1wRa.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Bold-KacFhGOf.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Medium-Dqqg-cnL.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-Regular-BRsdKART.woff2 +0 -0
- package/dist/assets/MonaspaceXenon-SemiBold-DNjPl3uE.woff2 +0 -0
- package/dist/assets/alipay-3tx9-HPp.svg +1 -0
- package/dist/assets/arb-CCfLcB_X.svg +7 -0
- package/dist/assets/arc-Dy98eSCd.svg +10 -0
- package/dist/assets/aztec-DiLp9qTG.svg +4 -0
- package/dist/assets/base-Ch0ino36.svg +4 -0
- package/dist/assets/cashapp-lOg0DIt8.svg +1 -0
- package/dist/assets/chains/arbitrum.svg.js +4 -0
- package/dist/assets/chains/arc.svg.js +4 -0
- package/dist/assets/chains/aztec.svg.js +4 -0
- package/dist/assets/chains/base.svg.js +4 -0
- package/dist/assets/chains/ethereum.svg.js +4 -0
- package/dist/assets/chains/gnosis.png.js +4 -0
- package/dist/assets/chains/index.js +31 -0
- package/dist/assets/chains/optimism.svg.js +4 -0
- package/dist/assets/chains/polygon.svg.js +4 -0
- package/dist/assets/chains/robinhood.svg.js +4 -0
- package/dist/assets/chains/tron.svg.js +4 -0
- package/dist/assets/chains/xochi.svg.js +4 -0
- package/dist/assets/dai-XuyZLceZ.png +0 -0
- package/dist/assets/defillama-BU037Unq.svg +1 -0
- package/dist/assets/defillama.svg.js +4 -0
- package/dist/assets/eth-Dvbng9UB.svg +8 -0
- package/dist/assets/eurc-NI9zNgOQ.png +0 -0
- package/dist/assets/eure-BH9vpwcv.png +0 -0
- package/dist/assets/gnosis-fRzAZQFj.png +0 -0
- package/dist/assets/mercadopago-gjsFb6F7.svg +1 -0
- package/dist/assets/monzo-B9XD4bL5.png +0 -0
- package/dist/assets/monzo-SZnIdUKN.svg +1 -0
- package/dist/assets/monzo-dark-Bwzg90UC.png +0 -0
- package/dist/assets/n26-cANcjY2T.svg +1 -0
- package/dist/assets/op-DF67SbB6.png +0 -0
- package/dist/assets/optimism-B3cTNxEQ.svg +4 -0
- package/dist/assets/paypal-D8xqXEtN.svg +1 -0
- package/dist/assets/pol-uLmSo2O8.svg +3 -0
- package/dist/assets/rails/SOURCES.md +50 -0
- package/dist/assets/rails/alipay.svg.js +4 -0
- package/dist/assets/rails/cashapp.svg.js +4 -0
- package/dist/assets/rails/index.js +59 -0
- package/dist/assets/rails/mercadopago.svg.js +4 -0
- package/dist/assets/rails/monzo-dark.png.js +4 -0
- package/dist/assets/rails/monzo.png.js +4 -0
- package/dist/assets/rails/monzo.svg.js +4 -0
- package/dist/assets/rails/n26.svg.js +4 -0
- package/dist/assets/rails/paypal.svg.js +4 -0
- package/dist/assets/rails/revolut-dark.png.js +4 -0
- package/dist/assets/rails/revolut.png.js +4 -0
- package/dist/assets/rails/revolut.svg.js +4 -0
- package/dist/assets/rails/venmo.svg.js +4 -0
- package/dist/assets/rails/wise-dark.png.js +4 -0
- package/dist/assets/rails/wise.png.js +4 -0
- package/dist/assets/rails/wise.svg.js +4 -0
- package/dist/assets/rails/xmoney.svg.js +4 -0
- package/dist/assets/rails/zelle.svg.js +4 -0
- package/dist/assets/raxol-86FmC34h.png +0 -0
- package/dist/assets/revolut-CiBtyALA.png +0 -0
- package/dist/assets/revolut-D7qr5Vzs.svg +1 -0
- package/dist/assets/revolut-dark-RQdWGM_p.png +0 -0
- package/dist/assets/robinhood-DgdGTQ1I.svg +8 -0
- package/dist/assets/tokens/arb.svg.js +4 -0
- package/dist/assets/tokens/dai.png.js +4 -0
- package/dist/assets/tokens/eth.svg.js +4 -0
- package/dist/assets/tokens/eurc.png.js +4 -0
- package/dist/assets/tokens/eure.png.js +4 -0
- package/dist/assets/tokens/index.js +36 -0
- package/dist/assets/tokens/op.png.js +4 -0
- package/dist/assets/tokens/pol.svg.js +4 -0
- package/dist/assets/tokens/raxol.png.js +4 -0
- package/dist/assets/tokens/usdc.png.js +4 -0
- package/dist/assets/tokens/usdg.png.js +4 -0
- package/dist/assets/tokens/usdt.png.js +4 -0
- package/dist/assets/tokens/wbtc.png.js +4 -0
- package/dist/assets/tokens/wsteth.png.js +4 -0
- package/dist/assets/tokens/zchf.png.js +4 -0
- package/dist/assets/tron-Dtumyzha.svg +4 -0
- package/dist/assets/usdc-UHSd0FoM.png +0 -0
- package/dist/assets/usdg-Cd5nCzbC.png +0 -0
- package/dist/assets/usdt-3G3YdPq8.png +0 -0
- package/dist/assets/venmo-CMHeCn-D.svg +1 -0
- package/dist/assets/wbtc-CV8uE44Q.png +0 -0
- package/dist/assets/wise-BUOflsWL.svg +1 -0
- package/dist/assets/wise-JLpDvCdq.png +0 -0
- package/dist/assets/wise-dark-_Q8pbCom.png +0 -0
- package/dist/assets/wsteth-BamwtTCR.png +0 -0
- package/dist/assets/xmoney-CwY9KVlD.svg +1 -0
- package/dist/assets/xochi-DL2f8G4R.svg +4 -0
- package/dist/assets/zchf-BLBNdTGJ.png +0 -0
- package/dist/assets/zelle-t15cG4SB.svg +1 -0
- package/dist/browser.js +4 -0
- package/dist/components/AccountChip.js +29 -0
- package/dist/components/ActivityFeed.js +710 -0
- package/dist/components/AssetsStrip.js +133 -0
- package/dist/components/AuthorizedAgents.js +197 -0
- package/dist/components/Chevron.js +22 -0
- package/dist/components/ErrorDisplay.js +68 -0
- package/dist/components/InfoButton.js +27 -0
- package/dist/components/IntentTimeline.js +202 -0
- package/dist/components/LinksSignIn.js +26 -0
- package/dist/components/MobileSigningBanner.js +44 -0
- package/dist/components/PrivacyBars.js +44 -0
- package/dist/components/PrivacyPanel.js +99 -0
- package/dist/components/QuoteDetails.js +327 -0
- package/dist/components/ReceiptCommand.js +46 -0
- package/dist/components/SessionReloadBanner.js +19 -0
- package/dist/components/SolverRace.js +62 -0
- package/dist/components/StealthClaims.js +179 -0
- package/dist/components/SwapFlowModal.js +408 -0
- package/dist/components/Toast.js +40 -0
- package/dist/components/TokenIcon.js +21 -0
- package/dist/components/TokenSearchModal.js +331 -0
- package/dist/components/TransactionPreview.js +230 -0
- package/dist/components/WalletProvider.js +41 -0
- package/dist/components/WrapModal.js +192 -0
- package/dist/components/swap-flow/CantonEscrowPanel.js +28 -0
- package/dist/components/swap-flow/CantonEscrowStatus.js +160 -0
- package/dist/components/swap-flow/DepositInstructions.js +156 -0
- package/dist/components/swap-flow/QrCode.js +22 -0
- package/dist/components/swap-flow/SwapResult.js +325 -0
- package/dist/components/swap-flow/depositScreen.js +36 -0
- package/dist/components/widgetTabsContext.js +17 -0
- package/dist/config.js +132 -0
- package/dist/configurator-model.js +71 -0
- package/dist/configurator.js +11 -0
- package/dist/constants.js +53 -0
- package/dist/hooks/applyTheme.js +10 -0
- package/dist/hooks/useAgentRegistry.js +28 -0
- package/dist/hooks/useAgentStream.js +89 -0
- package/dist/hooks/useCantonEscrow.js +89 -0
- package/dist/hooks/useCapabilities.js +86 -0
- package/dist/hooks/useEmbedLook.js +23 -0
- package/dist/hooks/useFocusTrap.js +44 -0
- package/dist/hooks/useIntent.js +485 -0
- package/dist/hooks/useIntentStatusPoll.js +71 -0
- package/dist/hooks/useIntentStream.js +95 -0
- package/dist/hooks/useLocalActivity.js +114 -0
- package/dist/hooks/useLocalSends.js +15 -0
- package/dist/hooks/useLocalStorage.js +26 -0
- package/dist/hooks/useOrderHistory.js +307 -0
- package/dist/hooks/usePermit.js +203 -0
- package/dist/hooks/usePrices.js +49 -0
- package/dist/hooks/usePublicBalances.js +186 -0
- package/dist/hooks/useRampSummaries.js +19 -0
- package/dist/hooks/useRecipientBalance.js +98 -0
- package/dist/hooks/useSettlements.js +33 -0
- package/dist/hooks/useStealth.js +324 -0
- package/dist/hooks/useStealthClaim.js +183 -0
- package/dist/hooks/useStealthScanner.js +259 -0
- package/dist/hooks/useTheme.js +48 -0
- package/dist/hooks/useTierInfo.js +20 -0
- package/dist/hooks/useTrustScore.js +16 -0
- package/dist/hooks/useWalletSession.js +70 -0
- package/dist/hooks/useWrapEth.js +60 -0
- package/dist/index.js +41 -0
- package/dist/integration.js +19 -0
- package/dist/lib/activityValue.js +20 -0
- package/dist/lib/agentConnect.js +11 -0
- package/dist/lib/agentRegistry.js +83 -0
- package/dist/lib/agentStreamVerify.js +47 -0
- package/dist/lib/api.js +67 -0
- package/dist/lib/auth.js +8 -0
- package/dist/lib/authFetch.js +33 -0
- package/dist/lib/aztecTokens.js +13 -0
- package/dist/lib/balances.js +77 -0
- package/dist/lib/capabilities.js +40 -0
- package/dist/lib/claimSubmitPoll.js +63 -0
- package/dist/lib/debug.js +7 -0
- package/dist/lib/declineGuidance.js +31 -0
- package/dist/lib/displayFallbacks.js +25 -0
- package/dist/lib/eip712.js +38 -0
- package/dist/lib/errorCategory.js +202 -0
- package/dist/lib/errorReport.js +19 -0
- package/dist/lib/explorerLinks.js +30 -0
- package/dist/lib/feesLabel.js +19 -0
- package/dist/lib/glyphs.js +58 -0
- package/dist/lib/hostBridge.js +41 -0
- package/dist/lib/hostOrigin.js +52 -0
- package/dist/lib/intentAPI.js +39 -0
- package/dist/lib/linksSignIn.js +9 -0
- package/dist/lib/localActivity.js +247 -0
- package/dist/lib/localSends.js +129 -0
- package/dist/lib/mobileWallet.js +17 -0
- package/dist/lib/pairAvailability.js +29 -0
- package/dist/lib/paymentSummary.js +23 -0
- package/dist/lib/permits.js +27 -0
- package/dist/lib/priceImpact.js +101 -0
- package/dist/lib/providers.js +124 -0
- package/dist/lib/qr.js +20 -0
- package/dist/lib/quoteCost.js +34 -0
- package/dist/lib/quoteCountdown.js +24 -0
- package/dist/lib/rampHostGate.js +24 -0
- package/dist/lib/rampLifecycle.js +63 -0
- package/dist/lib/receiptCost.js +64 -0
- package/dist/lib/recipient/index.js +302 -0
- package/dist/lib/recipient/recent.js +47 -0
- package/dist/lib/recipientReceipt.js +16 -0
- package/dist/lib/reportClient.js +32 -0
- package/dist/lib/sessionExpiry.js +11 -0
- package/dist/lib/settlementAvailability.js +34 -0
- package/dist/lib/stealth.js +110 -0
- package/dist/lib/swapFlowPhase.js +52 -0
- package/dist/lib/swapStatusCopy.js +59 -0
- package/dist/lib/tradeLifecycle.js +40 -0
- package/dist/lib/tronlink.js +71 -0
- package/dist/lib/walletSession.js +87 -0
- package/dist/pages/Configurator.js +390 -0
- package/dist/pages/Trade.js +635 -0
- package/dist/pages/configurator/AllowedAssetsSection.js +98 -0
- package/dist/pages/configurator/AppearanceSection.js +44 -0
- package/dist/pages/configurator/CodeDock.js +140 -0
- package/dist/pages/configurator/DeveloperSection.js +40 -0
- package/dist/pages/configurator/IntegrationSection.js +105 -0
- package/dist/pages/configurator/LayoutSection.js +83 -0
- package/dist/pages/configurator/PolicyNote.js +7 -0
- package/dist/pages/configurator/PreviewStage.js +165 -0
- package/dist/pages/configurator/PrivacySection.js +54 -0
- package/dist/pages/configurator/RouteSection.js +211 -0
- package/dist/pages/configurator/Settings.js +35 -0
- package/dist/pages/configurator/SharedLinkBanner.js +25 -0
- package/dist/pages/configurator/SurfaceSection.js +124 -0
- package/dist/pages/configurator/WhatUsersSee.js +268 -0
- package/dist/pages/configurator/codeShown.js +8 -0
- package/dist/pages/configurator/configuratorUrl.js +33 -0
- package/dist/pages/configurator/paramsDraft.js +82 -0
- package/dist/pages/configurator/previewModel.js +10 -0
- package/dist/pages/configurator/previewQuote.js +109 -0
- package/dist/pages/configurator/routePicks.js +131 -0
- package/dist/pages/configurator/snippets.js +98 -0
- package/dist/pages/configurator/surfaceParams.js +51 -0
- package/dist/pages/configurator/useCodeCheck.js +79 -0
- package/dist/pages/configurator/useConfiguratorUrl.js +24 -0
- package/dist/pages/configurator/useMediaQuery.js +20 -0
- package/dist/pages/configurator/useParamsDraft.js +33 -0
- package/dist/pages/configurator/usePreviewFee.js +100 -0
- package/dist/pages/send/MetaAddressValue.js +28 -0
- package/dist/pages/send/Receive.js +168 -0
- package/dist/pages/send/RecentRecipients.js +23 -0
- package/dist/pages/send/RecipientChip.js +26 -0
- package/dist/pages/send/ScanRecipient.js +85 -0
- package/dist/pages/send/SendForm.js +516 -0
- package/dist/pages/send/SendPanel.js +30 -0
- package/dist/pages/send/ShieldedDisclosure.js +12 -0
- package/dist/pages/send/StealthInvite.js +27 -0
- package/dist/pages/send/addressSend.js +92 -0
- package/dist/pages/send/sendCopy.js +10 -0
- package/dist/pages/send/sendRetry.js +24 -0
- package/dist/pages/send/stealthRecipient.js +65 -0
- package/dist/pages/send/stealthSend.js +15 -0
- package/dist/pages/send/useAddressSend.js +257 -0
- package/dist/pages/send/useSendRecipient.js +61 -0
- package/dist/pages/trade/BuyPanel.js +70 -0
- package/dist/pages/trade/RampRecovery.js +41 -0
- package/dist/pages/trade/RecipientSheet.js +182 -0
- package/dist/pages/trade/Selectors.js +152 -0
- package/dist/pages/trade/SwapPanel.js +972 -0
- package/dist/pages/trade/WidgetTabs.js +109 -0
- package/dist/pages/trade/canton.js +122 -0
- package/dist/pages/trade/config.js +70 -0
- package/dist/pages/trade/embedNarrowing.js +25 -0
- package/dist/pages/trade/embedParams.js +532 -0
- package/dist/pages/trade/embedTheme.js +9 -0
- package/dist/pages/trade/orderMinimum.js +8 -0
- package/dist/pages/trade/resumeSwap.js +55 -0
- package/dist/pages/trade/settlementCopy.js +32 -0
- package/dist/pages/trade/useAmountFit.js +31 -0
- package/dist/pages/trade/useEmbedDefaults.js +18 -0
- package/dist/pages/trade/useSettlementGating.js +289 -0
- package/dist/pages/trade/useSwapAmount.js +191 -0
- package/dist/pages/trade/useSwapFlow.js +511 -0
- package/dist/pages/trade/useSwapPanel.js +475 -0
- package/dist/pages/trade/useSwapRoute.js +634 -0
- package/dist/pages/trade/useTronLinkFill.js +34 -0
- package/dist/pages/trade/zkMoney.js +46 -0
- package/dist/promiseWithResolvers.js +20 -0
- package/dist/ramp/availability/RailTiles.js +156 -0
- package/dist/ramp/availability/RampDisclosure.js +38 -0
- package/dist/ramp/availability/RampRails.js +170 -0
- package/dist/ramp/availability/model.js +207 -0
- package/dist/ramp/availability/useRampDiscovery.js +83 -0
- package/dist/ramp/offramp/CompletedPrerequisite.js +23 -0
- package/dist/ramp/offramp/OfframpActivityList.js +16 -0
- package/dist/ramp/offramp/OfframpRoute.js +222 -0
- package/dist/ramp/offramp/OfframpRouteReview.js +94 -0
- package/dist/ramp/offramp/PaymentAppSend.js +765 -0
- package/dist/ramp/offramp/localOfframps.js +101 -0
- package/dist/ramp/offramp/model.js +154 -0
- package/dist/ramp/offramp/port.js +134 -0
- package/dist/ramp/offramp/prerequisite.js +143 -0
- package/dist/ramp/offramp/useOfframp.js +505 -0
- package/dist/ramp/offramp/useOfframpRails.js +73 -0
- package/dist/ramp/peer/BuyOnramp.js +292 -0
- package/dist/ramp/peer/OnrampSteps.js +148 -0
- package/dist/ramp/peer/buyerDriver.js +461 -0
- package/dist/ramp/peer/discovery.js +231 -0
- package/dist/ramp/peer/environment.js +7 -0
- package/dist/ramp/peer/liveProvider.js +87 -0
- package/dist/ramp/peer/liveReads.js +488 -0
- package/dist/ramp/peer/maker.js +92 -0
- package/dist/ramp/peer/normalization.js +184 -0
- package/dist/ramp/peer/offramp.js +648 -0
- package/dist/ramp/peer/onramp.js +353 -0
- package/dist/ramp/peer/preview.js +52 -0
- package/dist/ramp/peer/protectedMapping.js +67 -0
- package/dist/ramp/peer/runtime.js +55 -0
- package/dist/ramp/peer/sdkMaker.js +107 -0
- package/dist/ramp/recovery/ResumeOnramp.js +153 -0
- package/dist/ramp/recovery/summaries.js +173 -0
- package/dist/ramp/route/OnrampRoute.js +255 -0
- package/dist/ramp/route/RampRouteSteps.js +148 -0
- package/dist/ramp/route/routeActivity.js +12 -0
- package/dist/ramp/route/useXochiRampDriver.js +203 -0
- package/dist/styles.css +17473 -0
- package/dist/styles.js +2 -0
- package/dist/types/ConfiguratorApp.d.ts +6 -0
- package/dist/types/EmbedApp.d.ts +2 -0
- package/dist/types/activity.js +50 -0
- package/dist/types/asset.d.ts +2 -0
- package/dist/types/assets/chains/index.d.ts +3 -0
- package/dist/types/assets/rails/index.d.ts +12 -0
- package/dist/types/assets/tokens/index.d.ts +1 -0
- package/dist/types/browser.d.ts +1 -0
- package/dist/types/components/AccountChip.d.ts +10 -0
- package/dist/types/components/ActivityFeed.d.ts +46 -0
- package/dist/types/components/AssetsStrip.d.ts +14 -0
- package/dist/types/components/AuthorizedAgents.d.ts +15 -0
- package/dist/types/components/Chevron.d.ts +16 -0
- package/dist/types/components/ErrorDisplay.d.ts +46 -0
- package/dist/types/components/InfoButton.d.ts +6 -0
- package/dist/types/components/IntentTimeline.d.ts +41 -0
- package/dist/types/components/LinksSignIn.d.ts +13 -0
- package/dist/types/components/MobileSigningBanner.d.ts +16 -0
- package/dist/types/components/PermitBadge.d.ts +17 -0
- package/dist/types/components/PrivacyBars.d.ts +12 -0
- package/dist/types/components/PrivacyPanel.d.ts +33 -0
- package/dist/types/components/QuoteDetails.d.ts +56 -0
- package/dist/types/components/RampActivityList.d.ts +14 -0
- package/dist/types/components/ReceiptCommand.d.ts +12 -0
- package/dist/types/components/SessionReloadBanner.d.ts +8 -0
- package/dist/types/components/SolverRace.d.ts +35 -0
- package/dist/types/components/StealthClaims.d.ts +51 -0
- package/dist/types/components/SwapFlowModal.d.ts +142 -0
- package/dist/types/components/Toast.d.ts +10 -0
- package/dist/types/components/TokenIcon.d.ts +17 -0
- package/dist/types/components/TokenSearchModal.d.ts +28 -0
- package/dist/types/components/TransactionPreview.d.ts +37 -0
- package/dist/types/components/WalletProvider.d.ts +12 -0
- package/dist/types/components/WrapModal.d.ts +19 -0
- package/dist/types/components/swap-flow/CantonEscrowPanel.d.ts +14 -0
- package/dist/types/components/swap-flow/CantonEscrowStatus.d.ts +30 -0
- package/dist/types/components/swap-flow/DepositInstructions.d.ts +75 -0
- package/dist/types/components/swap-flow/QrCode.d.ts +18 -0
- package/dist/types/components/swap-flow/SwapResult.d.ts +68 -0
- package/dist/types/components/swap-flow/depositScreen.d.ts +67 -0
- package/dist/types/components/widgetTabsContext.d.ts +21 -0
- package/dist/types/config.d.ts +104 -0
- package/dist/types/configurator-model.d.ts +9 -0
- package/dist/types/configurator.d.ts +3 -0
- package/dist/types/constants.d.ts +52 -0
- package/dist/types/hooks/applyTheme.d.ts +7 -0
- package/dist/types/hooks/useAgentRegistry.d.ts +13 -0
- package/dist/types/hooks/useAgentStream.d.ts +15 -0
- package/dist/types/hooks/useCantonEscrow.d.ts +40 -0
- package/dist/types/hooks/useCapabilities.d.ts +83 -0
- package/dist/types/hooks/useEmbedLook.d.ts +4 -0
- package/dist/types/hooks/useFocusTrap.d.ts +7 -0
- package/dist/types/hooks/useIntent.d.ts +161 -0
- package/dist/types/hooks/useIntentStatusPoll.d.ts +107 -0
- package/dist/types/hooks/useIntentStream.d.ts +34 -0
- package/dist/types/hooks/useLocalActivity.d.ts +22 -0
- package/dist/types/hooks/useLocalSends.d.ts +8 -0
- package/dist/types/hooks/useLocalStorage.d.ts +8 -0
- package/dist/types/hooks/useOrderHistory.d.ts +52 -0
- package/dist/types/hooks/usePermit.d.ts +90 -0
- package/dist/types/hooks/usePrices.d.ts +72 -0
- package/dist/types/hooks/usePublicBalances.d.ts +19 -0
- package/dist/types/hooks/useRampSummaries.d.ts +9 -0
- package/dist/types/hooks/useRecipientBalance.d.ts +58 -0
- package/dist/types/hooks/useSettlements.d.ts +14 -0
- package/dist/types/hooks/useStealth.d.ts +72 -0
- package/dist/types/hooks/useStealthClaim.d.ts +96 -0
- package/dist/types/hooks/useStealthScanner.d.ts +44 -0
- package/dist/types/hooks/useTheme.d.ts +29 -0
- package/dist/types/hooks/useTierInfo.d.ts +23 -0
- package/dist/types/hooks/useTrustScore.d.ts +16 -0
- package/dist/types/hooks/useWalletSession.d.ts +21 -0
- package/dist/types/hooks/useWrapEth.d.ts +21 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.js +8 -0
- package/dist/types/integration.d.ts +9 -0
- package/dist/types/intent.js +85 -0
- package/dist/types/lib/activityValue.d.ts +16 -0
- package/dist/types/lib/agentConnect.d.ts +23 -0
- package/dist/types/lib/agentRegistry.d.ts +47 -0
- package/dist/types/lib/agentStreamVerify.d.ts +29 -0
- package/dist/types/lib/api.d.ts +41 -0
- package/dist/types/lib/auth.d.ts +6 -0
- package/dist/types/lib/authFetch.d.ts +14 -0
- package/dist/types/lib/aztecTokens.d.ts +15 -0
- package/dist/types/lib/balances.d.ts +88 -0
- package/dist/types/lib/capabilities.d.ts +3 -0
- package/dist/types/lib/claimSubmitPoll.d.ts +114 -0
- package/dist/types/lib/debug.d.ts +13 -0
- package/dist/types/lib/declineGuidance.d.ts +55 -0
- package/dist/types/lib/displayFallbacks.d.ts +7 -0
- package/dist/types/lib/eip712.d.ts +61 -0
- package/dist/types/lib/errorCategory.d.ts +50 -0
- package/dist/types/lib/errorReport.d.ts +15 -0
- package/dist/types/lib/explorerLinks.d.ts +67 -0
- package/dist/types/lib/feesLabel.d.ts +20 -0
- package/dist/types/lib/glyphs.d.ts +52 -0
- package/dist/types/lib/hostBridge.d.ts +11 -0
- package/dist/types/lib/hostOrigin.d.ts +30 -0
- package/dist/types/lib/intentAPI.d.ts +15 -0
- package/dist/types/lib/linksSignIn.d.ts +13 -0
- package/dist/types/lib/localActivity.d.ts +135 -0
- package/dist/types/lib/localSends.d.ts +55 -0
- package/dist/types/lib/mobileWallet.d.ts +27 -0
- package/dist/types/lib/pairAvailability.d.ts +106 -0
- package/dist/types/lib/paymentSummary.d.ts +18 -0
- package/dist/types/lib/permits.d.ts +25 -0
- package/dist/types/lib/priceImpact.d.ts +165 -0
- package/dist/types/lib/providers.d.ts +14 -0
- package/dist/types/lib/qr.d.ts +19 -0
- package/dist/types/lib/quoteCost.d.ts +45 -0
- package/dist/types/lib/quoteCountdown.d.ts +34 -0
- package/dist/types/lib/rampHostGate.d.ts +15 -0
- package/dist/types/lib/rampLifecycle.d.ts +20 -0
- package/dist/types/lib/receiptCost.d.ts +64 -0
- package/dist/types/lib/recipient/index.d.ts +33 -0
- package/dist/types/lib/recipient/recent.d.ts +5 -0
- package/dist/types/lib/recipientReceipt.d.ts +25 -0
- package/dist/types/lib/reportClient.d.ts +9 -0
- package/dist/types/lib/sessionExpiry.d.ts +11 -0
- package/dist/types/lib/settlementAvailability.d.ts +61 -0
- package/dist/types/lib/stealth.d.ts +75 -0
- package/dist/types/lib/swapFlowPhase.d.ts +76 -0
- package/dist/types/lib/swapStatusCopy.d.ts +57 -0
- package/dist/types/lib/tierProgressDisplay.d.ts +35 -0
- package/dist/types/lib/tierUnlock.d.ts +25 -0
- package/dist/types/lib/tradeLifecycle.d.ts +32 -0
- package/dist/types/lib/tronlink.d.ts +62 -0
- package/dist/types/lib/walletSession.d.ts +38 -0
- package/dist/types/pages/Configurator.d.ts +25 -0
- package/dist/types/pages/Trade.d.ts +36 -0
- package/dist/types/pages/configurator/AllowedAssetsSection.d.ts +17 -0
- package/dist/types/pages/configurator/AppearanceSection.d.ts +22 -0
- package/dist/types/pages/configurator/CodeDock.d.ts +19 -0
- package/dist/types/pages/configurator/DeveloperSection.d.ts +12 -0
- package/dist/types/pages/configurator/IntegrationSection.d.ts +20 -0
- package/dist/types/pages/configurator/LayoutSection.d.ts +20 -0
- package/dist/types/pages/configurator/PolicyNote.d.ts +6 -0
- package/dist/types/pages/configurator/PreviewStage.d.ts +22 -0
- package/dist/types/pages/configurator/PrivacySection.d.ts +16 -0
- package/dist/types/pages/configurator/RouteSection.d.ts +30 -0
- package/dist/types/pages/configurator/Settings.d.ts +25 -0
- package/dist/types/pages/configurator/SharedLinkBanner.d.ts +16 -0
- package/dist/types/pages/configurator/SurfaceSection.d.ts +5 -0
- package/dist/types/pages/configurator/WhatUsersSee.d.ts +30 -0
- package/dist/types/pages/configurator/codeShown.d.ts +15 -0
- package/dist/types/pages/configurator/configuratorUrl.d.ts +38 -0
- package/dist/types/pages/configurator/paramsDraft.d.ts +32 -0
- package/dist/types/pages/configurator/previewModel.d.ts +20 -0
- package/dist/types/pages/configurator/previewQuote.d.ts +96 -0
- package/dist/types/pages/configurator/routePicks.d.ts +75 -0
- package/dist/types/pages/configurator/snippets.d.ts +23 -0
- package/dist/types/pages/configurator/surfaceParams.d.ts +9 -0
- package/dist/types/pages/configurator/useCodeCheck.d.ts +56 -0
- package/dist/types/pages/configurator/useConfiguratorUrl.d.ts +21 -0
- package/dist/types/pages/configurator/useMediaQuery.d.ts +5 -0
- package/dist/types/pages/configurator/useParamsDraft.d.ts +29 -0
- package/dist/types/pages/configurator/usePreviewFee.d.ts +74 -0
- package/dist/types/pages/send/MetaAddressValue.d.ts +9 -0
- package/dist/types/pages/send/Receive.d.ts +3 -0
- package/dist/types/pages/send/RecentRecipients.d.ts +3 -0
- package/dist/types/pages/send/RecipientChip.d.ts +4 -0
- package/dist/types/pages/send/ScanRecipient.d.ts +3 -0
- package/dist/types/pages/send/SendForm.d.ts +17 -0
- package/dist/types/pages/send/SendPanel.d.ts +19 -0
- package/dist/types/pages/send/ShieldedDisclosure.d.ts +1 -0
- package/dist/types/pages/send/StealthInvite.d.ts +1 -0
- package/dist/types/pages/send/addressSend.d.ts +62 -0
- package/dist/types/pages/send/sendCopy.d.ts +9 -0
- package/dist/types/pages/send/sendRetry.d.ts +10 -0
- package/dist/types/pages/send/stealthRecipient.d.ts +37 -0
- package/dist/types/pages/send/stealthSend.d.ts +18 -0
- package/dist/types/pages/send/useAddressSend.d.ts +61 -0
- package/dist/types/pages/send/useSendRecipient.d.ts +13 -0
- package/dist/types/pages/trade/BuyPanel.d.ts +22 -0
- package/dist/types/pages/trade/RampRecovery.d.ts +22 -0
- package/dist/types/pages/trade/RecipientSheet.d.ts +11 -0
- package/dist/types/pages/trade/Selectors.d.ts +24 -0
- package/dist/types/pages/trade/SwapPanel.d.ts +34 -0
- package/dist/types/pages/trade/WidgetTabs.d.ts +46 -0
- package/dist/types/pages/trade/canton.d.ts +94 -0
- package/dist/types/pages/trade/config.d.ts +185 -0
- package/dist/types/pages/trade/embedNarrowing.d.ts +28 -0
- package/dist/types/pages/trade/embedParams.d.ts +299 -0
- package/dist/types/pages/trade/embedTheme.d.ts +14 -0
- package/dist/types/pages/trade/harness.d.ts +120 -0
- package/dist/types/pages/trade/orderMinimum.d.ts +5 -0
- package/dist/types/pages/trade/resumeSwap.d.ts +139 -0
- package/dist/types/pages/trade/settlementCopy.d.ts +42 -0
- package/dist/types/pages/trade/useAmountFit.d.ts +25 -0
- package/dist/types/pages/trade/useEmbedDefaults.d.ts +28 -0
- package/dist/types/pages/trade/useSettlementGating.d.ts +152 -0
- package/dist/types/pages/trade/useSwapAmount.d.ts +93 -0
- package/dist/types/pages/trade/useSwapFlow.d.ts +152 -0
- package/dist/types/pages/trade/useSwapPanel.d.ts +170 -0
- package/dist/types/pages/trade/useSwapRoute.d.ts +215 -0
- package/dist/types/pages/trade/useTronLinkFill.d.ts +13 -0
- package/dist/types/pages/trade/zkMoney.d.ts +28 -0
- package/dist/types/promiseWithResolvers.d.ts +12 -0
- package/dist/types/ramp/availability/RailTiles.d.ts +26 -0
- package/dist/types/ramp/availability/RampDisclosure.d.ts +9 -0
- package/dist/types/ramp/availability/RampRails.d.ts +27 -0
- package/dist/types/ramp/availability/model.d.ts +51 -0
- package/dist/types/ramp/availability/useRampDiscovery.d.ts +60 -0
- package/dist/types/ramp/offramp/CompletedPrerequisite.d.ts +5 -0
- package/dist/types/ramp/offramp/OfframpActivityList.d.ts +12 -0
- package/dist/types/ramp/offramp/OfframpRoute.d.ts +8 -0
- package/dist/types/ramp/offramp/OfframpRouteReview.d.ts +12 -0
- package/dist/types/ramp/offramp/PaymentAppSend.d.ts +27 -0
- package/dist/types/ramp/offramp/localOfframps.d.ts +58 -0
- package/dist/types/ramp/offramp/model.d.ts +46 -0
- package/dist/types/ramp/offramp/port.d.ts +55 -0
- package/dist/types/ramp/offramp/prerequisite.d.ts +271 -0
- package/dist/types/ramp/offramp/useOfframp.d.ts +87 -0
- package/dist/types/ramp/offramp/useOfframpRails.d.ts +36 -0
- package/dist/types/ramp/peer/BuyOnramp.d.ts +21 -0
- package/dist/types/ramp/peer/OnrampSteps.d.ts +32 -0
- package/dist/types/ramp/peer/buyerDriver.d.ts +48 -0
- package/dist/types/ramp/peer/discovery.d.ts +17 -0
- package/dist/types/ramp/peer/environment.d.ts +2 -0
- package/dist/types/ramp/peer/index.d.ts +14 -0
- package/dist/types/ramp/peer/liveProvider.d.ts +15 -0
- package/dist/types/ramp/peer/liveReads.d.ts +102 -0
- package/dist/types/ramp/peer/maker.d.ts +4 -0
- package/dist/types/ramp/peer/normalization.d.ts +33 -0
- package/dist/types/ramp/peer/offramp.d.ts +130 -0
- package/dist/types/ramp/peer/onramp.d.ts +134 -0
- package/dist/types/ramp/peer/preview.d.ts +14 -0
- package/dist/types/ramp/peer/protectedMapping.d.ts +22 -0
- package/dist/types/ramp/peer/runtime.d.ts +15 -0
- package/dist/types/ramp/peer/sdkMaker.d.ts +67 -0
- package/dist/types/ramp/peer/types.d.ts +64 -0
- package/dist/types/ramp/recovery/ResumeOnramp.d.ts +37 -0
- package/dist/types/ramp/recovery/summaries.d.ts +71 -0
- package/dist/types/ramp/route/OnrampRoute.d.ts +12 -0
- package/dist/types/ramp/route/RampRouteSteps.d.ts +16 -0
- package/dist/types/ramp/route/routeActivity.d.ts +4 -0
- package/dist/types/ramp/route/useXochiRampDriver.d.ts +22 -0
- package/dist/types/result.js +14 -0
- package/dist/types/styles.d.ts +1 -0
- package/dist/types/types/activity.d.ts +184 -0
- package/dist/types/types/index.d.ts +20 -0
- package/dist/types/types/intent.d.ts +85 -0
- package/dist/types/types/result.d.ts +53 -0
- package/dist/types/utils/format.d.ts +88 -0
- package/dist/types/wagmi.d.ts +143 -0
- package/dist/types/widgetLibModule.d.ts +8 -0
- package/dist/utils/format.js +109 -0
- package/dist/wagmi.js +210 -0
- package/dist/widgetLibModule.js +4 -0
- package/licenses/Monaspace-OFL-1.1.txt +93 -0
- package/licenses/assets.json +132 -0
- package/licenses/rainbowkit-MIT.txt +9 -0
- package/licenses/xochi-shared-MIT.txt +21 -0
- package/package.json +115 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { GLYPH } from "./glyphs.js";
|
|
2
|
+
import { paysNoGas } from "../types/intent.js";
|
|
3
|
+
function paymentSummary(method, hasPull, approval) {
|
|
4
|
+
const sep = ` ${GLYPH.sep} `;
|
|
5
|
+
switch (method) {
|
|
6
|
+
case "erc3009":
|
|
7
|
+
case "permit2":
|
|
8
|
+
case "pimlico":
|
|
9
|
+
case "mpp": {
|
|
10
|
+
const gas = paysNoGas(method, approval) ? "No gas" : approval === "required" ? "Gas for an approval" : "Gas only if an approval is needed";
|
|
11
|
+
return hasPull ? `${gas}${sep}sign twice` : gas;
|
|
12
|
+
}
|
|
13
|
+
case "approval":
|
|
14
|
+
return `Gas needed${sep}approve, then sign`;
|
|
15
|
+
case "deposit":
|
|
16
|
+
return `Gas needed${sep}send the tokens`;
|
|
17
|
+
case "x402":
|
|
18
|
+
return `Gas needed${sep}pay per call`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
paymentSummary
|
|
23
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const ERC3009_PULL_TYPES = /* @__PURE__ */ new Set([
|
|
2
|
+
"ReceiveWithAuthorization",
|
|
3
|
+
"TransferWithAuthorization"
|
|
4
|
+
]);
|
|
5
|
+
const PERMIT2_PULL_TYPES = /* @__PURE__ */ new Set([
|
|
6
|
+
"PermitWitnessTransferFrom",
|
|
7
|
+
"PermitBatchWitnessTransferFrom",
|
|
8
|
+
"PermitTransferFrom"
|
|
9
|
+
]);
|
|
10
|
+
function pullMethodFromAuthorization(pull) {
|
|
11
|
+
if (!pull) return null;
|
|
12
|
+
if (ERC3009_PULL_TYPES.has(pull.primaryType)) return "erc3009";
|
|
13
|
+
if (PERMIT2_PULL_TYPES.has(pull.primaryType)) return "permit2";
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
function permit2SpenderFromAuthorization(pull) {
|
|
17
|
+
if (!pull || !PERMIT2_PULL_TYPES.has(pull.primaryType)) return null;
|
|
18
|
+
const verifyingContract = pull.domain?.verifyingContract;
|
|
19
|
+
if (typeof verifyingContract !== "string" || !/^0x[0-9a-fA-F]{40}$/.test(verifyingContract)) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return verifyingContract;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
permit2SpenderFromAuthorization,
|
|
26
|
+
pullMethodFromAuthorization
|
|
27
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { isStableSymbol } from "@xochi/client";
|
|
2
|
+
function calculatePriceImpact(fromAmount, toAmount, fromDecimals, toDecimals, fromPrice, toPrice) {
|
|
3
|
+
try {
|
|
4
|
+
if (!fromPrice || !toPrice || fromPrice <= 0 || toPrice <= 0) return 0;
|
|
5
|
+
const from = Number(fromAmount) / Math.pow(10, fromDecimals);
|
|
6
|
+
const to = Number(toAmount) / Math.pow(10, toDecimals);
|
|
7
|
+
if (from === 0 || to === 0) return 0;
|
|
8
|
+
const marketRate2 = fromPrice / toPrice;
|
|
9
|
+
const quoteRate = to / from;
|
|
10
|
+
const impact = (1 - quoteRate / marketRate2) * 100;
|
|
11
|
+
return Math.max(0, impact);
|
|
12
|
+
} catch {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function marketGapAmount(fromAmount, toAmount, fromDecimals, toDecimals, fromPrice, toPrice) {
|
|
17
|
+
if (!fromPrice || !toPrice || fromPrice <= 0 || toPrice <= 0) return null;
|
|
18
|
+
const from = Number(fromAmount) / Math.pow(10, fromDecimals);
|
|
19
|
+
const to = Number(toAmount) / Math.pow(10, toDecimals);
|
|
20
|
+
if (!Number.isFinite(from) || !Number.isFinite(to) || from <= 0 || to <= 0) return null;
|
|
21
|
+
const marketPayout = from * (fromPrice / toPrice);
|
|
22
|
+
if (!Number.isFinite(marketPayout)) return null;
|
|
23
|
+
return Math.max(0, marketPayout - to);
|
|
24
|
+
}
|
|
25
|
+
function marketRate(fromPrice, toPrice) {
|
|
26
|
+
if (!fromPrice || !toPrice || fromPrice <= 0 || toPrice <= 0) return null;
|
|
27
|
+
const rate = fromPrice / toPrice;
|
|
28
|
+
return Number.isFinite(rate) && rate > 0 ? rate : null;
|
|
29
|
+
}
|
|
30
|
+
function formatRateValue(rate) {
|
|
31
|
+
if (rate < 0.01) return rate.toLocaleString("en-US", { maximumSignificantDigits: 4 });
|
|
32
|
+
return rate.toLocaleString("en-US", { maximumFractionDigits: rate >= 100 ? 2 : 4 });
|
|
33
|
+
}
|
|
34
|
+
function formatMarketRate(rate, fromSymbol, toSymbol) {
|
|
35
|
+
if (rate === null || !Number.isFinite(rate) || rate <= 0) return null;
|
|
36
|
+
const value = formatRateValue(rate);
|
|
37
|
+
return `1 ${fromSymbol} ≈ ${value} ${toSymbol}`;
|
|
38
|
+
}
|
|
39
|
+
function formatGapPct(pct) {
|
|
40
|
+
if (pct > 0 && pct < 0.05) return "<0.1%";
|
|
41
|
+
return `${pct.toFixed(1)}%`;
|
|
42
|
+
}
|
|
43
|
+
function formatPriceAge(ageSeconds) {
|
|
44
|
+
const age = Math.max(0, Math.floor(ageSeconds));
|
|
45
|
+
return age < 60 ? `${age}s ago` : `${Math.floor(age / 60)}m ago`;
|
|
46
|
+
}
|
|
47
|
+
function impliedRate(fromAmount, toAmount, fromDecimals, toDecimals) {
|
|
48
|
+
const from = Number(fromAmount) / Math.pow(10, fromDecimals);
|
|
49
|
+
const to = Number(toAmount) / Math.pow(10, toDecimals);
|
|
50
|
+
if (!Number.isFinite(from) || !Number.isFinite(to) || from <= 0 || to <= 0) return 0;
|
|
51
|
+
return to / from;
|
|
52
|
+
}
|
|
53
|
+
function formatImpliedRate(rate, fromSymbol, toSymbol, fromChainName, toChainName) {
|
|
54
|
+
if (!Number.isFinite(rate) || rate <= 0) return null;
|
|
55
|
+
const value = formatRateValue(rate);
|
|
56
|
+
return fromSymbol === toSymbol ? `1 ${fromSymbol} on ${fromChainName} = ${value} ${toSymbol} on ${toChainName}` : `1 ${fromSymbol} = ${value} ${toSymbol}`;
|
|
57
|
+
}
|
|
58
|
+
function formatCostPct(bps) {
|
|
59
|
+
if (bps > 0 && bps < 1) return "<0.01%";
|
|
60
|
+
return `${(bps / 100).toFixed(2)}%`;
|
|
61
|
+
}
|
|
62
|
+
const COST_WARNING_BPS = 50;
|
|
63
|
+
const COST_SEVERE_BPS = 100;
|
|
64
|
+
const MARKET_GAP_WARNING_PCT = 1;
|
|
65
|
+
const MARKET_GAP_SEVERE_PCT = 3;
|
|
66
|
+
function servedCostSeverity(costBps) {
|
|
67
|
+
if (costBps === null || !Number.isFinite(costBps) || costBps < 0) return "normal";
|
|
68
|
+
if (costBps > COST_SEVERE_BPS) return "severe";
|
|
69
|
+
if (costBps > COST_WARNING_BPS) return "warning";
|
|
70
|
+
return "normal";
|
|
71
|
+
}
|
|
72
|
+
function marketGapSeverity(priceImpactPct) {
|
|
73
|
+
if (!Number.isFinite(priceImpactPct) || priceImpactPct <= 0) return "normal";
|
|
74
|
+
if (priceImpactPct > MARKET_GAP_SEVERE_PCT) return "severe";
|
|
75
|
+
if (priceImpactPct > MARKET_GAP_WARNING_PCT) return "warning";
|
|
76
|
+
return "normal";
|
|
77
|
+
}
|
|
78
|
+
function stablePairShortfallPct(fromSymbol, toSymbol, fromAmount, toAmount, fromDecimals, toDecimals) {
|
|
79
|
+
if (!isStableSymbol(fromSymbol) || !isStableSymbol(toSymbol)) return null;
|
|
80
|
+
const rate = impliedRate(fromAmount, toAmount, fromDecimals, toDecimals);
|
|
81
|
+
if (rate <= 0) return null;
|
|
82
|
+
return Math.max(0, (1 - rate) * 100);
|
|
83
|
+
}
|
|
84
|
+
export {
|
|
85
|
+
COST_SEVERE_BPS,
|
|
86
|
+
COST_WARNING_BPS,
|
|
87
|
+
MARKET_GAP_SEVERE_PCT,
|
|
88
|
+
MARKET_GAP_WARNING_PCT,
|
|
89
|
+
calculatePriceImpact,
|
|
90
|
+
formatCostPct,
|
|
91
|
+
formatGapPct,
|
|
92
|
+
formatImpliedRate,
|
|
93
|
+
formatMarketRate,
|
|
94
|
+
formatPriceAge,
|
|
95
|
+
impliedRate,
|
|
96
|
+
marketGapAmount,
|
|
97
|
+
marketGapSeverity,
|
|
98
|
+
marketRate,
|
|
99
|
+
servedCostSeverity,
|
|
100
|
+
stablePairShortfallPct
|
|
101
|
+
};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
const PROVIDERS = [
|
|
2
|
+
// Humanity
|
|
3
|
+
{
|
|
4
|
+
id: "humanode",
|
|
5
|
+
name: "Humanode",
|
|
6
|
+
category: "humanity",
|
|
7
|
+
points: 15,
|
|
8
|
+
description: "Biometric PoH credential",
|
|
9
|
+
icon: "H"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "idena",
|
|
13
|
+
name: "Idena",
|
|
14
|
+
category: "humanity",
|
|
15
|
+
points: 18,
|
|
16
|
+
description: "AI-resistant PoH tests",
|
|
17
|
+
icon: "I"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
// ID kept as "gitcoin" for backward compat; rebranded to Human Passport
|
|
21
|
+
// (Holonym Foundation, Feb 2025). See docs/legal/provider-audit-2026-06.md.
|
|
22
|
+
id: "gitcoin",
|
|
23
|
+
name: "Human Passport",
|
|
24
|
+
category: "humanity",
|
|
25
|
+
points: 18,
|
|
26
|
+
description: "Aggregated sybil score",
|
|
27
|
+
icon: "G"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "worldcoin",
|
|
31
|
+
name: "Worldcoin",
|
|
32
|
+
category: "humanity",
|
|
33
|
+
points: 8,
|
|
34
|
+
description: "Orb-verified PoH",
|
|
35
|
+
icon: "W"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "brightid",
|
|
39
|
+
name: "BrightID",
|
|
40
|
+
category: "humanity",
|
|
41
|
+
points: 10,
|
|
42
|
+
description: "Social graph verification",
|
|
43
|
+
icon: "B"
|
|
44
|
+
},
|
|
45
|
+
// Identity
|
|
46
|
+
{
|
|
47
|
+
id: "zkpassport",
|
|
48
|
+
name: "ZKPassport",
|
|
49
|
+
category: "identity",
|
|
50
|
+
points: 30,
|
|
51
|
+
description: "Government ID via ZK proof",
|
|
52
|
+
icon: "Z"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
// ID kept as "polygonid" for backward compat; rebranded to Privado ID
|
|
56
|
+
// (spun out of Polygon Labs, Jun 2024). See provider-audit-2026-06.md.
|
|
57
|
+
id: "polygonid",
|
|
58
|
+
name: "Privado ID",
|
|
59
|
+
category: "identity",
|
|
60
|
+
points: 32,
|
|
61
|
+
description: "ZK identity credentials",
|
|
62
|
+
icon: "P"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: "coinbase",
|
|
66
|
+
name: "Coinbase Verified",
|
|
67
|
+
category: "identity",
|
|
68
|
+
points: 25,
|
|
69
|
+
description: "Exchange-level KYC",
|
|
70
|
+
icon: "C"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
id: "civic",
|
|
74
|
+
name: "Civic",
|
|
75
|
+
category: "identity",
|
|
76
|
+
points: 22,
|
|
77
|
+
description: "Identity verification",
|
|
78
|
+
icon: "V"
|
|
79
|
+
},
|
|
80
|
+
// Reputation
|
|
81
|
+
{
|
|
82
|
+
id: "ens",
|
|
83
|
+
name: "ENS",
|
|
84
|
+
category: "reputation",
|
|
85
|
+
points: 10,
|
|
86
|
+
description: "Domain ownership",
|
|
87
|
+
icon: "E"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "lens",
|
|
91
|
+
name: "Lens Protocol",
|
|
92
|
+
category: "reputation",
|
|
93
|
+
points: 6,
|
|
94
|
+
description: "Social graph history",
|
|
95
|
+
icon: "L"
|
|
96
|
+
},
|
|
97
|
+
// Compliance
|
|
98
|
+
{
|
|
99
|
+
id: "chainalysis",
|
|
100
|
+
name: "Chainalysis",
|
|
101
|
+
category: "compliance",
|
|
102
|
+
points: 20,
|
|
103
|
+
description: "Sanctions screening",
|
|
104
|
+
icon: "A"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
id: "xochi-history",
|
|
108
|
+
name: "Xochi History",
|
|
109
|
+
category: "compliance",
|
|
110
|
+
points: 15,
|
|
111
|
+
description: "Clean trading record",
|
|
112
|
+
icon: "X"
|
|
113
|
+
}
|
|
114
|
+
];
|
|
115
|
+
const CATEGORIES = [
|
|
116
|
+
"humanity",
|
|
117
|
+
"identity",
|
|
118
|
+
"reputation",
|
|
119
|
+
"compliance"
|
|
120
|
+
];
|
|
121
|
+
export {
|
|
122
|
+
CATEGORIES,
|
|
123
|
+
PROVIDERS
|
|
124
|
+
};
|
package/dist/lib/qr.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import qrcode from "qrcode-generator";
|
|
2
|
+
function buildQrSvg(value, margin = 4) {
|
|
3
|
+
const qr = qrcode(0, "M");
|
|
4
|
+
qr.addData(value);
|
|
5
|
+
qr.make();
|
|
6
|
+
const count = qr.getModuleCount();
|
|
7
|
+
const size = count + margin * 2;
|
|
8
|
+
let path = "";
|
|
9
|
+
for (let row = 0; row < count; row++) {
|
|
10
|
+
for (let col = 0; col < count; col++) {
|
|
11
|
+
if (qr.isDark(row, col)) {
|
|
12
|
+
path += `M${col + margin} ${row + margin}h1v1h-1z`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { size, path };
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
buildQrSvg
|
|
20
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { assetClassFromRate, feeAssetClass, deriveFeeBreakdown } from "@xochi/client";
|
|
2
|
+
import { safeBigInt, formatTokenAmount } from "../utils/format.js";
|
|
3
|
+
import { servedFees } from "./feesLabel.js";
|
|
4
|
+
function quoteCost(quote, input) {
|
|
5
|
+
const { fromSymbol, toSymbol, fromDecimals, toDecimals, trustScore } = input;
|
|
6
|
+
const rateAssetClass = assetClassFromRate(trustScore, quote.xochiFeeRate);
|
|
7
|
+
const assetClass = rateAssetClass ?? feeAssetClass(fromSymbol, toSymbol);
|
|
8
|
+
const fees = quote.feeBreakdown ?? deriveFeeBreakdown({
|
|
9
|
+
score: trustScore,
|
|
10
|
+
assetClass,
|
|
11
|
+
outputAmount: safeBigInt(quote.toAmount)
|
|
12
|
+
});
|
|
13
|
+
const feeIsOriginDenominated = quote.feeDenomination !== void 0 ? quote.feeDenomination === "origin" : quote.feeBreakdown !== void 0;
|
|
14
|
+
const feeDecimals = feeIsOriginDenominated ? fromDecimals : toDecimals;
|
|
15
|
+
const feeSymbol = feeIsOriginDenominated ? fromSymbol : toSymbol;
|
|
16
|
+
const inputTokens = (() => {
|
|
17
|
+
const value = Number(safeBigInt(input.fromAmount)) / 10 ** fromDecimals;
|
|
18
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
19
|
+
})();
|
|
20
|
+
const served = servedFees(quote, inputTokens, input.fromPriceUsd);
|
|
21
|
+
return {
|
|
22
|
+
servedBps: served.bps,
|
|
23
|
+
feesUsd: served.usd,
|
|
24
|
+
feesLabel: served.label,
|
|
25
|
+
inputTokens,
|
|
26
|
+
rateAssetClass,
|
|
27
|
+
assetClass,
|
|
28
|
+
fees,
|
|
29
|
+
feeAmount: (raw) => `${formatTokenAmount(safeBigInt(raw), feeDecimals, 4)} ${feeSymbol}`
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
quoteCost
|
|
34
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GLYPH } from "./glyphs.js";
|
|
2
|
+
function sanitizeSeconds(seconds) {
|
|
3
|
+
if (seconds === null || seconds === void 0) return null;
|
|
4
|
+
if (!Number.isFinite(seconds)) return 0;
|
|
5
|
+
return Math.max(0, Math.floor(seconds));
|
|
6
|
+
}
|
|
7
|
+
function quoteRefreshCountdown(seconds, bufferSec = 0) {
|
|
8
|
+
const safe = sanitizeSeconds(seconds);
|
|
9
|
+
if (safe === null) return null;
|
|
10
|
+
const remaining = Math.max(0, safe - Math.max(0, Math.floor(bufferSec)));
|
|
11
|
+
return remaining > 0 ? {
|
|
12
|
+
text: `${GLYPH.refresh} ${remaining}s`,
|
|
13
|
+
spoken: `New price in ${remaining} ${remaining === 1 ? "second" : "seconds"}`
|
|
14
|
+
} : { text: "Updating...", spoken: "Updating the price" };
|
|
15
|
+
}
|
|
16
|
+
function quoteExpiryLabel(seconds) {
|
|
17
|
+
const safe = sanitizeSeconds(seconds);
|
|
18
|
+
if (safe === null) return null;
|
|
19
|
+
return safe > 0 ? `Expires in ${safe}s` : null;
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
quoteExpiryLabel,
|
|
23
|
+
quoteRefreshCountdown
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
import { hostBridge } from "./hostBridge.js";
|
|
3
|
+
function rampHostGate(bridge) {
|
|
4
|
+
if (bridge === null) return "ready";
|
|
5
|
+
const protocol = bridge.hostProtocol();
|
|
6
|
+
return protocol === "current" ? "ready" : protocol;
|
|
7
|
+
}
|
|
8
|
+
function useRampHostGate(bridge = hostBridge) {
|
|
9
|
+
const subscribe = useCallback(
|
|
10
|
+
(notify) => bridge ? bridge.onHostProtocol(notify) : () => {
|
|
11
|
+
},
|
|
12
|
+
[bridge]
|
|
13
|
+
);
|
|
14
|
+
return useSyncExternalStore(subscribe, () => rampHostGate(bridge));
|
|
15
|
+
}
|
|
16
|
+
const RAMP_HOST_GATE_COPY = {
|
|
17
|
+
pending: "Waiting for the page hosting this widget to connect. Peer payments start once it does.",
|
|
18
|
+
legacy: "The page hosting this widget runs an older Xochi embed that cannot carry Peer payments safely, so they are off here. Swaps and sends still work. Ask the site to update its Xochi embed, or use xochi.fi."
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
RAMP_HOST_GATE_COPY,
|
|
22
|
+
rampHostGate,
|
|
23
|
+
useRampHostGate
|
|
24
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { RAMP_REF_PATTERN, mintRampRef } from "@xochi/widget-lib";
|
|
2
|
+
import { hostBridge } from "./hostBridge.js";
|
|
3
|
+
function emitterFor(rampRef, bridge) {
|
|
4
|
+
let lastStatus;
|
|
5
|
+
const lastRecovery = /* @__PURE__ */ new Map();
|
|
6
|
+
let done = false;
|
|
7
|
+
return {
|
|
8
|
+
status(peer, xochi) {
|
|
9
|
+
const key = `${peer}/${xochi ?? ""}`;
|
|
10
|
+
if (done || key === lastStatus) return;
|
|
11
|
+
if (lastStatus !== void 0) {
|
|
12
|
+
const [prevPeer, prevXochi] = lastStatus.split("/");
|
|
13
|
+
if (prevPeer !== peer) lastRecovery.delete("peer");
|
|
14
|
+
if (prevXochi !== (xochi ?? "")) lastRecovery.delete("xochi");
|
|
15
|
+
}
|
|
16
|
+
lastStatus = key;
|
|
17
|
+
bridge?.emit({
|
|
18
|
+
name: "ramp:status",
|
|
19
|
+
rampRef,
|
|
20
|
+
peer,
|
|
21
|
+
...xochi === void 0 ? {} : { xochi }
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
recoveryRequired(leg, code) {
|
|
25
|
+
if (done || lastRecovery.get(leg) === code) return;
|
|
26
|
+
lastRecovery.set(leg, code);
|
|
27
|
+
bridge?.emit({ name: "ramp:recovery-required", rampRef, leg, code });
|
|
28
|
+
},
|
|
29
|
+
terminal(peer, xochi) {
|
|
30
|
+
if (done) return;
|
|
31
|
+
done = true;
|
|
32
|
+
bridge?.emit({
|
|
33
|
+
name: "ramp:terminal",
|
|
34
|
+
rampRef,
|
|
35
|
+
peer,
|
|
36
|
+
...xochi === void 0 ? {} : { xochi }
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function createRampEmitter(direction, bridge = hostBridge) {
|
|
42
|
+
const rampRef = mintRampRef();
|
|
43
|
+
bridge?.emit({ name: "ramp:started", rampRef, direction });
|
|
44
|
+
return { rampRef, ...emitterFor(rampRef, bridge) };
|
|
45
|
+
}
|
|
46
|
+
function resumeRampEmitter(rampRef, bridge = hostBridge) {
|
|
47
|
+
if (rampRef === void 0 || !RAMP_REF_PATTERN.test(rampRef)) return null;
|
|
48
|
+
return { rampRef, ...emitterFor(rampRef, bridge) };
|
|
49
|
+
}
|
|
50
|
+
function emitSnapshot(emitter, next) {
|
|
51
|
+
if (!emitter) return;
|
|
52
|
+
emitter.status(next.peer.state, next.xochi?.state);
|
|
53
|
+
if (next.peer.state === "in_doubt") emitter.recoveryRequired("peer", "peer_in_doubt");
|
|
54
|
+
if (next.xochi?.state === "in_doubt") emitter.recoveryRequired("xochi", "xochi_in_doubt");
|
|
55
|
+
if (next.xochi?.state === "failed")
|
|
56
|
+
emitter.recoveryRequired("xochi", next.xochi.failure_code ?? "route_failed");
|
|
57
|
+
if (next.terminal) emitter.terminal(next.peer.state, next.xochi?.state);
|
|
58
|
+
}
|
|
59
|
+
export {
|
|
60
|
+
createRampEmitter,
|
|
61
|
+
emitSnapshot,
|
|
62
|
+
resumeRampEmitter
|
|
63
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const MAX_PLAUSIBLE_TOTAL_USD = 1e6;
|
|
2
|
+
function totalCostUsd(input) {
|
|
3
|
+
const served = Number(input.servedTotalUsd ?? "");
|
|
4
|
+
if (Number.isFinite(served) && served > 0 && served <= MAX_PLAUSIBLE_TOTAL_USD) return served;
|
|
5
|
+
if (input.costBps !== null && input.costBps > 0 && input.inputTokens !== null && input.inputTokens > 0 && input.inputPriceUsd !== void 0 && input.inputPriceUsd > 0) {
|
|
6
|
+
return input.inputTokens * input.inputPriceUsd * input.costBps / 1e4;
|
|
7
|
+
}
|
|
8
|
+
return null;
|
|
9
|
+
}
|
|
10
|
+
function usdCents(usd) {
|
|
11
|
+
if (usd === null || !Number.isFinite(usd) || usd <= 0) return null;
|
|
12
|
+
return Math.round(usd * 100);
|
|
13
|
+
}
|
|
14
|
+
const centsLabel = (cents) => `$${(cents / 100).toLocaleString("en-US", { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
15
|
+
function formatUsd(usd) {
|
|
16
|
+
const cents = usdCents(usd);
|
|
17
|
+
if (cents === null) return null;
|
|
18
|
+
return cents === 0 ? "<$0.01" : centsLabel(cents);
|
|
19
|
+
}
|
|
20
|
+
function approxUsd(formatted) {
|
|
21
|
+
return formatted.startsWith("<") ? formatted : `~${formatted}`;
|
|
22
|
+
}
|
|
23
|
+
function decomposeMarketGap(input) {
|
|
24
|
+
const gapBps = input.gapPct * 100;
|
|
25
|
+
const totalBps = Math.round(gapBps);
|
|
26
|
+
const totalPct = totalBps === 0 && gapBps > 0 ? "<0.01%" : `${(totalBps / 100).toFixed(2)}%`;
|
|
27
|
+
const totalUsd = formatUsd(input.gapUsd);
|
|
28
|
+
const total = totalUsd ? `${approxUsd(totalUsd)} (${totalPct})` : totalPct;
|
|
29
|
+
if (input.feeBps === null || !Number.isFinite(input.feeBps)) return { total, spread: null };
|
|
30
|
+
const spreadBps = totalBps - Math.round(input.feeBps);
|
|
31
|
+
if (spreadBps <= 0) return { total, spread: null };
|
|
32
|
+
const spreadPct = `${(spreadBps / 100).toFixed(2)}%`;
|
|
33
|
+
const gapCents = usdCents(input.gapUsd);
|
|
34
|
+
const feeCents = usdCents(input.feesUsd);
|
|
35
|
+
const spreadCents = gapCents !== null && feeCents !== null && gapCents > 0 && feeCents > 0 ? gapCents - feeCents : 0;
|
|
36
|
+
return {
|
|
37
|
+
total,
|
|
38
|
+
spread: spreadCents > 0 ? `~${centsLabel(spreadCents)} (${spreadPct})` : spreadPct
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function splitUsd(totalUsd, weights) {
|
|
42
|
+
const cents = usdCents(totalUsd);
|
|
43
|
+
const sum = weights.reduce((acc, w) => acc + w, 0n);
|
|
44
|
+
if (cents === null || cents === 0 || sum <= 0n || weights.some((w) => w < 0n)) return null;
|
|
45
|
+
const total = BigInt(cents);
|
|
46
|
+
const floors = weights.map((w) => total * w / sum);
|
|
47
|
+
const remainders = weights.map((w) => total * w % sum);
|
|
48
|
+
const left = Number(total - floors.reduce((acc, f) => acc + f, 0n));
|
|
49
|
+
const byRemainder = weights.map((_, i) => i).sort(
|
|
50
|
+
(a, b) => remainders[b] > remainders[a] ? 1 : remainders[b] < remainders[a] ? -1 : a - b
|
|
51
|
+
);
|
|
52
|
+
const bumped = new Set(byRemainder.slice(0, left));
|
|
53
|
+
return floors.map((f, i) => {
|
|
54
|
+
const part = Number(f) + (bumped.has(i) ? 1 : 0);
|
|
55
|
+
return part > 0 ? centsLabel(part) : weights[i] > 0n ? "<$0.01" : centsLabel(0);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
approxUsd,
|
|
60
|
+
decomposeMarketGap,
|
|
61
|
+
formatUsd,
|
|
62
|
+
splitUsd,
|
|
63
|
+
totalCostUsd
|
|
64
|
+
};
|