@openfort/react 0.3.1 → 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 +3 -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 -19620
- 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,252 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { RecoveryMethod, ChainTypeEnum, EmbeddedState } from '@openfort/openfort-js';
|
|
3
|
+
import { motion } from 'framer-motion';
|
|
4
|
+
import { useState, useMemo, useEffect, useCallback, useRef } from 'react';
|
|
5
|
+
import { KeyIcon, ShieldIcon, LockIcon, FingerPrintIcon, PhoneIcon, EmailIcon } from '../../../assets/icons.js';
|
|
6
|
+
import { OpenfortError } from '../../../types.js';
|
|
7
|
+
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
8
|
+
import { useResolvedIdentity } from '../../../hooks/useResolvedIdentity.js';
|
|
9
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
10
|
+
import { useRecoveryOTP } from '../../../shared/hooks/useRecoveryOTP.js';
|
|
11
|
+
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
12
|
+
import 'detect-browser';
|
|
13
|
+
import { truncateEthAddress } from '../../../utils/format.js';
|
|
14
|
+
import { logger } from '../../../utils/logger.js';
|
|
15
|
+
import Button from '../../Common/Button/index.js';
|
|
16
|
+
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
17
|
+
import FitText from '../../Common/FitText/index.js';
|
|
18
|
+
import Input from '../../Common/Input/index.js';
|
|
19
|
+
import Loader from '../../Common/Loading/index.js';
|
|
20
|
+
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
21
|
+
import { OtpInputStandalone } from '../../Common/OTPInput/index.js';
|
|
22
|
+
import { FloatingGraphic } from '../../FloatingGraphic/index.js';
|
|
23
|
+
import { routes } from '../../Openfort/types.js';
|
|
24
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
25
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
26
|
+
import { Body, ResultContainer, FooterTextButton, FooterButtonText } from '../EmailOTP/styles.js';
|
|
27
|
+
import { recoveryRegistry } from './recoveryRegistry.js';
|
|
28
|
+
|
|
29
|
+
const RecoverPasswordWallet = ({ wallet, onBack, logoutOnBack, }) => {
|
|
30
|
+
const [recoveryPhrase, setRecoveryPhrase] = useState('');
|
|
31
|
+
const [recoveryError, setRecoveryError] = useState(false);
|
|
32
|
+
const { triggerResize, setRoute } = useOpenfort();
|
|
33
|
+
const [loading, setLoading] = useState(false);
|
|
34
|
+
const { chainType } = useOpenfortCore();
|
|
35
|
+
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
36
|
+
const solanaWallet = useSolanaEmbeddedWallet();
|
|
37
|
+
const embeddedWallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
38
|
+
const { isEnabled: otpEnabled, requestOTP } = useRecoveryOTP();
|
|
39
|
+
const ctx = useMemo(() => ({
|
|
40
|
+
setActive: (opts) => embeddedWallet.setActive(opts),
|
|
41
|
+
setRoute,
|
|
42
|
+
setError: setRecoveryError,
|
|
43
|
+
otp: { isEnabled: otpEnabled, request: requestOTP },
|
|
44
|
+
setNeedsOTP: () => { },
|
|
45
|
+
setOtpResponse: () => { },
|
|
46
|
+
}), [embeddedWallet, setRoute, otpEnabled, requestOTP]);
|
|
47
|
+
const handleSubmit = async () => {
|
|
48
|
+
setLoading(true);
|
|
49
|
+
try {
|
|
50
|
+
await recoveryRegistry[chainType].password(wallet, {
|
|
51
|
+
...ctx,
|
|
52
|
+
password: recoveryPhrase,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
setRecoveryError(err instanceof OpenfortError ? err.message : 'Recovery failed. Please try again.');
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
setLoading(false);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (recoveryError)
|
|
64
|
+
triggerResize();
|
|
65
|
+
}, [recoveryError, triggerResize]);
|
|
66
|
+
const identity = useResolvedIdentity({
|
|
67
|
+
address: wallet.address,
|
|
68
|
+
chainType,
|
|
69
|
+
enabled: !!wallet.address,
|
|
70
|
+
});
|
|
71
|
+
const ensName = identity.status === 'success' ? identity.name : undefined;
|
|
72
|
+
return (jsxs(PageContent, { onBack: onBack, logoutOnBack: logoutOnBack, children: [jsx(FloatingGraphic, { height: "130px", logoCenter: {
|
|
73
|
+
logo: jsx(KeyIcon, {}),
|
|
74
|
+
size: '1.2',
|
|
75
|
+
}, logoTopLeft: {
|
|
76
|
+
logo: jsx(ShieldIcon, {}),
|
|
77
|
+
size: '0.75',
|
|
78
|
+
}, logoBottomRight: {
|
|
79
|
+
logo: jsx(LockIcon, {}),
|
|
80
|
+
size: '0.5',
|
|
81
|
+
} }), jsx(ModalHeading, { children: "Recover wallet" }), jsxs(ModalBody, { style: { textAlign: 'center' }, children: ["Please enter the password to recover wallet", ' ', jsx(CopyText, { value: wallet.address, children: ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address) })] }), jsxs("form", { onSubmit: (e) => {
|
|
82
|
+
e.preventDefault();
|
|
83
|
+
handleSubmit();
|
|
84
|
+
}, children: [jsx(Input, { value: recoveryPhrase, onChange: (e) => setRecoveryPhrase(e.target.value), type: "password", placeholder: "Enter your password", autoComplete: "off" }), recoveryError && (jsx(motion.div, { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 }, children: jsx(ModalBody, { style: { height: 24, marginTop: 12 }, "$error": true, children: jsx(FitText, { children: recoveryError }) }) }, recoveryError)), jsx(Button, { onClick: handleSubmit, waiting: loading, disabled: loading, children: "Recover wallet" })] })] }));
|
|
85
|
+
};
|
|
86
|
+
const RecoverPasskeyWallet = ({ wallet, onBack, logoutOnBack, }) => {
|
|
87
|
+
const { triggerResize, setRoute } = useOpenfort();
|
|
88
|
+
const [recoveryError, setRecoveryError] = useState(false);
|
|
89
|
+
const { chainType } = useOpenfortCore();
|
|
90
|
+
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
91
|
+
const solanaWallet = useSolanaEmbeddedWallet();
|
|
92
|
+
const embeddedWallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
93
|
+
const { isEnabled: otpEnabled, requestOTP } = useRecoveryOTP();
|
|
94
|
+
const ctx = useMemo(() => ({
|
|
95
|
+
setActive: (opts) => embeddedWallet.setActive(opts),
|
|
96
|
+
setRoute,
|
|
97
|
+
setError: setRecoveryError,
|
|
98
|
+
otp: { isEnabled: otpEnabled, request: requestOTP },
|
|
99
|
+
setNeedsOTP: () => { },
|
|
100
|
+
setOtpResponse: () => { },
|
|
101
|
+
}), [embeddedWallet, setRoute, otpEnabled, requestOTP]);
|
|
102
|
+
const recoverWallet = useCallback(async () => {
|
|
103
|
+
try {
|
|
104
|
+
await recoveryRegistry[chainType].passkey(wallet, ctx);
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
setRecoveryError(err instanceof OpenfortError ? err.message : 'Invalid passkey. Please try again.');
|
|
108
|
+
}
|
|
109
|
+
}, [chainType, wallet, ctx]);
|
|
110
|
+
const shouldRecoverWalletRef = useRef(false);
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
if (shouldRecoverWalletRef.current)
|
|
113
|
+
return;
|
|
114
|
+
shouldRecoverWalletRef.current = true;
|
|
115
|
+
recoverWallet();
|
|
116
|
+
}, [recoverWallet]);
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (recoveryError)
|
|
119
|
+
triggerResize();
|
|
120
|
+
}, [recoveryError, triggerResize]);
|
|
121
|
+
const identity = useResolvedIdentity({
|
|
122
|
+
address: wallet.address,
|
|
123
|
+
chainType,
|
|
124
|
+
enabled: !!wallet.address,
|
|
125
|
+
});
|
|
126
|
+
const ensName = identity.status === 'success' ? identity.name : undefined;
|
|
127
|
+
const walletDisplay = ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address);
|
|
128
|
+
return (jsx(PageContent, { onBack: onBack, logoutOnBack: logoutOnBack, children: jsx(Loader, { icon: jsx(FingerPrintIcon, {}), isError: !!recoveryError, header: recoveryError ? 'Invalid passkey.' : `Recovering wallet ${walletDisplay} with passkey...`, description: recoveryError ? 'There was an error creating your passkey. Please try again.' : undefined, onRetry: () => recoverWallet() }) }));
|
|
129
|
+
};
|
|
130
|
+
const RecoverAutomaticWallet = ({ wallet, onBack, logoutOnBack, }) => {
|
|
131
|
+
const { embeddedState } = useOpenfortCore();
|
|
132
|
+
const { setRoute } = useOpenfort();
|
|
133
|
+
const { chainType } = useOpenfortCore();
|
|
134
|
+
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
135
|
+
const solanaWallet = useSolanaEmbeddedWallet();
|
|
136
|
+
const embeddedWallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
137
|
+
const { isEnabled: isWalletRecoveryOTPEnabled, requestOTP } = useRecoveryOTP();
|
|
138
|
+
const [error, setError] = useState(false);
|
|
139
|
+
const [needsOTP, setNeedsOTP] = useState(false);
|
|
140
|
+
const [otpResponse, setOtpResponse] = useState(null);
|
|
141
|
+
const [otpStatus, setOtpStatus] = useState('idle');
|
|
142
|
+
const baseCtx = useMemo(() => ({
|
|
143
|
+
setActive: (opts) => embeddedWallet.setActive(opts),
|
|
144
|
+
setRoute,
|
|
145
|
+
setError,
|
|
146
|
+
otp: { isEnabled: isWalletRecoveryOTPEnabled, request: requestOTP },
|
|
147
|
+
setNeedsOTP,
|
|
148
|
+
setOtpResponse,
|
|
149
|
+
}), [embeddedWallet, setRoute, isWalletRecoveryOTPEnabled, requestOTP]);
|
|
150
|
+
const recoverWallet = useCallback(async () => {
|
|
151
|
+
if (chainType !== ChainTypeEnum.SVM && embeddedState !== EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED)
|
|
152
|
+
return;
|
|
153
|
+
logger.log('Automatically recovering wallet', wallet.address);
|
|
154
|
+
await recoveryRegistry[chainType].automatic(wallet, baseCtx);
|
|
155
|
+
}, [wallet, embeddedState, chainType, baseCtx]);
|
|
156
|
+
const shouldRecoverWalletRef = useRef(false);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (shouldRecoverWalletRef.current)
|
|
159
|
+
return;
|
|
160
|
+
shouldRecoverWalletRef.current = true;
|
|
161
|
+
recoverWallet();
|
|
162
|
+
}, [recoverWallet]);
|
|
163
|
+
const identity = useResolvedIdentity({
|
|
164
|
+
address: wallet.address,
|
|
165
|
+
chainType,
|
|
166
|
+
enabled: !!wallet.address,
|
|
167
|
+
});
|
|
168
|
+
const ensName = identity.status === 'success' ? identity.name : undefined;
|
|
169
|
+
const walletDisplay = ensName !== null && ensName !== void 0 ? ensName : truncateEthAddress(wallet.address);
|
|
170
|
+
const [canSendOtp, setCanSendOtp] = useState(true);
|
|
171
|
+
useEffect(() => {
|
|
172
|
+
if (canSendOtp)
|
|
173
|
+
return;
|
|
174
|
+
const timerId = setTimeout(() => setCanSendOtp(true), 10000);
|
|
175
|
+
return () => clearTimeout(timerId);
|
|
176
|
+
}, [canSendOtp]);
|
|
177
|
+
const handleCompleteOtp = useCallback(async (otp) => {
|
|
178
|
+
setOtpStatus('loading');
|
|
179
|
+
try {
|
|
180
|
+
await recoveryRegistry[chainType].automatic(wallet, { ...baseCtx, otpCode: otp });
|
|
181
|
+
setOtpStatus('success');
|
|
182
|
+
setTimeout(() => setRoute(routes.CONNECTED_SUCCESS), 1000);
|
|
183
|
+
}
|
|
184
|
+
catch (err) {
|
|
185
|
+
setOtpStatus('error');
|
|
186
|
+
setError(err instanceof OpenfortError ? err.message : 'There was an error verifying the OTP. Please try again.');
|
|
187
|
+
logger.log('Error verifying OTP for wallet recovery', err);
|
|
188
|
+
setTimeout(() => {
|
|
189
|
+
setOtpStatus('idle');
|
|
190
|
+
setError(false);
|
|
191
|
+
}, 1000);
|
|
192
|
+
}
|
|
193
|
+
}, [chainType, wallet, baseCtx, setRoute]);
|
|
194
|
+
const handleResendClick = useCallback(() => {
|
|
195
|
+
setOtpStatus('send-otp');
|
|
196
|
+
setCanSendOtp(false);
|
|
197
|
+
}, []);
|
|
198
|
+
const isResendDisabled = !canSendOtp || otpStatus === 'sending-otp' || otpStatus === 'send-otp';
|
|
199
|
+
const sendButtonText = useMemo(() => {
|
|
200
|
+
if (!canSendOtp)
|
|
201
|
+
return 'Code Sent!';
|
|
202
|
+
if (otpStatus === 'sending-otp')
|
|
203
|
+
return 'Sending...';
|
|
204
|
+
return 'Resend Code';
|
|
205
|
+
}, [canSendOtp, otpStatus]);
|
|
206
|
+
if (needsOTP && isWalletRecoveryOTPEnabled) {
|
|
207
|
+
return (jsxs(PageContent, { onBack: onBack, logoutOnBack: logoutOnBack, children: [jsx(ModalHeading, { children: "Enter your code" }), jsx(FloatingGraphic, { height: "100px", marginTop: "8px", marginBottom: "10px", logoCenter: {
|
|
208
|
+
logo: (otpResponse === null || otpResponse === void 0 ? void 0 : otpResponse.sentTo) === 'phone' ? jsx(PhoneIcon, {}) : jsx(EmailIcon, {}),
|
|
209
|
+
} }), jsxs(ModalBody, { children: [jsxs(Body, { as: "div", children: ["Recovering wallet ", jsx(CopyText, { value: wallet.address, children: walletDisplay }), "Please check ", jsx("b", { children: (otpResponse === null || otpResponse === void 0 ? void 0 : otpResponse.sentTo) === 'phone' ? otpResponse === null || otpResponse === void 0 ? void 0 : otpResponse.phone : otpResponse === null || otpResponse === void 0 ? void 0 : otpResponse.email }), " and enter your code below."] }), jsx(OtpInputStandalone, { length: 9, scale: "80%", onComplete: handleCompleteOtp, isLoading: otpStatus === 'loading', isError: otpStatus === 'error', isSuccess: otpStatus === 'success' }), jsxs(ResultContainer, { children: [otpStatus === 'success' && jsx(ModalBody, { "$valid": true, children: "Code verified successfully!" }), otpStatus === 'error' && jsx(ModalBody, { "$error": true, children: error || 'Invalid code. Please try again.' })] }), jsxs(FooterTextButton, { children: ["Didn't receive the code?", ' ', jsx(FooterButtonText, { type: "button", onClick: handleResendClick, disabled: isResendDisabled, children: sendButtonText })] })] })] }));
|
|
210
|
+
}
|
|
211
|
+
if (error) {
|
|
212
|
+
return (jsx(PageContent, { onBack: onBack, logoutOnBack: logoutOnBack, children: jsx(ModalBody, { style: { textAlign: 'center' }, "$error": true, children: jsx(FitText, { children: error }) }) }));
|
|
213
|
+
}
|
|
214
|
+
return (jsx(PageContent, { children: jsx(Loader, { header: `Recovering wallet...` }) }));
|
|
215
|
+
};
|
|
216
|
+
const RECOVER_WALLET_REGISTRY = {
|
|
217
|
+
[RecoveryMethod.PASSWORD]: RecoverPasswordWallet,
|
|
218
|
+
[RecoveryMethod.AUTOMATIC]: RecoverAutomaticWallet,
|
|
219
|
+
[RecoveryMethod.PASSKEY]: RecoverPasskeyWallet,
|
|
220
|
+
};
|
|
221
|
+
const RecoverWallet = ({ wallet, onBack, logoutOnBack }) => {
|
|
222
|
+
var _a;
|
|
223
|
+
const Component = RECOVER_WALLET_REGISTRY[(_a = wallet.recoveryMethod) !== null && _a !== void 0 ? _a : RecoveryMethod.AUTOMATIC];
|
|
224
|
+
if (!Component) {
|
|
225
|
+
logger.error(`Unsupported recovery method: ${wallet.recoveryMethod}, defaulting to automatic.`);
|
|
226
|
+
return jsx(RecoverAutomaticWallet, { wallet: wallet, onBack: onBack, logoutOnBack: logoutOnBack });
|
|
227
|
+
}
|
|
228
|
+
return jsx(Component, { wallet: wallet, onBack: onBack, logoutOnBack: logoutOnBack });
|
|
229
|
+
};
|
|
230
|
+
const RecoverPage = () => {
|
|
231
|
+
const { previousRoute, route } = useOpenfort();
|
|
232
|
+
const wallet = route.route === routes.SOL_RECOVER_WALLET
|
|
233
|
+
? route.wallet
|
|
234
|
+
: route.route === routes.RECOVER_WALLET
|
|
235
|
+
? route.wallet
|
|
236
|
+
: undefined;
|
|
237
|
+
const { onBack, logoutOnBack } = useMemo(() => {
|
|
238
|
+
if ((previousRoute === null || previousRoute === void 0 ? void 0 : previousRoute.route) === routes.SELECT_WALLET_TO_RECOVER) {
|
|
239
|
+
return {
|
|
240
|
+
onBack: 'back',
|
|
241
|
+
logoutOnBack: false,
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
return { onBack: routes.PROVIDERS, logoutOnBack: true };
|
|
245
|
+
}, [previousRoute]);
|
|
246
|
+
if (!wallet)
|
|
247
|
+
return null;
|
|
248
|
+
return jsx(RecoverWallet, { wallet: wallet, onBack: onBack, logoutOnBack: logoutOnBack });
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
export { RecoverPage as default };
|
|
252
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChainTypeEnum, RecoveryMethod } from '@openfort/openfort-js';
|
|
2
|
+
import type { OTPResponse } from '../../../shared/hooks/useRecoveryOTP';
|
|
3
|
+
import type { RecoverableWallet } from '../../../shared/types';
|
|
4
|
+
import { type SetRouteOptions } from '../../Openfort/types';
|
|
5
|
+
type RecoveryContext = {
|
|
6
|
+
setActive: (opts: {
|
|
7
|
+
address: string;
|
|
8
|
+
password?: string;
|
|
9
|
+
recoveryMethod?: RecoveryMethod;
|
|
10
|
+
otpCode?: string;
|
|
11
|
+
passkeyId?: string;
|
|
12
|
+
}) => Promise<void>;
|
|
13
|
+
setRoute: (options: SetRouteOptions) => void;
|
|
14
|
+
setError: (e: string | false) => void;
|
|
15
|
+
otp: {
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
request: () => Promise<OTPResponse>;
|
|
18
|
+
};
|
|
19
|
+
setNeedsOTP: (n: boolean) => void;
|
|
20
|
+
setOtpResponse: (r: OTPResponse | null) => void;
|
|
21
|
+
password?: string;
|
|
22
|
+
otpCode?: string;
|
|
23
|
+
passkeyId?: string;
|
|
24
|
+
};
|
|
25
|
+
type RecoveryEntry = (wallet: RecoverableWallet, ctx: RecoveryContext) => Promise<void>;
|
|
26
|
+
type RecoveryRegistryByChain = {
|
|
27
|
+
password: RecoveryEntry;
|
|
28
|
+
passkey: RecoveryEntry;
|
|
29
|
+
automatic: RecoveryEntry;
|
|
30
|
+
};
|
|
31
|
+
export declare const recoveryRegistry: Record<ChainTypeEnum.EVM | ChainTypeEnum.SVM, RecoveryRegistryByChain>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ChainTypeEnum, RecoveryMethod } from '@openfort/openfort-js';
|
|
2
|
+
import { handleOtpRecoveryError } from '../../../shared/utils/otpError.js';
|
|
3
|
+
import { routes } from '../../Openfort/types.js';
|
|
4
|
+
|
|
5
|
+
async function passwordEntry(wallet, ctx) {
|
|
6
|
+
ctx.setError(false);
|
|
7
|
+
await ctx.setActive({
|
|
8
|
+
address: wallet.address,
|
|
9
|
+
recoveryMethod: RecoveryMethod.PASSWORD,
|
|
10
|
+
password: ctx.password,
|
|
11
|
+
});
|
|
12
|
+
ctx.setRoute(routes.CONNECTED_SUCCESS);
|
|
13
|
+
}
|
|
14
|
+
async function passkeyEntry(wallet, ctx) {
|
|
15
|
+
ctx.setError(false);
|
|
16
|
+
await ctx.setActive({
|
|
17
|
+
address: wallet.address,
|
|
18
|
+
recoveryMethod: RecoveryMethod.PASSKEY,
|
|
19
|
+
passkeyId: ctx.passkeyId,
|
|
20
|
+
});
|
|
21
|
+
ctx.setRoute(routes.CONNECTED_SUCCESS);
|
|
22
|
+
}
|
|
23
|
+
async function automaticEntry(wallet, ctx) {
|
|
24
|
+
ctx.setError(false);
|
|
25
|
+
try {
|
|
26
|
+
await ctx.setActive({
|
|
27
|
+
address: wallet.address,
|
|
28
|
+
recoveryMethod: RecoveryMethod.AUTOMATIC,
|
|
29
|
+
otpCode: ctx.otpCode,
|
|
30
|
+
});
|
|
31
|
+
ctx.setRoute(routes.CONNECTED_SUCCESS);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
const { error, isOTPRequired } = handleOtpRecoveryError(err, ctx.otp.isEnabled);
|
|
35
|
+
if (isOTPRequired && ctx.otp.isEnabled) {
|
|
36
|
+
try {
|
|
37
|
+
const res = await ctx.otp.request();
|
|
38
|
+
ctx.setNeedsOTP(true);
|
|
39
|
+
ctx.setOtpResponse(res);
|
|
40
|
+
}
|
|
41
|
+
catch (_otpErr) {
|
|
42
|
+
ctx.setError('Failed to send recovery code');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
ctx.setError(error.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const RECOVERY_REGISTRY = {
|
|
51
|
+
password: passwordEntry,
|
|
52
|
+
passkey: passkeyEntry,
|
|
53
|
+
automatic: automaticEntry,
|
|
54
|
+
};
|
|
55
|
+
const recoveryRegistry = {
|
|
56
|
+
[ChainTypeEnum.EVM]: RECOVERY_REGISTRY,
|
|
57
|
+
[ChainTypeEnum.SVM]: RECOVERY_REGISTRY,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export { recoveryRegistry };
|
|
61
|
+
//# sourceMappingURL=recoveryRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recoveryRegistry.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useMemo, useEffect } from 'react';
|
|
3
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
4
|
+
import styled from '../../../styles/styled/index.js';
|
|
5
|
+
import { logger } from '../../../utils/logger.js';
|
|
6
|
+
import Button from '../../Common/Button/index.js';
|
|
7
|
+
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
8
|
+
import { ModalHeading, ModalContent, ModalH1, ModalBody } from '../../Common/Modal/styles.js';
|
|
9
|
+
import { getProviderName } from '../../Common/Providers/getProviderName.js';
|
|
10
|
+
import { WalletDisplay } from '../../Common/Providers/ProviderHeader.js';
|
|
11
|
+
import { ProviderIcon } from '../../Common/Providers/ProviderIcon.js';
|
|
12
|
+
import { routes } from '../../Openfort/types.js';
|
|
13
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
14
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
15
|
+
import { ProviderIconContainer, ProviderIconWrapper, ProviderIconInner } from '../LinkedProvider/index.js';
|
|
16
|
+
|
|
17
|
+
const ButtonWrapper = styled.div `
|
|
18
|
+
display: flex;
|
|
19
|
+
gap: 12px;
|
|
20
|
+
margin-top: 24px;
|
|
21
|
+
`;
|
|
22
|
+
const ErrorMessage = styled.div `
|
|
23
|
+
color: var(--ck-body-color-danger, #ff4d4f);
|
|
24
|
+
margin-top: 16px;
|
|
25
|
+
`;
|
|
26
|
+
const RemoveLinkedProvider = () => {
|
|
27
|
+
const { route, triggerResize, onBack, setOnBack, setRouteHistory, setRoute } = useOpenfort();
|
|
28
|
+
const { client, updateUser } = useOpenfortCore();
|
|
29
|
+
const [error, setError] = useState(null);
|
|
30
|
+
const [isSuccess, setIsSuccess] = useState(false);
|
|
31
|
+
const provider = useMemo(() => {
|
|
32
|
+
if (route.route === 'removeLinkedProvider') {
|
|
33
|
+
return route.account;
|
|
34
|
+
}
|
|
35
|
+
throw new Error('No provider found in route');
|
|
36
|
+
}, [route]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (error)
|
|
39
|
+
triggerResize();
|
|
40
|
+
}, [error]);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
if (isSuccess) {
|
|
43
|
+
updateUser();
|
|
44
|
+
triggerResize();
|
|
45
|
+
setOnBack(() => () => {
|
|
46
|
+
setRouteHistory((prev) => {
|
|
47
|
+
const newHistory = [...prev];
|
|
48
|
+
newHistory.pop();
|
|
49
|
+
newHistory.pop();
|
|
50
|
+
if (newHistory.length > 0) {
|
|
51
|
+
setRoute(newHistory[newHistory.length - 1]);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
setRoute({ route: routes.CONNECTED });
|
|
55
|
+
}
|
|
56
|
+
return newHistory;
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}, [isSuccess]);
|
|
61
|
+
const handleRemove = async () => {
|
|
62
|
+
var _a;
|
|
63
|
+
const errorMsg = 'Failed to remove linked provider. Please try again.';
|
|
64
|
+
if (provider.provider === 'siwe' || provider.provider === 'wallet') {
|
|
65
|
+
try {
|
|
66
|
+
const result = await client.auth.unlinkWallet({
|
|
67
|
+
address: provider.accountId,
|
|
68
|
+
chainId: Number((_a = provider.chainId) !== null && _a !== void 0 ? _a : 0),
|
|
69
|
+
});
|
|
70
|
+
if (!result.success) {
|
|
71
|
+
setError(errorMsg);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setIsSuccess(true);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
logger.error('Unexpected error removing linked provider:', e);
|
|
79
|
+
setError(errorMsg);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
try {
|
|
84
|
+
const result = await client.auth.unlinkOAuth({
|
|
85
|
+
provider: provider.provider,
|
|
86
|
+
});
|
|
87
|
+
if (!result.status) {
|
|
88
|
+
setError(errorMsg);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
setIsSuccess(true);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
logger.error('Unexpected error removing linked provider:', e);
|
|
96
|
+
setError(errorMsg);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
return (jsxs(PageContent, { children: [jsxs(ModalHeading, { children: ["Remove ", getProviderName(provider.provider)] }), jsxs(ModalContent, { style: { paddingBottom: 0 }, children: [jsx(ProviderIconContainer, { style: { marginBottom: '16px' }, children: jsx(ProviderIconWrapper, { children: jsx(ProviderIconInner, { children: jsx(ProviderIcon, { account: provider }) }) }) }), isSuccess ? (jsxs(Fragment, { children: [jsx(ModalH1, { "$valid": true, children: "Success" }), jsxs(ModalBody, { children: ["Successfully removed", ' ', provider.provider === 'siwe' ? (jsxs("span", { children: [jsx("b", { children: jsx(WalletDisplay, { walletAddress: provider.accountId }) }), "."] })) : (jsxs(Fragment, { children: [jsx("b", { children: getProviderName(provider.provider) }), " as an authentication method."] }))] }), jsx(ButtonWrapper, { style: { marginTop: 0 }, children: jsx(Button, { onClick: () => onBack === null || onBack === void 0 ? void 0 : onBack(), children: "Back" }) })] })) : (jsxs(Fragment, { children: [jsxs("p", { children: ["Are you sure you want to remove", ' ', provider.provider === 'siwe' ? (jsxs(CopyText, { value: provider.accountId, children: [jsx("b", { children: jsx(WalletDisplay, { walletAddress: provider.accountId }) }), "?"] })) : (jsxs(Fragment, { children: [jsx("b", { children: getProviderName(provider.provider) }), "as an authentication method?"] }))] }), error && jsx(ErrorMessage, { children: error }), jsxs(ButtonWrapper, { style: { marginTop: 0 }, children: [jsx(Button, { onClick: () => onBack === null || onBack === void 0 ? void 0 : onBack(), children: "Cancel" }), jsx(Button, { onClick: handleRemove, children: "Remove" })] })] }))] })] }));
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export { RemoveLinkedProvider as default };
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect } from 'react';
|
|
3
|
+
import { formatUnits } from 'viem';
|
|
4
|
+
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
5
|
+
import { Arrow, ArrowChevron, TextLinkButton } from '../../Common/Button/styles.js';
|
|
6
|
+
import { ModalHeading } from '../../Common/Modal/styles.js';
|
|
7
|
+
import { routes } from '../../Openfort/types.js';
|
|
8
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
9
|
+
import { getAssetSymbol, getAssetDecimals, formatBalanceWithSymbol } from '../Send/utils.js';
|
|
10
|
+
import { SelectTokenContent, EmptyState, TokenList, TokenButton, TokenInfo, TokenSymbol, TokenName, TokenBalance } from './styles.js';
|
|
11
|
+
|
|
12
|
+
const ZERO = BigInt(0);
|
|
13
|
+
const usdFormatter = new Intl.NumberFormat('en-US', {
|
|
14
|
+
style: 'currency',
|
|
15
|
+
currency: 'USD',
|
|
16
|
+
minimumFractionDigits: 2,
|
|
17
|
+
maximumFractionDigits: 2,
|
|
18
|
+
});
|
|
19
|
+
const SelectToken = ({ isBuyFlow }) => {
|
|
20
|
+
const { setSendForm, setBuyForm, setRoute, triggerResize } = useOpenfort();
|
|
21
|
+
const [viewAllAssets, setViewAllAssets] = useState(false);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
triggerResize();
|
|
24
|
+
}, [viewAllAssets]);
|
|
25
|
+
const { data: walletAssets, isLoading: isBalancesLoading } = useEthereumWalletAssets();
|
|
26
|
+
// Show all tokens for both buy and send flows
|
|
27
|
+
const selectableTokens = walletAssets || [];
|
|
28
|
+
const handleSelect = (asset) => {
|
|
29
|
+
var _a;
|
|
30
|
+
// In send flow, don't allow selecting tokens with 0 balance
|
|
31
|
+
if (!isBuyFlow && ((_a = asset.balance) !== null && _a !== void 0 ? _a : ZERO) <= ZERO) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (isBuyFlow) {
|
|
35
|
+
setBuyForm((prev) => ({
|
|
36
|
+
...prev,
|
|
37
|
+
asset,
|
|
38
|
+
}));
|
|
39
|
+
setRoute(routes.BUY);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
setSendForm((prev) => ({
|
|
43
|
+
...prev,
|
|
44
|
+
asset,
|
|
45
|
+
amount: '', // Always reset amount when selecting a token
|
|
46
|
+
}));
|
|
47
|
+
setRoute(routes.SEND);
|
|
48
|
+
};
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
triggerResize();
|
|
51
|
+
}, [selectableTokens.length, isBuyFlow]);
|
|
52
|
+
const renderContent = () => {
|
|
53
|
+
if (!selectableTokens.length) {
|
|
54
|
+
if (isBalancesLoading) {
|
|
55
|
+
return jsx(EmptyState, { children: "Loading balances\u2026" });
|
|
56
|
+
}
|
|
57
|
+
return jsx(EmptyState, { children: "No supported tokens found for this network yet." });
|
|
58
|
+
}
|
|
59
|
+
return (jsxs(TokenList, { children: [selectableTokens.map((token) => {
|
|
60
|
+
var _a, _b, _c, _d, _e;
|
|
61
|
+
const key = token.type === 'erc20' ? token.address : 'native';
|
|
62
|
+
const displaySymbol = getAssetSymbol(token);
|
|
63
|
+
const displayName = ((_a = token.metadata) === null || _a === void 0 ? void 0 : _a.name) || displaySymbol || 'Unknown Token';
|
|
64
|
+
// const symbolKey = token.metadata?.symbol?.toUpperCase()
|
|
65
|
+
const decimals = getAssetDecimals(token);
|
|
66
|
+
const pricePerToken = (_c = (_b = token.metadata) === null || _b === void 0 ? void 0 : _b.fiat) === null || _c === void 0 ? void 0 : _c.value;
|
|
67
|
+
let usdValue = null;
|
|
68
|
+
// Show loading state for balances
|
|
69
|
+
const isBalanceLoaded = token.balance !== undefined;
|
|
70
|
+
const balanceDisplay = isBalanceLoaded
|
|
71
|
+
? formatBalanceWithSymbol(token.balance, decimals, ((_d = token.metadata) === null || _d === void 0 ? void 0 : _d.symbol) || '')
|
|
72
|
+
: 'Loading...';
|
|
73
|
+
// Check if token has zero balance (for send flow opacity)
|
|
74
|
+
const hasZeroBalance = isBalanceLoaded && ((_e = token.balance) !== null && _e !== void 0 ? _e : ZERO) <= ZERO;
|
|
75
|
+
if (hasZeroBalance && !viewAllAssets && !isBuyFlow)
|
|
76
|
+
return null;
|
|
77
|
+
const isDisabled = !isBuyFlow && hasZeroBalance;
|
|
78
|
+
if (isBalanceLoaded && pricePerToken !== undefined && token.balance !== undefined) {
|
|
79
|
+
const amount = parseFloat(formatUnits(token.balance, decimals));
|
|
80
|
+
if (Number.isFinite(amount)) {
|
|
81
|
+
const totalUsd = amount * pricePerToken;
|
|
82
|
+
if (totalUsd >= 0.01) {
|
|
83
|
+
usdValue = usdFormatter.format(totalUsd);
|
|
84
|
+
}
|
|
85
|
+
else if (totalUsd > 0) {
|
|
86
|
+
usdValue = '<$0.01';
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
usdValue = usdFormatter.format(0);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return (jsxs(TokenButton, { type: "button", onClick: () => handleSelect(token), style: { opacity: isDisabled ? 0.4 : 1, cursor: isDisabled ? 'not-allowed' : 'pointer' }, children: [jsxs(TokenInfo, { children: [jsx(TokenSymbol, { children: displayName }), isBuyFlow && jsx(TokenName, { children: displaySymbol })] }), isBuyFlow ? (jsx(Arrow, { width: "13", height: "12", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx(ArrowChevron, { stroke: "currentColor", d: "M7.51431 1.5L11.757 5.74264M7.5 10.4858L11.7426 6.24314" }) })) : (jsxs(TokenInfo, { children: [jsx(TokenBalance, { children: balanceDisplay }), usdValue ? jsx(TokenName, { style: { textAlign: 'end' }, children: usdValue }) : null] }))] }, key));
|
|
94
|
+
}), !isBuyFlow && (jsx(TextLinkButton, { type: "button", onClick: () => {
|
|
95
|
+
setViewAllAssets(!viewAllAssets);
|
|
96
|
+
}, children: viewAllAssets ? 'View less assets' : 'View all assets' }))] }));
|
|
97
|
+
};
|
|
98
|
+
return (jsxs(SelectTokenContent, { children: [jsx(ModalHeading, { children: "Select asset" }), renderContent()] }));
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export { SelectToken as default };
|
|
102
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import styled from '../../../styles/styled/index.js';
|
|
2
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
3
|
+
|
|
4
|
+
const SelectTokenContent = styled(PageContent) `
|
|
5
|
+
min-height: 320px;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
padding-bottom: 16px;
|
|
9
|
+
`;
|
|
10
|
+
const TokenList = styled.div `
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
gap: 12px;
|
|
14
|
+
margin-top: 6px;
|
|
15
|
+
flex: 1;
|
|
16
|
+
`;
|
|
17
|
+
const TokenButton = 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 var(--ck-body-divider);
|
|
25
|
+
background: var(--ck-secondary-button-background);
|
|
26
|
+
color: var(--ck-body-color);
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
transition: background 150ms ease, border-color 150ms ease;
|
|
29
|
+
|
|
30
|
+
&:hover {
|
|
31
|
+
background: var(--ck-secondary-button-hover-background);
|
|
32
|
+
border-color: var(--ck-body-color-muted);
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
const TokenContainer = styled.div `
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
width: 100%;
|
|
40
|
+
padding: 14px 16px;
|
|
41
|
+
border-radius: var(--ck-secondary-button-border-radius);
|
|
42
|
+
border: 1px solid var(--ck-body-divider);
|
|
43
|
+
background: var(--ck-secondary-button-background);
|
|
44
|
+
color: var(--ck-body-color);
|
|
45
|
+
`;
|
|
46
|
+
const TokenInfo = styled.div `
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 2px;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
text-align: right;
|
|
52
|
+
`;
|
|
53
|
+
const TokenSymbol = styled.span `
|
|
54
|
+
font-size: 15px;
|
|
55
|
+
font-weight: 600;
|
|
56
|
+
color: var(--ck-body-color);
|
|
57
|
+
`;
|
|
58
|
+
const TokenName = styled.span `
|
|
59
|
+
font-size: 13px;
|
|
60
|
+
color: var(--ck-body-color-muted);
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
overflow: hidden;
|
|
63
|
+
text-overflow: ellipsis;
|
|
64
|
+
`;
|
|
65
|
+
const TokenBalance = styled.span `
|
|
66
|
+
font-size: 14px;
|
|
67
|
+
font-weight: 600;
|
|
68
|
+
color: var(--ck-body-color);
|
|
69
|
+
`;
|
|
70
|
+
const EmptyState = styled.div `
|
|
71
|
+
margin-top: 28px;
|
|
72
|
+
font-size: 13px;
|
|
73
|
+
color: var(--ck-body-color-muted);
|
|
74
|
+
text-align: center;
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
export { EmptyState, SelectTokenContent, TokenBalance, TokenButton, TokenContainer, TokenInfo, TokenList, TokenName, TokenSymbol };
|
|
78
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default SelectWalletToRecover;
|
|
1
|
+
export default function SelectWalletToRecover(): import("react/jsx-runtime").JSX.Element;
|