@openfort/react 0.3.2 → 1.0.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/build/assets/browsers.js +13 -0
- package/build/assets/browsers.js.map +1 -0
- package/build/assets/chains.js +139 -0
- package/build/assets/chains.js.map +1 -0
- package/build/assets/icons.js +41 -0
- package/build/assets/icons.js.map +1 -0
- package/build/assets/logos.js +173 -0
- package/build/assets/logos.js.map +1 -0
- package/build/assets/wave.js +6 -0
- package/build/assets/wave.js.map +1 -0
- package/build/components/BalanceButton/index.js +89 -0
- package/build/components/BalanceButton/index.js.map +1 -0
- package/build/components/Common/Alert/index.js +10 -0
- package/build/components/Common/Alert/index.js.map +1 -0
- package/build/components/Common/Alert/styles.js +55 -0
- package/build/components/Common/Alert/styles.js.map +1 -0
- package/build/components/Common/Avatar/index.d.ts +11 -3
- package/build/components/Common/Avatar/index.js +100 -0
- package/build/components/Common/Avatar/index.js.map +1 -0
- package/build/components/Common/Avatar/styles.js +59 -0
- package/build/components/Common/Avatar/styles.js.map +1 -0
- package/build/components/Common/BrowserIcon/index.js +28 -0
- package/build/components/Common/BrowserIcon/index.js.map +1 -0
- package/build/components/Common/BrowserIcon/styles.js +20 -0
- package/build/components/Common/BrowserIcon/styles.js.map +1 -0
- package/build/components/Common/Button/index.js +36 -0
- package/build/components/Common/Button/index.js.map +1 -0
- package/build/components/Common/Button/styles.js +302 -0
- package/build/components/Common/Button/styles.js.map +1 -0
- package/build/components/Common/Button/types.d.ts +1 -0
- package/build/components/Common/Chain/index.d.ts +8 -0
- package/build/components/Common/Chain/index.js +38 -0
- package/build/components/Common/Chain/index.js.map +1 -0
- package/build/components/Common/Chain/styles.js +94 -0
- package/build/components/Common/Chain/styles.js.map +1 -0
- package/build/components/Common/ConnectorList/index.js +58 -0
- package/build/components/Common/ConnectorList/index.js.map +1 -0
- package/build/components/Common/ConnectorList/styles.js +324 -0
- package/build/components/Common/ConnectorList/styles.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyButton.js +12 -0
- package/build/components/Common/CopyToClipboard/CopyButton.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyIcon.js +76 -0
- package/build/components/Common/CopyToClipboard/CopyIcon.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyIconButton.js +38 -0
- package/build/components/Common/CopyToClipboard/CopyIconButton.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyText.js +26 -0
- package/build/components/Common/CopyToClipboard/CopyText.js.map +1 -0
- package/build/components/Common/CustomQRCode/QRCode.js +60 -0
- package/build/components/Common/CustomQRCode/QRCode.js.map +1 -0
- package/build/components/Common/CustomQRCode/index.js +22 -0
- package/build/components/Common/CustomQRCode/index.js.map +1 -0
- package/build/components/Common/CustomQRCode/styles.js +155 -0
- package/build/components/Common/CustomQRCode/styles.js.map +1 -0
- package/build/components/Common/FitText/index.js +28 -0
- package/build/components/Common/FitText/index.js.map +1 -0
- package/build/components/Common/Input/index.js +17 -0
- package/build/components/Common/Input/index.js.map +1 -0
- package/build/components/Common/Input/styles.js +53 -0
- package/build/components/Common/Input/styles.js.map +1 -0
- package/build/components/Common/LargeButton/index.js +10 -0
- package/build/components/Common/LargeButton/index.js.map +1 -0
- package/build/components/Common/LargeButton/styles.js +69 -0
- package/build/components/Common/LargeButton/styles.js.map +1 -0
- package/build/components/Common/Loading/index.js +96 -0
- package/build/components/Common/Loading/index.js.map +1 -0
- package/build/components/Common/Modal/index.js +272 -0
- package/build/components/Common/Modal/index.js.map +1 -0
- package/build/components/Common/Modal/styles.d.ts +0 -1
- package/build/components/Common/Modal/styles.js +657 -0
- package/build/components/Common/Modal/styles.js.map +1 -0
- package/build/components/Common/OTPInput/index.js +108 -0
- package/build/components/Common/OTPInput/index.js.map +1 -0
- package/build/components/Common/OTPInput/styles.js +153 -0
- package/build/components/Common/OTPInput/styles.js.map +1 -0
- package/build/components/Common/Portal/index.js +31 -0
- package/build/components/Common/Portal/index.js.map +1 -0
- package/build/components/Common/PoweredByFooter/index.js +103 -0
- package/build/components/Common/PoweredByFooter/index.js.map +1 -0
- package/build/components/Common/Providers/ProviderHeader.d.ts +2 -2
- package/build/components/Common/Providers/ProviderHeader.js +55 -0
- package/build/components/Common/Providers/ProviderHeader.js.map +1 -0
- package/build/components/Common/Providers/ProviderIcon.d.ts +2 -2
- package/build/components/Common/Providers/ProviderIcon.js +41 -0
- package/build/components/Common/Providers/ProviderIcon.js.map +1 -0
- package/build/components/Common/Providers/getProviderName.d.ts +1 -1
- package/build/components/Common/Providers/getProviderName.js +15 -0
- package/build/components/Common/Providers/getProviderName.js.map +1 -0
- package/build/components/Common/ScrollArea/index.js +58 -0
- package/build/components/Common/ScrollArea/index.js.map +1 -0
- package/build/components/Common/ScrollArea/styles.js +168 -0
- package/build/components/Common/ScrollArea/styles.js.map +1 -0
- package/build/components/Common/Spinner/index.js +24 -0
- package/build/components/Common/Spinner/index.js.map +1 -0
- package/build/components/Common/Spinner/styles.js +22 -0
- package/build/components/Common/Spinner/styles.js.map +1 -0
- package/build/components/Common/SquircleSpinner/index.js +15 -0
- package/build/components/Common/SquircleSpinner/index.js.map +1 -0
- package/build/components/Common/SquircleSpinner/styles.js +66 -0
- package/build/components/Common/SquircleSpinner/styles.js.map +1 -0
- package/build/components/Common/ThemedButton/index.js +25 -0
- package/build/components/Common/ThemedButton/index.js.map +1 -0
- package/build/components/Common/ThemedButton/styles.js +152 -0
- package/build/components/Common/ThemedButton/styles.js.map +1 -0
- package/build/components/Common/TickList/index.js +11 -0
- package/build/components/Common/TickList/index.js.map +1 -0
- package/build/components/Common/TickList/styles.js +28 -0
- package/build/components/Common/TickList/styles.js.map +1 -0
- package/build/components/Common/Tooltip/index.js +91 -0
- package/build/components/Common/Tooltip/index.js.map +1 -0
- package/build/components/Common/Tooltip/styles.js +81 -0
- package/build/components/Common/Tooltip/styles.js.map +1 -0
- package/build/components/Common/WalletRecoveryIcon/index.d.ts +4 -0
- package/build/components/Common/WalletRecoveryIcon/index.js +19 -0
- package/build/components/Common/WalletRecoveryIcon/index.js.map +1 -0
- package/build/components/ConnectButton/index.d.ts +12 -4
- package/build/components/ConnectButton/index.js +266 -0
- package/build/components/ConnectButton/index.js.map +1 -0
- package/build/components/ConnectButton/styles.js +50 -0
- package/build/components/ConnectButton/styles.js.map +1 -0
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.js +20 -0
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.js.map +1 -0
- package/build/components/ConnectModal/ConnectUsing.d.ts +1 -1
- package/build/components/ConnectModal/ConnectUsing.js +68 -0
- package/build/components/ConnectModal/ConnectUsing.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.js +17 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/styles.js +118 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/styles.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/index.d.ts +0 -2
- package/build/components/ConnectModal/ConnectWithInjector/index.js +295 -0
- package/build/components/ConnectModal/ConnectWithInjector/index.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/styles.js +133 -0
- package/build/components/ConnectModal/ConnectWithInjector/styles.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithMobile.js +99 -0
- package/build/components/ConnectModal/ConnectWithMobile.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithOAuth.js +128 -0
- package/build/components/ConnectModal/ConnectWithOAuth.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithQRCode.js +78 -0
- package/build/components/ConnectModal/ConnectWithQRCode.js.map +1 -0
- package/build/components/ConnectModal/index.js +230 -0
- package/build/components/ConnectModal/index.js.map +1 -0
- package/build/components/FloatingGraphic/index.js +13 -0
- package/build/components/FloatingGraphic/index.js.map +1 -0
- package/build/components/FloatingGraphic/styles.js +175 -0
- package/build/components/FloatingGraphic/styles.js.map +1 -0
- package/build/components/Openfort/OpenfortProvider.d.ts +10 -25
- package/build/components/Openfort/OpenfortProvider.js +351 -0
- package/build/components/Openfort/OpenfortProvider.js.map +1 -0
- package/build/components/Openfort/context.d.ts +48 -5
- package/build/components/Openfort/context.js +7 -0
- package/build/components/Openfort/context.js.map +1 -0
- package/build/components/Openfort/routeHelpers.d.ts +5 -0
- package/build/components/Openfort/routeHelpers.js +20 -0
- package/build/components/Openfort/routeHelpers.js.map +1 -0
- package/build/components/Openfort/types.d.ts +57 -23
- package/build/components/Openfort/types.js +119 -0
- package/build/components/Openfort/types.js.map +1 -0
- package/build/components/Openfort/useOpenfort.d.ts +2 -0
- package/build/components/Openfort/useOpenfort.js +12 -0
- package/build/components/Openfort/useOpenfort.js.map +1 -0
- package/build/components/PageContent/index.js +55 -0
- package/build/components/PageContent/index.js.map +1 -0
- package/build/components/PageContent/styles.js +11 -0
- package/build/components/PageContent/styles.js.map +1 -0
- package/build/components/Pages/About/graphics.js +193 -0
- package/build/components/Pages/About/graphics.js.map +1 -0
- package/build/components/Pages/About/index.js +142 -0
- package/build/components/Pages/About/index.js.map +1 -0
- package/build/components/Pages/About/styles.js +142 -0
- package/build/components/Pages/About/styles.js.map +1 -0
- package/build/components/Pages/AssetInventory/index.js +66 -0
- package/build/components/Pages/AssetInventory/index.js.map +1 -0
- package/build/components/Pages/Buy/coinbaseApi.js +106 -0
- package/build/components/Pages/Buy/coinbaseApi.js.map +1 -0
- package/build/components/Pages/Buy/index.js +88 -0
- package/build/components/Pages/Buy/index.js.map +1 -0
- package/build/components/Pages/Buy/onrampApi.js +57 -0
- package/build/components/Pages/Buy/onrampApi.js.map +1 -0
- package/build/components/Pages/Buy/providers.js +39 -0
- package/build/components/Pages/Buy/providers.js.map +1 -0
- package/build/components/Pages/Buy/stripeApi.js +74 -0
- package/build/components/Pages/Buy/stripeApi.js.map +1 -0
- package/build/components/Pages/Buy/styles.js +230 -0
- package/build/components/Pages/Buy/styles.js.map +1 -0
- package/build/components/Pages/Buy/utils.js +71 -0
- package/build/components/Pages/Buy/utils.js.map +1 -0
- package/build/components/Pages/BuyComplete/index.js +47 -0
- package/build/components/Pages/BuyComplete/index.js.map +1 -0
- package/build/components/Pages/BuyProcessing/index.js +231 -0
- package/build/components/Pages/BuyProcessing/index.js.map +1 -0
- package/build/components/Pages/BuyProviderSelect/index.js +55 -0
- package/build/components/Pages/BuyProviderSelect/index.js.map +1 -0
- package/build/components/Pages/BuyProviderSelect/styles.js +103 -0
- package/build/components/Pages/BuyProviderSelect/styles.js.map +1 -0
- package/build/components/Pages/BuySelectProvider/index.js +245 -0
- package/build/components/Pages/BuySelectProvider/index.js.map +1 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.d.ts +22 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.js +11 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.js.map +1 -0
- package/build/components/Pages/Connected/EthereumConnected.d.ts +3 -0
- package/build/components/Pages/Connected/EthereumConnected.js +133 -0
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -0
- package/build/components/Pages/Connected/SolanaConnected.d.ts +3 -0
- package/build/components/Pages/Connected/SolanaConnected.js +96 -0
- package/build/components/Pages/Connected/SolanaConnected.js.map +1 -0
- package/build/components/Pages/Connected/index.d.ts +2 -2
- package/build/components/Pages/Connected/index.js +18 -0
- package/build/components/Pages/Connected/index.js.map +1 -0
- package/build/components/Pages/Connected/styles.js +122 -0
- package/build/components/Pages/Connected/styles.js.map +1 -0
- package/build/components/Pages/ConnectedSuccess/index.js +19 -0
- package/build/components/Pages/ConnectedSuccess/index.js.map +1 -0
- package/build/components/Pages/Connectors/index.js +73 -0
- package/build/components/Pages/Connectors/index.js.map +1 -0
- package/build/components/Pages/CreateGuestUserPage/index.js +28 -0
- package/build/components/Pages/CreateGuestUserPage/index.js.map +1 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.d.ts +6 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.js +241 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.js.map +1 -0
- package/build/components/Pages/CreateWallet/index.js +303 -0
- package/build/components/Pages/CreateWallet/index.js.map +1 -0
- package/build/components/Pages/CreateWallet/styles.js +17 -0
- package/build/components/Pages/CreateWallet/styles.js.map +1 -0
- package/build/components/Pages/DownloadApp/index.js +32 -0
- package/build/components/Pages/DownloadApp/index.js.map +1 -0
- package/build/components/Pages/EmailLogin/index.js +118 -0
- package/build/components/Pages/EmailLogin/index.js.map +1 -0
- package/build/components/Pages/EmailLogin/styles.js +24 -0
- package/build/components/Pages/EmailLogin/styles.js.map +1 -0
- package/build/components/Pages/EmailOTP/index.js +116 -0
- package/build/components/Pages/EmailOTP/index.js.map +1 -0
- package/build/components/Pages/EmailOTP/styles.js +38 -0
- package/build/components/Pages/EmailOTP/styles.js.map +1 -0
- package/build/components/Pages/EmailVerification/index.js +86 -0
- package/build/components/Pages/EmailVerification/index.js.map +1 -0
- package/build/components/Pages/ExportKey/index.js +44 -0
- package/build/components/Pages/ExportKey/index.js.map +1 -0
- package/build/components/Pages/ForgotPassword/index.js +129 -0
- package/build/components/Pages/ForgotPassword/index.js.map +1 -0
- package/build/components/Pages/LinkEmail/index.js +63 -0
- package/build/components/Pages/LinkEmail/index.js.map +1 -0
- package/build/components/Pages/LinkedProvider/index.d.ts +3 -0
- package/build/components/Pages/LinkedProvider/index.js +90 -0
- package/build/components/Pages/LinkedProvider/index.js.map +1 -0
- package/build/components/Pages/LinkedProviders/index.js +45 -0
- package/build/components/Pages/LinkedProviders/index.js.map +1 -0
- package/build/components/Pages/LinkedProviders/styles.js +51 -0
- package/build/components/Pages/LinkedProviders/styles.js.map +1 -0
- package/build/components/Pages/LoadWallets/index.js +91 -0
- package/build/components/Pages/LoadWallets/index.js.map +1 -0
- package/build/components/Pages/Loading/index.js +61 -0
- package/build/components/Pages/Loading/index.js.map +1 -0
- package/build/components/Pages/MobileConnectors/index.js +71 -0
- package/build/components/Pages/MobileConnectors/index.js.map +1 -0
- package/build/components/Pages/MobileConnectors/styles.js +65 -0
- package/build/components/Pages/MobileConnectors/styles.js.map +1 -0
- package/build/components/Pages/NoAssetsAvailable/index.js +45 -0
- package/build/components/Pages/NoAssetsAvailable/index.js.map +1 -0
- package/build/components/Pages/NoAssetsAvailable/styles.js +10 -0
- package/build/components/Pages/NoAssetsAvailable/styles.js.map +1 -0
- package/build/components/Pages/Onboarding/index.js +20 -0
- package/build/components/Pages/Onboarding/index.js.map +1 -0
- package/build/components/Pages/PhoneOTP/index.js +128 -0
- package/build/components/Pages/PhoneOTP/index.js.map +1 -0
- package/build/components/Pages/PhoneOTP/styles.js +38 -0
- package/build/components/Pages/PhoneOTP/styles.js.map +1 -0
- package/build/components/Pages/Profile/index.js +35 -0
- package/build/components/Pages/Profile/index.js.map +1 -0
- package/build/components/Pages/Providers/index.js +157 -0
- package/build/components/Pages/Providers/index.js.map +1 -0
- package/build/components/Pages/Providers/styles.js +156 -0
- package/build/components/Pages/Providers/styles.js.map +1 -0
- package/build/components/Pages/Receive/index.js +61 -0
- package/build/components/Pages/Receive/index.js.map +1 -0
- package/build/components/Pages/Receive/styles.d.ts +1 -0
- package/build/components/Pages/Receive/styles.js +52 -0
- package/build/components/Pages/Receive/styles.js.map +1 -0
- package/build/components/Pages/Recover/index.js +252 -0
- package/build/components/Pages/Recover/index.js.map +1 -0
- package/build/components/Pages/Recover/recoveryRegistry.d.ts +32 -0
- package/build/components/Pages/Recover/recoveryRegistry.js +61 -0
- package/build/components/Pages/Recover/recoveryRegistry.js.map +1 -0
- package/build/components/Pages/RemoveLinkedProvider/index.js +104 -0
- package/build/components/Pages/RemoveLinkedProvider/index.js.map +1 -0
- package/build/components/Pages/SelectToken/index.js +102 -0
- package/build/components/Pages/SelectToken/index.js.map +1 -0
- package/build/components/Pages/SelectToken/styles.js +78 -0
- package/build/components/Pages/SelectToken/styles.js.map +1 -0
- package/build/components/Pages/SelectWalletToRecover/index.d.ts +1 -2
- package/build/components/Pages/SelectWalletToRecover/index.js +70 -0
- package/build/components/Pages/SelectWalletToRecover/index.js.map +1 -0
- package/build/components/Pages/Send/EthereumSend.d.ts +1 -0
- package/build/components/Pages/Send/EthereumSend.js +88 -0
- package/build/components/Pages/Send/EthereumSend.js.map +1 -0
- package/build/components/Pages/Send/SolanaSend.d.ts +1 -0
- package/build/components/Pages/Send/SolanaSend.js +93 -0
- package/build/components/Pages/Send/SolanaSend.js.map +1 -0
- package/build/components/Pages/Send/index.d.ts +7 -1
- package/build/components/Pages/Send/index.js +18 -0
- package/build/components/Pages/Send/index.js.map +1 -0
- package/build/components/Pages/Send/styles.js +112 -0
- package/build/components/Pages/Send/styles.js.map +1 -0
- package/build/components/Pages/Send/utils.d.ts +1 -1
- package/build/components/Pages/Send/utils.js +63 -0
- package/build/components/Pages/Send/utils.js.map +1 -0
- package/build/components/Pages/SendConfirmation/EstimatedFees.js +66 -0
- package/build/components/Pages/SendConfirmation/EstimatedFees.js.map +1 -0
- package/build/components/Pages/SendConfirmation/index.js +331 -0
- package/build/components/Pages/SendConfirmation/index.js.map +1 -0
- package/build/components/Pages/SendConfirmation/styles.js +129 -0
- package/build/components/Pages/SendConfirmation/styles.js.map +1 -0
- package/build/components/Pages/SocialProviders/index.js +15 -0
- package/build/components/Pages/SocialProviders/index.js.map +1 -0
- package/build/components/Pages/SolanaSendConfirmation/index.d.ts +1 -0
- package/build/components/Pages/SolanaSendConfirmation/index.js +152 -0
- package/build/components/Pages/SolanaSendConfirmation/index.js.map +1 -0
- package/build/components/Pages/SolanaWallets/index.d.ts +1 -0
- package/build/components/Pages/SolanaWallets/index.js +36 -0
- package/build/components/Pages/SolanaWallets/index.js.map +1 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.js +62 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.js.map +1 -0
- package/build/components/PasswordStrength/password-utility.js +128 -0
- package/build/components/PasswordStrength/password-utility.js.map +1 -0
- package/build/constants/chainConfigs.js +316 -0
- package/build/constants/chainConfigs.js.map +1 -0
- package/build/constants/defaultTheme.js +6 -0
- package/build/constants/defaultTheme.js.map +1 -0
- package/build/constants/openfort.d.ts +4 -0
- package/build/constants/openfort.js +8 -0
- package/build/constants/openfort.js.map +1 -0
- package/build/core/ConnectionStrategy.d.ts +31 -0
- package/build/core/ConnectionStrategy.js +9 -0
- package/build/core/ConnectionStrategy.js.map +1 -0
- package/build/core/ConnectionStrategyContext.d.ts +16 -0
- package/build/core/ConnectionStrategyContext.js +22 -0
- package/build/core/ConnectionStrategyContext.js.map +1 -0
- package/build/core/errors.d.ts +1 -0
- package/build/core/strategies/EthereumBridgeStrategy.d.ts +11 -0
- package/build/core/strategies/EthereumBridgeStrategy.js +83 -0
- package/build/core/strategies/EthereumBridgeStrategy.js.map +1 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.d.ts +8 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.js +85 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.js.map +1 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.d.ts +9 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.js +53 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.js.map +1 -0
- package/build/core/strategyUtils.d.ts +6 -0
- package/build/core/strategyUtils.js +31 -0
- package/build/core/strategyUtils.js.map +1 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.d.ts +87 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.js +18 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.js.map +1 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.d.ts +14 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.js +24 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.js.map +1 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.d.ts +17 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js +425 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js.map +1 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.d.ts +29 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.js +204 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.js.map +1 -0
- package/build/ethereum/index.d.ts +11 -0
- package/build/ethereum/index.js +3 -0
- package/build/ethereum/index.js.map +1 -0
- package/build/ethereum/types.d.ts +140 -0
- package/build/hooks/openfort/auth/requestEmailVerification.js +21 -0
- package/build/hooks/openfort/auth/requestEmailVerification.js.map +1 -0
- package/build/hooks/openfort/auth/status.js +11 -0
- package/build/hooks/openfort/auth/status.js.map +1 -0
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +2 -1
- package/build/hooks/openfort/auth/useAuthCallback.js +197 -0
- package/build/hooks/openfort/auth/useAuthCallback.js.map +1 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.d.ts +2 -2
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js +161 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useEmailAuth.js +496 -0
- package/build/hooks/openfort/auth/useEmailAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useEmailOtpAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useEmailOtpAuth.js +151 -0
- package/build/hooks/openfort/auth/useEmailOtpAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useGuestAuth.js +142 -0
- package/build/hooks/openfort/auth/useGuestAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useOAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useOAuth.js +217 -0
- package/build/hooks/openfort/auth/useOAuth.js.map +1 -0
- package/build/hooks/openfort/auth/usePhoneOtpAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/usePhoneOtpAuth.js +174 -0
- package/build/hooks/openfort/auth/usePhoneOtpAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useSignOut.d.ts +2 -1
- package/build/hooks/openfort/auth/useSignOut.js +104 -0
- package/build/hooks/openfort/auth/useSignOut.js.map +1 -0
- package/build/hooks/openfort/hookConsistency.js +17 -0
- package/build/hooks/openfort/hookConsistency.js.map +1 -0
- package/build/hooks/openfort/use7702Authorization.js +73 -0
- package/build/hooks/openfort/use7702Authorization.js.map +1 -0
- package/build/hooks/openfort/useGrantPermissions.d.ts +7 -76
- package/build/hooks/openfort/useGrantPermissions.js +221 -0
- package/build/hooks/openfort/useGrantPermissions.js.map +1 -0
- package/build/hooks/openfort/useProviders.js +75 -0
- package/build/hooks/openfort/useProviders.js.map +1 -0
- package/build/hooks/openfort/useRevokePermissions.d.ts +2 -1
- package/build/hooks/openfort/useRevokePermissions.js +126 -0
- package/build/hooks/openfort/useRevokePermissions.js.map +1 -0
- package/build/hooks/openfort/useUI.d.ts +4 -45
- package/build/hooks/openfort/useUI.js +122 -0
- package/build/hooks/openfort/useUI.js.map +1 -0
- package/build/hooks/openfort/useUser.d.ts +12 -35
- package/build/hooks/openfort/useUser.js +61 -0
- package/build/hooks/openfort/useUser.js.map +1 -0
- package/build/hooks/openfort/walletTypes.d.ts +32 -0
- package/build/hooks/openfort/walletTypes.js +53 -0
- package/build/hooks/openfort/walletTypes.js.map +1 -0
- package/build/hooks/useBalance.d.ts +50 -0
- package/build/hooks/useBalance.js +80 -0
- package/build/hooks/useBalance.js.map +1 -0
- package/build/hooks/useConnectLifecycle.d.ts +7 -0
- package/build/hooks/useConnectLifecycle.js +43 -0
- package/build/hooks/useConnectLifecycle.js.map +1 -0
- package/build/hooks/useConnectors.d.ts +3 -5
- package/build/hooks/useConnectors.js +26 -0
- package/build/hooks/useConnectors.js.map +1 -0
- package/build/hooks/useCopyToClipboard.js +29 -0
- package/build/hooks/useCopyToClipboard.js.map +1 -0
- package/build/hooks/useFitText.js +125 -0
- package/build/hooks/useFitText.js.map +1 -0
- package/build/hooks/useFocusTrap.d.ts +4 -1
- package/build/hooks/useFocusTrap.js +60 -0
- package/build/hooks/useFocusTrap.js.map +1 -0
- package/build/hooks/useGoogleFont.js +43 -0
- package/build/hooks/useGoogleFont.js.map +1 -0
- package/build/hooks/useIsMobile.js +17 -0
- package/build/hooks/useIsMobile.js.map +1 -0
- package/build/hooks/useIsMounted.js +10 -0
- package/build/hooks/useIsMounted.js.map +1 -0
- package/build/hooks/useLastConnector.js +39 -0
- package/build/hooks/useLastConnector.js.map +1 -0
- package/build/hooks/useLocales.d.ts +1 -1
- package/build/hooks/useLocales.js +68 -0
- package/build/hooks/useLocales.js.map +1 -0
- package/build/hooks/useLockBodyScroll.js +53 -0
- package/build/hooks/useLockBodyScroll.js.map +1 -0
- package/build/hooks/usePrevious.js +14 -0
- package/build/hooks/usePrevious.js.map +1 -0
- package/build/hooks/useResolvedIdentity.d.ts +70 -0
- package/build/hooks/useResolvedIdentity.js +90 -0
- package/build/hooks/useResolvedIdentity.js.map +1 -0
- package/build/hooks/useRouteProps.d.ts +10 -5
- package/build/hooks/useRouteProps.js +27 -0
- package/build/hooks/useRouteProps.js.map +1 -0
- package/build/hooks/useWalletConnectModal.js +59 -0
- package/build/hooks/useWalletConnectModal.js.map +1 -0
- package/build/hooks/useWindowSize.js +23 -0
- package/build/hooks/useWindowSize.js.map +1 -0
- package/build/index.d.ts +61 -16
- package/build/index.js +31 -0
- package/build/index.js.map +1 -0
- package/build/localizations/index.js +57 -0
- package/build/localizations/index.js.map +1 -0
- package/build/localizations/locales/ar-AE.js +100 -0
- package/build/localizations/locales/ar-AE.js.map +1 -0
- package/build/localizations/locales/ca-AD.js +98 -0
- package/build/localizations/locales/ca-AD.js.map +1 -0
- package/build/localizations/locales/ee-EE.js +98 -0
- package/build/localizations/locales/ee-EE.js.map +1 -0
- package/build/localizations/locales/en-US.js +115 -0
- package/build/localizations/locales/en-US.js.map +1 -0
- package/build/localizations/locales/es-ES.js +98 -0
- package/build/localizations/locales/es-ES.js.map +1 -0
- package/build/localizations/locales/fa-IR.js +98 -0
- package/build/localizations/locales/fa-IR.js.map +1 -0
- package/build/localizations/locales/fr-FR.js +98 -0
- package/build/localizations/locales/fr-FR.js.map +1 -0
- package/build/localizations/locales/ja-JP.js +98 -0
- package/build/localizations/locales/ja-JP.js.map +1 -0
- package/build/localizations/locales/pt-BR.js +98 -0
- package/build/localizations/locales/pt-BR.js.map +1 -0
- package/build/localizations/locales/ru-RU.js +98 -0
- package/build/localizations/locales/ru-RU.js.map +1 -0
- package/build/localizations/locales/tr-TR.js +98 -0
- package/build/localizations/locales/tr-TR.js.map +1 -0
- package/build/localizations/locales/vi-VN.js +98 -0
- package/build/localizations/locales/vi-VN.js.map +1 -0
- package/build/localizations/locales/zh-CN.js +98 -0
- package/build/localizations/locales/zh-CN.js.map +1 -0
- package/build/openfort/CoreOpenfortProvider.d.ts +9 -22
- package/build/openfort/CoreOpenfortProvider.js +389 -0
- package/build/openfort/CoreOpenfortProvider.js.map +1 -0
- package/build/{hooks/useConnectCallback.d.ts → openfort/connectCallbackTypes.d.ts} +2 -2
- package/build/openfort/context.d.ts +3 -2
- package/build/openfort/context.js +6 -0
- package/build/openfort/context.js.map +1 -0
- package/build/openfort/core/client.d.ts +2 -1
- package/build/openfort/core/client.js +23 -0
- package/build/openfort/core/client.js.map +1 -0
- package/build/openfort/hooks/useActiveAddressSync.d.ts +20 -0
- package/build/openfort/hooks/useActiveAddressSync.js +76 -0
- package/build/openfort/hooks/useActiveAddressSync.js.map +1 -0
- package/build/openfort/hooks/useAutoRecovery.d.ts +26 -0
- package/build/openfort/hooks/useAutoRecovery.js +102 -0
- package/build/openfort/hooks/useAutoRecovery.js.map +1 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.d.ts +31 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.js +77 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.js.map +1 -0
- package/build/openfort/selectors.d.ts +9 -0
- package/build/openfort/selectors.js +15 -0
- package/build/openfort/selectors.js.map +1 -0
- package/build/openfort/store.d.ts +46 -0
- package/build/openfort/store.js +116 -0
- package/build/openfort/store.js.map +1 -0
- package/build/openfort/useOpenfort.d.ts +9 -3
- package/build/openfort/useOpenfort.js +15 -0
- package/build/openfort/useOpenfort.js.map +1 -0
- package/build/openfort/useOpenfortStore.d.ts +2 -0
- package/build/openfort/useOpenfortStore.js +13 -0
- package/build/openfort/useOpenfortStore.js.map +1 -0
- package/build/query/index.d.ts +2 -0
- package/build/query/queryKeys.d.ts +12 -0
- package/build/query/queryKeys.js +15 -0
- package/build/query/queryKeys.js.map +1 -0
- package/build/query/queryOptions.d.ts +23 -0
- package/build/query/queryOptions.js +31 -0
- package/build/query/queryOptions.js.map +1 -0
- package/build/shared/hooks/useAsyncData.d.ts +19 -0
- package/build/shared/hooks/useAsyncData.js +69 -0
- package/build/shared/hooks/useAsyncData.js.map +1 -0
- package/build/shared/hooks/useRecoveryOTP.d.ts +11 -0
- package/build/shared/hooks/useRecoveryOTP.js +64 -0
- package/build/shared/hooks/useRecoveryOTP.js.map +1 -0
- package/build/shared/types.d.ts +65 -0
- package/build/shared/utils/embeddedWalletStatusMapper.d.ts +15 -0
- package/build/shared/utils/embeddedWalletStatusMapper.js +22 -0
- package/build/shared/utils/embeddedWalletStatusMapper.js.map +1 -0
- package/build/shared/utils/explorer.d.ts +24 -0
- package/build/shared/utils/explorer.js +71 -0
- package/build/shared/utils/explorer.js.map +1 -0
- package/build/shared/utils/otpError.d.ts +8 -0
- package/build/shared/utils/otpError.js +17 -0
- package/build/shared/utils/otpError.js.map +1 -0
- package/build/shared/utils/recovery.d.ts +15 -0
- package/build/shared/utils/recovery.js +96 -0
- package/build/shared/utils/recovery.js.map +1 -0
- package/build/shared/utils/validation.d.ts +15 -0
- package/build/shared/utils/validation.js +27 -0
- package/build/shared/utils/validation.js.map +1 -0
- package/build/shared/utils/walletStatusProps.d.ts +18 -0
- package/build/shared/utils/walletStatusProps.js +45 -0
- package/build/shared/utils/walletStatusProps.js.map +1 -0
- package/build/siwe/create-siwe-message.d.ts +15 -1
- package/build/siwe/create-siwe-message.js +32 -0
- package/build/siwe/create-siwe-message.js.map +1 -0
- package/build/solana/SolanaContext.d.ts +43 -0
- package/build/solana/SolanaContext.js +87 -0
- package/build/solana/SolanaContext.js.map +1 -0
- package/build/solana/constants.d.ts +21 -0
- package/build/solana/constants.js +24 -0
- package/build/solana/constants.js.map +1 -0
- package/build/solana/hooks/recoveryResolver.d.ts +16 -0
- package/build/solana/hooks/recoveryResolver.js +39 -0
- package/build/solana/hooks/recoveryResolver.js.map +1 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.d.ts +17 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.js +389 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.js.map +1 -0
- package/build/solana/hooks/utils.d.ts +2 -0
- package/build/solana/hooks/utils.js +18 -0
- package/build/solana/hooks/utils.js.map +1 -0
- package/build/solana/index.d.ts +12 -0
- package/build/solana/index.js +2 -0
- package/build/solana/index.js.map +1 -0
- package/build/solana/operations.d.ts +22 -0
- package/build/solana/operations.js +40 -0
- package/build/solana/operations.js.map +1 -0
- package/build/solana/provider.d.ts +131 -0
- package/build/solana/provider.js +126 -0
- package/build/solana/provider.js.map +1 -0
- package/build/solana/types.d.ts +253 -0
- package/build/solana/utils/transfer.d.ts +9 -0
- package/build/solana/utils/transfer.js +20 -0
- package/build/solana/utils/transfer.js.map +1 -0
- package/build/styles/index.js +334 -0
- package/build/styles/index.js.map +1 -0
- package/build/styles/styled/index.js +14 -0
- package/build/styles/styled/index.js.map +1 -0
- package/build/styles/themes/base.js +147 -0
- package/build/styles/themes/base.js.map +1 -0
- package/build/styles/themes/index.js +13 -0
- package/build/styles/themes/index.js.map +1 -0
- package/build/styles/themes/midnight.js +78 -0
- package/build/styles/themes/midnight.js.map +1 -0
- package/build/styles/themes/minimal.js +100 -0
- package/build/styles/themes/minimal.js.map +1 -0
- package/build/styles/themes/nouns.js +83 -0
- package/build/styles/themes/nouns.js.map +1 -0
- package/build/styles/themes/retro.js +110 -0
- package/build/styles/themes/retro.js.map +1 -0
- package/build/styles/themes/rounded.js +110 -0
- package/build/styles/themes/rounded.js.map +1 -0
- package/build/styles/themes/soft.js +73 -0
- package/build/styles/themes/soft.js.map +1 -0
- package/build/styles/themes/web95.js +136 -0
- package/build/styles/themes/web95.js.map +1 -0
- package/build/types.d.ts +5 -6
- package/build/types.js +33 -0
- package/build/types.js.map +1 -0
- package/build/utils/banner.d.ts +1 -0
- package/build/utils/banner.js +14 -0
- package/build/utils/banner.js.map +1 -0
- package/build/utils/errorHandling.js +331 -0
- package/build/utils/errorHandling.js.map +1 -0
- package/build/utils/format.d.ts +18 -0
- package/build/utils/format.js +59 -0
- package/build/utils/format.js.map +1 -0
- package/build/utils/index.d.ts +2 -3
- package/build/utils/index.js +67 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/logger.js +13 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/oauthErrorHandler.d.ts +1 -1
- package/build/utils/oauthErrorHandler.js +42 -0
- package/build/utils/oauthErrorHandler.js.map +1 -0
- package/build/utils/p3.js +14 -0
- package/build/utils/p3.js.map +1 -0
- package/build/utils/rpc.d.ts +34 -0
- package/build/utils/rpc.js +93 -0
- package/build/utils/rpc.js.map +1 -0
- package/build/utils/useOnUserReturn.js +25 -0
- package/build/utils/useOnUserReturn.js.map +1 -0
- package/build/utils/validation.js +7 -0
- package/build/utils/validation.js.map +1 -0
- package/build/utils/wallets.d.ts +6 -0
- package/build/utils/wallets.js +14 -0
- package/build/utils/wallets.js.map +1 -0
- package/build/version.d.ts +1 -1
- package/build/version.js +4 -0
- package/build/version.js.map +1 -0
- package/build/wagmi/OpenfortWagmiBridge.d.ts +3 -0
- package/build/wagmi/OpenfortWagmiBridge.js +166 -0
- package/build/wagmi/OpenfortWagmiBridge.js.map +1 -0
- package/build/wagmi/components/ChainSelect/index.js +140 -0
- package/build/wagmi/components/ChainSelect/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectDropdown/index.js +144 -0
- package/build/wagmi/components/ChainSelectDropdown/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectDropdown/styles.js +47 -0
- package/build/wagmi/components/ChainSelectDropdown/styles.js.map +1 -0
- package/build/wagmi/components/ChainSelectList/index.js +109 -0
- package/build/wagmi/components/ChainSelectList/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectList/styles.js +225 -0
- package/build/wagmi/components/ChainSelectList/styles.js.map +1 -0
- package/build/wagmi/components/SwitchNetworks/index.js +22 -0
- package/build/wagmi/components/SwitchNetworks/index.js.map +1 -0
- package/build/wagmi/connectorFilter.d.ts +6 -0
- package/build/wagmi/connectorFilter.js +16 -0
- package/build/wagmi/connectorFilter.js.map +1 -0
- package/build/{defaultConfig.d.ts → wagmi/defaultConfig.d.ts} +1 -2
- package/build/wagmi/defaultConfig.js +27 -0
- package/build/wagmi/defaultConfig.js.map +1 -0
- package/build/wagmi/defaultConnectors.js +36 -0
- package/build/wagmi/defaultConnectors.js.map +1 -0
- package/build/wagmi/embeddedConnector.d.ts +4 -0
- package/build/wagmi/embeddedConnector.js +80 -0
- package/build/wagmi/embeddedConnector.js.map +1 -0
- package/build/wagmi/index.d.ts +10 -0
- package/build/wagmi/index.js +10 -0
- package/build/wagmi/index.js.map +1 -0
- package/build/wagmi/useChainIsSupported.d.ts +20 -0
- package/build/wagmi/useChainIsSupported.js +30 -0
- package/build/wagmi/useChainIsSupported.js.map +1 -0
- package/build/wagmi/useChains.d.ts +29 -0
- package/build/wagmi/useChains.js +38 -0
- package/build/wagmi/useChains.js.map +1 -0
- package/build/wagmi/useConnectWithSiwe.d.ts +22 -0
- package/build/wagmi/useConnectWithSiwe.js +115 -0
- package/build/wagmi/useConnectWithSiwe.js.map +1 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.d.ts +2 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.js +55 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.js.map +1 -0
- package/build/wagmi/useWalletAuth.d.ts +24 -0
- package/build/wagmi/useWalletAuth.js +180 -0
- package/build/wagmi/useWalletAuth.js.map +1 -0
- package/build/wallets/useExternalConnectors.d.ts +17 -0
- package/build/wallets/useExternalConnectors.js +98 -0
- package/build/wallets/useExternalConnectors.js.map +1 -0
- package/build/wallets/walletConfigs.js +344 -0
- package/build/wallets/walletConfigs.js.map +1 -0
- package/package.json +62 -11
- package/build/components/PageLayout/index.d.ts +0 -6
- package/build/components/contexts/web3/index.d.ts +0 -13
- package/build/constants/erc20.d.ts +0 -42
- package/build/hooks/openfort/auth/useWalletAuth.d.ts +0 -20
- package/build/hooks/openfort/useConnectWithSiwe.d.ts +0 -8
- package/build/hooks/openfort/useWalletAssets.d.ts +0 -16
- package/build/hooks/openfort/useWallets.d.ts +0 -134
- package/build/hooks/useChainIsSupported.d.ts +0 -24
- package/build/hooks/useChains.d.ts +0 -41
- package/build/hooks/useConnect.d.ts +0 -24
- package/build/hooks/useEnsFallbackConfig.d.ts +0 -1
- package/build/index.es.js +0 -19627
- package/build/index.es.js.map +0 -1
- package/build/openfortCustomTypes.d.ts +0 -10
- package/build/wallets/index.d.ts +0 -7
- package/build/wallets/useWagmiWallets.d.ts +0 -9
- /package/build/components/Pages/{SoicalProviders → SocialProviders}/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelect/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectDropdown/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectDropdown/styles.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectList/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectList/styles.d.ts +0 -0
- /package/build/{components/Pages → wagmi/components}/SwitchNetworks/index.d.ts +0 -0
- /package/build/{defaultConnectors.d.ts → wagmi/defaultConnectors.d.ts} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo, useEffect } from 'react';
|
|
3
|
+
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
4
|
+
import { routes } from '../../Openfort/types.js';
|
|
5
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
6
|
+
import { getProviderQuotes, getProviders } from '../Buy/providers.js';
|
|
7
|
+
import { createCurrencyFormatter } from '../Buy/utils.js';
|
|
8
|
+
import { sanitizeForParsing, sanitizeAmountInput, getAssetSymbol } from '../Send/utils.js';
|
|
9
|
+
import { ProviderSelectContent, EmptyState, ProviderList, ProviderButton, ProviderInfo, ProviderNameRow, ProviderName, ProviderBadge, ProviderMeta, ProviderRight, ProviderQuote, ProviderFiat } from './styles.js';
|
|
10
|
+
|
|
11
|
+
const BuyProviderSelect = () => {
|
|
12
|
+
const { buyForm, setBuyForm, setRoute, triggerResize } = useOpenfort();
|
|
13
|
+
const providers = getProviders();
|
|
14
|
+
const normalizedAmount = sanitizeForParsing(sanitizeAmountInput(buyForm.amount));
|
|
15
|
+
const fiatAmount = useMemo(() => {
|
|
16
|
+
if (!normalizedAmount)
|
|
17
|
+
return null;
|
|
18
|
+
const numeric = Number(normalizedAmount);
|
|
19
|
+
if (!Number.isFinite(numeric))
|
|
20
|
+
return null;
|
|
21
|
+
return numeric;
|
|
22
|
+
}, [normalizedAmount]);
|
|
23
|
+
const quotes = useMemo(() => getProviderQuotes(fiatAmount), [fiatAmount]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
triggerResize();
|
|
26
|
+
}, [quotes.length]);
|
|
27
|
+
const currencyFormatter = useMemo(() => createCurrencyFormatter(buyForm.currency), [buyForm.currency]);
|
|
28
|
+
const tokenSymbol = getAssetSymbol(buyForm.asset);
|
|
29
|
+
const handleSelect = (id) => {
|
|
30
|
+
setBuyForm((prev) => ({
|
|
31
|
+
...prev,
|
|
32
|
+
providerId: id,
|
|
33
|
+
}));
|
|
34
|
+
setRoute(routes.BUY);
|
|
35
|
+
};
|
|
36
|
+
const renderProviders = () => {
|
|
37
|
+
if (!providers.length) {
|
|
38
|
+
return jsx(EmptyState, { children: "No providers available right now." });
|
|
39
|
+
}
|
|
40
|
+
return (jsx(ProviderList, { children: providers.map((provider) => {
|
|
41
|
+
const quote = quotes.find((item) => item.provider.id === provider.id);
|
|
42
|
+
const netDisplay = quote && quote.netAmount !== null ? `${quote.netAmount.toFixed(2)} ${tokenSymbol}` : '--';
|
|
43
|
+
const fiatDisplay = fiatAmount !== null ? currencyFormatter.format(fiatAmount) : '--';
|
|
44
|
+
const feePercentage = (provider.feeBps / 100).toFixed(2);
|
|
45
|
+
const highlight = provider.highlight === 'best' ? 'Best price' : provider.highlight === 'fast' ? 'Fastest' : null;
|
|
46
|
+
const metaText = `Fee ${feePercentage}%`;
|
|
47
|
+
const isActive = buyForm.providerId === provider.id;
|
|
48
|
+
return (jsxs(ProviderButton, { type: "button", onClick: () => handleSelect(provider.id), "$active": isActive, children: [jsxs(ProviderInfo, { children: [jsxs(ProviderNameRow, { children: [jsx(ProviderName, { children: provider.name }), highlight ? jsx(ProviderBadge, { children: highlight }) : null] }), jsx(ProviderMeta, { children: metaText })] }), jsxs(ProviderRight, { children: [jsx(ProviderQuote, { children: netDisplay }), jsx(ProviderFiat, { children: fiatDisplay })] })] }, provider.id));
|
|
49
|
+
}) }));
|
|
50
|
+
};
|
|
51
|
+
return (jsxs(ProviderSelectContent, { children: [jsx(ModalHeading, { children: "Choose provider" }), jsx(ModalBody, { children: "Compare quotes and pick the provider that works best for you." }), renderProviders()] }));
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { BuyProviderSelect as default };
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import styled from '../../../styles/styled/index.js';
|
|
2
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
3
|
+
|
|
4
|
+
const ProviderSelectContent = styled(PageContent) `
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: 16px;
|
|
8
|
+
text-align: left;
|
|
9
|
+
padding-bottom: 16px;
|
|
10
|
+
`;
|
|
11
|
+
const ProviderList = styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 12px;
|
|
15
|
+
margin-top: 12px;
|
|
16
|
+
`;
|
|
17
|
+
const ProviderButton = styled.button `
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
width: 100%;
|
|
22
|
+
padding: 14px 16px;
|
|
23
|
+
border-radius: var(--ck-secondary-button-border-radius);
|
|
24
|
+
border: 1px solid ${({ $active }) => ($active ? 'var(--ck-accent-color)' : 'var(--ck-body-divider)')};
|
|
25
|
+
background: ${({ $active }) => $active ? 'var(--ck-secondary-button-hover-background)' : 'var(--ck-secondary-button-background)'};
|
|
26
|
+
color: var(--ck-body-color);
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
|
|
29
|
+
text-align: left;
|
|
30
|
+
|
|
31
|
+
&:hover {
|
|
32
|
+
background: var(--ck-secondary-button-hover-background);
|
|
33
|
+
border-color: ${({ $active }) => ($active ? 'var(--ck-accent-color)' : 'var(--ck-body-color-muted)')};
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const ProviderInfo = styled.div `
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-direction: column;
|
|
39
|
+
gap: 4px;
|
|
40
|
+
overflow: hidden;
|
|
41
|
+
`;
|
|
42
|
+
const ProviderNameRow = styled.div `
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
gap: 8px;
|
|
46
|
+
`;
|
|
47
|
+
const ProviderName = styled.span `
|
|
48
|
+
font-size: 15px;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
color: var(--ck-body-color);
|
|
51
|
+
`;
|
|
52
|
+
const ProviderBadge = styled.span `
|
|
53
|
+
font-size: 11px;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
text-transform: uppercase;
|
|
56
|
+
letter-spacing: 0.03em;
|
|
57
|
+
padding: 4px 8px;
|
|
58
|
+
border-radius: 999px;
|
|
59
|
+
background: var(--ck-secondary-button-hover-background);
|
|
60
|
+
color: var(--ck-body-color-muted);
|
|
61
|
+
`;
|
|
62
|
+
const ProviderMeta = styled.span `
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 6px;
|
|
66
|
+
font-size: 13px;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
color: var(--ck-body-color-muted);
|
|
69
|
+
white-space: nowrap;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
text-overflow: ellipsis;
|
|
72
|
+
`;
|
|
73
|
+
const ProviderRight = styled.div `
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
align-items: flex-end;
|
|
77
|
+
gap: 4px;
|
|
78
|
+
white-space: nowrap;
|
|
79
|
+
`;
|
|
80
|
+
const ProviderQuote = styled.span `
|
|
81
|
+
font-size: 15px;
|
|
82
|
+
font-weight: 600;
|
|
83
|
+
color: var(--ck-body-color);
|
|
84
|
+
`;
|
|
85
|
+
const ProviderFiat = styled.span `
|
|
86
|
+
font-size: 13px;
|
|
87
|
+
font-weight: 500;
|
|
88
|
+
color: var(--ck-body-color-muted);
|
|
89
|
+
`;
|
|
90
|
+
const EmptyState = styled.div `
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
padding: 24px;
|
|
95
|
+
border-radius: var(--ck-secondary-button-border-radius);
|
|
96
|
+
border: 1px solid var(--ck-body-divider);
|
|
97
|
+
background: var(--ck-secondary-button-background);
|
|
98
|
+
color: var(--ck-body-color-muted);
|
|
99
|
+
font-size: 14px;
|
|
100
|
+
`;
|
|
101
|
+
|
|
102
|
+
export { EmptyState, ProviderBadge, ProviderButton, ProviderFiat, ProviderInfo, ProviderList, ProviderMeta, ProviderName, ProviderNameRow, ProviderQuote, ProviderRight, ProviderSelectContent };
|
|
103
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
4
|
+
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
5
|
+
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
6
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
7
|
+
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
8
|
+
import Button from '../../Common/Button/index.js';
|
|
9
|
+
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
10
|
+
import { routes } from '../../Openfort/types.js';
|
|
11
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
12
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
13
|
+
import { isCoinbaseSupported } from '../Buy/coinbaseApi.js';
|
|
14
|
+
import { getAllQuotes } from '../Buy/onrampApi.js';
|
|
15
|
+
import { getProviders } from '../Buy/providers.js';
|
|
16
|
+
import { isStripeSupported } from '../Buy/stripeApi.js';
|
|
17
|
+
import { ProviderList, ProviderButton, ProviderInfo, ProviderNameRow, ProviderName, ProviderBadge, ProviderMeta, ProviderRight, ProviderQuote, ProviderFiat, ContinueButtonWrapper } from '../Buy/styles.js';
|
|
18
|
+
import { createCurrencyFormatter, formatTokenAmount } from '../Buy/utils.js';
|
|
19
|
+
import { isSameToken, getAssetSymbol } from '../Send/utils.js';
|
|
20
|
+
|
|
21
|
+
const BuySelectProvider = () => {
|
|
22
|
+
const { buyForm, setBuyForm, setRoute, triggerResize, publishableKey } = useOpenfort();
|
|
23
|
+
const { chainType } = useOpenfortCore();
|
|
24
|
+
// Use chain-specific hooks
|
|
25
|
+
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
26
|
+
const solanaWallet = useSolanaEmbeddedWallet();
|
|
27
|
+
const wallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
28
|
+
const isConnected = wallet.status === 'connected';
|
|
29
|
+
const address = isConnected ? wallet.address : undefined;
|
|
30
|
+
const chainId = isConnected && chainType === ChainTypeEnum.EVM ? wallet.chainId : undefined;
|
|
31
|
+
const [quotes, setQuotes] = useState({});
|
|
32
|
+
const [isLoadingQuote, setIsLoadingQuote] = useState(false);
|
|
33
|
+
const [coinbaseError, setCoinbaseError] = useState(false);
|
|
34
|
+
const [stripeError, setStripeError] = useState(false);
|
|
35
|
+
const [quoteRefreshTimer, setQuoteRefreshTimer] = useState(60);
|
|
36
|
+
const [refetchTrigger, setRefetchTrigger] = useState(0);
|
|
37
|
+
const fiatAmount = useMemo(() => {
|
|
38
|
+
const normalized = buyForm.amount;
|
|
39
|
+
if (!normalized)
|
|
40
|
+
return null;
|
|
41
|
+
const numeric = Number(normalized);
|
|
42
|
+
if (!Number.isFinite(numeric))
|
|
43
|
+
return null;
|
|
44
|
+
return numeric;
|
|
45
|
+
}, [buyForm.amount]);
|
|
46
|
+
const { data: assets } = useEthereumWalletAssets();
|
|
47
|
+
const matchedToken = useMemo(() => assets === null || assets === void 0 ? void 0 : assets.find((asset) => isSameToken(asset, buyForm.asset)), [assets, buyForm.asset]);
|
|
48
|
+
const selectedTokenOption = matchedToken !== null && matchedToken !== void 0 ? matchedToken : assets === null || assets === void 0 ? void 0 : assets[0];
|
|
49
|
+
const selectedToken = selectedTokenOption !== null && selectedTokenOption !== void 0 ? selectedTokenOption : buyForm.asset;
|
|
50
|
+
const tokenSymbol = getAssetSymbol(selectedToken);
|
|
51
|
+
const currencyFormatter = useMemo(() => createCurrencyFormatter(buyForm.currency), [buyForm.currency]);
|
|
52
|
+
// Trigger resize on mount
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
triggerResize();
|
|
55
|
+
}, [triggerResize]);
|
|
56
|
+
// Quote refresh timer - counts down from 60 and triggers refetch
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!fiatAmount || fiatAmount <= 0)
|
|
59
|
+
return;
|
|
60
|
+
const interval = setInterval(() => {
|
|
61
|
+
setQuoteRefreshTimer((prev) => {
|
|
62
|
+
if (prev <= 1) {
|
|
63
|
+
setRefetchTrigger((t) => t + 1);
|
|
64
|
+
return 60;
|
|
65
|
+
}
|
|
66
|
+
return prev - 1;
|
|
67
|
+
});
|
|
68
|
+
}, 1000);
|
|
69
|
+
return () => clearInterval(interval);
|
|
70
|
+
}, [fiatAmount]);
|
|
71
|
+
// Reset timer when amount changes
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (fiatAmount && fiatAmount > 0) {
|
|
74
|
+
setQuoteRefreshTimer(60);
|
|
75
|
+
}
|
|
76
|
+
}, [fiatAmount]);
|
|
77
|
+
// Fetch quotes from all providers
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
const fetchQuotes = async () => {
|
|
80
|
+
if (!address || !chainId || !fiatAmount || fiatAmount <= 0) {
|
|
81
|
+
setQuotes({});
|
|
82
|
+
setCoinbaseError(false);
|
|
83
|
+
setStripeError(false);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
setIsLoadingQuote(true);
|
|
87
|
+
setCoinbaseError(false);
|
|
88
|
+
setStripeError(false);
|
|
89
|
+
try {
|
|
90
|
+
const allQuotes = await getAllQuotes({
|
|
91
|
+
token: selectedToken,
|
|
92
|
+
chainId,
|
|
93
|
+
publishableKey,
|
|
94
|
+
sourceAmount: fiatAmount.toFixed(2),
|
|
95
|
+
sourceCurrency: buyForm.currency,
|
|
96
|
+
});
|
|
97
|
+
const quotesMap = {};
|
|
98
|
+
for (const quote of allQuotes) {
|
|
99
|
+
quotesMap[quote.provider] = quote;
|
|
100
|
+
}
|
|
101
|
+
setQuotes(quotesMap);
|
|
102
|
+
// Update error states based on which providers returned quotes
|
|
103
|
+
setCoinbaseError(!quotesMap.coinbase && isCoinbaseSupported(selectedToken));
|
|
104
|
+
setStripeError(!quotesMap.stripe && isStripeSupported(selectedToken));
|
|
105
|
+
}
|
|
106
|
+
catch (_error) {
|
|
107
|
+
setQuotes({});
|
|
108
|
+
setCoinbaseError(true);
|
|
109
|
+
setStripeError(true);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
setIsLoadingQuote(false);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
// Debounce the quote fetching
|
|
116
|
+
const timeoutId = setTimeout(fetchQuotes, 500);
|
|
117
|
+
return () => clearTimeout(timeoutId);
|
|
118
|
+
}, [
|
|
119
|
+
fiatAmount,
|
|
120
|
+
selectedToken.metadata,
|
|
121
|
+
selectedToken.type,
|
|
122
|
+
buyForm.currency,
|
|
123
|
+
chainId,
|
|
124
|
+
address,
|
|
125
|
+
publishableKey,
|
|
126
|
+
refetchTrigger,
|
|
127
|
+
]);
|
|
128
|
+
const handleSelectProvider = (id) => {
|
|
129
|
+
setBuyForm((prev) => ({
|
|
130
|
+
...prev,
|
|
131
|
+
providerId: id,
|
|
132
|
+
}));
|
|
133
|
+
};
|
|
134
|
+
const handleContinue = () => {
|
|
135
|
+
// Just navigate to the processing screen
|
|
136
|
+
// The processing screen will handle session creation and popup
|
|
137
|
+
setRoute(routes.BUY_PROCESSING);
|
|
138
|
+
};
|
|
139
|
+
const handleBack = () => {
|
|
140
|
+
setRoute(routes.BUY);
|
|
141
|
+
};
|
|
142
|
+
const formattedFiat = fiatAmount !== null ? currencyFormatter.format(fiatAmount) : null;
|
|
143
|
+
const step2Disabled = !address || isLoadingQuote;
|
|
144
|
+
const providers = getProviders();
|
|
145
|
+
// Find the highest destination amount across all quotes to use as the target
|
|
146
|
+
const targetDestinationAmount = useMemo(() => {
|
|
147
|
+
const amounts = Object.values(quotes)
|
|
148
|
+
.map((q) => Number.parseFloat(q.destinationAmount))
|
|
149
|
+
.filter((n) => Number.isFinite(n));
|
|
150
|
+
return amounts.length > 0 ? Math.max(...amounts) : null;
|
|
151
|
+
}, [quotes]);
|
|
152
|
+
return (jsxs(PageContent, { onBack: handleBack, children: [jsx(ModalHeading, { children: "Select Provider" }), jsx(ModalBody, { children: formattedFiat && `Buying ${formattedFiat} of ${tokenSymbol}` }), jsx(ModalBody, { style: { marginTop: 4, fontSize: '12px', opacity: 0.7 }, children: isLoadingQuote ? 'Loading quotes...' : `Quotes refresh in ${quoteRefreshTimer}s` }), jsx(ProviderList, { children: providers.map((provider) => {
|
|
153
|
+
var _a, _b, _c, _d, _e, _f;
|
|
154
|
+
// Get provider-specific quote data
|
|
155
|
+
const providerQuote = quotes[provider.id];
|
|
156
|
+
let providerNetAmount = null;
|
|
157
|
+
let providerFeePercentage = null;
|
|
158
|
+
let providerFiatAmount = fiatAmount;
|
|
159
|
+
let isDisabled = false;
|
|
160
|
+
let disabledReason = '';
|
|
161
|
+
let isEstimated = false;
|
|
162
|
+
if (provider.id === 'coinbase') {
|
|
163
|
+
// Check if token is supported
|
|
164
|
+
if (!isCoinbaseSupported(selectedToken)) {
|
|
165
|
+
isDisabled = true;
|
|
166
|
+
disabledReason = 'Token not supported';
|
|
167
|
+
}
|
|
168
|
+
else if (coinbaseError) {
|
|
169
|
+
isDisabled = true;
|
|
170
|
+
disabledReason = 'Provider not supported';
|
|
171
|
+
}
|
|
172
|
+
else if (providerQuote) {
|
|
173
|
+
const originalDestinationAmount = Number.parseFloat(providerQuote.destinationAmount);
|
|
174
|
+
// Normalize to target destination amount
|
|
175
|
+
if (targetDestinationAmount !== null &&
|
|
176
|
+
Math.abs(originalDestinationAmount - targetDestinationAmount) > 0.000001) {
|
|
177
|
+
// Amounts differ, need to estimate
|
|
178
|
+
isEstimated = true;
|
|
179
|
+
providerNetAmount = targetDestinationAmount;
|
|
180
|
+
// Estimate the cost: base amount + scaled fees
|
|
181
|
+
// Formula: baseAmount + (fees × (targetAmount / originalAmount))
|
|
182
|
+
const totalFees = (_b = (_a = providerQuote.fees) === null || _a === void 0 ? void 0 : _a.reduce((sum, fee) => sum + Number.parseFloat(fee.amount), 0)) !== null && _b !== void 0 ? _b : 0;
|
|
183
|
+
const baseAmount = fiatAmount !== null && fiatAmount !== void 0 ? fiatAmount : 0;
|
|
184
|
+
const ratio = targetDestinationAmount / originalDestinationAmount;
|
|
185
|
+
const estimatedFees = totalFees * ratio;
|
|
186
|
+
providerFiatAmount = baseAmount + estimatedFees;
|
|
187
|
+
// Recalculate fee percentage based on estimated fees
|
|
188
|
+
providerFeePercentage = baseAmount > 0 ? ((estimatedFees / baseAmount) * 100).toFixed(2) : null;
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
// Amounts match, use actual quote
|
|
192
|
+
providerNetAmount = originalDestinationAmount;
|
|
193
|
+
const totalFees = (_d = (_c = providerQuote.fees) === null || _c === void 0 ? void 0 : _c.reduce((sum, fee) => sum + Number.parseFloat(fee.amount), 0)) !== null && _d !== void 0 ? _d : 0;
|
|
194
|
+
providerFeePercentage = fiatAmount ? ((totalFees / fiatAmount) * 100).toFixed(2) : null;
|
|
195
|
+
const sourceAmount = Number.parseFloat(providerQuote.sourceAmount);
|
|
196
|
+
providerFiatAmount = sourceAmount + totalFees;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
else if (provider.id === 'stripe') {
|
|
201
|
+
// Check if token is supported
|
|
202
|
+
if (!isStripeSupported(selectedToken)) {
|
|
203
|
+
isDisabled = true;
|
|
204
|
+
disabledReason = 'Token not supported';
|
|
205
|
+
}
|
|
206
|
+
else if (stripeError) {
|
|
207
|
+
isDisabled = true;
|
|
208
|
+
disabledReason = 'Provider not supported';
|
|
209
|
+
}
|
|
210
|
+
else if (providerQuote) {
|
|
211
|
+
// Stripe quote is always used as-is (it typically has the best rate)
|
|
212
|
+
providerNetAmount = Number.parseFloat(providerQuote.destinationAmount);
|
|
213
|
+
// Use sourceAmount to show the actual total the user will pay
|
|
214
|
+
providerFiatAmount = Number.parseFloat(providerQuote.sourceAmount);
|
|
215
|
+
// Calculate total fees
|
|
216
|
+
const totalFees = (_f = (_e = providerQuote.fees) === null || _e === void 0 ? void 0 : _e.reduce((sum, fee) => sum + Number.parseFloat(fee.amount), 0)) !== null && _f !== void 0 ? _f : 0;
|
|
217
|
+
providerFeePercentage = fiatAmount ? ((totalFees / fiatAmount) * 100).toFixed(2) : null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// Use real quote data if available, otherwise show loading or fallback
|
|
221
|
+
const netDisplay = isDisabled
|
|
222
|
+
? disabledReason
|
|
223
|
+
: isLoadingQuote || !providerQuote
|
|
224
|
+
? '...'
|
|
225
|
+
: providerNetAmount !== null
|
|
226
|
+
? formatTokenAmount(providerNetAmount, tokenSymbol)
|
|
227
|
+
: '--';
|
|
228
|
+
const fiatDisplay = isDisabled
|
|
229
|
+
? ''
|
|
230
|
+
: isLoadingQuote || !providerQuote
|
|
231
|
+
? '...'
|
|
232
|
+
: providerFiatAmount !== null
|
|
233
|
+
? `${isEstimated ? '~' : ''}${currencyFormatter.format(providerFiatAmount)}`
|
|
234
|
+
: '--';
|
|
235
|
+
// Use real fee percentage if available
|
|
236
|
+
const feePercentage = providerFeePercentage !== null && providerFeePercentage !== void 0 ? providerFeePercentage : (provider.feeBps / 100).toFixed(2);
|
|
237
|
+
const highlight = provider.highlight === 'best' ? 'Best price' : provider.highlight === 'fast' ? 'Fastest' : null;
|
|
238
|
+
const metaText = isDisabled ? '' : `Fee ${isEstimated ? '~' : ''}${feePercentage}%`;
|
|
239
|
+
const isActive = buyForm.providerId === provider.id;
|
|
240
|
+
return (jsxs(ProviderButton, { type: "button", onClick: () => !isDisabled && handleSelectProvider(provider.id), "$active": isActive, disabled: isDisabled, children: [jsxs(ProviderInfo, { children: [jsxs(ProviderNameRow, { children: [jsx(ProviderName, { children: provider.name }), highlight && !isDisabled ? jsx(ProviderBadge, { children: highlight }) : null] }), jsx(ProviderMeta, { children: metaText })] }), jsxs(ProviderRight, { children: [jsx(ProviderQuote, { children: fiatDisplay }), jsx(ProviderFiat, { children: netDisplay })] })] }, provider.id));
|
|
241
|
+
}) }), jsxs(ContinueButtonWrapper, { children: [jsx(Button, { variant: "secondary", onClick: handleBack, children: "Back" }), jsx(Button, { variant: "primary", onClick: handleContinue, disabled: step2Disabled, children: "Continue" })] })] }));
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export { BuySelectProvider as default };
|
|
245
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared layout for Ethereum and Solana connected pages.
|
|
3
|
+
* Renders avatar, address, balance, and action buttons with chain-specific content.
|
|
4
|
+
*/
|
|
5
|
+
import type React from 'react';
|
|
6
|
+
type ConnectedPageLayoutProps = {
|
|
7
|
+
address: string;
|
|
8
|
+
displayName: React.ReactNode;
|
|
9
|
+
avatar: React.ReactNode;
|
|
10
|
+
balance: React.ReactNode | null;
|
|
11
|
+
actions: React.ReactNode;
|
|
12
|
+
beforeAvatar?: React.ReactNode;
|
|
13
|
+
hideBalance?: boolean;
|
|
14
|
+
isBalanceLoading?: boolean;
|
|
15
|
+
/** When true and address is empty, show Loading... instead of noWalletFallback */
|
|
16
|
+
isAddressLoading?: boolean;
|
|
17
|
+
noWalletFallback: React.ReactNode;
|
|
18
|
+
/** Optional content after actions (e.g. AnimatePresence for testnet message) */
|
|
19
|
+
afterActions?: React.ReactNode;
|
|
20
|
+
};
|
|
21
|
+
export declare const ConnectedPageLayout: React.FC<ConnectedPageLayoutProps>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ModalContent, ModalH1, ModalBody } from '../../Common/Modal/styles.js';
|
|
3
|
+
import PoweredByFooter from '../../Common/PoweredByFooter/index.js';
|
|
4
|
+
import { AvatarContainer, AvatarInner, BalanceContainer, LoadingBalance, ActionButtonsContainer } from './styles.js';
|
|
5
|
+
|
|
6
|
+
const ConnectedPageLayout = ({ address, displayName, avatar, balance, actions, beforeAvatar, hideBalance, isBalanceLoading, isAddressLoading, noWalletFallback, afterActions, }) => {
|
|
7
|
+
return (jsxs(ModalContent, { style: { paddingBottom: 6, gap: 6 }, children: [address ? (jsxs(Fragment, { children: [jsx(AvatarContainer, { children: jsxs(AvatarInner, { children: [beforeAvatar, avatar] }) }), jsx(ModalH1, { children: displayName }), hideBalance ? null : (jsxs(ModalBody, { children: [jsx(BalanceContainer, { children: isBalanceLoading ? (jsx(LoadingBalance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: "\u00A0" })) : (balance) }), jsx(ActionButtonsContainer, { children: actions }), afterActions] }))] })) : isAddressLoading ? (jsx(LoadingBalance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: "Loading..." })) : (noWalletFallback), jsx(PoweredByFooter, {})] }));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { ConnectedPageLayout };
|
|
11
|
+
//# sourceMappingURL=ConnectedPageLayout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectedPageLayout.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
+
import { AnimatePresence, motion } from 'framer-motion';
|
|
4
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import { formatUnits } from 'viem';
|
|
6
|
+
import { UserRoundIcon, SendIcon, ReceiveIcon, BuyIcon } from '../../../assets/icons.js';
|
|
7
|
+
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
8
|
+
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
9
|
+
import useLocales from '../../../hooks/useLocales.js';
|
|
10
|
+
import { useResolvedIdentity } from '../../../hooks/useResolvedIdentity.js';
|
|
11
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
12
|
+
import { nFormatter } from '../../../utils/index.js';
|
|
13
|
+
import { logger } from '../../../utils/logger.js';
|
|
14
|
+
import ChainSelector from '../../../wagmi/components/ChainSelect/index.js';
|
|
15
|
+
import Avatar from '../../Common/Avatar/index.js';
|
|
16
|
+
import Button from '../../Common/Button/index.js';
|
|
17
|
+
import { TextLinkButton } from '../../Common/Button/styles.js';
|
|
18
|
+
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
19
|
+
import { ModalBody } from '../../Common/Modal/styles.js';
|
|
20
|
+
import { useThemeContext } from '../../ConnectKitThemeProvider/ConnectKitThemeProvider.js';
|
|
21
|
+
import { routes, defaultSendFormState } from '../../Openfort/types.js';
|
|
22
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
23
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
24
|
+
import { getAssetDecimals } from '../Send/utils.js';
|
|
25
|
+
import { ConnectedPageLayout } from './ConnectedPageLayout.js';
|
|
26
|
+
import { LinkedProvidersToggle, Balance, Unsupported, ChainSelectorContainer, ActionButton } from './styles.js';
|
|
27
|
+
import { truncateEthAddress } from '../../../utils/format.js';
|
|
28
|
+
|
|
29
|
+
function getFirstBalanceAsset(assets) {
|
|
30
|
+
return assets === null || assets === void 0 ? void 0 : assets.find((a) => a.balance && a.balance > BigInt(0));
|
|
31
|
+
}
|
|
32
|
+
const EthereumConnected = () => {
|
|
33
|
+
var _a, _b, _c, _d;
|
|
34
|
+
const context = useOpenfort();
|
|
35
|
+
const { setHeaderLeftSlot, setRoute, chains } = context;
|
|
36
|
+
const themeContext = useThemeContext();
|
|
37
|
+
const wallet = useEthereumEmbeddedWallet();
|
|
38
|
+
const { embeddedAccounts } = useOpenfortCore();
|
|
39
|
+
const hasEthereumWallets = ((_a = embeddedAccounts === null || embeddedAccounts === void 0 ? void 0 : embeddedAccounts.filter((a) => a.chainType === ChainTypeEnum.EVM)) !== null && _a !== void 0 ? _a : []).length > 0;
|
|
40
|
+
const isConnected = wallet.status === 'connected';
|
|
41
|
+
const address = isConnected ? wallet.address : undefined;
|
|
42
|
+
const chainId = isConnected ? wallet.chainId : undefined;
|
|
43
|
+
const { chainType } = useOpenfortCore();
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (process.env.NODE_ENV === 'development' && chainType !== ChainTypeEnum.EVM) {
|
|
46
|
+
logger.warn('[EthereumConnected] This component is for EVM only. Current chainType is not EVM; ensure OpenfortProvider uses chainType={ChainTypeEnum.EVM}.');
|
|
47
|
+
}
|
|
48
|
+
}, [chainType]);
|
|
49
|
+
const chain = chains.find((c) => c.id === chainId);
|
|
50
|
+
const identity = useResolvedIdentity({
|
|
51
|
+
address: address !== null && address !== void 0 ? address : '',
|
|
52
|
+
chainType,
|
|
53
|
+
ensChainId: chainId !== null && chainId !== void 0 ? chainId : 0,
|
|
54
|
+
enabled: isConnected && !!address,
|
|
55
|
+
});
|
|
56
|
+
const ensName = identity.status === 'success' ? identity.name : undefined;
|
|
57
|
+
const { data: assets, isLoading, refetch } = useEthereumWalletAssets();
|
|
58
|
+
const totalBalanceUsd = useMemo(() => {
|
|
59
|
+
if (!assets)
|
|
60
|
+
return 0;
|
|
61
|
+
return assets.reduce((acc, asset) => {
|
|
62
|
+
var _a, _b, _c, _d;
|
|
63
|
+
if (!asset.metadata || !asset.balance)
|
|
64
|
+
return acc;
|
|
65
|
+
const price = (_c = (_b = (_a = asset.metadata) === null || _a === void 0 ? void 0 : _a.fiat) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : 0;
|
|
66
|
+
if (!price)
|
|
67
|
+
return acc;
|
|
68
|
+
const balance = Number(formatUnits((_d = asset.balance) !== null && _d !== void 0 ? _d : BigInt(0), getAssetDecimals(asset)));
|
|
69
|
+
return acc + price * balance;
|
|
70
|
+
}, 0);
|
|
71
|
+
}, [assets]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (isConnected) {
|
|
74
|
+
refetch();
|
|
75
|
+
}
|
|
76
|
+
}, [isConnected, refetch]);
|
|
77
|
+
const isTestnet = (_b = chain === null || chain === void 0 ? void 0 : chain.testnet) !== null && _b !== void 0 ? _b : false;
|
|
78
|
+
const [showTestnetMessage, setShowTestnetMessage] = useState(false);
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
context.triggerResize();
|
|
81
|
+
if (showTestnetMessage) {
|
|
82
|
+
const timer = setTimeout(() => {
|
|
83
|
+
setShowTestnetMessage(false);
|
|
84
|
+
}, 2000);
|
|
85
|
+
return () => clearTimeout(timer);
|
|
86
|
+
}
|
|
87
|
+
}, [showTestnetMessage, context.triggerResize]);
|
|
88
|
+
const handleBuyClick = (e) => {
|
|
89
|
+
if (!chain || isTestnet) {
|
|
90
|
+
e.preventDefault();
|
|
91
|
+
setShowTestnetMessage(true);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
context.setRoute(routes.BUY);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
useEffect(() => {
|
|
98
|
+
if (!address) {
|
|
99
|
+
setHeaderLeftSlot(null);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
setHeaderLeftSlot(jsx(LinkedProvidersToggle, { type: "button", onClick: () => setRoute(routes.PROFILE), "aria-label": "Profile", title: "Profile", children: jsx(UserRoundIcon, {}) }));
|
|
103
|
+
return () => {
|
|
104
|
+
setHeaderLeftSlot(null);
|
|
105
|
+
};
|
|
106
|
+
}, [address, setHeaderLeftSlot, setRoute]);
|
|
107
|
+
const { setSendForm } = context;
|
|
108
|
+
const separator = ['web95', 'rounded', 'minimal'].includes((_d = (_c = themeContext.theme) !== null && _c !== void 0 ? _c : context.uiConfig.theme) !== null && _d !== void 0 ? _d : '')
|
|
109
|
+
? '....'
|
|
110
|
+
: undefined;
|
|
111
|
+
const locales = useLocales();
|
|
112
|
+
const balanceNode = !!assets && !isLoading ? (jsx(TextLinkButton, { type: "button", onClick: () => {
|
|
113
|
+
const firstBalanceAsset = getFirstBalanceAsset(assets);
|
|
114
|
+
if (!firstBalanceAsset) {
|
|
115
|
+
setRoute(routes.NO_ASSETS_AVAILABLE);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
setRoute(routes.ASSET_INVENTORY);
|
|
119
|
+
}, children: jsxs(Balance, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, transition: { duration: 0.2 }, children: ["$", nFormatter(totalBalanceUsd)] }, `chain-${chain === null || chain === void 0 ? void 0 : chain.id}`) })) : null;
|
|
120
|
+
const noWalletFallback = hasEthereumWallets ? (jsx(Button, { onClick: () => context.setRoute(routes.LOAD_WALLETS), children: "Manage wallets" })) : (jsx(Button, { onClick: () => context.setRoute({ route: routes.CONNECTORS, connectType: 'link' }), icon: jsx(Unsupported, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsxs("svg", { width: "130", height: "120", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("title", { children: "Unsupported wallet icon" }), jsx("path", { d: "M2.61317 11.2501H9.46246C10.6009 11.2501 11.3256 10.3506 11.3256 9.3549C11.3256 9.05145 11.255 8.73244 11.0881 8.43303L7.65903 2.14708C7.659 2.14702 7.65897 2.14696 7.65893 2.1469C7.65889 2.14682 7.65884 2.14673 7.65879 2.14664C7.31045 1.50746 6.6741 1.17871 6.04 1.17871C5.41478 1.17871 4.763 1.50043 4.41518 2.14968L0.993416 8.43476C0.828865 8.72426 0.75 9.04297 0.75 9.3549C0.75 10.3506 1.47471 11.2501 2.61317 11.2501Z", fill: "currentColor", stroke: "var(--ck-body-background, #fff)", strokeWidth: "1.5" }), jsx("path", { d: "M6.03258 7.43916C5.77502 7.43916 5.63096 7.29153 5.62223 7.02311L5.55675 4.96973C5.54802 4.69684 5.74446 4.5 6.02821 4.5C6.3076 4.5 6.51277 4.70131 6.50404 4.9742L6.43856 7.01864C6.42546 7.29153 6.2814 7.43916 6.03258 7.43916ZM6.03258 9.11676C5.7401 9.11676 5.5 8.9065 5.5 8.60677C5.5 8.30704 5.7401 8.09678 6.03258 8.09678C6.32506 8.09678 6.56515 8.30256 6.56515 8.60677C6.56515 8.91097 6.32069 9.11676 6.03258 9.11676Z", fill: "white" })] }) }), children: "Connect wallet" }));
|
|
121
|
+
return (jsx(PageContent, { onBack: null, header: locales.profileScreen_heading, children: jsx(ConnectedPageLayout, { address: address !== null && address !== void 0 ? address : '', displayName: jsx(CopyText, { value: address !== null && address !== void 0 ? address : '', children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(address !== null && address !== void 0 ? address : '', separator) }), avatar: address ? jsx(Avatar, { address: address }) : jsx("span", {}), beforeAvatar: jsx(ChainSelectorContainer, { initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration: 0.2 }, children: jsx(ChainSelector, {}) }, chainId !== null && chainId !== void 0 ? chainId : 'loading'), balance: balanceNode, actions: jsxs(Fragment, { children: [jsx(ActionButton, { icon: jsx(SendIcon, {}), onClick: () => {
|
|
122
|
+
const firstBalanceAsset = getFirstBalanceAsset(assets);
|
|
123
|
+
if (!firstBalanceAsset) {
|
|
124
|
+
setRoute(routes.NO_ASSETS_AVAILABLE);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
setSendForm({ ...defaultSendFormState, asset: firstBalanceAsset });
|
|
128
|
+
context.setRoute(routes.SEND);
|
|
129
|
+
}, children: "Send" }), jsx(ActionButton, { icon: jsx(ReceiveIcon, {}), onClick: () => context.setRoute(routes.RECEIVE), children: "Get" }), jsx(ActionButton, { icon: jsx(BuyIcon, {}), onClick: handleBuyClick, style: isTestnet ? { cursor: 'not-allowed', opacity: 0.4, pointerEvents: 'auto' } : undefined, children: "Buy" })] }), hideBalance: context === null || context === void 0 ? void 0 : context.uiConfig.hideBalance, isBalanceLoading: isLoading, noWalletFallback: noWalletFallback, afterActions: jsx(AnimatePresence, { onExitComplete: () => context.triggerResize(), children: showTestnetMessage && (jsx(ModalBody, { as: motion.div, initial: { opacity: 0, y: -10 }, animate: { opacity: 0.7, y: 0 }, exit: { opacity: 0, y: -10 }, transition: { duration: 0.2 }, style: { marginTop: 12, fontSize: 14, textAlign: 'center' }, children: "Buy is only available on mainnet chains" })) }) }) }));
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export { EthereumConnected as default };
|
|
133
|
+
//# sourceMappingURL=EthereumConnected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumConnected.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|