@openfort/react 0.3.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/browsers.js +13 -0
- package/build/assets/browsers.js.map +1 -0
- package/build/assets/chains.js +139 -0
- package/build/assets/chains.js.map +1 -0
- package/build/assets/icons.js +41 -0
- package/build/assets/icons.js.map +1 -0
- package/build/assets/logos.js +173 -0
- package/build/assets/logos.js.map +1 -0
- package/build/assets/wave.js +6 -0
- package/build/assets/wave.js.map +1 -0
- package/build/components/BalanceButton/index.js +89 -0
- package/build/components/BalanceButton/index.js.map +1 -0
- package/build/components/Common/Alert/index.js +10 -0
- package/build/components/Common/Alert/index.js.map +1 -0
- package/build/components/Common/Alert/styles.js +55 -0
- package/build/components/Common/Alert/styles.js.map +1 -0
- package/build/components/Common/Avatar/index.d.ts +11 -3
- package/build/components/Common/Avatar/index.js +100 -0
- package/build/components/Common/Avatar/index.js.map +1 -0
- package/build/components/Common/Avatar/styles.js +59 -0
- package/build/components/Common/Avatar/styles.js.map +1 -0
- package/build/components/Common/BrowserIcon/index.js +28 -0
- package/build/components/Common/BrowserIcon/index.js.map +1 -0
- package/build/components/Common/BrowserIcon/styles.js +20 -0
- package/build/components/Common/BrowserIcon/styles.js.map +1 -0
- package/build/components/Common/Button/index.js +36 -0
- package/build/components/Common/Button/index.js.map +1 -0
- package/build/components/Common/Button/styles.js +302 -0
- package/build/components/Common/Button/styles.js.map +1 -0
- package/build/components/Common/Button/types.d.ts +1 -0
- package/build/components/Common/Chain/index.d.ts +8 -0
- package/build/components/Common/Chain/index.js +38 -0
- package/build/components/Common/Chain/index.js.map +1 -0
- package/build/components/Common/Chain/styles.js +94 -0
- package/build/components/Common/Chain/styles.js.map +1 -0
- package/build/components/Common/ConnectorList/index.js +58 -0
- package/build/components/Common/ConnectorList/index.js.map +1 -0
- package/build/components/Common/ConnectorList/styles.js +324 -0
- package/build/components/Common/ConnectorList/styles.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyButton.js +12 -0
- package/build/components/Common/CopyToClipboard/CopyButton.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyIcon.js +76 -0
- package/build/components/Common/CopyToClipboard/CopyIcon.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyIconButton.js +38 -0
- package/build/components/Common/CopyToClipboard/CopyIconButton.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyText.js +26 -0
- package/build/components/Common/CopyToClipboard/CopyText.js.map +1 -0
- package/build/components/Common/CustomQRCode/QRCode.js +60 -0
- package/build/components/Common/CustomQRCode/QRCode.js.map +1 -0
- package/build/components/Common/CustomQRCode/index.js +22 -0
- package/build/components/Common/CustomQRCode/index.js.map +1 -0
- package/build/components/Common/CustomQRCode/styles.js +155 -0
- package/build/components/Common/CustomQRCode/styles.js.map +1 -0
- package/build/components/Common/FitText/index.js +28 -0
- package/build/components/Common/FitText/index.js.map +1 -0
- package/build/components/Common/Input/index.js +17 -0
- package/build/components/Common/Input/index.js.map +1 -0
- package/build/components/Common/Input/styles.js +53 -0
- package/build/components/Common/Input/styles.js.map +1 -0
- package/build/components/Common/LargeButton/index.js +10 -0
- package/build/components/Common/LargeButton/index.js.map +1 -0
- package/build/components/Common/LargeButton/styles.js +69 -0
- package/build/components/Common/LargeButton/styles.js.map +1 -0
- package/build/components/Common/Loading/index.js +96 -0
- package/build/components/Common/Loading/index.js.map +1 -0
- package/build/components/Common/Modal/index.js +272 -0
- package/build/components/Common/Modal/index.js.map +1 -0
- package/build/components/Common/Modal/styles.d.ts +0 -1
- package/build/components/Common/Modal/styles.js +657 -0
- package/build/components/Common/Modal/styles.js.map +1 -0
- package/build/components/Common/OTPInput/index.js +108 -0
- package/build/components/Common/OTPInput/index.js.map +1 -0
- package/build/components/Common/OTPInput/styles.js +153 -0
- package/build/components/Common/OTPInput/styles.js.map +1 -0
- package/build/components/Common/Portal/index.js +31 -0
- package/build/components/Common/Portal/index.js.map +1 -0
- package/build/components/Common/PoweredByFooter/index.js +103 -0
- package/build/components/Common/PoweredByFooter/index.js.map +1 -0
- package/build/components/Common/Providers/ProviderHeader.d.ts +2 -2
- package/build/components/Common/Providers/ProviderHeader.js +55 -0
- package/build/components/Common/Providers/ProviderHeader.js.map +1 -0
- package/build/components/Common/Providers/ProviderIcon.d.ts +2 -2
- package/build/components/Common/Providers/ProviderIcon.js +41 -0
- package/build/components/Common/Providers/ProviderIcon.js.map +1 -0
- package/build/components/Common/Providers/getProviderName.d.ts +1 -1
- package/build/components/Common/Providers/getProviderName.js +15 -0
- package/build/components/Common/Providers/getProviderName.js.map +1 -0
- package/build/components/Common/ScrollArea/index.js +58 -0
- package/build/components/Common/ScrollArea/index.js.map +1 -0
- package/build/components/Common/ScrollArea/styles.js +168 -0
- package/build/components/Common/ScrollArea/styles.js.map +1 -0
- package/build/components/Common/Spinner/index.js +24 -0
- package/build/components/Common/Spinner/index.js.map +1 -0
- package/build/components/Common/Spinner/styles.js +22 -0
- package/build/components/Common/Spinner/styles.js.map +1 -0
- package/build/components/Common/SquircleSpinner/index.js +15 -0
- package/build/components/Common/SquircleSpinner/index.js.map +1 -0
- package/build/components/Common/SquircleSpinner/styles.js +66 -0
- package/build/components/Common/SquircleSpinner/styles.js.map +1 -0
- package/build/components/Common/ThemedButton/index.js +25 -0
- package/build/components/Common/ThemedButton/index.js.map +1 -0
- package/build/components/Common/ThemedButton/styles.js +152 -0
- package/build/components/Common/ThemedButton/styles.js.map +1 -0
- package/build/components/Common/TickList/index.js +11 -0
- package/build/components/Common/TickList/index.js.map +1 -0
- package/build/components/Common/TickList/styles.js +28 -0
- package/build/components/Common/TickList/styles.js.map +1 -0
- package/build/components/Common/Tooltip/index.js +91 -0
- package/build/components/Common/Tooltip/index.js.map +1 -0
- package/build/components/Common/Tooltip/styles.js +81 -0
- package/build/components/Common/Tooltip/styles.js.map +1 -0
- package/build/components/Common/WalletRecoveryIcon/index.d.ts +4 -0
- package/build/components/Common/WalletRecoveryIcon/index.js +19 -0
- package/build/components/Common/WalletRecoveryIcon/index.js.map +1 -0
- package/build/components/ConnectButton/index.d.ts +12 -4
- package/build/components/ConnectButton/index.js +266 -0
- package/build/components/ConnectButton/index.js.map +1 -0
- package/build/components/ConnectButton/styles.js +50 -0
- package/build/components/ConnectButton/styles.js.map +1 -0
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.js +20 -0
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.js.map +1 -0
- package/build/components/ConnectModal/ConnectUsing.d.ts +1 -1
- package/build/components/ConnectModal/ConnectUsing.js +68 -0
- package/build/components/ConnectModal/ConnectUsing.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.js +17 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/styles.js +118 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/styles.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/index.d.ts +0 -2
- package/build/components/ConnectModal/ConnectWithInjector/index.js +295 -0
- package/build/components/ConnectModal/ConnectWithInjector/index.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/styles.js +133 -0
- package/build/components/ConnectModal/ConnectWithInjector/styles.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithMobile.js +99 -0
- package/build/components/ConnectModal/ConnectWithMobile.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithOAuth.js +128 -0
- package/build/components/ConnectModal/ConnectWithOAuth.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithQRCode.js +78 -0
- package/build/components/ConnectModal/ConnectWithQRCode.js.map +1 -0
- package/build/components/ConnectModal/index.js +230 -0
- package/build/components/ConnectModal/index.js.map +1 -0
- package/build/components/FloatingGraphic/index.js +13 -0
- package/build/components/FloatingGraphic/index.js.map +1 -0
- package/build/components/FloatingGraphic/styles.js +175 -0
- package/build/components/FloatingGraphic/styles.js.map +1 -0
- package/build/components/Openfort/OpenfortProvider.d.ts +10 -25
- package/build/components/Openfort/OpenfortProvider.js +351 -0
- package/build/components/Openfort/OpenfortProvider.js.map +1 -0
- package/build/components/Openfort/context.d.ts +48 -5
- package/build/components/Openfort/context.js +7 -0
- package/build/components/Openfort/context.js.map +1 -0
- package/build/components/Openfort/routeHelpers.d.ts +5 -0
- package/build/components/Openfort/routeHelpers.js +20 -0
- package/build/components/Openfort/routeHelpers.js.map +1 -0
- package/build/components/Openfort/types.d.ts +57 -23
- package/build/components/Openfort/types.js +119 -0
- package/build/components/Openfort/types.js.map +1 -0
- package/build/components/Openfort/useOpenfort.d.ts +2 -0
- package/build/components/Openfort/useOpenfort.js +12 -0
- package/build/components/Openfort/useOpenfort.js.map +1 -0
- package/build/components/PageContent/index.js +55 -0
- package/build/components/PageContent/index.js.map +1 -0
- package/build/components/PageContent/styles.js +11 -0
- package/build/components/PageContent/styles.js.map +1 -0
- package/build/components/Pages/About/graphics.js +193 -0
- package/build/components/Pages/About/graphics.js.map +1 -0
- package/build/components/Pages/About/index.js +142 -0
- package/build/components/Pages/About/index.js.map +1 -0
- package/build/components/Pages/About/styles.js +142 -0
- package/build/components/Pages/About/styles.js.map +1 -0
- package/build/components/Pages/AssetInventory/index.js +66 -0
- package/build/components/Pages/AssetInventory/index.js.map +1 -0
- package/build/components/Pages/Buy/coinbaseApi.js +106 -0
- package/build/components/Pages/Buy/coinbaseApi.js.map +1 -0
- package/build/components/Pages/Buy/index.js +88 -0
- package/build/components/Pages/Buy/index.js.map +1 -0
- package/build/components/Pages/Buy/onrampApi.js +57 -0
- package/build/components/Pages/Buy/onrampApi.js.map +1 -0
- package/build/components/Pages/Buy/providers.js +39 -0
- package/build/components/Pages/Buy/providers.js.map +1 -0
- package/build/components/Pages/Buy/stripeApi.js +74 -0
- package/build/components/Pages/Buy/stripeApi.js.map +1 -0
- package/build/components/Pages/Buy/styles.js +230 -0
- package/build/components/Pages/Buy/styles.js.map +1 -0
- package/build/components/Pages/Buy/utils.js +71 -0
- package/build/components/Pages/Buy/utils.js.map +1 -0
- package/build/components/Pages/BuyComplete/index.js +47 -0
- package/build/components/Pages/BuyComplete/index.js.map +1 -0
- package/build/components/Pages/BuyProcessing/index.js +231 -0
- package/build/components/Pages/BuyProcessing/index.js.map +1 -0
- package/build/components/Pages/BuyProviderSelect/index.js +55 -0
- package/build/components/Pages/BuyProviderSelect/index.js.map +1 -0
- package/build/components/Pages/BuyProviderSelect/styles.js +103 -0
- package/build/components/Pages/BuyProviderSelect/styles.js.map +1 -0
- package/build/components/Pages/BuySelectProvider/index.js +245 -0
- package/build/components/Pages/BuySelectProvider/index.js.map +1 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.d.ts +22 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.js +11 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.js.map +1 -0
- package/build/components/Pages/Connected/EthereumConnected.d.ts +3 -0
- package/build/components/Pages/Connected/EthereumConnected.js +133 -0
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -0
- package/build/components/Pages/Connected/SolanaConnected.d.ts +3 -0
- package/build/components/Pages/Connected/SolanaConnected.js +96 -0
- package/build/components/Pages/Connected/SolanaConnected.js.map +1 -0
- package/build/components/Pages/Connected/index.d.ts +2 -2
- package/build/components/Pages/Connected/index.js +18 -0
- package/build/components/Pages/Connected/index.js.map +1 -0
- package/build/components/Pages/Connected/styles.js +122 -0
- package/build/components/Pages/Connected/styles.js.map +1 -0
- package/build/components/Pages/ConnectedSuccess/index.js +19 -0
- package/build/components/Pages/ConnectedSuccess/index.js.map +1 -0
- package/build/components/Pages/Connectors/index.js +73 -0
- package/build/components/Pages/Connectors/index.js.map +1 -0
- package/build/components/Pages/CreateGuestUserPage/index.js +28 -0
- package/build/components/Pages/CreateGuestUserPage/index.js.map +1 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.d.ts +6 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.js +241 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.js.map +1 -0
- package/build/components/Pages/CreateWallet/index.js +303 -0
- package/build/components/Pages/CreateWallet/index.js.map +1 -0
- package/build/components/Pages/CreateWallet/styles.js +17 -0
- package/build/components/Pages/CreateWallet/styles.js.map +1 -0
- package/build/components/Pages/DownloadApp/index.js +32 -0
- package/build/components/Pages/DownloadApp/index.js.map +1 -0
- package/build/components/Pages/EmailLogin/index.js +118 -0
- package/build/components/Pages/EmailLogin/index.js.map +1 -0
- package/build/components/Pages/EmailLogin/styles.js +24 -0
- package/build/components/Pages/EmailLogin/styles.js.map +1 -0
- package/build/components/Pages/EmailOTP/index.js +116 -0
- package/build/components/Pages/EmailOTP/index.js.map +1 -0
- package/build/components/Pages/EmailOTP/styles.js +38 -0
- package/build/components/Pages/EmailOTP/styles.js.map +1 -0
- package/build/components/Pages/EmailVerification/index.js +86 -0
- package/build/components/Pages/EmailVerification/index.js.map +1 -0
- package/build/components/Pages/ExportKey/index.js +44 -0
- package/build/components/Pages/ExportKey/index.js.map +1 -0
- package/build/components/Pages/ForgotPassword/index.js +129 -0
- package/build/components/Pages/ForgotPassword/index.js.map +1 -0
- package/build/components/Pages/LinkEmail/index.js +63 -0
- package/build/components/Pages/LinkEmail/index.js.map +1 -0
- package/build/components/Pages/LinkedProvider/index.d.ts +3 -0
- package/build/components/Pages/LinkedProvider/index.js +90 -0
- package/build/components/Pages/LinkedProvider/index.js.map +1 -0
- package/build/components/Pages/LinkedProviders/index.js +45 -0
- package/build/components/Pages/LinkedProviders/index.js.map +1 -0
- package/build/components/Pages/LinkedProviders/styles.js +51 -0
- package/build/components/Pages/LinkedProviders/styles.js.map +1 -0
- package/build/components/Pages/LoadWallets/index.js +91 -0
- package/build/components/Pages/LoadWallets/index.js.map +1 -0
- package/build/components/Pages/Loading/index.js +61 -0
- package/build/components/Pages/Loading/index.js.map +1 -0
- package/build/components/Pages/MobileConnectors/index.js +71 -0
- package/build/components/Pages/MobileConnectors/index.js.map +1 -0
- package/build/components/Pages/MobileConnectors/styles.js +65 -0
- package/build/components/Pages/MobileConnectors/styles.js.map +1 -0
- package/build/components/Pages/NoAssetsAvailable/index.js +45 -0
- package/build/components/Pages/NoAssetsAvailable/index.js.map +1 -0
- package/build/components/Pages/NoAssetsAvailable/styles.js +10 -0
- package/build/components/Pages/NoAssetsAvailable/styles.js.map +1 -0
- package/build/components/Pages/Onboarding/index.js +20 -0
- package/build/components/Pages/Onboarding/index.js.map +1 -0
- package/build/components/Pages/PhoneOTP/index.js +128 -0
- package/build/components/Pages/PhoneOTP/index.js.map +1 -0
- package/build/components/Pages/PhoneOTP/styles.js +38 -0
- package/build/components/Pages/PhoneOTP/styles.js.map +1 -0
- package/build/components/Pages/Profile/index.js +35 -0
- package/build/components/Pages/Profile/index.js.map +1 -0
- package/build/components/Pages/Providers/index.js +157 -0
- package/build/components/Pages/Providers/index.js.map +1 -0
- package/build/components/Pages/Providers/styles.js +156 -0
- package/build/components/Pages/Providers/styles.js.map +1 -0
- package/build/components/Pages/Receive/index.js +61 -0
- package/build/components/Pages/Receive/index.js.map +1 -0
- package/build/components/Pages/Receive/styles.d.ts +1 -0
- package/build/components/Pages/Receive/styles.js +52 -0
- package/build/components/Pages/Receive/styles.js.map +1 -0
- package/build/components/Pages/Recover/index.js +252 -0
- package/build/components/Pages/Recover/index.js.map +1 -0
- package/build/components/Pages/Recover/recoveryRegistry.d.ts +32 -0
- package/build/components/Pages/Recover/recoveryRegistry.js +61 -0
- package/build/components/Pages/Recover/recoveryRegistry.js.map +1 -0
- package/build/components/Pages/RemoveLinkedProvider/index.js +104 -0
- package/build/components/Pages/RemoveLinkedProvider/index.js.map +1 -0
- package/build/components/Pages/SelectToken/index.js +102 -0
- package/build/components/Pages/SelectToken/index.js.map +1 -0
- package/build/components/Pages/SelectToken/styles.js +78 -0
- package/build/components/Pages/SelectToken/styles.js.map +1 -0
- package/build/components/Pages/SelectWalletToRecover/index.d.ts +1 -2
- package/build/components/Pages/SelectWalletToRecover/index.js +70 -0
- package/build/components/Pages/SelectWalletToRecover/index.js.map +1 -0
- package/build/components/Pages/Send/EthereumSend.d.ts +1 -0
- package/build/components/Pages/Send/EthereumSend.js +88 -0
- package/build/components/Pages/Send/EthereumSend.js.map +1 -0
- package/build/components/Pages/Send/SolanaSend.d.ts +1 -0
- package/build/components/Pages/Send/SolanaSend.js +93 -0
- package/build/components/Pages/Send/SolanaSend.js.map +1 -0
- package/build/components/Pages/Send/index.d.ts +7 -1
- package/build/components/Pages/Send/index.js +18 -0
- package/build/components/Pages/Send/index.js.map +1 -0
- package/build/components/Pages/Send/styles.js +112 -0
- package/build/components/Pages/Send/styles.js.map +1 -0
- package/build/components/Pages/Send/utils.d.ts +1 -1
- package/build/components/Pages/Send/utils.js +63 -0
- package/build/components/Pages/Send/utils.js.map +1 -0
- package/build/components/Pages/SendConfirmation/EstimatedFees.js +66 -0
- package/build/components/Pages/SendConfirmation/EstimatedFees.js.map +1 -0
- package/build/components/Pages/SendConfirmation/index.js +331 -0
- package/build/components/Pages/SendConfirmation/index.js.map +1 -0
- package/build/components/Pages/SendConfirmation/styles.js +129 -0
- package/build/components/Pages/SendConfirmation/styles.js.map +1 -0
- package/build/components/Pages/SocialProviders/index.js +15 -0
- package/build/components/Pages/SocialProviders/index.js.map +1 -0
- package/build/components/Pages/SolanaSendConfirmation/index.d.ts +1 -0
- package/build/components/Pages/SolanaSendConfirmation/index.js +152 -0
- package/build/components/Pages/SolanaSendConfirmation/index.js.map +1 -0
- package/build/components/Pages/SolanaWallets/index.d.ts +1 -0
- package/build/components/Pages/SolanaWallets/index.js +36 -0
- package/build/components/Pages/SolanaWallets/index.js.map +1 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.js +62 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.js.map +1 -0
- package/build/components/PasswordStrength/password-utility.js +128 -0
- package/build/components/PasswordStrength/password-utility.js.map +1 -0
- package/build/constants/chainConfigs.js +316 -0
- package/build/constants/chainConfigs.js.map +1 -0
- package/build/constants/defaultTheme.js +6 -0
- package/build/constants/defaultTheme.js.map +1 -0
- package/build/constants/openfort.d.ts +4 -0
- package/build/constants/openfort.js +8 -0
- package/build/constants/openfort.js.map +1 -0
- package/build/core/ConnectionStrategy.d.ts +31 -0
- package/build/core/ConnectionStrategy.js +9 -0
- package/build/core/ConnectionStrategy.js.map +1 -0
- package/build/core/ConnectionStrategyContext.d.ts +16 -0
- package/build/core/ConnectionStrategyContext.js +22 -0
- package/build/core/ConnectionStrategyContext.js.map +1 -0
- package/build/core/errors.d.ts +1 -0
- package/build/core/strategies/EthereumBridgeStrategy.d.ts +11 -0
- package/build/core/strategies/EthereumBridgeStrategy.js +83 -0
- package/build/core/strategies/EthereumBridgeStrategy.js.map +1 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.d.ts +8 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.js +85 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.js.map +1 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.d.ts +9 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.js +53 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.js.map +1 -0
- package/build/core/strategyUtils.d.ts +6 -0
- package/build/core/strategyUtils.js +31 -0
- package/build/core/strategyUtils.js.map +1 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.d.ts +87 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.js +18 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.js.map +1 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.d.ts +14 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.js +24 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.js.map +1 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.d.ts +17 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js +425 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js.map +1 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.d.ts +29 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.js +204 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.js.map +1 -0
- package/build/ethereum/index.d.ts +11 -0
- package/build/ethereum/index.js +3 -0
- package/build/ethereum/index.js.map +1 -0
- package/build/ethereum/types.d.ts +140 -0
- package/build/hooks/openfort/auth/requestEmailVerification.js +21 -0
- package/build/hooks/openfort/auth/requestEmailVerification.js.map +1 -0
- package/build/hooks/openfort/auth/status.js +11 -0
- package/build/hooks/openfort/auth/status.js.map +1 -0
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +2 -1
- package/build/hooks/openfort/auth/useAuthCallback.js +197 -0
- package/build/hooks/openfort/auth/useAuthCallback.js.map +1 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.d.ts +2 -2
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js +161 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useEmailAuth.js +496 -0
- package/build/hooks/openfort/auth/useEmailAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useEmailOtpAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useEmailOtpAuth.js +151 -0
- package/build/hooks/openfort/auth/useEmailOtpAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useGuestAuth.js +142 -0
- package/build/hooks/openfort/auth/useGuestAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useOAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useOAuth.js +217 -0
- package/build/hooks/openfort/auth/useOAuth.js.map +1 -0
- package/build/hooks/openfort/auth/usePhoneOtpAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/usePhoneOtpAuth.js +174 -0
- package/build/hooks/openfort/auth/usePhoneOtpAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useSignOut.d.ts +2 -1
- package/build/hooks/openfort/auth/useSignOut.js +104 -0
- package/build/hooks/openfort/auth/useSignOut.js.map +1 -0
- package/build/hooks/openfort/hookConsistency.js +17 -0
- package/build/hooks/openfort/hookConsistency.js.map +1 -0
- package/build/hooks/openfort/use7702Authorization.js +73 -0
- package/build/hooks/openfort/use7702Authorization.js.map +1 -0
- package/build/hooks/openfort/useGrantPermissions.d.ts +7 -76
- package/build/hooks/openfort/useGrantPermissions.js +221 -0
- package/build/hooks/openfort/useGrantPermissions.js.map +1 -0
- package/build/hooks/openfort/useProviders.js +75 -0
- package/build/hooks/openfort/useProviders.js.map +1 -0
- package/build/hooks/openfort/useRevokePermissions.d.ts +2 -1
- package/build/hooks/openfort/useRevokePermissions.js +126 -0
- package/build/hooks/openfort/useRevokePermissions.js.map +1 -0
- package/build/hooks/openfort/useUI.d.ts +4 -45
- package/build/hooks/openfort/useUI.js +122 -0
- package/build/hooks/openfort/useUI.js.map +1 -0
- package/build/hooks/openfort/useUser.d.ts +12 -35
- package/build/hooks/openfort/useUser.js +61 -0
- package/build/hooks/openfort/useUser.js.map +1 -0
- package/build/hooks/openfort/walletTypes.d.ts +32 -0
- package/build/hooks/openfort/walletTypes.js +53 -0
- package/build/hooks/openfort/walletTypes.js.map +1 -0
- package/build/hooks/useBalance.d.ts +50 -0
- package/build/hooks/useBalance.js +80 -0
- package/build/hooks/useBalance.js.map +1 -0
- package/build/hooks/useConnectLifecycle.d.ts +7 -0
- package/build/hooks/useConnectLifecycle.js +43 -0
- package/build/hooks/useConnectLifecycle.js.map +1 -0
- package/build/hooks/useConnectors.d.ts +3 -5
- package/build/hooks/useConnectors.js +26 -0
- package/build/hooks/useConnectors.js.map +1 -0
- package/build/hooks/useCopyToClipboard.js +29 -0
- package/build/hooks/useCopyToClipboard.js.map +1 -0
- package/build/hooks/useFitText.js +125 -0
- package/build/hooks/useFitText.js.map +1 -0
- package/build/hooks/useFocusTrap.d.ts +4 -1
- package/build/hooks/useFocusTrap.js +60 -0
- package/build/hooks/useFocusTrap.js.map +1 -0
- package/build/hooks/useGoogleFont.js +43 -0
- package/build/hooks/useGoogleFont.js.map +1 -0
- package/build/hooks/useIsMobile.js +17 -0
- package/build/hooks/useIsMobile.js.map +1 -0
- package/build/hooks/useIsMounted.js +10 -0
- package/build/hooks/useIsMounted.js.map +1 -0
- package/build/hooks/useLastConnector.js +39 -0
- package/build/hooks/useLastConnector.js.map +1 -0
- package/build/hooks/useLocales.d.ts +1 -1
- package/build/hooks/useLocales.js +68 -0
- package/build/hooks/useLocales.js.map +1 -0
- package/build/hooks/useLockBodyScroll.js +53 -0
- package/build/hooks/useLockBodyScroll.js.map +1 -0
- package/build/hooks/usePrevious.js +14 -0
- package/build/hooks/usePrevious.js.map +1 -0
- package/build/hooks/useResolvedIdentity.d.ts +70 -0
- package/build/hooks/useResolvedIdentity.js +90 -0
- package/build/hooks/useResolvedIdentity.js.map +1 -0
- package/build/hooks/useRouteProps.d.ts +10 -5
- package/build/hooks/useRouteProps.js +27 -0
- package/build/hooks/useRouteProps.js.map +1 -0
- package/build/hooks/useWalletConnectModal.js +59 -0
- package/build/hooks/useWalletConnectModal.js.map +1 -0
- package/build/hooks/useWindowSize.js +23 -0
- package/build/hooks/useWindowSize.js.map +1 -0
- package/build/index.d.ts +61 -16
- package/build/index.js +31 -0
- package/build/index.js.map +1 -0
- package/build/localizations/index.js +57 -0
- package/build/localizations/index.js.map +1 -0
- package/build/localizations/locales/ar-AE.js +100 -0
- package/build/localizations/locales/ar-AE.js.map +1 -0
- package/build/localizations/locales/ca-AD.js +98 -0
- package/build/localizations/locales/ca-AD.js.map +1 -0
- package/build/localizations/locales/ee-EE.js +98 -0
- package/build/localizations/locales/ee-EE.js.map +1 -0
- package/build/localizations/locales/en-US.js +115 -0
- package/build/localizations/locales/en-US.js.map +1 -0
- package/build/localizations/locales/es-ES.js +98 -0
- package/build/localizations/locales/es-ES.js.map +1 -0
- package/build/localizations/locales/fa-IR.js +98 -0
- package/build/localizations/locales/fa-IR.js.map +1 -0
- package/build/localizations/locales/fr-FR.js +98 -0
- package/build/localizations/locales/fr-FR.js.map +1 -0
- package/build/localizations/locales/ja-JP.js +98 -0
- package/build/localizations/locales/ja-JP.js.map +1 -0
- package/build/localizations/locales/pt-BR.js +98 -0
- package/build/localizations/locales/pt-BR.js.map +1 -0
- package/build/localizations/locales/ru-RU.js +98 -0
- package/build/localizations/locales/ru-RU.js.map +1 -0
- package/build/localizations/locales/tr-TR.js +98 -0
- package/build/localizations/locales/tr-TR.js.map +1 -0
- package/build/localizations/locales/vi-VN.js +98 -0
- package/build/localizations/locales/vi-VN.js.map +1 -0
- package/build/localizations/locales/zh-CN.js +98 -0
- package/build/localizations/locales/zh-CN.js.map +1 -0
- package/build/openfort/CoreOpenfortProvider.d.ts +9 -22
- package/build/openfort/CoreOpenfortProvider.js +389 -0
- package/build/openfort/CoreOpenfortProvider.js.map +1 -0
- package/build/{hooks/useConnectCallback.d.ts → openfort/connectCallbackTypes.d.ts} +2 -2
- package/build/openfort/context.d.ts +3 -2
- package/build/openfort/context.js +6 -0
- package/build/openfort/context.js.map +1 -0
- package/build/openfort/core/client.d.ts +2 -1
- package/build/openfort/core/client.js +23 -0
- package/build/openfort/core/client.js.map +1 -0
- package/build/openfort/hooks/useActiveAddressSync.d.ts +20 -0
- package/build/openfort/hooks/useActiveAddressSync.js +76 -0
- package/build/openfort/hooks/useActiveAddressSync.js.map +1 -0
- package/build/openfort/hooks/useAutoRecovery.d.ts +26 -0
- package/build/openfort/hooks/useAutoRecovery.js +102 -0
- package/build/openfort/hooks/useAutoRecovery.js.map +1 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.d.ts +31 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.js +77 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.js.map +1 -0
- package/build/openfort/selectors.d.ts +9 -0
- package/build/openfort/selectors.js +15 -0
- package/build/openfort/selectors.js.map +1 -0
- package/build/openfort/store.d.ts +46 -0
- package/build/openfort/store.js +116 -0
- package/build/openfort/store.js.map +1 -0
- package/build/openfort/useOpenfort.d.ts +9 -3
- package/build/openfort/useOpenfort.js +15 -0
- package/build/openfort/useOpenfort.js.map +1 -0
- package/build/openfort/useOpenfortStore.d.ts +2 -0
- package/build/openfort/useOpenfortStore.js +13 -0
- package/build/openfort/useOpenfortStore.js.map +1 -0
- package/build/query/index.d.ts +2 -0
- package/build/query/queryKeys.d.ts +12 -0
- package/build/query/queryKeys.js +15 -0
- package/build/query/queryKeys.js.map +1 -0
- package/build/query/queryOptions.d.ts +23 -0
- package/build/query/queryOptions.js +31 -0
- package/build/query/queryOptions.js.map +1 -0
- package/build/shared/hooks/useAsyncData.d.ts +19 -0
- package/build/shared/hooks/useAsyncData.js +69 -0
- package/build/shared/hooks/useAsyncData.js.map +1 -0
- package/build/shared/hooks/useRecoveryOTP.d.ts +11 -0
- package/build/shared/hooks/useRecoveryOTP.js +64 -0
- package/build/shared/hooks/useRecoveryOTP.js.map +1 -0
- package/build/shared/types.d.ts +65 -0
- package/build/shared/utils/embeddedWalletStatusMapper.d.ts +15 -0
- package/build/shared/utils/embeddedWalletStatusMapper.js +22 -0
- package/build/shared/utils/embeddedWalletStatusMapper.js.map +1 -0
- package/build/shared/utils/explorer.d.ts +24 -0
- package/build/shared/utils/explorer.js +71 -0
- package/build/shared/utils/explorer.js.map +1 -0
- package/build/shared/utils/otpError.d.ts +8 -0
- package/build/shared/utils/otpError.js +17 -0
- package/build/shared/utils/otpError.js.map +1 -0
- package/build/shared/utils/recovery.d.ts +15 -0
- package/build/shared/utils/recovery.js +96 -0
- package/build/shared/utils/recovery.js.map +1 -0
- package/build/shared/utils/validation.d.ts +15 -0
- package/build/shared/utils/validation.js +27 -0
- package/build/shared/utils/validation.js.map +1 -0
- package/build/shared/utils/walletStatusProps.d.ts +18 -0
- package/build/shared/utils/walletStatusProps.js +45 -0
- package/build/shared/utils/walletStatusProps.js.map +1 -0
- package/build/siwe/create-siwe-message.d.ts +15 -1
- package/build/siwe/create-siwe-message.js +32 -0
- package/build/siwe/create-siwe-message.js.map +1 -0
- package/build/solana/SolanaContext.d.ts +43 -0
- package/build/solana/SolanaContext.js +87 -0
- package/build/solana/SolanaContext.js.map +1 -0
- package/build/solana/constants.d.ts +21 -0
- package/build/solana/constants.js +24 -0
- package/build/solana/constants.js.map +1 -0
- package/build/solana/hooks/recoveryResolver.d.ts +16 -0
- package/build/solana/hooks/recoveryResolver.js +39 -0
- package/build/solana/hooks/recoveryResolver.js.map +1 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.d.ts +17 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.js +389 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.js.map +1 -0
- package/build/solana/hooks/utils.d.ts +2 -0
- package/build/solana/hooks/utils.js +18 -0
- package/build/solana/hooks/utils.js.map +1 -0
- package/build/solana/index.d.ts +12 -0
- package/build/solana/index.js +2 -0
- package/build/solana/index.js.map +1 -0
- package/build/solana/operations.d.ts +22 -0
- package/build/solana/operations.js +40 -0
- package/build/solana/operations.js.map +1 -0
- package/build/solana/provider.d.ts +131 -0
- package/build/solana/provider.js +126 -0
- package/build/solana/provider.js.map +1 -0
- package/build/solana/types.d.ts +253 -0
- package/build/solana/utils/transfer.d.ts +9 -0
- package/build/solana/utils/transfer.js +20 -0
- package/build/solana/utils/transfer.js.map +1 -0
- package/build/styles/index.js +334 -0
- package/build/styles/index.js.map +1 -0
- package/build/styles/styled/index.js +14 -0
- package/build/styles/styled/index.js.map +1 -0
- package/build/styles/themes/base.js +147 -0
- package/build/styles/themes/base.js.map +1 -0
- package/build/styles/themes/index.js +13 -0
- package/build/styles/themes/index.js.map +1 -0
- package/build/styles/themes/midnight.js +78 -0
- package/build/styles/themes/midnight.js.map +1 -0
- package/build/styles/themes/minimal.js +100 -0
- package/build/styles/themes/minimal.js.map +1 -0
- package/build/styles/themes/nouns.js +83 -0
- package/build/styles/themes/nouns.js.map +1 -0
- package/build/styles/themes/retro.js +110 -0
- package/build/styles/themes/retro.js.map +1 -0
- package/build/styles/themes/rounded.js +110 -0
- package/build/styles/themes/rounded.js.map +1 -0
- package/build/styles/themes/soft.js +73 -0
- package/build/styles/themes/soft.js.map +1 -0
- package/build/styles/themes/web95.js +136 -0
- package/build/styles/themes/web95.js.map +1 -0
- package/build/types.d.ts +5 -6
- package/build/types.js +33 -0
- package/build/types.js.map +1 -0
- package/build/utils/banner.d.ts +1 -0
- package/build/utils/banner.js +14 -0
- package/build/utils/banner.js.map +1 -0
- package/build/utils/errorHandling.js +331 -0
- package/build/utils/errorHandling.js.map +1 -0
- package/build/utils/format.d.ts +18 -0
- package/build/utils/format.js +59 -0
- package/build/utils/format.js.map +1 -0
- package/build/utils/index.d.ts +2 -3
- package/build/utils/index.js +67 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/logger.js +13 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/oauthErrorHandler.d.ts +1 -1
- package/build/utils/oauthErrorHandler.js +42 -0
- package/build/utils/oauthErrorHandler.js.map +1 -0
- package/build/utils/p3.js +14 -0
- package/build/utils/p3.js.map +1 -0
- package/build/utils/rpc.d.ts +34 -0
- package/build/utils/rpc.js +93 -0
- package/build/utils/rpc.js.map +1 -0
- package/build/utils/useOnUserReturn.js +25 -0
- package/build/utils/useOnUserReturn.js.map +1 -0
- package/build/utils/validation.js +7 -0
- package/build/utils/validation.js.map +1 -0
- package/build/utils/wallets.d.ts +6 -0
- package/build/utils/wallets.js +14 -0
- package/build/utils/wallets.js.map +1 -0
- package/build/version.d.ts +1 -1
- package/build/version.js +4 -0
- package/build/version.js.map +1 -0
- package/build/wagmi/OpenfortWagmiBridge.d.ts +3 -0
- package/build/wagmi/OpenfortWagmiBridge.js +166 -0
- package/build/wagmi/OpenfortWagmiBridge.js.map +1 -0
- package/build/wagmi/components/ChainSelect/index.js +140 -0
- package/build/wagmi/components/ChainSelect/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectDropdown/index.js +144 -0
- package/build/wagmi/components/ChainSelectDropdown/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectDropdown/styles.js +47 -0
- package/build/wagmi/components/ChainSelectDropdown/styles.js.map +1 -0
- package/build/wagmi/components/ChainSelectList/index.js +109 -0
- package/build/wagmi/components/ChainSelectList/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectList/styles.js +225 -0
- package/build/wagmi/components/ChainSelectList/styles.js.map +1 -0
- package/build/wagmi/components/SwitchNetworks/index.js +22 -0
- package/build/wagmi/components/SwitchNetworks/index.js.map +1 -0
- package/build/wagmi/connectorFilter.d.ts +6 -0
- package/build/wagmi/connectorFilter.js +16 -0
- package/build/wagmi/connectorFilter.js.map +1 -0
- package/build/{defaultConfig.d.ts → wagmi/defaultConfig.d.ts} +1 -2
- package/build/wagmi/defaultConfig.js +27 -0
- package/build/wagmi/defaultConfig.js.map +1 -0
- package/build/wagmi/defaultConnectors.js +36 -0
- package/build/wagmi/defaultConnectors.js.map +1 -0
- package/build/wagmi/embeddedConnector.d.ts +4 -0
- package/build/wagmi/embeddedConnector.js +80 -0
- package/build/wagmi/embeddedConnector.js.map +1 -0
- package/build/wagmi/index.d.ts +10 -0
- package/build/wagmi/index.js +10 -0
- package/build/wagmi/index.js.map +1 -0
- package/build/wagmi/useChainIsSupported.d.ts +20 -0
- package/build/wagmi/useChainIsSupported.js +30 -0
- package/build/wagmi/useChainIsSupported.js.map +1 -0
- package/build/wagmi/useChains.d.ts +29 -0
- package/build/wagmi/useChains.js +38 -0
- package/build/wagmi/useChains.js.map +1 -0
- package/build/wagmi/useConnectWithSiwe.d.ts +22 -0
- package/build/wagmi/useConnectWithSiwe.js +115 -0
- package/build/wagmi/useConnectWithSiwe.js.map +1 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.d.ts +2 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.js +55 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.js.map +1 -0
- package/build/wagmi/useWalletAuth.d.ts +24 -0
- package/build/wagmi/useWalletAuth.js +180 -0
- package/build/wagmi/useWalletAuth.js.map +1 -0
- package/build/wallets/useExternalConnectors.d.ts +17 -0
- package/build/wallets/useExternalConnectors.js +98 -0
- package/build/wallets/useExternalConnectors.js.map +1 -0
- package/build/wallets/walletConfigs.js +344 -0
- package/build/wallets/walletConfigs.js.map +1 -0
- package/package.json +62 -11
- package/build/components/PageLayout/index.d.ts +0 -6
- package/build/components/contexts/web3/index.d.ts +0 -13
- package/build/constants/erc20.d.ts +0 -42
- package/build/hooks/openfort/auth/useWalletAuth.d.ts +0 -20
- package/build/hooks/openfort/useConnectWithSiwe.d.ts +0 -8
- package/build/hooks/openfort/useWalletAssets.d.ts +0 -16
- package/build/hooks/openfort/useWallets.d.ts +0 -134
- package/build/hooks/useChainIsSupported.d.ts +0 -24
- package/build/hooks/useChains.d.ts +0 -41
- package/build/hooks/useConnect.d.ts +0 -24
- package/build/hooks/useEnsFallbackConfig.d.ts +0 -1
- package/build/index.es.js +0 -19627
- package/build/index.es.js.map +0 -1
- package/build/openfortCustomTypes.d.ts +0 -10
- package/build/wallets/index.d.ts +0 -7
- package/build/wallets/useWagmiWallets.d.ts +0 -9
- /package/build/components/Pages/{SoicalProviders → SocialProviders}/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelect/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectDropdown/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectDropdown/styles.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectList/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectList/styles.d.ts +0 -0
- /package/build/{components/Pages → wagmi/components}/SwitchNetworks/index.d.ts +0 -0
- /package/build/{defaultConnectors.d.ts → wagmi/defaultConnectors.d.ts} +0 -0
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
* This hook provides programmatic control over the Openfort UI modal, including opening,
|
|
5
5
|
* closing, and navigating between different screens. It handles route validation and
|
|
6
6
|
* automatically selects appropriate screens based on user connection and authentication state.
|
|
7
|
-
* The hook ensures safe navigation by validating routes against user's current state.
|
|
8
7
|
*
|
|
9
8
|
* @returns UI control functions and modal state
|
|
10
9
|
*
|
|
@@ -12,53 +11,13 @@
|
|
|
12
11
|
* ```tsx
|
|
13
12
|
* const ui = useUI();
|
|
14
13
|
*
|
|
15
|
-
* // Check if modal is open
|
|
16
14
|
* if (ui.isOpen) {
|
|
17
|
-
* console.log('Openfort modal is
|
|
15
|
+
* console.log('Openfort modal is open');
|
|
18
16
|
* }
|
|
19
17
|
*
|
|
20
|
-
* //
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* };
|
|
24
|
-
*
|
|
25
|
-
* // Close modal
|
|
26
|
-
* const handleClose = () => {
|
|
27
|
-
* ui.close();
|
|
28
|
-
* };
|
|
29
|
-
*
|
|
30
|
-
* // Programmatically control modal state
|
|
31
|
-
* const toggleModal = () => {
|
|
32
|
-
* ui.setIsOpen(!ui.isOpen);
|
|
33
|
-
* };
|
|
34
|
-
*
|
|
35
|
-
* // Open specific screens
|
|
36
|
-
* const handleProfileClick = () => {
|
|
37
|
-
* ui.openProfile(); // Opens user profile screen (connected users only)
|
|
38
|
-
* };
|
|
39
|
-
*
|
|
40
|
-
* const handleProvidersClick = () => {
|
|
41
|
-
* ui.openProviders(); // Opens authentication providers screen
|
|
42
|
-
* };
|
|
43
|
-
*
|
|
44
|
-
* const handleWalletsClick = () => {
|
|
45
|
-
* ui.openWallets(); // Opens wallet connectors screen
|
|
46
|
-
* };
|
|
47
|
-
*
|
|
48
|
-
* const handleNetworkClick = () => {
|
|
49
|
-
* ui.openSwitchNetworks(); // Opens network switching screen (connected users only)
|
|
50
|
-
* };
|
|
51
|
-
*
|
|
52
|
-
* // Example usage in component
|
|
53
|
-
* return (
|
|
54
|
-
* <div>
|
|
55
|
-
* <button onClick={handleConnect}>
|
|
56
|
-
* {ui.isOpen ? 'Close' : 'Open'} Openfort
|
|
57
|
-
* </button>
|
|
58
|
-
* <button onClick={handleProfileClick}>Profile</button>
|
|
59
|
-
* <button onClick={handleWalletsClick}>Wallets</button>
|
|
60
|
-
* </div>
|
|
61
|
-
* );
|
|
18
|
+
* ui.open(); // Opens modal with default route
|
|
19
|
+
* ui.close(); // Closes modal
|
|
20
|
+
* ui.openProfile(); // Opens user profile screen
|
|
62
21
|
* ```
|
|
63
22
|
*/
|
|
64
23
|
export declare function useUI(): {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { routes } from '../../components/Openfort/types.js';
|
|
4
|
+
import { useOpenfort } from '../../components/Openfort/useOpenfort.js';
|
|
5
|
+
import { useConnectionStrategy } from '../../core/ConnectionStrategyContext.js';
|
|
6
|
+
import { useEthereumEmbeddedWallet } from '../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
7
|
+
import { useEthereumBridge } from '../../ethereum/OpenfortEthereumBridgeContext.js';
|
|
8
|
+
import { useOpenfortCore } from '../../openfort/useOpenfort.js';
|
|
9
|
+
import { useSolanaEmbeddedWallet } from '../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
10
|
+
import { logger } from '../../utils/logger.js';
|
|
11
|
+
|
|
12
|
+
const safeRoutes = {
|
|
13
|
+
disconnected: [
|
|
14
|
+
routes.PROVIDERS,
|
|
15
|
+
{ route: routes.CONNECTORS, connectType: 'linkIfUserConnectIfNoUser' },
|
|
16
|
+
routes.MOBILECONNECTORS,
|
|
17
|
+
],
|
|
18
|
+
connected: [
|
|
19
|
+
routes.CONNECTED,
|
|
20
|
+
{ route: routes.CONNECTORS, connectType: 'linkIfUserConnectIfNoUser' },
|
|
21
|
+
routes.ETH_SWITCH_NETWORK,
|
|
22
|
+
routes.PROVIDERS,
|
|
23
|
+
],
|
|
24
|
+
};
|
|
25
|
+
const allRoutes = [...safeRoutes.connected, ...safeRoutes.disconnected];
|
|
26
|
+
/** Connector id must be a connector (e.g. injected, walletConnect), not an Openfort account id. */
|
|
27
|
+
function isAccountId(id) {
|
|
28
|
+
return id.startsWith('acc_');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Hook for controlling Openfort UI modal and navigation
|
|
32
|
+
*
|
|
33
|
+
* This hook provides programmatic control over the Openfort UI modal, including opening,
|
|
34
|
+
* closing, and navigating between different screens. It handles route validation and
|
|
35
|
+
* automatically selects appropriate screens based on user connection and authentication state.
|
|
36
|
+
*
|
|
37
|
+
* @returns UI control functions and modal state
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* const ui = useUI();
|
|
42
|
+
*
|
|
43
|
+
* if (ui.isOpen) {
|
|
44
|
+
* console.log('Openfort modal is open');
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* ui.open(); // Opens modal with default route
|
|
48
|
+
* ui.close(); // Closes modal
|
|
49
|
+
* ui.openProfile(); // Opens user profile screen
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
function useUI() {
|
|
53
|
+
var _a;
|
|
54
|
+
const { open, setOpen, setRoute, setConnector, connector, chainType } = useOpenfort();
|
|
55
|
+
const { isLoading, user, needsRecovery, embeddedAccounts, activeEmbeddedAddress, embeddedState } = useOpenfortCore();
|
|
56
|
+
const bridge = useEthereumBridge();
|
|
57
|
+
const strategy = useConnectionStrategy();
|
|
58
|
+
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
59
|
+
const solanaWallet = useSolanaEmbeddedWallet();
|
|
60
|
+
const wallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
61
|
+
const state = React.useMemo(() => ({
|
|
62
|
+
user,
|
|
63
|
+
embeddedAccounts,
|
|
64
|
+
activeEmbeddedAddress,
|
|
65
|
+
chainType,
|
|
66
|
+
embeddedState,
|
|
67
|
+
}), [user, embeddedAccounts, activeEmbeddedAddress, chainType, embeddedState]);
|
|
68
|
+
// Bridge: strategy owns connection. Embedded: wallet hooks are source of truth.
|
|
69
|
+
const isConnected = (strategy === null || strategy === void 0 ? void 0 : strategy.kind) === 'bridge' ? ((_a = strategy === null || strategy === void 0 ? void 0 : strategy.isConnected(state)) !== null && _a !== void 0 ? _a : false) : wallet.status === 'connected';
|
|
70
|
+
function defaultOpen() {
|
|
71
|
+
setOpen(true);
|
|
72
|
+
if (isAccountId(connector.id)) {
|
|
73
|
+
setConnector({ id: '' });
|
|
74
|
+
}
|
|
75
|
+
if (isLoading)
|
|
76
|
+
setRoute(routes.LOADING);
|
|
77
|
+
else if (!user)
|
|
78
|
+
setRoute(routes.PROVIDERS);
|
|
79
|
+
else if (!isConnected)
|
|
80
|
+
setRoute(routes.LOAD_WALLETS);
|
|
81
|
+
else if (needsRecovery && !bridge)
|
|
82
|
+
setRoute(routes.LOAD_WALLETS);
|
|
83
|
+
else
|
|
84
|
+
setRoute(routes.CONNECTED);
|
|
85
|
+
}
|
|
86
|
+
const gotoAndOpen = (route) => {
|
|
87
|
+
let validRoute = route;
|
|
88
|
+
if (!allRoutes.includes(route)) {
|
|
89
|
+
validRoute = isConnected ? routes.CONNECTED : routes.PROVIDERS;
|
|
90
|
+
logger.log(`Route ${route} is not a valid route, navigating to ${validRoute} instead.`);
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
if (isConnected) {
|
|
94
|
+
if (!safeRoutes.connected.includes(route)) {
|
|
95
|
+
validRoute = routes.CONNECTED;
|
|
96
|
+
logger.log(`Route ${route} is not a valid route when connected, navigating to ${validRoute} instead.`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
if (!safeRoutes.disconnected.includes(route)) {
|
|
101
|
+
validRoute = routes.PROVIDERS;
|
|
102
|
+
logger.log(`Route ${route} is not a valid route when disconnected, navigating to ${validRoute} instead.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
setRoute(validRoute);
|
|
107
|
+
setOpen(true);
|
|
108
|
+
};
|
|
109
|
+
return {
|
|
110
|
+
isOpen: open,
|
|
111
|
+
open: () => defaultOpen(),
|
|
112
|
+
close: () => setOpen(false),
|
|
113
|
+
setIsOpen: setOpen,
|
|
114
|
+
openProfile: () => gotoAndOpen(routes.CONNECTED),
|
|
115
|
+
openSwitchNetworks: () => gotoAndOpen(routes.ETH_SWITCH_NETWORK),
|
|
116
|
+
openProviders: () => gotoAndOpen(routes.PROVIDERS),
|
|
117
|
+
openWallets: () => gotoAndOpen({ route: routes.CONNECTORS, connectType: 'linkIfUserConnectIfNoUser' }),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export { useUI };
|
|
122
|
+
//# sourceMappingURL=useUI.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUI.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,51 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Returns the current user, linked accounts, auth state, and token helpers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* user sessions. The hook automatically updates when authentication state changes.
|
|
4
|
+
* Use `isConnected` for the common "am I connected?" check: true when authenticated and
|
|
5
|
+
* wallet is ready for the current chain.
|
|
7
6
|
*
|
|
8
|
-
* @
|
|
7
|
+
* @remarks Client-only. Use in a Client Component (e.g. add `"use client"` in Next.js App Router).
|
|
8
|
+
*
|
|
9
|
+
* @returns user, linkedAccounts, isAuthenticated, isConnected, getAccessToken, validateAndRefreshToken
|
|
9
10
|
*
|
|
10
11
|
* @example
|
|
11
12
|
* ```tsx
|
|
12
|
-
* const
|
|
13
|
-
*
|
|
14
|
-
* // Check if user is authenticated
|
|
15
|
-
* if (userHook.isAuthenticated && userHook.user) {
|
|
16
|
-
* console.log('User is authenticated:', userHook.user);
|
|
17
|
-
* console.log('User ID:', userHook.user.id);
|
|
18
|
-
* console.log('User email:', userHook.user.email);
|
|
19
|
-
* console.log('Linked accounts:', userHook.linkedAccounts);
|
|
20
|
-
* } else {
|
|
21
|
-
* console.log('User is not authenticated');
|
|
22
|
-
* }
|
|
13
|
+
* const { user, isConnected, getAccessToken } = useUser()
|
|
23
14
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* try {
|
|
27
|
-
* const token = await userHook.getAccessToken();
|
|
28
|
-
* console.log('Access token:', token);
|
|
29
|
-
* } catch (error) {
|
|
30
|
-
* console.error('Failed to get access token:', error);
|
|
31
|
-
* }
|
|
32
|
-
* };
|
|
15
|
+
* if (!isConnected) return <Spinner />
|
|
16
|
+
* // User is authenticated and wallet is connected — safe to send/sign
|
|
33
17
|
*
|
|
34
|
-
*
|
|
35
|
-
* const refreshToken = async () => {
|
|
36
|
-
* try {
|
|
37
|
-
* await userHook.validateAndRefreshToken();
|
|
38
|
-
* console.log('Token validated and refreshed');
|
|
39
|
-
* } catch (error) {
|
|
40
|
-
* console.error('Token validation failed:', error);
|
|
41
|
-
* }
|
|
42
|
-
* };
|
|
18
|
+
* const token = await getAccessToken()
|
|
43
19
|
* ```
|
|
44
20
|
*/
|
|
45
21
|
export declare function useUser(): {
|
|
46
22
|
user: import("@openfort/openfort-js").User | null;
|
|
47
|
-
linkedAccounts: import("
|
|
23
|
+
linkedAccounts: import("@openfort/openfort-js").UserAccount[];
|
|
48
24
|
isAuthenticated: boolean;
|
|
25
|
+
isConnected: boolean;
|
|
49
26
|
getAccessToken: () => Promise<string | null>;
|
|
50
27
|
validateAndRefreshToken: () => Promise<void>;
|
|
51
28
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { EmbeddedState } from '@openfort/openfort-js';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useOpenfortCore } from '../../openfort/useOpenfort.js';
|
|
4
|
+
import { handleOAuthConfigError } from '../../utils/oauthErrorHandler.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the current user, linked accounts, auth state, and token helpers.
|
|
8
|
+
*
|
|
9
|
+
* Use `isConnected` for the common "am I connected?" check: true when authenticated and
|
|
10
|
+
* wallet is ready for the current chain.
|
|
11
|
+
*
|
|
12
|
+
* @remarks Client-only. Use in a Client Component (e.g. add `"use client"` in Next.js App Router).
|
|
13
|
+
*
|
|
14
|
+
* @returns user, linkedAccounts, isAuthenticated, isConnected, getAccessToken, validateAndRefreshToken
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* const { user, isConnected, getAccessToken } = useUser()
|
|
19
|
+
*
|
|
20
|
+
* if (!isConnected) return <Spinner />
|
|
21
|
+
* // User is authenticated and wallet is connected — safe to send/sign
|
|
22
|
+
*
|
|
23
|
+
* const token = await getAccessToken()
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
function useUser() {
|
|
27
|
+
const { user, client, embeddedState, linkedAccounts, activeEmbeddedAddress } = useOpenfortCore();
|
|
28
|
+
const isAuthenticated = embeddedState !== EmbeddedState.NONE && embeddedState !== EmbeddedState.UNAUTHENTICATED;
|
|
29
|
+
const isConnected = embeddedState === EmbeddedState.READY && !!activeEmbeddedAddress;
|
|
30
|
+
const getAccessTokenAndUpdate = useCallback(async () => {
|
|
31
|
+
try {
|
|
32
|
+
await client.validateAndRefreshToken();
|
|
33
|
+
const token = await client.getAccessToken();
|
|
34
|
+
return token;
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
handleOAuthConfigError(error);
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
}, [client]);
|
|
41
|
+
const validateAndRefresh = useCallback(async () => {
|
|
42
|
+
try {
|
|
43
|
+
await client.validateAndRefreshToken();
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
handleOAuthConfigError(error);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}, [client]);
|
|
50
|
+
return {
|
|
51
|
+
user,
|
|
52
|
+
linkedAccounts,
|
|
53
|
+
isAuthenticated,
|
|
54
|
+
isConnected,
|
|
55
|
+
getAccessToken: getAccessTokenAndUpdate,
|
|
56
|
+
validateAndRefreshToken: validateAndRefresh,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { useUser };
|
|
61
|
+
//# sourceMappingURL=useUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUser.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type AccountTypeEnum, ChainTypeEnum, type EmbeddedAccount, type RecoveryMethod } from '@openfort/openfort-js';
|
|
2
|
+
import type { Hex } from 'viem';
|
|
3
|
+
import type { ConnectedEmbeddedEthereumWallet } from '../../ethereum/types';
|
|
4
|
+
import type { ConnectedEmbeddedSolanaWallet } from '../../solana/types';
|
|
5
|
+
import type { BaseFlowState } from './auth/status';
|
|
6
|
+
export type EthereumUserWallet = ConnectedEmbeddedEthereumWallet;
|
|
7
|
+
/** Solana embedded wallet shape (mirrors UserWallet for SVM). address is Base58. Discriminate with chainType. */
|
|
8
|
+
export type SolanaUserWallet = {
|
|
9
|
+
address: string;
|
|
10
|
+
id: string;
|
|
11
|
+
chainType: typeof ChainTypeEnum.SVM;
|
|
12
|
+
isAvailable: boolean;
|
|
13
|
+
isActive?: boolean;
|
|
14
|
+
isConnecting?: boolean;
|
|
15
|
+
accounts: {
|
|
16
|
+
id: string;
|
|
17
|
+
}[];
|
|
18
|
+
recoveryMethod?: RecoveryMethod;
|
|
19
|
+
accountType?: AccountTypeEnum;
|
|
20
|
+
createdAt?: number;
|
|
21
|
+
};
|
|
22
|
+
export type UserWallet = EthereumUserWallet | SolanaUserWallet;
|
|
23
|
+
export type WalletFlowStatus = BaseFlowState | {
|
|
24
|
+
status: 'creating' | 'connecting';
|
|
25
|
+
address?: Hex;
|
|
26
|
+
error?: never;
|
|
27
|
+
};
|
|
28
|
+
export declare function embeddedAccountToUserWallet(account: EmbeddedAccount): EthereumUserWallet;
|
|
29
|
+
/** Build SolanaUserWallet from a ConnectedEmbeddedSolanaWallet (e.g. for route navigation). */
|
|
30
|
+
export declare function toSolanaUserWallet(w: ConnectedEmbeddedSolanaWallet): SolanaUserWallet;
|
|
31
|
+
/** Build SolanaUserWallet from a single SVM embedded account (e.g. for post-auth return). */
|
|
32
|
+
export declare function embeddedAccountToSolanaUserWallet(account: EmbeddedAccount): SolanaUserWallet;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
|
|
3
|
+
function embeddedAccountToUserWallet(account) {
|
|
4
|
+
return {
|
|
5
|
+
id: account.id,
|
|
6
|
+
address: account.address,
|
|
7
|
+
ownerAddress: account.ownerAddress,
|
|
8
|
+
implementationType: account.implementationType,
|
|
9
|
+
chainType: ChainTypeEnum.EVM,
|
|
10
|
+
walletIndex: 0,
|
|
11
|
+
recoveryMethod: account.recoveryMethod,
|
|
12
|
+
getProvider: async () => {
|
|
13
|
+
throw new Error('Wallet not yet loaded; use useEthereumEmbeddedWallet to access provider');
|
|
14
|
+
},
|
|
15
|
+
isAvailable: true,
|
|
16
|
+
isActive: false,
|
|
17
|
+
isConnecting: false,
|
|
18
|
+
accounts: [{ id: account.id, chainId: account.chainId }],
|
|
19
|
+
connectorType: 'embedded',
|
|
20
|
+
walletClientType: 'openfort',
|
|
21
|
+
accountId: account.id,
|
|
22
|
+
accountType: account.accountType,
|
|
23
|
+
createdAt: account.createdAt,
|
|
24
|
+
salt: account.salt,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/** Build SolanaUserWallet from a ConnectedEmbeddedSolanaWallet (e.g. for route navigation). */
|
|
28
|
+
function toSolanaUserWallet(w) {
|
|
29
|
+
return {
|
|
30
|
+
id: w.id,
|
|
31
|
+
address: w.address,
|
|
32
|
+
chainType: ChainTypeEnum.SVM,
|
|
33
|
+
isAvailable: true,
|
|
34
|
+
accounts: [{ id: w.id }],
|
|
35
|
+
recoveryMethod: w.recoveryMethod,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/** Build SolanaUserWallet from a single SVM embedded account (e.g. for post-auth return). */
|
|
39
|
+
function embeddedAccountToSolanaUserWallet(account) {
|
|
40
|
+
return {
|
|
41
|
+
address: account.address,
|
|
42
|
+
id: account.id,
|
|
43
|
+
chainType: ChainTypeEnum.SVM,
|
|
44
|
+
isAvailable: true,
|
|
45
|
+
accounts: [{ id: account.id }],
|
|
46
|
+
recoveryMethod: account.recoveryMethod,
|
|
47
|
+
accountType: account.accountType,
|
|
48
|
+
createdAt: account.createdAt,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export { embeddedAccountToSolanaUserWallet, embeddedAccountToUserWallet, toSolanaUserWallet };
|
|
53
|
+
//# sourceMappingURL=walletTypes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletTypes.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
import type { SolanaCluster } from '../solana/types';
|
|
3
|
+
/** Event name for balance invalidation. Call invalidateBalance() after balance-changing txs. */
|
|
4
|
+
export declare const BALANCE_INVALIDATE_EVENT = "openfort:balance-invalidate";
|
|
5
|
+
/** Dispatches balance invalidation so all useBalance instances refetch. Call after mint/send. */
|
|
6
|
+
export declare function invalidateBalance(): void;
|
|
7
|
+
type BalanceState = {
|
|
8
|
+
status: 'idle';
|
|
9
|
+
refetch: () => void;
|
|
10
|
+
} | {
|
|
11
|
+
status: 'loading';
|
|
12
|
+
refetch: () => void;
|
|
13
|
+
} | {
|
|
14
|
+
status: 'error';
|
|
15
|
+
error: Error;
|
|
16
|
+
refetch: () => void;
|
|
17
|
+
} | {
|
|
18
|
+
status: 'success';
|
|
19
|
+
value: bigint;
|
|
20
|
+
formatted: string;
|
|
21
|
+
symbol: string;
|
|
22
|
+
decimals: number;
|
|
23
|
+
refetch: () => void;
|
|
24
|
+
};
|
|
25
|
+
interface UseBalanceOptions {
|
|
26
|
+
/** Address to fetch balance for */
|
|
27
|
+
address: string;
|
|
28
|
+
/** Chain type */
|
|
29
|
+
chainType: ChainTypeEnum;
|
|
30
|
+
/** Ethereum chain ID (default: 84532 Base Sepolia) */
|
|
31
|
+
chainId?: number;
|
|
32
|
+
/** Solana cluster (default: devnet) */
|
|
33
|
+
cluster?: SolanaCluster;
|
|
34
|
+
/** Solana commitment level (default: confirmed) */
|
|
35
|
+
commitment?: 'processed' | 'confirmed' | 'finalized';
|
|
36
|
+
/** Enable/disable the query */
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
/** Refetch interval in ms (default: 30000) */
|
|
39
|
+
refetchInterval?: number;
|
|
40
|
+
}
|
|
41
|
+
type BalanceResult = {
|
|
42
|
+
value: bigint;
|
|
43
|
+
formatted: string;
|
|
44
|
+
symbol: string;
|
|
45
|
+
decimals: number;
|
|
46
|
+
};
|
|
47
|
+
export declare function fetchSolanaBalance(addressStr: string, rpcUrl: string, commitment: 'processed' | 'confirmed' | 'finalized'): Promise<BalanceResult>;
|
|
48
|
+
/** Hook for fetching native token balance. */
|
|
49
|
+
export declare function useBalance(options: UseBalanceOptions): BalanceState;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { createPublicClient, http, formatEther } from 'viem';
|
|
4
|
+
import { useOpenfort } from '../components/Openfort/useOpenfort.js';
|
|
5
|
+
import { DEFAULT_TESTNET_CHAIN_ID } from '../core/ConnectionStrategy.js';
|
|
6
|
+
import { useAsyncData } from '../shared/hooks/useAsyncData.js';
|
|
7
|
+
import { formatSol } from '../solana/hooks/utils.js';
|
|
8
|
+
import { getDefaultEthereumRpcUrl, getDefaultSolanaRpcUrl, getNativeCurrency } from '../utils/rpc.js';
|
|
9
|
+
|
|
10
|
+
/** Event name for balance invalidation. Call invalidateBalance() after balance-changing txs. */
|
|
11
|
+
const BALANCE_INVALIDATE_EVENT = 'openfort:balance-invalidate';
|
|
12
|
+
/** Dispatches balance invalidation so all useBalance instances refetch. Call after mint/send. */
|
|
13
|
+
function invalidateBalance() {
|
|
14
|
+
if (typeof window !== 'undefined') {
|
|
15
|
+
window.dispatchEvent(new CustomEvent(BALANCE_INVALIDATE_EVENT));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async function fetchEvmBalance(address, rpcUrl, chainId) {
|
|
19
|
+
const client = createPublicClient({ transport: http(rpcUrl) });
|
|
20
|
+
const balance = await client.getBalance({ address: address });
|
|
21
|
+
const { symbol, decimals } = getNativeCurrency(chainId);
|
|
22
|
+
return { value: balance, formatted: formatEther(balance), symbol, decimals };
|
|
23
|
+
}
|
|
24
|
+
async function fetchSolanaBalance(addressStr, rpcUrl, commitment) {
|
|
25
|
+
const { address, createSolanaRpc } = await import('@solana/kit');
|
|
26
|
+
const rpc = createSolanaRpc(rpcUrl);
|
|
27
|
+
const { value: lamports } = await rpc.getBalance(address(addressStr), { commitment }).send();
|
|
28
|
+
return {
|
|
29
|
+
value: BigInt(lamports),
|
|
30
|
+
formatted: formatSol(BigInt(lamports), 9),
|
|
31
|
+
symbol: 'SOL',
|
|
32
|
+
decimals: 9,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** Hook for fetching native token balance. */
|
|
36
|
+
function useBalance(options) {
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
38
|
+
const { address, chainType, chainId = DEFAULT_TESTNET_CHAIN_ID, cluster = 'devnet', commitment = 'confirmed', enabled = true, refetchInterval = 30000, } = options;
|
|
39
|
+
const { walletConfig } = useOpenfort();
|
|
40
|
+
const rpcUrl = chainType === ChainTypeEnum.EVM
|
|
41
|
+
? ((_c = (_b = (_a = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _a === void 0 ? void 0 : _a.rpcUrls) === null || _b === void 0 ? void 0 : _b[chainId]) !== null && _c !== void 0 ? _c : getDefaultEthereumRpcUrl(chainId))
|
|
42
|
+
: ((_f = (_e = (_d = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.solana) === null || _d === void 0 ? void 0 : _d.rpcUrls) === null || _e === void 0 ? void 0 : _e[cluster]) !== null && _f !== void 0 ? _f : getDefaultSolanaRpcUrl(cluster));
|
|
43
|
+
const isEnabled = enabled && !!address && address.length > 0;
|
|
44
|
+
const { data, error, isLoading, refetch } = useAsyncData({
|
|
45
|
+
queryKey: ['balance', chainType, address, chainId, cluster],
|
|
46
|
+
queryFn: () => chainType === ChainTypeEnum.EVM
|
|
47
|
+
? fetchEvmBalance(address, rpcUrl, chainId)
|
|
48
|
+
: fetchSolanaBalance(address, rpcUrl, commitment),
|
|
49
|
+
enabled: isEnabled,
|
|
50
|
+
refetchInterval,
|
|
51
|
+
staleTime: 30000,
|
|
52
|
+
});
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!isEnabled)
|
|
55
|
+
return;
|
|
56
|
+
const handler = () => refetch().catch(() => { });
|
|
57
|
+
window.addEventListener(BALANCE_INVALIDATE_EVENT, handler);
|
|
58
|
+
return () => window.removeEventListener(BALANCE_INVALIDATE_EVENT, handler);
|
|
59
|
+
}, [isEnabled, refetch]);
|
|
60
|
+
if (!isEnabled) {
|
|
61
|
+
return { status: 'idle', refetch };
|
|
62
|
+
}
|
|
63
|
+
if (isLoading) {
|
|
64
|
+
return { status: 'loading', refetch };
|
|
65
|
+
}
|
|
66
|
+
if (error) {
|
|
67
|
+
return { status: 'error', error, refetch };
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
status: 'success',
|
|
71
|
+
value: (_g = data === null || data === void 0 ? void 0 : data.value) !== null && _g !== void 0 ? _g : BigInt(0),
|
|
72
|
+
formatted: (_h = data === null || data === void 0 ? void 0 : data.formatted) !== null && _h !== void 0 ? _h : '0',
|
|
73
|
+
symbol: (_j = data === null || data === void 0 ? void 0 : data.symbol) !== null && _j !== void 0 ? _j : '',
|
|
74
|
+
decimals: (_k = data === null || data === void 0 ? void 0 : data.decimals) !== null && _k !== void 0 ? _k : 18,
|
|
75
|
+
refetch,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export { BALANCE_INVALIDATE_EVENT, fetchSolanaBalance, invalidateBalance, useBalance };
|
|
80
|
+
//# sourceMappingURL=useBalance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBalance.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ConnectionStrategy } from '../core/ConnectionStrategy';
|
|
2
|
+
import type { ConnectCallbackProps } from '../openfort/connectCallbackTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Standalone hook: subscribes to connection lifecycle and fires onConnect/onDisconnect
|
|
5
|
+
* when strategy.isConnected(state) changes. Must be used inside CoreOpenfortProvider.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useConnectLifecycle(strategy: ConnectionStrategy | null, onConnect: ConnectCallbackProps['onConnect'], onDisconnect: ConnectCallbackProps['onDisconnect']): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useRef, useLayoutEffect, useEffect } from 'react';
|
|
2
|
+
import { useOpenfortStore } from '../openfort/useOpenfortStore.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Standalone hook: subscribes to connection lifecycle and fires onConnect/onDisconnect
|
|
6
|
+
* when strategy.isConnected(state) changes. Must be used inside CoreOpenfortProvider.
|
|
7
|
+
*/
|
|
8
|
+
function useConnectLifecycle(strategy, onConnect, onDisconnect) {
|
|
9
|
+
const user = useOpenfortStore((s) => s.user);
|
|
10
|
+
const embeddedAccounts = useOpenfortStore((s) => s.embeddedAccounts);
|
|
11
|
+
const activeEmbeddedAddress = useOpenfortStore((s) => s.activeEmbeddedAddress);
|
|
12
|
+
const embeddedState = useOpenfortStore((s) => s.embeddedState);
|
|
13
|
+
const chainType = useOpenfortStore((s) => s.chainType);
|
|
14
|
+
const prevConnected = useRef(false);
|
|
15
|
+
const onConnectRef = useRef(onConnect);
|
|
16
|
+
const onDisconnectRef = useRef(onDisconnect);
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
onConnectRef.current = onConnect;
|
|
19
|
+
onDisconnectRef.current = onDisconnect;
|
|
20
|
+
}, [onConnect, onDisconnect]);
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
if (!strategy)
|
|
24
|
+
return;
|
|
25
|
+
const state = { user, embeddedAccounts, chainType, activeEmbeddedAddress, embeddedState };
|
|
26
|
+
const connected = strategy.isConnected(state);
|
|
27
|
+
if (connected && !prevConnected.current) {
|
|
28
|
+
prevConnected.current = true;
|
|
29
|
+
const address = strategy.getAddress(state);
|
|
30
|
+
(_a = onConnectRef.current) === null || _a === void 0 ? void 0 : _a.call(onConnectRef, { address: address !== null && address !== void 0 ? address : undefined, connectorId: undefined, user: (_b = state.user) !== null && _b !== void 0 ? _b : undefined });
|
|
31
|
+
}
|
|
32
|
+
else if (!connected && prevConnected.current) {
|
|
33
|
+
prevConnected.current = false;
|
|
34
|
+
(_c = onDisconnectRef.current) === null || _c === void 0 ? void 0 : _c.call(onDisconnectRef);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
prevConnected.current = connected;
|
|
38
|
+
}
|
|
39
|
+
}, [strategy, user, embeddedAccounts, activeEmbeddedAddress, embeddedState, chainType]);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { useConnectLifecycle };
|
|
43
|
+
//# sourceMappingURL=useConnectLifecycle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnectLifecycle.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function useFamilyAccountsConnector(): Connector<import("wagmi").CreateConnectorFn> | undefined;
|
|
5
|
-
export declare function useFamilyConnector(): Connector<import("wagmi").CreateConnectorFn> | undefined;
|
|
1
|
+
import type { OpenfortEthereumBridgeConnector } from '../ethereum/OpenfortEthereumBridgeContext';
|
|
2
|
+
export declare function useFamilyAccountsConnector(): OpenfortEthereumBridgeConnector | undefined;
|
|
3
|
+
export declare function useFamilyConnector(): OpenfortEthereumBridgeConnector | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEthereumBridge } from '../ethereum/OpenfortEthereumBridgeContext.js';
|
|
2
|
+
|
|
3
|
+
function useConnectors() {
|
|
4
|
+
var _a;
|
|
5
|
+
const bridge = useEthereumBridge();
|
|
6
|
+
return (_a = bridge === null || bridge === void 0 ? void 0 : bridge.connectors) !== null && _a !== void 0 ? _a : [];
|
|
7
|
+
}
|
|
8
|
+
function useConnector(id, uuid) {
|
|
9
|
+
const connectors = useConnectors();
|
|
10
|
+
if (id === 'injected' && uuid) {
|
|
11
|
+
return connectors.find((c) => c.id === id && c.name === uuid);
|
|
12
|
+
}
|
|
13
|
+
if (id === 'injected') {
|
|
14
|
+
return connectors.find((c) => { var _a; return c.id === id && ((_a = c.name) === null || _a === void 0 ? void 0 : _a.includes('Injected')); });
|
|
15
|
+
}
|
|
16
|
+
return connectors.find((c) => c.id === id);
|
|
17
|
+
}
|
|
18
|
+
function useFamilyAccountsConnector() {
|
|
19
|
+
return useConnector('familyAccountsProvider');
|
|
20
|
+
}
|
|
21
|
+
function useFamilyConnector() {
|
|
22
|
+
return useConnector('co.family.wallet');
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { useFamilyAccountsConnector, useFamilyConnector };
|
|
26
|
+
//# sourceMappingURL=useConnectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConnectors.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|