@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
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import { type QueryObserverResult, type RefetchOptions } from '@tanstack/react-query';
|
|
1
|
+
import { type Openfort } from '@openfort/openfort-js';
|
|
3
2
|
import type React from 'react';
|
|
4
3
|
import { type PropsWithChildren } from 'react';
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
needsRecovery: boolean;
|
|
13
|
-
user: User | null;
|
|
14
|
-
updateUser: (user?: User) => Promise<User | null>;
|
|
15
|
-
linkedAccounts: UserAccount[];
|
|
16
|
-
embeddedAccounts?: EmbeddedAccount[];
|
|
17
|
-
isLoadingAccounts: boolean;
|
|
18
|
-
logout: () => void;
|
|
19
|
-
updateEmbeddedAccounts: (options?: RefetchOptions) => Promise<QueryObserverResult<EmbeddedAccount[], Error>>;
|
|
20
|
-
walletStatus: WalletFlowStatus;
|
|
21
|
-
setWalletStatus: (status: WalletFlowStatus) => void;
|
|
22
|
-
client: Openfort;
|
|
23
|
-
};
|
|
4
|
+
import type { ConnectCallbackProps } from './connectCallbackTypes';
|
|
5
|
+
import type { OpenfortStore } from './store';
|
|
6
|
+
/**
|
|
7
|
+
* Public return type for useOpenfortCore(). Matches the store shape.
|
|
8
|
+
* Kept as a named type for backward compatibility with consumers that import it.
|
|
9
|
+
*/
|
|
10
|
+
export type OpenfortCoreContextValue = OpenfortStore;
|
|
24
11
|
type CoreOpenfortProviderProps = PropsWithChildren<{
|
|
25
12
|
openfortConfig: ConstructorParameters<typeof Openfort>[0];
|
|
26
|
-
} &
|
|
13
|
+
} & ConnectCallbackProps>;
|
|
27
14
|
export declare const CoreOpenfortProvider: React.FC<CoreOpenfortProviderProps>;
|
|
28
15
|
export {};
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { ChainTypeEnum, EmbeddedState } from '@openfort/openfort-js';
|
|
2
|
+
import { useContext, useMemo, useState, useEffect, useRef, useCallback, useLayoutEffect, createElement, Fragment } from 'react';
|
|
3
|
+
import { useStore } from 'zustand';
|
|
4
|
+
import { routes } from '../components/Openfort/types.js';
|
|
5
|
+
import { useOpenfort } from '../components/Openfort/useOpenfort.js';
|
|
6
|
+
import { embeddedWalletId } from '../constants/openfort.js';
|
|
7
|
+
import { ConnectionStrategyProvider, useConnectionStrategy } from '../core/ConnectionStrategyContext.js';
|
|
8
|
+
import { OpenfortEthereumBridgeContext } from '../ethereum/OpenfortEthereumBridgeContext.js';
|
|
9
|
+
import { useConnectLifecycle } from '../hooks/useConnectLifecycle.js';
|
|
10
|
+
import { showInitBanner } from '../utils/banner.js';
|
|
11
|
+
import { logger } from '../utils/logger.js';
|
|
12
|
+
import { handleOAuthConfigError } from '../utils/oauthErrorHandler.js';
|
|
13
|
+
import { mapBridgeConnectorsToWalletProps } from '../wallets/useExternalConnectors.js';
|
|
14
|
+
import { StoreContext } from './context.js';
|
|
15
|
+
import { createOpenfortClient } from './core/client.js';
|
|
16
|
+
import { useActiveAddressSync } from './hooks/useActiveAddressSync.js';
|
|
17
|
+
import { useAutoRecovery } from './hooks/useAutoRecovery.js';
|
|
18
|
+
import { useEmbeddedStateMachine } from './hooks/useEmbeddedStateMachine.js';
|
|
19
|
+
import { createOpenfortStore } from './store.js';
|
|
20
|
+
|
|
21
|
+
function ConnectLifecycleEffect({ onConnect, onDisconnect }) {
|
|
22
|
+
const strategy = useConnectionStrategy();
|
|
23
|
+
useConnectLifecycle(strategy, onConnect, onDisconnect);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const CoreOpenfortProvider = ({ children, onConnect, onDisconnect, openfortConfig, }) => {
|
|
27
|
+
const bridge = useContext(OpenfortEthereumBridgeContext);
|
|
28
|
+
const { walletConfig, chainType, setChainType, uiConfig, open, route, connector } = useOpenfort();
|
|
29
|
+
const bridgeConnectors = useMemo(() => {
|
|
30
|
+
if (!bridge)
|
|
31
|
+
return [];
|
|
32
|
+
return mapBridgeConnectorsToWalletProps(bridge, {
|
|
33
|
+
walletConnectName: uiConfig.walletConnectName,
|
|
34
|
+
});
|
|
35
|
+
}, [bridge, uiConfig.walletConnectName]);
|
|
36
|
+
const [solanaStrategy, setSolanaStrategy] = useState(null);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (!(walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.solana)) {
|
|
39
|
+
setSolanaStrategy(null);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
let cancelled = false;
|
|
43
|
+
import('../core/strategies/SolanaEmbeddedStrategy.js').then((m) => {
|
|
44
|
+
if (!cancelled)
|
|
45
|
+
setSolanaStrategy(m.createSolanaEmbeddedStrategy(walletConfig));
|
|
46
|
+
});
|
|
47
|
+
return () => {
|
|
48
|
+
cancelled = true;
|
|
49
|
+
};
|
|
50
|
+
}, [walletConfig]);
|
|
51
|
+
const [evmStrategy, setEvmStrategy] = useState(null);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
if (!(walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) && !bridge) {
|
|
54
|
+
setEvmStrategy(null);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
let cancelled = false;
|
|
58
|
+
if (bridge) {
|
|
59
|
+
import('../core/strategies/EthereumBridgeStrategy.js').then((m) => {
|
|
60
|
+
if (!cancelled)
|
|
61
|
+
setEvmStrategy(m.createEthereumBridgeStrategy(bridge, bridgeConnectors));
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
import('../core/strategies/EthereumEmbeddedStrategy.js').then((m) => {
|
|
66
|
+
if (!cancelled)
|
|
67
|
+
setEvmStrategy(m.createEthereumEmbeddedStrategy(walletConfig));
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return () => {
|
|
71
|
+
cancelled = true;
|
|
72
|
+
};
|
|
73
|
+
}, [bridge, bridgeConnectors, walletConfig]);
|
|
74
|
+
// ---- Zustand store + Openfort client ----
|
|
75
|
+
const bridgeRef = useRef(bridge);
|
|
76
|
+
bridgeRef.current = bridge;
|
|
77
|
+
// ---- Openfort instance ----
|
|
78
|
+
const openfort = useMemo(() => {
|
|
79
|
+
logger.log('Creating Openfort instance.', openfortConfig);
|
|
80
|
+
if (!openfortConfig.baseConfiguration.publishableKey)
|
|
81
|
+
throw Error('CoreOpenfortProvider requires a publishableKey to be set in the baseConfiguration.');
|
|
82
|
+
let resolvedShieldConfig = openfortConfig.shieldConfiguration;
|
|
83
|
+
if (resolvedShieldConfig && !resolvedShieldConfig.passkeyRpId && typeof window !== 'undefined') {
|
|
84
|
+
resolvedShieldConfig = {
|
|
85
|
+
passkeyRpId: window.location.hostname,
|
|
86
|
+
passkeyRpName: document.title || 'Openfort app',
|
|
87
|
+
...resolvedShieldConfig,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const newClient = createOpenfortClient({ ...openfortConfig, shieldConfiguration: resolvedShieldConfig });
|
|
91
|
+
return newClient;
|
|
92
|
+
}, []);
|
|
93
|
+
const store = useMemo(() => {
|
|
94
|
+
return createOpenfortStore(chainType, openfort, () => {
|
|
95
|
+
var _a;
|
|
96
|
+
return ({
|
|
97
|
+
hasBridge: !!bridgeRef.current,
|
|
98
|
+
address: (_a = bridgeRef.current) === null || _a === void 0 ? void 0 : _a.account.address,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
}, []);
|
|
102
|
+
// Sync chainType from UI context into the store
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
store.getState().setChainType(chainType);
|
|
105
|
+
}, [store, chainType]);
|
|
106
|
+
// Recompute isLoading when bridge address changes (bridge connects/disconnects)
|
|
107
|
+
const address = bridge === null || bridge === void 0 ? void 0 : bridge.account.address;
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
store.getState().recomputeIsLoading();
|
|
110
|
+
}, [store, address]);
|
|
111
|
+
const strategy = useMemo(() => {
|
|
112
|
+
var _a;
|
|
113
|
+
const strategyByChain = {
|
|
114
|
+
[ChainTypeEnum.SVM]: solanaStrategy,
|
|
115
|
+
[ChainTypeEnum.EVM]: evmStrategy,
|
|
116
|
+
};
|
|
117
|
+
return (_a = strategyByChain[chainType]) !== null && _a !== void 0 ? _a : null;
|
|
118
|
+
}, [chainType, solanaStrategy, evmStrategy]);
|
|
119
|
+
// ---- Embedded state ----
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
showInitBanner();
|
|
122
|
+
if (!openfort)
|
|
123
|
+
return;
|
|
124
|
+
const unwatch = openfort.embeddedWallet.watchEmbeddedState({
|
|
125
|
+
onChange: (state, prevState) => {
|
|
126
|
+
logger.log('Embedded state changed:', EmbeddedState[state], '(prev:', prevState !== undefined ? EmbeddedState[prevState] : 'none', ')');
|
|
127
|
+
store.getState().setEmbeddedState(state);
|
|
128
|
+
},
|
|
129
|
+
onError: (error) => {
|
|
130
|
+
logger.error('Error watching embedded state:', error);
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
return unwatch;
|
|
134
|
+
}, [openfort, store]);
|
|
135
|
+
const updateUser = useCallback(async (user, logoutOnError = false) => {
|
|
136
|
+
var _a;
|
|
137
|
+
if (!openfort)
|
|
138
|
+
return null;
|
|
139
|
+
logger.log('Updating user', { user, logoutOnError });
|
|
140
|
+
if (user) {
|
|
141
|
+
store.getState().setUser(user);
|
|
142
|
+
return user;
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
const user = await openfort.user.get();
|
|
146
|
+
logger.log('Getting user');
|
|
147
|
+
store.getState().setLinkedAccounts(user.linkedAccounts);
|
|
148
|
+
store.getState().setUser(user);
|
|
149
|
+
return user;
|
|
150
|
+
}
|
|
151
|
+
catch (err) {
|
|
152
|
+
logger.log('Error getting user', err);
|
|
153
|
+
if (!logoutOnError)
|
|
154
|
+
return null;
|
|
155
|
+
const status = err && typeof err === 'object' && 'response' in err
|
|
156
|
+
? (_a = err.response) === null || _a === void 0 ? void 0 : _a.status
|
|
157
|
+
: undefined;
|
|
158
|
+
if (status === 404) {
|
|
159
|
+
logger.log('User not found, logging out');
|
|
160
|
+
logout();
|
|
161
|
+
}
|
|
162
|
+
else if (status === 401) {
|
|
163
|
+
logger.log('User not authenticated, logging out');
|
|
164
|
+
logout();
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
}, [openfort, store]);
|
|
169
|
+
const [silentRefetchInProgress, setSilentRefetchInProgress] = useState(false);
|
|
170
|
+
const [isAccountsPending, setAccountsPending] = useState(false);
|
|
171
|
+
const fetchSeqRef = useRef(0);
|
|
172
|
+
const fetchEmbeddedAccounts = useCallback(async (options) => {
|
|
173
|
+
const seq = ++fetchSeqRef.current;
|
|
174
|
+
if (options === null || options === void 0 ? void 0 : options.silent)
|
|
175
|
+
setSilentRefetchInProgress(true);
|
|
176
|
+
setAccountsPending(true);
|
|
177
|
+
try {
|
|
178
|
+
const accounts = await openfort.embeddedWallet.list({
|
|
179
|
+
limit: 100,
|
|
180
|
+
});
|
|
181
|
+
if (seq === fetchSeqRef.current) {
|
|
182
|
+
store.getState().setEmbeddedAccounts(accounts);
|
|
183
|
+
}
|
|
184
|
+
return accounts;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
handleOAuthConfigError(error);
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
if (seq === fetchSeqRef.current) {
|
|
192
|
+
setAccountsPending(false);
|
|
193
|
+
if (options === null || options === void 0 ? void 0 : options.silent)
|
|
194
|
+
setSilentRefetchInProgress(false);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}, [openfort, store]);
|
|
198
|
+
const isLoadingAccounts = isAccountsPending && !silentRefetchInProgress;
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
store.getState().setIsLoadingAccounts(isLoadingAccounts);
|
|
201
|
+
}, [store, isLoadingAccounts]);
|
|
202
|
+
const updateUserRef = useRef(updateUser);
|
|
203
|
+
const fetchEmbeddedAccountsRef = useRef(fetchEmbeddedAccounts);
|
|
204
|
+
useLayoutEffect(() => {
|
|
205
|
+
updateUserRef.current = updateUser;
|
|
206
|
+
fetchEmbeddedAccountsRef.current = fetchEmbeddedAccounts;
|
|
207
|
+
}, [updateUser, fetchEmbeddedAccounts]);
|
|
208
|
+
// Subscribe to store state for effects
|
|
209
|
+
const storeEmbeddedState = useStore(store, (s) => s.embeddedState);
|
|
210
|
+
const storeEmbeddedAccounts = useStore(store, (s) => s.embeddedAccounts);
|
|
211
|
+
const storeActiveEmbeddedAddress = useStore(store, (s) => s.activeEmbeddedAddress);
|
|
212
|
+
const storeUser = useStore(store, (s) => s.user);
|
|
213
|
+
useActiveAddressSync({
|
|
214
|
+
openfort,
|
|
215
|
+
storeEmbeddedAccounts,
|
|
216
|
+
storeEmbeddedState,
|
|
217
|
+
storeActiveEmbeddedAddress,
|
|
218
|
+
chainType,
|
|
219
|
+
store,
|
|
220
|
+
});
|
|
221
|
+
// Current chain for EVM provider reconfiguration
|
|
222
|
+
const evmChainId = (strategy === null || strategy === void 0 ? void 0 : strategy.chainType) === ChainTypeEnum.EVM ? (bridge ? bridge.chainId : strategy === null || strategy === void 0 ? void 0 : strategy.getChainId()) : undefined;
|
|
223
|
+
// Track what we last initialized to avoid redundant initProvider calls when
|
|
224
|
+
// the strategy object is recreated but nothing meaningful changed.
|
|
225
|
+
const lastInitRef = useRef(null);
|
|
226
|
+
const initInProgressRef = useRef(false);
|
|
227
|
+
// Init provider; only fetch accounts when READY (prevents list() before auth is stored)
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
if (!openfort || !walletConfig || !strategy)
|
|
230
|
+
return;
|
|
231
|
+
// EVM: only run at READY — auto-recover handles EMBEDDED_SIGNER_NOT_CONFIGURED → READY.
|
|
232
|
+
// Running getEthereumProvider() concurrently with recover() causes a race condition.
|
|
233
|
+
// SVM: initProvider is a no-op, safe to run anytime.
|
|
234
|
+
if (storeEmbeddedState !== EmbeddedState.READY) {
|
|
235
|
+
if (strategy.chainType === ChainTypeEnum.EVM ||
|
|
236
|
+
storeEmbeddedState !== EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED) {
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Skip if we already initialized with the same parameters
|
|
241
|
+
const initKey = { kind: strategy.kind, chainType: strategy.chainType, evmChainId };
|
|
242
|
+
const prev = lastInitRef.current;
|
|
243
|
+
if (prev &&
|
|
244
|
+
prev.kind === initKey.kind &&
|
|
245
|
+
prev.chainType === initKey.chainType &&
|
|
246
|
+
prev.evmChainId === initKey.evmChainId) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
// Prevent concurrent initProvider calls
|
|
250
|
+
if (initInProgressRef.current) {
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
initInProgressRef.current = true;
|
|
254
|
+
let cancelled = false;
|
|
255
|
+
strategy
|
|
256
|
+
.initProvider(openfort, walletConfig, evmChainId)
|
|
257
|
+
.then(() => {
|
|
258
|
+
if (cancelled)
|
|
259
|
+
return;
|
|
260
|
+
lastInitRef.current = initKey;
|
|
261
|
+
// Only fetch accounts when authenticated — avoids SessionError on callback pages
|
|
262
|
+
if (store.getState().embeddedState === EmbeddedState.READY) {
|
|
263
|
+
return fetchEmbeddedAccounts({ silent: true });
|
|
264
|
+
}
|
|
265
|
+
logger.log('[CoreProvider] initProvider: not fetching accounts, state is', EmbeddedState[store.getState().embeddedState]);
|
|
266
|
+
})
|
|
267
|
+
.catch((_err) => { })
|
|
268
|
+
.finally(() => {
|
|
269
|
+
initInProgressRef.current = false;
|
|
270
|
+
});
|
|
271
|
+
return () => {
|
|
272
|
+
cancelled = true;
|
|
273
|
+
lastInitRef.current = null;
|
|
274
|
+
initInProgressRef.current = false;
|
|
275
|
+
};
|
|
276
|
+
}, [openfort, walletConfig, strategy, evmChainId, storeEmbeddedState]);
|
|
277
|
+
// On refresh, embeddedState reaches READY before the user is loaded, so
|
|
278
|
+
// fetchEmbeddedAccounts (called inside initProvider) returns empty. Re-fetch
|
|
279
|
+
// once the user becomes available while still in READY state.
|
|
280
|
+
// returns empty. Re-fetch once user becomes available while already READY.
|
|
281
|
+
useEffect(() => {
|
|
282
|
+
var _a;
|
|
283
|
+
if (!storeUser || storeEmbeddedState !== EmbeddedState.READY)
|
|
284
|
+
return;
|
|
285
|
+
if ((_a = store.getState().embeddedAccounts) === null || _a === void 0 ? void 0 : _a.length)
|
|
286
|
+
return;
|
|
287
|
+
fetchEmbeddedAccounts({ silent: true }).catch(() => { });
|
|
288
|
+
}, [storeUser, storeEmbeddedState, store, fetchEmbeddedAccounts]);
|
|
289
|
+
const { isConnectedWithEmbeddedSigner, setIsConnectedWithEmbeddedSigner, connectingRef } = useEmbeddedStateMachine({
|
|
290
|
+
openfort,
|
|
291
|
+
storeEmbeddedState,
|
|
292
|
+
storeUser,
|
|
293
|
+
store,
|
|
294
|
+
updateUserRef,
|
|
295
|
+
fetchEmbeddedAccountsRef,
|
|
296
|
+
});
|
|
297
|
+
useAutoRecovery({
|
|
298
|
+
storeEmbeddedState,
|
|
299
|
+
storeActiveEmbeddedAddress,
|
|
300
|
+
openfort,
|
|
301
|
+
walletConfig,
|
|
302
|
+
store,
|
|
303
|
+
});
|
|
304
|
+
// Refs for UI state that the bridge-connect guard reads but should NOT trigger re-runs.
|
|
305
|
+
const openRef = useRef(open);
|
|
306
|
+
const routeRef = useRef(route);
|
|
307
|
+
const connectorRef = useRef(connector);
|
|
308
|
+
useLayoutEffect(() => {
|
|
309
|
+
openRef.current = open;
|
|
310
|
+
}, [open]);
|
|
311
|
+
useLayoutEffect(() => {
|
|
312
|
+
routeRef.current = route;
|
|
313
|
+
}, [route]);
|
|
314
|
+
useLayoutEffect(() => {
|
|
315
|
+
connectorRef.current = connector;
|
|
316
|
+
}, [connector]);
|
|
317
|
+
useEffect(() => {
|
|
318
|
+
var _a;
|
|
319
|
+
if (!bridge || address || !storeUser)
|
|
320
|
+
return;
|
|
321
|
+
if (chainType !== ChainTypeEnum.EVM)
|
|
322
|
+
return;
|
|
323
|
+
if (isConnectedWithEmbeddedSigner)
|
|
324
|
+
return;
|
|
325
|
+
if (connectingRef.current)
|
|
326
|
+
return;
|
|
327
|
+
if (storeEmbeddedState !== EmbeddedState.READY)
|
|
328
|
+
return;
|
|
329
|
+
if (bridge.account.connector && bridge.account.connector.id !== embeddedWalletId)
|
|
330
|
+
return;
|
|
331
|
+
const currentRoute = routeRef.current;
|
|
332
|
+
const routeRoute = typeof currentRoute === 'object' && currentRoute && 'route' in currentRoute ? currentRoute.route : currentRoute;
|
|
333
|
+
if (openRef.current &&
|
|
334
|
+
routeRoute === routes.CONNECT &&
|
|
335
|
+
((_a = connectorRef.current) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
336
|
+
connectorRef.current.id !== embeddedWalletId)
|
|
337
|
+
return;
|
|
338
|
+
const openfortConnector = bridge.connectors.find((c) => c.name === 'Openfort');
|
|
339
|
+
if (!openfortConnector)
|
|
340
|
+
return;
|
|
341
|
+
connectingRef.current = true;
|
|
342
|
+
setIsConnectedWithEmbeddedSigner(true);
|
|
343
|
+
bridge.connect({ connector: openfortConnector });
|
|
344
|
+
}, [bridge, address, storeUser, chainType, storeEmbeddedState, isConnectedWithEmbeddedSigner]);
|
|
345
|
+
// ---- Auth functions ----
|
|
346
|
+
const logout = useCallback(async () => {
|
|
347
|
+
if (!openfort)
|
|
348
|
+
return;
|
|
349
|
+
store.getState().setUser(null);
|
|
350
|
+
store.getState().setActiveEmbeddedAddress(undefined);
|
|
351
|
+
store.getState().setEmbeddedAccounts(undefined);
|
|
352
|
+
store.getState().setWalletStatus({ status: 'idle' });
|
|
353
|
+
connectingRef.current = false;
|
|
354
|
+
setIsConnectedWithEmbeddedSigner(false);
|
|
355
|
+
lastInitRef.current = null;
|
|
356
|
+
logger.log('Logging out...');
|
|
357
|
+
await openfort.auth.logout();
|
|
358
|
+
if (bridge) {
|
|
359
|
+
await bridge.disconnect();
|
|
360
|
+
bridge.reset();
|
|
361
|
+
}
|
|
362
|
+
}, [openfort, bridge, store]);
|
|
363
|
+
const signUpGuest = useCallback(async () => {
|
|
364
|
+
if (!openfort)
|
|
365
|
+
return;
|
|
366
|
+
try {
|
|
367
|
+
logger.log('Signing up as guest...');
|
|
368
|
+
const res = await openfort.auth.signUpGuest();
|
|
369
|
+
logger.log('Signed up as guest:', res);
|
|
370
|
+
}
|
|
371
|
+
catch (error) {
|
|
372
|
+
logger.error('Error logging in as guest:', error);
|
|
373
|
+
}
|
|
374
|
+
}, [openfort]);
|
|
375
|
+
// ---- Inject actions into store ----
|
|
376
|
+
useLayoutEffect(() => {
|
|
377
|
+
store.setState({
|
|
378
|
+
logout,
|
|
379
|
+
signUpGuest,
|
|
380
|
+
updateUser,
|
|
381
|
+
updateEmbeddedAccounts: fetchEmbeddedAccounts,
|
|
382
|
+
setChainType,
|
|
383
|
+
});
|
|
384
|
+
}, [store, logout, signUpGuest, updateUser, fetchEmbeddedAccounts, setChainType]);
|
|
385
|
+
return createElement(StoreContext.Provider, { value: store }, createElement(ConnectionStrategyProvider, { strategy }, createElement(Fragment, null, createElement(ConnectLifecycleEffect, { onConnect, onDisconnect }), children)));
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
export { CoreOpenfortProvider };
|
|
389
|
+
//# sourceMappingURL=CoreOpenfortProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreOpenfortProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { User } from '@openfort/openfort-js';
|
|
2
|
-
export type
|
|
2
|
+
export type ConnectCallbackProps = {
|
|
3
3
|
onConnect?: ({ address, connectorId, user }: {
|
|
4
4
|
address?: string;
|
|
5
5
|
connectorId?: string;
|
|
@@ -7,4 +7,4 @@ export type useConnectCallbackProps = {
|
|
|
7
7
|
}) => void;
|
|
8
8
|
onDisconnect?: () => void;
|
|
9
9
|
};
|
|
10
|
-
export
|
|
10
|
+
export type useConnectCallbackProps = ConnectCallbackProps;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { StoreApi } from 'zustand';
|
|
2
|
+
import type { OpenfortStore } from './store';
|
|
3
|
+
export declare const StoreContext: import("react").Context<StoreApi<OpenfortStore> | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -17,6 +17,7 @@ import { Openfort as OpenfortClient, type OpenfortSDKConfiguration } from '@open
|
|
|
17
17
|
export declare function createOpenfortClient(config: OpenfortSDKConfiguration): OpenfortClient;
|
|
18
18
|
/**
|
|
19
19
|
* Sets the shared {@link OpenfortClient} instance.
|
|
20
|
+
* Kept for backwards compatibility; the client is provided via React context.
|
|
20
21
|
*
|
|
21
22
|
* @param client - Pre-configured Openfort client to store as the default.
|
|
22
23
|
*
|
|
@@ -26,4 +27,4 @@ export declare function createOpenfortClient(config: OpenfortSDKConfiguration):
|
|
|
26
27
|
* setDefaultClient(client);
|
|
27
28
|
* ```
|
|
28
29
|
*/
|
|
29
|
-
export declare function setDefaultClient(
|
|
30
|
+
export declare function setDefaultClient(_client: OpenfortClient): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Openfort } from '@openfort/openfort-js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a new {@link OpenfortClient} instance.
|
|
5
|
+
*
|
|
6
|
+
* @param config - Configuration options passed directly to the Openfort SDK constructor.
|
|
7
|
+
* @returns A configured Openfort client instance.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const client = createOpenfortClient({
|
|
12
|
+
* baseConfiguration: { publishableKey: 'pk_test_123' },
|
|
13
|
+
* });
|
|
14
|
+
*
|
|
15
|
+
* const token = await client.getAccessToken();
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
function createOpenfortClient(config) {
|
|
19
|
+
return new Openfort(config);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { createOpenfortClient };
|
|
23
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ChainTypeEnum, type Openfort } from '@openfort/openfort-js';
|
|
2
|
+
import type { StoreApi } from 'zustand/vanilla';
|
|
3
|
+
import type { OpenfortStore } from '../store';
|
|
4
|
+
type Params = {
|
|
5
|
+
openfort: Openfort;
|
|
6
|
+
storeEmbeddedAccounts: OpenfortStore['embeddedAccounts'];
|
|
7
|
+
storeEmbeddedState: OpenfortStore['embeddedState'];
|
|
8
|
+
storeActiveEmbeddedAddress: OpenfortStore['activeEmbeddedAddress'];
|
|
9
|
+
chainType: ChainTypeEnum;
|
|
10
|
+
store: StoreApi<OpenfortStore>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Syncs the active embedded address into the store.
|
|
14
|
+
*
|
|
15
|
+
* - Clears address when there are no accounts or user is logged out.
|
|
16
|
+
* - When READY: asks the SDK for its active wallet, falls back to the first
|
|
17
|
+
* account for the current chain.
|
|
18
|
+
*/
|
|
19
|
+
export declare function useActiveAddressSync({ openfort, storeEmbeddedAccounts, storeEmbeddedState, storeActiveEmbeddedAddress, chainType, store, }: Params): void;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { EmbeddedState } from '@openfort/openfort-js';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { firstEmbeddedAddress } from '../../core/strategyUtils.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Syncs the active embedded address into the store.
|
|
7
|
+
*
|
|
8
|
+
* - Clears address when there are no accounts or user is logged out.
|
|
9
|
+
* - When READY: asks the SDK for its active wallet, falls back to the first
|
|
10
|
+
* account for the current chain.
|
|
11
|
+
*/
|
|
12
|
+
function useActiveAddressSync({ openfort, storeEmbeddedAccounts, storeEmbeddedState, storeActiveEmbeddedAddress, chainType, store, }) {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!openfort || !(storeEmbeddedAccounts === null || storeEmbeddedAccounts === void 0 ? void 0 : storeEmbeddedAccounts.length)) {
|
|
15
|
+
if (!(storeEmbeddedAccounts === null || storeEmbeddedAccounts === void 0 ? void 0 : storeEmbeddedAccounts.length)) {
|
|
16
|
+
store.getState().setActiveEmbeddedAddress(undefined);
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
// Terminal non-READY states: clear only on genuine logout (no user).
|
|
21
|
+
// During OAuth the state passes through UNAUTHENTICATED → EMBEDDED_SIGNER_NOT_CONFIGURED → READY
|
|
22
|
+
// while accounts and address are already set. Clearing here would undo that.
|
|
23
|
+
if (storeEmbeddedState === EmbeddedState.UNAUTHENTICATED || storeEmbeddedState === EmbeddedState.NONE) {
|
|
24
|
+
if (!store.getState().user) {
|
|
25
|
+
store.getState().setActiveEmbeddedAddress(undefined);
|
|
26
|
+
}
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Bootstrap recovery: when signer is not yet configured and no address is set,
|
|
30
|
+
// seed the active address so useAutoRecovery can trigger and drive state → READY.
|
|
31
|
+
if (storeEmbeddedState === EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED) {
|
|
32
|
+
if (storeActiveEmbeddedAddress === undefined) {
|
|
33
|
+
const first = firstEmbeddedAddress(storeEmbeddedAccounts, chainType);
|
|
34
|
+
if (first)
|
|
35
|
+
store.getState().setActiveEmbeddedAddress(first);
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (storeEmbeddedState !== EmbeddedState.READY) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// Already have an address — nothing to resolve
|
|
43
|
+
if (storeActiveEmbeddedAddress !== undefined)
|
|
44
|
+
return;
|
|
45
|
+
// Priority 1: ask the SDK for its active wallet
|
|
46
|
+
let cancelled = false;
|
|
47
|
+
openfort.embeddedWallet
|
|
48
|
+
.get()
|
|
49
|
+
.then((active) => {
|
|
50
|
+
if (cancelled)
|
|
51
|
+
return;
|
|
52
|
+
const addr = active === null || active === void 0 ? void 0 : active.address;
|
|
53
|
+
if (addr) {
|
|
54
|
+
store.getState().setActiveEmbeddedAddress(addr);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// Priority 2: fallback to first account for current chain
|
|
58
|
+
const first = firstEmbeddedAddress(storeEmbeddedAccounts, chainType);
|
|
59
|
+
if (first)
|
|
60
|
+
store.getState().setActiveEmbeddedAddress(first);
|
|
61
|
+
})
|
|
62
|
+
.catch((_err) => {
|
|
63
|
+
if (cancelled)
|
|
64
|
+
return;
|
|
65
|
+
const first = firstEmbeddedAddress(storeEmbeddedAccounts, chainType);
|
|
66
|
+
if (first)
|
|
67
|
+
store.getState().setActiveEmbeddedAddress(first);
|
|
68
|
+
});
|
|
69
|
+
return () => {
|
|
70
|
+
cancelled = true;
|
|
71
|
+
};
|
|
72
|
+
}, [openfort, storeEmbeddedAccounts, storeEmbeddedState, storeActiveEmbeddedAddress, chainType, store]);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { useActiveAddressSync };
|
|
76
|
+
//# sourceMappingURL=useActiveAddressSync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useActiveAddressSync.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Openfort } from '@openfort/openfort-js';
|
|
2
|
+
import type { StoreApi } from 'zustand/vanilla';
|
|
3
|
+
import type { OpenfortWalletConfig } from '../../components/Openfort/types';
|
|
4
|
+
import type { OpenfortStore } from '../store';
|
|
5
|
+
type Params = {
|
|
6
|
+
storeEmbeddedState: OpenfortStore['embeddedState'];
|
|
7
|
+
storeActiveEmbeddedAddress: OpenfortStore['activeEmbeddedAddress'];
|
|
8
|
+
openfort: Openfort | null;
|
|
9
|
+
walletConfig: OpenfortWalletConfig | undefined;
|
|
10
|
+
store: StoreApi<OpenfortStore>;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Auto-recover: when the SDK reaches EMBEDDED_SIGNER_NOT_CONFIGURED with a known
|
|
14
|
+
* active address, attempts to configure the signer via recover() → READY.
|
|
15
|
+
*
|
|
16
|
+
* Reads embeddedAccounts imperatively from the store (not as a dep) so that
|
|
17
|
+
* fetchEmbeddedAccounts updating the store mid-recovery does not re-trigger the
|
|
18
|
+
* effect and cancel the closure before recover() runs.
|
|
19
|
+
*
|
|
20
|
+
* PASSWORD recovery is skipped — it requires explicit user input.
|
|
21
|
+
*
|
|
22
|
+
* On failure: surfaces recoveryError in the store. Does NOT auto-create a new wallet
|
|
23
|
+
* because silently replacing a wallet can strand the user's funds.
|
|
24
|
+
*/
|
|
25
|
+
export declare function useAutoRecovery({ storeEmbeddedState, storeActiveEmbeddedAddress, openfort, walletConfig, store, }: Params): void;
|
|
26
|
+
export {};
|