@openfort/react 0.3.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/assets/browsers.js +13 -0
- package/build/assets/browsers.js.map +1 -0
- package/build/assets/chains.js +139 -0
- package/build/assets/chains.js.map +1 -0
- package/build/assets/icons.js +41 -0
- package/build/assets/icons.js.map +1 -0
- package/build/assets/logos.js +173 -0
- package/build/assets/logos.js.map +1 -0
- package/build/assets/wave.js +6 -0
- package/build/assets/wave.js.map +1 -0
- package/build/components/BalanceButton/index.js +89 -0
- package/build/components/BalanceButton/index.js.map +1 -0
- package/build/components/Common/Alert/index.js +10 -0
- package/build/components/Common/Alert/index.js.map +1 -0
- package/build/components/Common/Alert/styles.js +55 -0
- package/build/components/Common/Alert/styles.js.map +1 -0
- package/build/components/Common/Avatar/index.d.ts +11 -3
- package/build/components/Common/Avatar/index.js +100 -0
- package/build/components/Common/Avatar/index.js.map +1 -0
- package/build/components/Common/Avatar/styles.js +59 -0
- package/build/components/Common/Avatar/styles.js.map +1 -0
- package/build/components/Common/BrowserIcon/index.js +28 -0
- package/build/components/Common/BrowserIcon/index.js.map +1 -0
- package/build/components/Common/BrowserIcon/styles.js +20 -0
- package/build/components/Common/BrowserIcon/styles.js.map +1 -0
- package/build/components/Common/Button/index.js +36 -0
- package/build/components/Common/Button/index.js.map +1 -0
- package/build/components/Common/Button/styles.js +302 -0
- package/build/components/Common/Button/styles.js.map +1 -0
- package/build/components/Common/Button/types.d.ts +1 -0
- package/build/components/Common/Chain/index.d.ts +8 -0
- package/build/components/Common/Chain/index.js +38 -0
- package/build/components/Common/Chain/index.js.map +1 -0
- package/build/components/Common/Chain/styles.js +94 -0
- package/build/components/Common/Chain/styles.js.map +1 -0
- package/build/components/Common/ConnectorList/index.js +58 -0
- package/build/components/Common/ConnectorList/index.js.map +1 -0
- package/build/components/Common/ConnectorList/styles.js +324 -0
- package/build/components/Common/ConnectorList/styles.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyButton.js +12 -0
- package/build/components/Common/CopyToClipboard/CopyButton.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyIcon.js +76 -0
- package/build/components/Common/CopyToClipboard/CopyIcon.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyIconButton.js +38 -0
- package/build/components/Common/CopyToClipboard/CopyIconButton.js.map +1 -0
- package/build/components/Common/CopyToClipboard/CopyText.js +26 -0
- package/build/components/Common/CopyToClipboard/CopyText.js.map +1 -0
- package/build/components/Common/CustomQRCode/QRCode.js +60 -0
- package/build/components/Common/CustomQRCode/QRCode.js.map +1 -0
- package/build/components/Common/CustomQRCode/index.js +22 -0
- package/build/components/Common/CustomQRCode/index.js.map +1 -0
- package/build/components/Common/CustomQRCode/styles.js +155 -0
- package/build/components/Common/CustomQRCode/styles.js.map +1 -0
- package/build/components/Common/FitText/index.js +28 -0
- package/build/components/Common/FitText/index.js.map +1 -0
- package/build/components/Common/Input/index.js +17 -0
- package/build/components/Common/Input/index.js.map +1 -0
- package/build/components/Common/Input/styles.js +53 -0
- package/build/components/Common/Input/styles.js.map +1 -0
- package/build/components/Common/LargeButton/index.js +10 -0
- package/build/components/Common/LargeButton/index.js.map +1 -0
- package/build/components/Common/LargeButton/styles.js +69 -0
- package/build/components/Common/LargeButton/styles.js.map +1 -0
- package/build/components/Common/Loading/index.js +96 -0
- package/build/components/Common/Loading/index.js.map +1 -0
- package/build/components/Common/Modal/index.js +272 -0
- package/build/components/Common/Modal/index.js.map +1 -0
- package/build/components/Common/Modal/styles.d.ts +0 -1
- package/build/components/Common/Modal/styles.js +657 -0
- package/build/components/Common/Modal/styles.js.map +1 -0
- package/build/components/Common/OTPInput/index.js +108 -0
- package/build/components/Common/OTPInput/index.js.map +1 -0
- package/build/components/Common/OTPInput/styles.js +153 -0
- package/build/components/Common/OTPInput/styles.js.map +1 -0
- package/build/components/Common/Portal/index.js +31 -0
- package/build/components/Common/Portal/index.js.map +1 -0
- package/build/components/Common/PoweredByFooter/index.js +103 -0
- package/build/components/Common/PoweredByFooter/index.js.map +1 -0
- package/build/components/Common/Providers/ProviderHeader.d.ts +2 -2
- package/build/components/Common/Providers/ProviderHeader.js +55 -0
- package/build/components/Common/Providers/ProviderHeader.js.map +1 -0
- package/build/components/Common/Providers/ProviderIcon.d.ts +2 -2
- package/build/components/Common/Providers/ProviderIcon.js +41 -0
- package/build/components/Common/Providers/ProviderIcon.js.map +1 -0
- package/build/components/Common/Providers/getProviderName.d.ts +1 -1
- package/build/components/Common/Providers/getProviderName.js +15 -0
- package/build/components/Common/Providers/getProviderName.js.map +1 -0
- package/build/components/Common/ScrollArea/index.js +58 -0
- package/build/components/Common/ScrollArea/index.js.map +1 -0
- package/build/components/Common/ScrollArea/styles.js +168 -0
- package/build/components/Common/ScrollArea/styles.js.map +1 -0
- package/build/components/Common/Spinner/index.js +24 -0
- package/build/components/Common/Spinner/index.js.map +1 -0
- package/build/components/Common/Spinner/styles.js +22 -0
- package/build/components/Common/Spinner/styles.js.map +1 -0
- package/build/components/Common/SquircleSpinner/index.js +15 -0
- package/build/components/Common/SquircleSpinner/index.js.map +1 -0
- package/build/components/Common/SquircleSpinner/styles.js +66 -0
- package/build/components/Common/SquircleSpinner/styles.js.map +1 -0
- package/build/components/Common/ThemedButton/index.js +25 -0
- package/build/components/Common/ThemedButton/index.js.map +1 -0
- package/build/components/Common/ThemedButton/styles.js +152 -0
- package/build/components/Common/ThemedButton/styles.js.map +1 -0
- package/build/components/Common/TickList/index.js +11 -0
- package/build/components/Common/TickList/index.js.map +1 -0
- package/build/components/Common/TickList/styles.js +28 -0
- package/build/components/Common/TickList/styles.js.map +1 -0
- package/build/components/Common/Tooltip/index.js +91 -0
- package/build/components/Common/Tooltip/index.js.map +1 -0
- package/build/components/Common/Tooltip/styles.js +81 -0
- package/build/components/Common/Tooltip/styles.js.map +1 -0
- package/build/components/Common/WalletRecoveryIcon/index.d.ts +4 -0
- package/build/components/Common/WalletRecoveryIcon/index.js +19 -0
- package/build/components/Common/WalletRecoveryIcon/index.js.map +1 -0
- package/build/components/ConnectButton/index.d.ts +12 -4
- package/build/components/ConnectButton/index.js +266 -0
- package/build/components/ConnectButton/index.js.map +1 -0
- package/build/components/ConnectButton/styles.js +50 -0
- package/build/components/ConnectButton/styles.js.map +1 -0
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.js +20 -0
- package/build/components/ConnectKitThemeProvider/ConnectKitThemeProvider.js.map +1 -0
- package/build/components/ConnectModal/ConnectUsing.d.ts +1 -1
- package/build/components/ConnectModal/ConnectUsing.js +68 -0
- package/build/components/ConnectModal/ConnectUsing.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.js +17 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/index.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/styles.js +118 -0
- package/build/components/ConnectModal/ConnectWithInjector/CircleSpinner/styles.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/index.d.ts +0 -2
- package/build/components/ConnectModal/ConnectWithInjector/index.js +295 -0
- package/build/components/ConnectModal/ConnectWithInjector/index.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithInjector/styles.js +133 -0
- package/build/components/ConnectModal/ConnectWithInjector/styles.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithMobile.js +99 -0
- package/build/components/ConnectModal/ConnectWithMobile.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithOAuth.js +128 -0
- package/build/components/ConnectModal/ConnectWithOAuth.js.map +1 -0
- package/build/components/ConnectModal/ConnectWithQRCode.js +78 -0
- package/build/components/ConnectModal/ConnectWithQRCode.js.map +1 -0
- package/build/components/ConnectModal/index.js +230 -0
- package/build/components/ConnectModal/index.js.map +1 -0
- package/build/components/FloatingGraphic/index.js +13 -0
- package/build/components/FloatingGraphic/index.js.map +1 -0
- package/build/components/FloatingGraphic/styles.js +175 -0
- package/build/components/FloatingGraphic/styles.js.map +1 -0
- package/build/components/Openfort/OpenfortProvider.d.ts +10 -25
- package/build/components/Openfort/OpenfortProvider.js +351 -0
- package/build/components/Openfort/OpenfortProvider.js.map +1 -0
- package/build/components/Openfort/context.d.ts +48 -5
- package/build/components/Openfort/context.js +7 -0
- package/build/components/Openfort/context.js.map +1 -0
- package/build/components/Openfort/routeHelpers.d.ts +5 -0
- package/build/components/Openfort/routeHelpers.js +20 -0
- package/build/components/Openfort/routeHelpers.js.map +1 -0
- package/build/components/Openfort/types.d.ts +57 -23
- package/build/components/Openfort/types.js +119 -0
- package/build/components/Openfort/types.js.map +1 -0
- package/build/components/Openfort/useOpenfort.d.ts +2 -0
- package/build/components/Openfort/useOpenfort.js +12 -0
- package/build/components/Openfort/useOpenfort.js.map +1 -0
- package/build/components/PageContent/index.js +55 -0
- package/build/components/PageContent/index.js.map +1 -0
- package/build/components/PageContent/styles.js +11 -0
- package/build/components/PageContent/styles.js.map +1 -0
- package/build/components/Pages/About/graphics.js +193 -0
- package/build/components/Pages/About/graphics.js.map +1 -0
- package/build/components/Pages/About/index.js +142 -0
- package/build/components/Pages/About/index.js.map +1 -0
- package/build/components/Pages/About/styles.js +142 -0
- package/build/components/Pages/About/styles.js.map +1 -0
- package/build/components/Pages/AssetInventory/index.js +66 -0
- package/build/components/Pages/AssetInventory/index.js.map +1 -0
- package/build/components/Pages/Buy/coinbaseApi.js +106 -0
- package/build/components/Pages/Buy/coinbaseApi.js.map +1 -0
- package/build/components/Pages/Buy/index.js +88 -0
- package/build/components/Pages/Buy/index.js.map +1 -0
- package/build/components/Pages/Buy/onrampApi.js +57 -0
- package/build/components/Pages/Buy/onrampApi.js.map +1 -0
- package/build/components/Pages/Buy/providers.js +39 -0
- package/build/components/Pages/Buy/providers.js.map +1 -0
- package/build/components/Pages/Buy/stripeApi.js +74 -0
- package/build/components/Pages/Buy/stripeApi.js.map +1 -0
- package/build/components/Pages/Buy/styles.js +230 -0
- package/build/components/Pages/Buy/styles.js.map +1 -0
- package/build/components/Pages/Buy/utils.js +71 -0
- package/build/components/Pages/Buy/utils.js.map +1 -0
- package/build/components/Pages/BuyComplete/index.js +47 -0
- package/build/components/Pages/BuyComplete/index.js.map +1 -0
- package/build/components/Pages/BuyProcessing/index.js +231 -0
- package/build/components/Pages/BuyProcessing/index.js.map +1 -0
- package/build/components/Pages/BuyProviderSelect/index.js +55 -0
- package/build/components/Pages/BuyProviderSelect/index.js.map +1 -0
- package/build/components/Pages/BuyProviderSelect/styles.js +103 -0
- package/build/components/Pages/BuyProviderSelect/styles.js.map +1 -0
- package/build/components/Pages/BuySelectProvider/index.js +245 -0
- package/build/components/Pages/BuySelectProvider/index.js.map +1 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.d.ts +22 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.js +11 -0
- package/build/components/Pages/Connected/ConnectedPageLayout.js.map +1 -0
- package/build/components/Pages/Connected/EthereumConnected.d.ts +3 -0
- package/build/components/Pages/Connected/EthereumConnected.js +133 -0
- package/build/components/Pages/Connected/EthereumConnected.js.map +1 -0
- package/build/components/Pages/Connected/SolanaConnected.d.ts +3 -0
- package/build/components/Pages/Connected/SolanaConnected.js +96 -0
- package/build/components/Pages/Connected/SolanaConnected.js.map +1 -0
- package/build/components/Pages/Connected/index.d.ts +2 -2
- package/build/components/Pages/Connected/index.js +18 -0
- package/build/components/Pages/Connected/index.js.map +1 -0
- package/build/components/Pages/Connected/styles.js +122 -0
- package/build/components/Pages/Connected/styles.js.map +1 -0
- package/build/components/Pages/ConnectedSuccess/index.js +19 -0
- package/build/components/Pages/ConnectedSuccess/index.js.map +1 -0
- package/build/components/Pages/Connectors/index.js +73 -0
- package/build/components/Pages/Connectors/index.js.map +1 -0
- package/build/components/Pages/CreateGuestUserPage/index.js +28 -0
- package/build/components/Pages/CreateGuestUserPage/index.js.map +1 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.d.ts +6 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.js +241 -0
- package/build/components/Pages/CreateWallet/SolanaCreateWallet.js.map +1 -0
- package/build/components/Pages/CreateWallet/index.js +303 -0
- package/build/components/Pages/CreateWallet/index.js.map +1 -0
- package/build/components/Pages/CreateWallet/styles.js +17 -0
- package/build/components/Pages/CreateWallet/styles.js.map +1 -0
- package/build/components/Pages/DownloadApp/index.js +32 -0
- package/build/components/Pages/DownloadApp/index.js.map +1 -0
- package/build/components/Pages/EmailLogin/index.js +118 -0
- package/build/components/Pages/EmailLogin/index.js.map +1 -0
- package/build/components/Pages/EmailLogin/styles.js +24 -0
- package/build/components/Pages/EmailLogin/styles.js.map +1 -0
- package/build/components/Pages/EmailOTP/index.js +116 -0
- package/build/components/Pages/EmailOTP/index.js.map +1 -0
- package/build/components/Pages/EmailOTP/styles.js +38 -0
- package/build/components/Pages/EmailOTP/styles.js.map +1 -0
- package/build/components/Pages/EmailVerification/index.js +86 -0
- package/build/components/Pages/EmailVerification/index.js.map +1 -0
- package/build/components/Pages/ExportKey/index.js +44 -0
- package/build/components/Pages/ExportKey/index.js.map +1 -0
- package/build/components/Pages/ForgotPassword/index.js +129 -0
- package/build/components/Pages/ForgotPassword/index.js.map +1 -0
- package/build/components/Pages/LinkEmail/index.js +63 -0
- package/build/components/Pages/LinkEmail/index.js.map +1 -0
- package/build/components/Pages/LinkedProvider/index.d.ts +3 -0
- package/build/components/Pages/LinkedProvider/index.js +90 -0
- package/build/components/Pages/LinkedProvider/index.js.map +1 -0
- package/build/components/Pages/LinkedProviders/index.js +45 -0
- package/build/components/Pages/LinkedProviders/index.js.map +1 -0
- package/build/components/Pages/LinkedProviders/styles.js +51 -0
- package/build/components/Pages/LinkedProviders/styles.js.map +1 -0
- package/build/components/Pages/LoadWallets/index.js +91 -0
- package/build/components/Pages/LoadWallets/index.js.map +1 -0
- package/build/components/Pages/Loading/index.js +61 -0
- package/build/components/Pages/Loading/index.js.map +1 -0
- package/build/components/Pages/MobileConnectors/index.js +71 -0
- package/build/components/Pages/MobileConnectors/index.js.map +1 -0
- package/build/components/Pages/MobileConnectors/styles.js +65 -0
- package/build/components/Pages/MobileConnectors/styles.js.map +1 -0
- package/build/components/Pages/NoAssetsAvailable/index.js +45 -0
- package/build/components/Pages/NoAssetsAvailable/index.js.map +1 -0
- package/build/components/Pages/NoAssetsAvailable/styles.js +10 -0
- package/build/components/Pages/NoAssetsAvailable/styles.js.map +1 -0
- package/build/components/Pages/Onboarding/index.js +20 -0
- package/build/components/Pages/Onboarding/index.js.map +1 -0
- package/build/components/Pages/PhoneOTP/index.js +128 -0
- package/build/components/Pages/PhoneOTP/index.js.map +1 -0
- package/build/components/Pages/PhoneOTP/styles.js +38 -0
- package/build/components/Pages/PhoneOTP/styles.js.map +1 -0
- package/build/components/Pages/Profile/index.js +35 -0
- package/build/components/Pages/Profile/index.js.map +1 -0
- package/build/components/Pages/Providers/index.js +157 -0
- package/build/components/Pages/Providers/index.js.map +1 -0
- package/build/components/Pages/Providers/styles.js +156 -0
- package/build/components/Pages/Providers/styles.js.map +1 -0
- package/build/components/Pages/Receive/index.js +61 -0
- package/build/components/Pages/Receive/index.js.map +1 -0
- package/build/components/Pages/Receive/styles.d.ts +1 -0
- package/build/components/Pages/Receive/styles.js +52 -0
- package/build/components/Pages/Receive/styles.js.map +1 -0
- package/build/components/Pages/Recover/index.js +252 -0
- package/build/components/Pages/Recover/index.js.map +1 -0
- package/build/components/Pages/Recover/recoveryRegistry.d.ts +32 -0
- package/build/components/Pages/Recover/recoveryRegistry.js +61 -0
- package/build/components/Pages/Recover/recoveryRegistry.js.map +1 -0
- package/build/components/Pages/RemoveLinkedProvider/index.js +104 -0
- package/build/components/Pages/RemoveLinkedProvider/index.js.map +1 -0
- package/build/components/Pages/SelectToken/index.js +102 -0
- package/build/components/Pages/SelectToken/index.js.map +1 -0
- package/build/components/Pages/SelectToken/styles.js +78 -0
- package/build/components/Pages/SelectToken/styles.js.map +1 -0
- package/build/components/Pages/SelectWalletToRecover/index.d.ts +1 -2
- package/build/components/Pages/SelectWalletToRecover/index.js +70 -0
- package/build/components/Pages/SelectWalletToRecover/index.js.map +1 -0
- package/build/components/Pages/Send/EthereumSend.d.ts +1 -0
- package/build/components/Pages/Send/EthereumSend.js +88 -0
- package/build/components/Pages/Send/EthereumSend.js.map +1 -0
- package/build/components/Pages/Send/SolanaSend.d.ts +1 -0
- package/build/components/Pages/Send/SolanaSend.js +93 -0
- package/build/components/Pages/Send/SolanaSend.js.map +1 -0
- package/build/components/Pages/Send/index.d.ts +7 -1
- package/build/components/Pages/Send/index.js +18 -0
- package/build/components/Pages/Send/index.js.map +1 -0
- package/build/components/Pages/Send/styles.js +112 -0
- package/build/components/Pages/Send/styles.js.map +1 -0
- package/build/components/Pages/Send/utils.d.ts +1 -1
- package/build/components/Pages/Send/utils.js +63 -0
- package/build/components/Pages/Send/utils.js.map +1 -0
- package/build/components/Pages/SendConfirmation/EstimatedFees.js +66 -0
- package/build/components/Pages/SendConfirmation/EstimatedFees.js.map +1 -0
- package/build/components/Pages/SendConfirmation/index.js +331 -0
- package/build/components/Pages/SendConfirmation/index.js.map +1 -0
- package/build/components/Pages/SendConfirmation/styles.js +129 -0
- package/build/components/Pages/SendConfirmation/styles.js.map +1 -0
- package/build/components/Pages/SocialProviders/index.js +15 -0
- package/build/components/Pages/SocialProviders/index.js.map +1 -0
- package/build/components/Pages/SolanaSendConfirmation/index.d.ts +1 -0
- package/build/components/Pages/SolanaSendConfirmation/index.js +152 -0
- package/build/components/Pages/SolanaSendConfirmation/index.js.map +1 -0
- package/build/components/Pages/SolanaWallets/index.d.ts +1 -0
- package/build/components/Pages/SolanaWallets/index.js +36 -0
- package/build/components/Pages/SolanaWallets/index.js.map +1 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.js +62 -0
- package/build/components/PasswordStrength/PasswordStrengthIndicator.js.map +1 -0
- package/build/components/PasswordStrength/password-utility.js +128 -0
- package/build/components/PasswordStrength/password-utility.js.map +1 -0
- package/build/constants/chainConfigs.js +316 -0
- package/build/constants/chainConfigs.js.map +1 -0
- package/build/constants/defaultTheme.js +6 -0
- package/build/constants/defaultTheme.js.map +1 -0
- package/build/constants/openfort.d.ts +4 -0
- package/build/constants/openfort.js +8 -0
- package/build/constants/openfort.js.map +1 -0
- package/build/core/ConnectionStrategy.d.ts +31 -0
- package/build/core/ConnectionStrategy.js +9 -0
- package/build/core/ConnectionStrategy.js.map +1 -0
- package/build/core/ConnectionStrategyContext.d.ts +16 -0
- package/build/core/ConnectionStrategyContext.js +22 -0
- package/build/core/ConnectionStrategyContext.js.map +1 -0
- package/build/core/errors.d.ts +1 -0
- package/build/core/strategies/EthereumBridgeStrategy.d.ts +11 -0
- package/build/core/strategies/EthereumBridgeStrategy.js +83 -0
- package/build/core/strategies/EthereumBridgeStrategy.js.map +1 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.d.ts +8 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.js +85 -0
- package/build/core/strategies/EthereumEmbeddedStrategy.js.map +1 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.d.ts +9 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.js +53 -0
- package/build/core/strategies/SolanaEmbeddedStrategy.js.map +1 -0
- package/build/core/strategyUtils.d.ts +6 -0
- package/build/core/strategyUtils.js +31 -0
- package/build/core/strategyUtils.js.map +1 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.d.ts +87 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.js +18 -0
- package/build/ethereum/OpenfortEthereumBridgeContext.js.map +1 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.d.ts +14 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.js +24 -0
- package/build/ethereum/hooks/getEmbeddedWalletClient.js.map +1 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.d.ts +17 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js +425 -0
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js.map +1 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.d.ts +29 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.js +204 -0
- package/build/ethereum/hooks/useEthereumWalletAssets.js.map +1 -0
- package/build/ethereum/index.d.ts +11 -0
- package/build/ethereum/index.js +3 -0
- package/build/ethereum/index.js.map +1 -0
- package/build/ethereum/types.d.ts +140 -0
- package/build/hooks/openfort/auth/requestEmailVerification.js +21 -0
- package/build/hooks/openfort/auth/requestEmailVerification.js.map +1 -0
- package/build/hooks/openfort/auth/status.js +11 -0
- package/build/hooks/openfort/auth/status.js.map +1 -0
- package/build/hooks/openfort/auth/useAuthCallback.d.ts +2 -1
- package/build/hooks/openfort/auth/useAuthCallback.js +197 -0
- package/build/hooks/openfort/auth/useAuthCallback.js.map +1 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.d.ts +3 -2
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js +161 -0
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useEmailAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useEmailAuth.js +496 -0
- package/build/hooks/openfort/auth/useEmailAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useEmailOtpAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useEmailOtpAuth.js +151 -0
- package/build/hooks/openfort/auth/useEmailOtpAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useGuestAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useGuestAuth.js +142 -0
- package/build/hooks/openfort/auth/useGuestAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useOAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/useOAuth.js +217 -0
- package/build/hooks/openfort/auth/useOAuth.js.map +1 -0
- package/build/hooks/openfort/auth/usePhoneOtpAuth.d.ts +4 -3
- package/build/hooks/openfort/auth/usePhoneOtpAuth.js +174 -0
- package/build/hooks/openfort/auth/usePhoneOtpAuth.js.map +1 -0
- package/build/hooks/openfort/auth/useSignOut.d.ts +2 -1
- package/build/hooks/openfort/auth/useSignOut.js +104 -0
- package/build/hooks/openfort/auth/useSignOut.js.map +1 -0
- package/build/hooks/openfort/hookConsistency.js +17 -0
- package/build/hooks/openfort/hookConsistency.js.map +1 -0
- package/build/hooks/openfort/use7702Authorization.js +73 -0
- package/build/hooks/openfort/use7702Authorization.js.map +1 -0
- package/build/hooks/openfort/useGrantPermissions.d.ts +7 -76
- package/build/hooks/openfort/useGrantPermissions.js +221 -0
- package/build/hooks/openfort/useGrantPermissions.js.map +1 -0
- package/build/hooks/openfort/useProviders.js +75 -0
- package/build/hooks/openfort/useProviders.js.map +1 -0
- package/build/hooks/openfort/useRevokePermissions.d.ts +2 -1
- package/build/hooks/openfort/useRevokePermissions.js +126 -0
- package/build/hooks/openfort/useRevokePermissions.js.map +1 -0
- package/build/hooks/openfort/useUI.d.ts +4 -45
- package/build/hooks/openfort/useUI.js +122 -0
- package/build/hooks/openfort/useUI.js.map +1 -0
- package/build/hooks/openfort/useUser.d.ts +12 -35
- package/build/hooks/openfort/useUser.js +61 -0
- package/build/hooks/openfort/useUser.js.map +1 -0
- package/build/hooks/openfort/walletTypes.d.ts +32 -0
- package/build/hooks/openfort/walletTypes.js +53 -0
- package/build/hooks/openfort/walletTypes.js.map +1 -0
- package/build/hooks/useBalance.d.ts +50 -0
- package/build/hooks/useBalance.js +80 -0
- package/build/hooks/useBalance.js.map +1 -0
- package/build/hooks/useConnectLifecycle.d.ts +7 -0
- package/build/hooks/useConnectLifecycle.js +43 -0
- package/build/hooks/useConnectLifecycle.js.map +1 -0
- package/build/hooks/useConnectors.d.ts +3 -5
- package/build/hooks/useConnectors.js +26 -0
- package/build/hooks/useConnectors.js.map +1 -0
- package/build/hooks/useCopyToClipboard.js +29 -0
- package/build/hooks/useCopyToClipboard.js.map +1 -0
- package/build/hooks/useFitText.js +125 -0
- package/build/hooks/useFitText.js.map +1 -0
- package/build/hooks/useFocusTrap.d.ts +4 -1
- package/build/hooks/useFocusTrap.js +60 -0
- package/build/hooks/useFocusTrap.js.map +1 -0
- package/build/hooks/useGoogleFont.js +43 -0
- package/build/hooks/useGoogleFont.js.map +1 -0
- package/build/hooks/useIsMobile.js +17 -0
- package/build/hooks/useIsMobile.js.map +1 -0
- package/build/hooks/useIsMounted.js +10 -0
- package/build/hooks/useIsMounted.js.map +1 -0
- package/build/hooks/useLastConnector.js +39 -0
- package/build/hooks/useLastConnector.js.map +1 -0
- package/build/hooks/useLocales.d.ts +1 -1
- package/build/hooks/useLocales.js +68 -0
- package/build/hooks/useLocales.js.map +1 -0
- package/build/hooks/useLockBodyScroll.js +53 -0
- package/build/hooks/useLockBodyScroll.js.map +1 -0
- package/build/hooks/usePrevious.js +14 -0
- package/build/hooks/usePrevious.js.map +1 -0
- package/build/hooks/useResolvedIdentity.d.ts +70 -0
- package/build/hooks/useResolvedIdentity.js +90 -0
- package/build/hooks/useResolvedIdentity.js.map +1 -0
- package/build/hooks/useRouteProps.d.ts +10 -5
- package/build/hooks/useRouteProps.js +27 -0
- package/build/hooks/useRouteProps.js.map +1 -0
- package/build/hooks/useWalletConnectModal.js +59 -0
- package/build/hooks/useWalletConnectModal.js.map +1 -0
- package/build/hooks/useWindowSize.js +23 -0
- package/build/hooks/useWindowSize.js.map +1 -0
- package/build/index.d.ts +61 -16
- package/build/index.js +31 -0
- package/build/index.js.map +1 -0
- package/build/localizations/index.js +57 -0
- package/build/localizations/index.js.map +1 -0
- package/build/localizations/locales/ar-AE.js +100 -0
- package/build/localizations/locales/ar-AE.js.map +1 -0
- package/build/localizations/locales/ca-AD.js +98 -0
- package/build/localizations/locales/ca-AD.js.map +1 -0
- package/build/localizations/locales/ee-EE.js +98 -0
- package/build/localizations/locales/ee-EE.js.map +1 -0
- package/build/localizations/locales/en-US.js +115 -0
- package/build/localizations/locales/en-US.js.map +1 -0
- package/build/localizations/locales/es-ES.js +98 -0
- package/build/localizations/locales/es-ES.js.map +1 -0
- package/build/localizations/locales/fa-IR.js +98 -0
- package/build/localizations/locales/fa-IR.js.map +1 -0
- package/build/localizations/locales/fr-FR.js +98 -0
- package/build/localizations/locales/fr-FR.js.map +1 -0
- package/build/localizations/locales/ja-JP.js +98 -0
- package/build/localizations/locales/ja-JP.js.map +1 -0
- package/build/localizations/locales/pt-BR.js +98 -0
- package/build/localizations/locales/pt-BR.js.map +1 -0
- package/build/localizations/locales/ru-RU.js +98 -0
- package/build/localizations/locales/ru-RU.js.map +1 -0
- package/build/localizations/locales/tr-TR.js +98 -0
- package/build/localizations/locales/tr-TR.js.map +1 -0
- package/build/localizations/locales/vi-VN.js +98 -0
- package/build/localizations/locales/vi-VN.js.map +1 -0
- package/build/localizations/locales/zh-CN.js +98 -0
- package/build/localizations/locales/zh-CN.js.map +1 -0
- package/build/openfort/CoreOpenfortProvider.d.ts +9 -22
- package/build/openfort/CoreOpenfortProvider.js +389 -0
- package/build/openfort/CoreOpenfortProvider.js.map +1 -0
- package/build/{hooks/useConnectCallback.d.ts → openfort/connectCallbackTypes.d.ts} +2 -2
- package/build/openfort/context.d.ts +3 -2
- package/build/openfort/context.js +6 -0
- package/build/openfort/context.js.map +1 -0
- package/build/openfort/core/client.d.ts +2 -1
- package/build/openfort/core/client.js +23 -0
- package/build/openfort/core/client.js.map +1 -0
- package/build/openfort/hooks/useActiveAddressSync.d.ts +20 -0
- package/build/openfort/hooks/useActiveAddressSync.js +76 -0
- package/build/openfort/hooks/useActiveAddressSync.js.map +1 -0
- package/build/openfort/hooks/useAutoRecovery.d.ts +26 -0
- package/build/openfort/hooks/useAutoRecovery.js +102 -0
- package/build/openfort/hooks/useAutoRecovery.js.map +1 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.d.ts +31 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.js +77 -0
- package/build/openfort/hooks/useEmbeddedStateMachine.js.map +1 -0
- package/build/openfort/selectors.d.ts +9 -0
- package/build/openfort/selectors.js +15 -0
- package/build/openfort/selectors.js.map +1 -0
- package/build/openfort/store.d.ts +46 -0
- package/build/openfort/store.js +116 -0
- package/build/openfort/store.js.map +1 -0
- package/build/openfort/useOpenfort.d.ts +9 -3
- package/build/openfort/useOpenfort.js +15 -0
- package/build/openfort/useOpenfort.js.map +1 -0
- package/build/openfort/useOpenfortStore.d.ts +2 -0
- package/build/openfort/useOpenfortStore.js +13 -0
- package/build/openfort/useOpenfortStore.js.map +1 -0
- package/build/query/index.d.ts +2 -0
- package/build/query/queryKeys.d.ts +12 -0
- package/build/query/queryKeys.js +15 -0
- package/build/query/queryKeys.js.map +1 -0
- package/build/query/queryOptions.d.ts +23 -0
- package/build/query/queryOptions.js +31 -0
- package/build/query/queryOptions.js.map +1 -0
- package/build/shared/hooks/useAsyncData.d.ts +19 -0
- package/build/shared/hooks/useAsyncData.js +69 -0
- package/build/shared/hooks/useAsyncData.js.map +1 -0
- package/build/shared/hooks/useRecoveryOTP.d.ts +11 -0
- package/build/shared/hooks/useRecoveryOTP.js +64 -0
- package/build/shared/hooks/useRecoveryOTP.js.map +1 -0
- package/build/shared/types.d.ts +65 -0
- package/build/shared/utils/embeddedWalletStatusMapper.d.ts +15 -0
- package/build/shared/utils/embeddedWalletStatusMapper.js +22 -0
- package/build/shared/utils/embeddedWalletStatusMapper.js.map +1 -0
- package/build/shared/utils/explorer.d.ts +24 -0
- package/build/shared/utils/explorer.js +71 -0
- package/build/shared/utils/explorer.js.map +1 -0
- package/build/shared/utils/otpError.d.ts +8 -0
- package/build/shared/utils/otpError.js +17 -0
- package/build/shared/utils/otpError.js.map +1 -0
- package/build/shared/utils/recovery.d.ts +15 -0
- package/build/shared/utils/recovery.js +96 -0
- package/build/shared/utils/recovery.js.map +1 -0
- package/build/shared/utils/validation.d.ts +15 -0
- package/build/shared/utils/validation.js +27 -0
- package/build/shared/utils/validation.js.map +1 -0
- package/build/shared/utils/walletStatusProps.d.ts +18 -0
- package/build/shared/utils/walletStatusProps.js +45 -0
- package/build/shared/utils/walletStatusProps.js.map +1 -0
- package/build/siwe/create-siwe-message.d.ts +15 -1
- package/build/siwe/create-siwe-message.js +32 -0
- package/build/siwe/create-siwe-message.js.map +1 -0
- package/build/solana/SolanaContext.d.ts +43 -0
- package/build/solana/SolanaContext.js +87 -0
- package/build/solana/SolanaContext.js.map +1 -0
- package/build/solana/constants.d.ts +21 -0
- package/build/solana/constants.js +24 -0
- package/build/solana/constants.js.map +1 -0
- package/build/solana/hooks/recoveryResolver.d.ts +16 -0
- package/build/solana/hooks/recoveryResolver.js +39 -0
- package/build/solana/hooks/recoveryResolver.js.map +1 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.d.ts +17 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.js +389 -0
- package/build/solana/hooks/useSolanaEmbeddedWallet.js.map +1 -0
- package/build/solana/hooks/utils.d.ts +2 -0
- package/build/solana/hooks/utils.js +18 -0
- package/build/solana/hooks/utils.js.map +1 -0
- package/build/solana/index.d.ts +12 -0
- package/build/solana/index.js +2 -0
- package/build/solana/index.js.map +1 -0
- package/build/solana/operations.d.ts +22 -0
- package/build/solana/operations.js +40 -0
- package/build/solana/operations.js.map +1 -0
- package/build/solana/provider.d.ts +131 -0
- package/build/solana/provider.js +126 -0
- package/build/solana/provider.js.map +1 -0
- package/build/solana/types.d.ts +253 -0
- package/build/solana/utils/transfer.d.ts +9 -0
- package/build/solana/utils/transfer.js +20 -0
- package/build/solana/utils/transfer.js.map +1 -0
- package/build/styles/index.js +334 -0
- package/build/styles/index.js.map +1 -0
- package/build/styles/styled/index.js +14 -0
- package/build/styles/styled/index.js.map +1 -0
- package/build/styles/themes/base.js +147 -0
- package/build/styles/themes/base.js.map +1 -0
- package/build/styles/themes/index.js +13 -0
- package/build/styles/themes/index.js.map +1 -0
- package/build/styles/themes/midnight.js +78 -0
- package/build/styles/themes/midnight.js.map +1 -0
- package/build/styles/themes/minimal.js +100 -0
- package/build/styles/themes/minimal.js.map +1 -0
- package/build/styles/themes/nouns.js +83 -0
- package/build/styles/themes/nouns.js.map +1 -0
- package/build/styles/themes/retro.js +110 -0
- package/build/styles/themes/retro.js.map +1 -0
- package/build/styles/themes/rounded.js +110 -0
- package/build/styles/themes/rounded.js.map +1 -0
- package/build/styles/themes/soft.js +73 -0
- package/build/styles/themes/soft.js.map +1 -0
- package/build/styles/themes/web95.js +136 -0
- package/build/styles/themes/web95.js.map +1 -0
- package/build/types.d.ts +5 -6
- package/build/types.js +33 -0
- package/build/types.js.map +1 -0
- package/build/utils/banner.d.ts +1 -0
- package/build/utils/banner.js +14 -0
- package/build/utils/banner.js.map +1 -0
- package/build/utils/errorHandling.js +331 -0
- package/build/utils/errorHandling.js.map +1 -0
- package/build/utils/format.d.ts +18 -0
- package/build/utils/format.js +59 -0
- package/build/utils/format.js.map +1 -0
- package/build/utils/index.d.ts +2 -3
- package/build/utils/index.js +67 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/logger.js +13 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/oauthErrorHandler.d.ts +1 -1
- package/build/utils/oauthErrorHandler.js +42 -0
- package/build/utils/oauthErrorHandler.js.map +1 -0
- package/build/utils/p3.js +14 -0
- package/build/utils/p3.js.map +1 -0
- package/build/utils/rpc.d.ts +34 -0
- package/build/utils/rpc.js +93 -0
- package/build/utils/rpc.js.map +1 -0
- package/build/utils/useOnUserReturn.js +25 -0
- package/build/utils/useOnUserReturn.js.map +1 -0
- package/build/utils/validation.js +7 -0
- package/build/utils/validation.js.map +1 -0
- package/build/utils/wallets.d.ts +6 -0
- package/build/utils/wallets.js +14 -0
- package/build/utils/wallets.js.map +1 -0
- package/build/version.d.ts +1 -1
- package/build/version.js +4 -0
- package/build/version.js.map +1 -0
- package/build/wagmi/OpenfortWagmiBridge.d.ts +3 -0
- package/build/wagmi/OpenfortWagmiBridge.js +166 -0
- package/build/wagmi/OpenfortWagmiBridge.js.map +1 -0
- package/build/wagmi/components/ChainSelect/index.js +140 -0
- package/build/wagmi/components/ChainSelect/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectDropdown/index.js +144 -0
- package/build/wagmi/components/ChainSelectDropdown/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectDropdown/styles.js +47 -0
- package/build/wagmi/components/ChainSelectDropdown/styles.js.map +1 -0
- package/build/wagmi/components/ChainSelectList/index.js +109 -0
- package/build/wagmi/components/ChainSelectList/index.js.map +1 -0
- package/build/wagmi/components/ChainSelectList/styles.js +225 -0
- package/build/wagmi/components/ChainSelectList/styles.js.map +1 -0
- package/build/wagmi/components/SwitchNetworks/index.js +22 -0
- package/build/wagmi/components/SwitchNetworks/index.js.map +1 -0
- package/build/wagmi/connectorFilter.d.ts +6 -0
- package/build/wagmi/connectorFilter.js +16 -0
- package/build/wagmi/connectorFilter.js.map +1 -0
- package/build/{defaultConfig.d.ts → wagmi/defaultConfig.d.ts} +1 -2
- package/build/wagmi/defaultConfig.js +27 -0
- package/build/wagmi/defaultConfig.js.map +1 -0
- package/build/wagmi/defaultConnectors.js +36 -0
- package/build/wagmi/defaultConnectors.js.map +1 -0
- package/build/wagmi/embeddedConnector.d.ts +4 -0
- package/build/wagmi/embeddedConnector.js +80 -0
- package/build/wagmi/embeddedConnector.js.map +1 -0
- package/build/wagmi/index.d.ts +10 -0
- package/build/wagmi/index.js +10 -0
- package/build/wagmi/index.js.map +1 -0
- package/build/wagmi/useChainIsSupported.d.ts +20 -0
- package/build/wagmi/useChainIsSupported.js +30 -0
- package/build/wagmi/useChainIsSupported.js.map +1 -0
- package/build/wagmi/useChains.d.ts +29 -0
- package/build/wagmi/useChains.js +38 -0
- package/build/wagmi/useChains.js.map +1 -0
- package/build/wagmi/useConnectWithSiwe.d.ts +22 -0
- package/build/wagmi/useConnectWithSiwe.js +115 -0
- package/build/wagmi/useConnectWithSiwe.js.map +1 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.d.ts +2 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.js +55 -0
- package/build/wagmi/useEmbeddedWalletWagmiSync.js.map +1 -0
- package/build/wagmi/useWalletAuth.d.ts +24 -0
- package/build/wagmi/useWalletAuth.js +180 -0
- package/build/wagmi/useWalletAuth.js.map +1 -0
- package/build/wallets/useExternalConnectors.d.ts +17 -0
- package/build/wallets/useExternalConnectors.js +98 -0
- package/build/wallets/useExternalConnectors.js.map +1 -0
- package/build/wallets/walletConfigs.js +344 -0
- package/build/wallets/walletConfigs.js.map +1 -0
- package/package.json +62 -11
- package/build/components/PageLayout/index.d.ts +0 -6
- package/build/components/contexts/web3/index.d.ts +0 -13
- package/build/constants/erc20.d.ts +0 -42
- package/build/hooks/openfort/auth/useWalletAuth.d.ts +0 -20
- package/build/hooks/openfort/useConnectWithSiwe.d.ts +0 -8
- package/build/hooks/openfort/useWalletAssets.d.ts +0 -16
- package/build/hooks/openfort/useWallets.d.ts +0 -134
- package/build/hooks/useChainIsSupported.d.ts +0 -24
- package/build/hooks/useChains.d.ts +0 -41
- package/build/hooks/useConnect.d.ts +0 -24
- package/build/hooks/useEnsFallbackConfig.d.ts +0 -1
- package/build/index.es.js +0 -19620
- package/build/index.es.js.map +0 -1
- package/build/openfortCustomTypes.d.ts +0 -10
- package/build/wallets/index.d.ts +0 -7
- package/build/wallets/useWagmiWallets.d.ts +0 -9
- /package/build/components/Pages/{SoicalProviders → SocialProviders}/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelect/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectDropdown/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectDropdown/styles.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectList/index.d.ts +0 -0
- /package/build/{components/Common → wagmi/components}/ChainSelectList/styles.d.ts +0 -0
- /package/build/{components/Pages → wagmi/components}/SwitchNetworks/index.d.ts +0 -0
- /package/build/{defaultConnectors.d.ts → wagmi/defaultConnectors.d.ts} +0 -0
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
+
import { useMemo, useEffect, useState, useRef } from 'react';
|
|
4
|
+
import { isAddress, createPublicClient, http, erc20Abi, parseUnits, encodeFunctionData } from 'viem';
|
|
5
|
+
import { TickIcon } from '../../../assets/icons.js';
|
|
6
|
+
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
7
|
+
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
8
|
+
import { useBalance } from '../../../hooks/useBalance.js';
|
|
9
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
10
|
+
import { useAsyncData } from '../../../shared/hooks/useAsyncData.js';
|
|
11
|
+
import { getExplorerUrl } from '../../../shared/utils/explorer.js';
|
|
12
|
+
import 'detect-browser';
|
|
13
|
+
import { truncateEthAddress } from '../../../utils/format.js';
|
|
14
|
+
import { parseTransactionError } from '../../../utils/errorHandling.js';
|
|
15
|
+
import { logger } from '../../../utils/logger.js';
|
|
16
|
+
import { getChainName, getDefaultEthereumRpcUrl } from '../../../utils/rpc.js';
|
|
17
|
+
import Button from '../../Common/Button/index.js';
|
|
18
|
+
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
19
|
+
import Loader from '../../Common/Loading/index.js';
|
|
20
|
+
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
21
|
+
import { routes } from '../../Openfort/types.js';
|
|
22
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
23
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
24
|
+
import { sanitizeForParsing, isSameToken, getAssetSymbol, getAssetDecimals } from '../Send/utils.js';
|
|
25
|
+
import { EstimatedFees } from './EstimatedFees.js';
|
|
26
|
+
import { ButtonRow, SummaryList, SummaryItem, SummaryLabel, AmountValue, AddressValue, FeesValue, CheckIconWrapper, StatusMessage, ErrorContainer, ErrorTitle, ErrorMessage, ErrorAction } from './styles.js';
|
|
27
|
+
|
|
28
|
+
/** Check if chain is a testnet */
|
|
29
|
+
function isTestnetChain(chainId) {
|
|
30
|
+
const testnets = new Set([5, 11155111, 80001, 84532, 421614, 97, 4002]);
|
|
31
|
+
return testnets.has(chainId);
|
|
32
|
+
}
|
|
33
|
+
const SendConfirmation = () => {
|
|
34
|
+
var _a, _b, _c, _d, _e, _f;
|
|
35
|
+
const wallet = useEthereumEmbeddedWallet();
|
|
36
|
+
const { chainType } = useOpenfortCore();
|
|
37
|
+
const { sendForm, setRoute, triggerResize, walletConfig } = useOpenfort();
|
|
38
|
+
const address = wallet.status === 'connected' ? wallet.address : undefined;
|
|
39
|
+
const chainId = wallet.status === 'connected' ? wallet.chainId : undefined;
|
|
40
|
+
// Build chain info for block explorer
|
|
41
|
+
const chain = chainId
|
|
42
|
+
? {
|
|
43
|
+
id: chainId,
|
|
44
|
+
name: getChainName(chainId),
|
|
45
|
+
blockExplorers: {
|
|
46
|
+
default: {
|
|
47
|
+
url: getExplorerUrl(ChainTypeEnum.EVM, { chainId }),
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
testnet: isTestnetChain(chainId),
|
|
51
|
+
}
|
|
52
|
+
: undefined;
|
|
53
|
+
const recipientAddress = isAddress(sendForm.recipient) ? sendForm.recipient : undefined;
|
|
54
|
+
const normalisedAmount = sanitizeForParsing(sendForm.amount);
|
|
55
|
+
const { data: assets } = useEthereumWalletAssets();
|
|
56
|
+
const matchedToken = useMemo(() => assets === null || assets === void 0 ? void 0 : assets.find((asset) => isSameToken(asset, sendForm.asset)), [assets, sendForm.asset]);
|
|
57
|
+
const selectedTokenOption = matchedToken !== null && matchedToken !== void 0 ? matchedToken : assets === null || assets === void 0 ? void 0 : assets[0];
|
|
58
|
+
const token = selectedTokenOption !== null && selectedTokenOption !== void 0 ? selectedTokenOption : sendForm.asset;
|
|
59
|
+
const isErc20 = token.type === 'erc20';
|
|
60
|
+
const nativeBalance = useBalance({
|
|
61
|
+
address: address !== null && address !== void 0 ? address : '',
|
|
62
|
+
chainType: chainType,
|
|
63
|
+
chainId: chainId !== null && chainId !== void 0 ? chainId : 84532,
|
|
64
|
+
cluster: chainType === ChainTypeEnum.SVM ? 'devnet' : undefined,
|
|
65
|
+
enabled: !!address && !isErc20,
|
|
66
|
+
});
|
|
67
|
+
const refetchNativeBalance = nativeBalance.refetch;
|
|
68
|
+
// ERC20 balance using viem publicClient directly (skipped when native send; no placeholder address)
|
|
69
|
+
const erc20Balance = useAsyncData({
|
|
70
|
+
queryKey: ['erc20-balance', address, token.type === 'erc20' ? token.address : null, chainId],
|
|
71
|
+
queryFn: async () => {
|
|
72
|
+
if (!isErc20 || !address || !chainId)
|
|
73
|
+
return { value: BigInt(0), decimals: 18, symbol: 'ERC20' };
|
|
74
|
+
try {
|
|
75
|
+
const rpcUrl = getDefaultEthereumRpcUrl(chainId);
|
|
76
|
+
const publicClient = createPublicClient({ transport: http(rpcUrl) });
|
|
77
|
+
const balance = await publicClient.readContract({
|
|
78
|
+
address: token.address,
|
|
79
|
+
abi: erc20Abi,
|
|
80
|
+
functionName: 'balanceOf',
|
|
81
|
+
args: [address],
|
|
82
|
+
});
|
|
83
|
+
return { value: balance, decimals: 18, symbol: getAssetSymbol(token) };
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
logger.error('Failed to fetch ERC20 balance:', error);
|
|
87
|
+
return { value: BigInt(0), decimals: 18, symbol: getAssetSymbol(token) };
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
enabled: Boolean(isErc20 && address && chainId),
|
|
91
|
+
});
|
|
92
|
+
const refetchErc20Balance = erc20Balance.refetch;
|
|
93
|
+
const parsedAmount = normalisedAmount && token && getAssetDecimals(token) !== undefined
|
|
94
|
+
? (() => {
|
|
95
|
+
try {
|
|
96
|
+
return parseUnits(normalisedAmount, getAssetDecimals(token));
|
|
97
|
+
}
|
|
98
|
+
catch (_error) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
})()
|
|
102
|
+
: null;
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!recipientAddress || parsedAmount === null || parsedAmount <= BigInt(0)) {
|
|
105
|
+
logger.log('INVALID - recipientAddress:', recipientAddress, 'parsedAmount:', parsedAmount);
|
|
106
|
+
// setRoute(routes.SEND)
|
|
107
|
+
}
|
|
108
|
+
}, [recipientAddress, parsedAmount, setRoute]);
|
|
109
|
+
// Get current balance value from discriminated unions
|
|
110
|
+
const nativeBalanceValue = nativeBalance.status === 'success' ? nativeBalance.value : undefined;
|
|
111
|
+
const erc20BalanceValue = erc20Balance.data && !erc20Balance.error ? (_a = erc20Balance.data) === null || _a === void 0 ? void 0 : _a.value : undefined;
|
|
112
|
+
const currentBalance = isErc20 ? erc20BalanceValue : nativeBalanceValue;
|
|
113
|
+
const nativeSymbol = nativeBalance.status === 'success' ? nativeBalance.symbol : 'ETH';
|
|
114
|
+
const insufficientBalance = parsedAmount !== null && currentBalance !== undefined ? parsedAmount > currentBalance : false;
|
|
115
|
+
// Track original balance and polling state
|
|
116
|
+
const [isPollingBalance, setIsPollingBalance] = useState(false);
|
|
117
|
+
const originalBalanceRef = useRef(undefined);
|
|
118
|
+
const pollingIntervalRef = useRef(null);
|
|
119
|
+
// Inline transaction state management (replaces useEthereumSendTransaction + useEthereumWriteContract)
|
|
120
|
+
const [nativeTxHash, setNativeTxHash] = useState(undefined);
|
|
121
|
+
const [isNativePending, setIsNativePending] = useState(false);
|
|
122
|
+
const [nativeError, setNativeError] = useState(null);
|
|
123
|
+
const [erc20TxHash, setErc20TxHash] = useState(undefined);
|
|
124
|
+
const [isTokenPending, setIsTokenPending] = useState(false);
|
|
125
|
+
const [erc20Error, setErc20Error] = useState(null);
|
|
126
|
+
const transactionHash = nativeTxHash !== null && nativeTxHash !== void 0 ? nativeTxHash : erc20TxHash;
|
|
127
|
+
const sendTransactionAsync = async (params) => {
|
|
128
|
+
setIsNativePending(true);
|
|
129
|
+
setNativeError(null);
|
|
130
|
+
try {
|
|
131
|
+
if (!wallet.activeWallet)
|
|
132
|
+
throw new Error('Wallet not available');
|
|
133
|
+
const provider = await wallet.activeWallet.getProvider();
|
|
134
|
+
const hash = (await provider.request({
|
|
135
|
+
method: 'eth_sendTransaction',
|
|
136
|
+
params: [
|
|
137
|
+
{
|
|
138
|
+
from: address,
|
|
139
|
+
to: params.to,
|
|
140
|
+
value: `0x${params.value.toString(16)}`,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
}));
|
|
144
|
+
setNativeTxHash(hash);
|
|
145
|
+
return hash;
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
149
|
+
setNativeError(err);
|
|
150
|
+
throw err;
|
|
151
|
+
}
|
|
152
|
+
finally {
|
|
153
|
+
setIsNativePending(false);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
const writeContractAsync = async (params) => {
|
|
157
|
+
setIsTokenPending(true);
|
|
158
|
+
setErc20Error(null);
|
|
159
|
+
try {
|
|
160
|
+
if (!wallet.activeWallet)
|
|
161
|
+
throw new Error('Wallet not available');
|
|
162
|
+
const provider = await wallet.activeWallet.getProvider();
|
|
163
|
+
const data = encodeFunctionData({
|
|
164
|
+
abi: params.abi,
|
|
165
|
+
functionName: params.functionName,
|
|
166
|
+
args: params.args,
|
|
167
|
+
});
|
|
168
|
+
const hash = (await provider.request({
|
|
169
|
+
method: 'eth_sendTransaction',
|
|
170
|
+
params: [{ from: address, to: params.address, data }],
|
|
171
|
+
}));
|
|
172
|
+
setErc20TxHash(hash);
|
|
173
|
+
return hash;
|
|
174
|
+
}
|
|
175
|
+
catch (error) {
|
|
176
|
+
const err = error instanceof Error ? error : new Error(String(error));
|
|
177
|
+
setErc20Error(err);
|
|
178
|
+
throw err;
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
setIsTokenPending(false);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
const transferData = recipientAddress && parsedAmount !== null && parsedAmount > BigInt(0)
|
|
185
|
+
? token.type === 'erc20'
|
|
186
|
+
? encodeFunctionData({
|
|
187
|
+
abi: erc20Abi,
|
|
188
|
+
functionName: 'transfer',
|
|
189
|
+
args: [recipientAddress, parsedAmount],
|
|
190
|
+
})
|
|
191
|
+
: undefined
|
|
192
|
+
: undefined;
|
|
193
|
+
// Wait for transaction receipt using viem publicClient directly
|
|
194
|
+
const receiptState = useAsyncData({
|
|
195
|
+
queryKey: ['tx-receipt', transactionHash, chainId],
|
|
196
|
+
queryFn: async () => {
|
|
197
|
+
if (!transactionHash || !chainId)
|
|
198
|
+
return null;
|
|
199
|
+
try {
|
|
200
|
+
const rpcUrl = getDefaultEthereumRpcUrl(chainId);
|
|
201
|
+
const publicClient = createPublicClient({ transport: http(rpcUrl) });
|
|
202
|
+
const receipt = await publicClient.waitForTransactionReceipt({ hash: transactionHash });
|
|
203
|
+
return receipt;
|
|
204
|
+
}
|
|
205
|
+
catch (error) {
|
|
206
|
+
logger.error('Failed to get transaction receipt:', error);
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
enabled: Boolean(transactionHash && chainId),
|
|
211
|
+
});
|
|
212
|
+
const receipt = receiptState.data;
|
|
213
|
+
const isWaitingForReceipt = receiptState.isLoading;
|
|
214
|
+
const isSuccess = receiptState.data && !receiptState.error && ((_b = receiptState.data) === null || _b === void 0 ? void 0 : _b.status) === 'success';
|
|
215
|
+
const waitError = (_c = receiptState.error) !== null && _c !== void 0 ? _c : null;
|
|
216
|
+
const isSubmitting = isNativePending || isTokenPending;
|
|
217
|
+
const isLoading = isSubmitting || isWaitingForReceipt;
|
|
218
|
+
const firstError = nativeError || erc20Error || waitError;
|
|
219
|
+
// Store original balance when transaction starts
|
|
220
|
+
useEffect(() => {
|
|
221
|
+
if (isSubmitting && originalBalanceRef.current === undefined) {
|
|
222
|
+
originalBalanceRef.current = currentBalance;
|
|
223
|
+
}
|
|
224
|
+
}, [isSubmitting, currentBalance]);
|
|
225
|
+
// Poll balance when transaction is successful until it changes
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
if (isSuccess && originalBalanceRef.current !== undefined) {
|
|
228
|
+
// Start polling
|
|
229
|
+
setIsPollingBalance(true);
|
|
230
|
+
const refetchBalance = isErc20 ? refetchErc20Balance : refetchNativeBalance;
|
|
231
|
+
// Immediate first refetch
|
|
232
|
+
refetchBalance();
|
|
233
|
+
// Set up interval for polling every 3 seconds
|
|
234
|
+
pollingIntervalRef.current = setInterval(() => {
|
|
235
|
+
refetchBalance();
|
|
236
|
+
}, 3000);
|
|
237
|
+
}
|
|
238
|
+
return () => {
|
|
239
|
+
if (pollingIntervalRef.current) {
|
|
240
|
+
clearInterval(pollingIntervalRef.current);
|
|
241
|
+
pollingIntervalRef.current = null;
|
|
242
|
+
}
|
|
243
|
+
};
|
|
244
|
+
}, [isSuccess, isErc20, refetchErc20Balance, refetchNativeBalance]);
|
|
245
|
+
// Stop polling when balance changes
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
if (isPollingBalance && currentBalance !== undefined && originalBalanceRef.current !== undefined) {
|
|
248
|
+
if (currentBalance !== originalBalanceRef.current) {
|
|
249
|
+
setIsPollingBalance(false);
|
|
250
|
+
if (pollingIntervalRef.current) {
|
|
251
|
+
clearInterval(pollingIntervalRef.current);
|
|
252
|
+
pollingIntervalRef.current = null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}, [isPollingBalance, currentBalance]);
|
|
257
|
+
const handleConfirm = async () => {
|
|
258
|
+
if (!recipientAddress || !parsedAmount || parsedAmount <= BigInt(0) || insufficientBalance)
|
|
259
|
+
return;
|
|
260
|
+
try {
|
|
261
|
+
if (token.type === 'native') {
|
|
262
|
+
await sendTransactionAsync({
|
|
263
|
+
to: recipientAddress,
|
|
264
|
+
value: parsedAmount,
|
|
265
|
+
chainId,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
else {
|
|
269
|
+
await writeContractAsync({
|
|
270
|
+
abi: erc20Abi,
|
|
271
|
+
address: token.address,
|
|
272
|
+
functionName: 'transfer',
|
|
273
|
+
args: [recipientAddress, parsedAmount],
|
|
274
|
+
chainId,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (_error) {
|
|
279
|
+
// Errors are surfaced through mutation hooks
|
|
280
|
+
}
|
|
281
|
+
};
|
|
282
|
+
const handleCancel = () => {
|
|
283
|
+
// Keep the current token, amount, and recipient when going back - don't reset
|
|
284
|
+
setRoute(routes.SEND);
|
|
285
|
+
};
|
|
286
|
+
const handleFinish = () => {
|
|
287
|
+
// Clear polling interval if still running
|
|
288
|
+
if (pollingIntervalRef.current) {
|
|
289
|
+
clearInterval(pollingIntervalRef.current);
|
|
290
|
+
pollingIntervalRef.current = null;
|
|
291
|
+
}
|
|
292
|
+
setIsPollingBalance(false);
|
|
293
|
+
// Don't reset the form - keep amount, token, and recipient for easier repeat transactions
|
|
294
|
+
setRoute(routes.CONNECTED);
|
|
295
|
+
};
|
|
296
|
+
const status = isSuccess ? 'success' : firstError ? 'error' : 'idle';
|
|
297
|
+
const errorDetails = status === 'error' ? parseTransactionError(firstError) : null;
|
|
298
|
+
const blockExplorerUrl = (_e = (_d = chain === null || chain === void 0 ? void 0 : chain.blockExplorers) === null || _d === void 0 ? void 0 : _d.default) === null || _e === void 0 ? void 0 : _e.url;
|
|
299
|
+
const handleOpenBlockExplorer = () => {
|
|
300
|
+
if ((receipt === null || receipt === void 0 ? void 0 : receipt.transactionHash) && blockExplorerUrl) {
|
|
301
|
+
window.open(`${blockExplorerUrl}/tx/${receipt.transactionHash}`, '_blank', 'noopener,noreferrer');
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
useEffect(() => {
|
|
305
|
+
setTimeout(triggerResize, 10); // delay required here for modal to resize
|
|
306
|
+
}, [errorDetails, insufficientBalance, receipt === null || receipt === void 0 ? void 0 : receipt.transactionHash, isLoading, triggerResize]);
|
|
307
|
+
const isSponsored = useMemo(() => {
|
|
308
|
+
var _a;
|
|
309
|
+
const feeSponsorship = (_a = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _a === void 0 ? void 0 : _a.ethereumFeeSponsorshipId;
|
|
310
|
+
if (!feeSponsorship)
|
|
311
|
+
return false;
|
|
312
|
+
if (typeof feeSponsorship === 'string')
|
|
313
|
+
return true;
|
|
314
|
+
return feeSponsorship[chainId !== null && chainId !== void 0 ? chainId : 0] !== undefined;
|
|
315
|
+
}, [(_f = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _f === void 0 ? void 0 : _f.ethereumFeeSponsorshipId, chainId]);
|
|
316
|
+
if (isSuccess) {
|
|
317
|
+
const successAmount = normalisedAmount || '0';
|
|
318
|
+
const successSymbol = getAssetSymbol(token);
|
|
319
|
+
return (jsxs(PageContent, { children: [jsx(Loader, { isSuccess: true, header: "Transfer Sent", description: `${successAmount} ${successSymbol} sent successfully` }), jsxs(ButtonRow, { children: [jsx(Button, { variant: "primary", onClick: handleOpenBlockExplorer, children: "View on Explorer" }), jsx(Button, { variant: "secondary", onClick: handleFinish, children: "Back to profile" })] })] }));
|
|
320
|
+
}
|
|
321
|
+
return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: "Confirm transfer" }), jsx(ModalBody, { children: "Review the transaction details before sending." }), jsxs(SummaryList, { children: [jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "Sending" }), jsxs(AmountValue, { children: [normalisedAmount || '0', " ", getAssetSymbol(token)] })] }), jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "From" }), jsx(AddressValue, { children: address ? (jsx(CopyText, { size: "1rem", value: address, children: truncateEthAddress(address) })) : ('--') })] }), jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "To" }), jsx(AddressValue, { children: recipientAddress ? (jsx(CopyText, { size: "1rem", value: recipientAddress, children: truncateEthAddress(recipientAddress) })) : ('--') })] }), jsxs("div", { children: [jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "Estimated fees" }), jsxs(FeesValue, { "$completed": isSponsored, children: [jsx(EstimatedFees, { account: address, to: token.type === 'erc20' ? token.address : recipientAddress, value: token.type === 'native' && parsedAmount ? parsedAmount : undefined, data: transferData, chainId: chainId, nativeSymbol: nativeSymbol, enabled: Boolean(address && recipientAddress && parsedAmount && parsedAmount > BigInt(0)), hideInfoIcon: isSponsored }), jsx(CheckIconWrapper, { children: jsx(TickIcon, {}) })] })] }), isSponsored && (jsx("div", { style: {
|
|
322
|
+
textAlign: 'end',
|
|
323
|
+
marginTop: '4px',
|
|
324
|
+
width: '100%',
|
|
325
|
+
color: 'var(--ck-body-color-valid)',
|
|
326
|
+
fontSize: '12px',
|
|
327
|
+
}, children: "Sponsored transaction" }))] })] }), insufficientBalance && !isSuccess && (jsx(StatusMessage, { "$status": "error", children: "Insufficient balance for this transfer." })), errorDetails && (jsxs(ErrorContainer, { children: [jsx(ErrorTitle, { children: errorDetails.title }), jsx(ErrorMessage, { children: errorDetails.message }), errorDetails.action && jsx(ErrorAction, { children: errorDetails.action })] })), jsxs(ButtonRow, { children: [jsx(Button, { variant: "primary", onClick: isSuccess ? handleOpenBlockExplorer : handleConfirm, disabled: isSuccess ? false : !recipientAddress || !parsedAmount || parsedAmount <= BigInt(0) || insufficientBalance, waiting: isLoading, icon: isSuccess ? jsx(TickIcon, { style: { width: 18, height: 18 } }) : undefined, children: isSuccess ? 'Confirmed' : isLoading ? 'Confirming...' : 'Confirm' }), isSuccess ? (jsx(Button, { variant: "secondary", onClick: handleFinish, children: "Back to profile" })) : (jsx(Button, { variant: "secondary", onClick: handleCancel, disabled: isLoading, children: "Cancel" }))] })] }));
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
export { SendConfirmation as default };
|
|
331
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import styled from '../../../styles/styled/index.js';
|
|
2
|
+
|
|
3
|
+
const SummaryList = styled.div `
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 12px;
|
|
7
|
+
margin: 20px 0;
|
|
8
|
+
`;
|
|
9
|
+
const SummaryItem = styled.div `
|
|
10
|
+
display: flex;
|
|
11
|
+
justify-content: space-between;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 12px;
|
|
14
|
+
text-align: left;
|
|
15
|
+
`;
|
|
16
|
+
const SummaryLabel = styled.span `
|
|
17
|
+
font-size: 14px;
|
|
18
|
+
color: var(--ck-body-color-muted);
|
|
19
|
+
`;
|
|
20
|
+
const SummaryValue = styled.span `
|
|
21
|
+
font-size: 15px;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
color: var(--ck-body-color);
|
|
24
|
+
text-align: right;
|
|
25
|
+
word-break: break-all;
|
|
26
|
+
`;
|
|
27
|
+
const AmountValue = styled(SummaryValue) `
|
|
28
|
+
color: var(--ck-body-color);
|
|
29
|
+
display: inline-flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: flex-end;
|
|
32
|
+
gap: 8px;
|
|
33
|
+
`;
|
|
34
|
+
const AddressValue = styled(SummaryValue) `
|
|
35
|
+
display: inline-flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: flex-end;
|
|
38
|
+
gap: 8px;
|
|
39
|
+
`;
|
|
40
|
+
const FeesValue = styled(SummaryValue) `
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
justify-content: flex-end;
|
|
44
|
+
gap: 4px;
|
|
45
|
+
text-decoration: ${(props) => (props.$completed ? 'line-through' : 'none')};
|
|
46
|
+
opacity: ${(props) => (props.$completed ? 0.6 : 1)};
|
|
47
|
+
`;
|
|
48
|
+
const CheckIconWrapper = styled.span `
|
|
49
|
+
color: var(--ck-body-color);
|
|
50
|
+
line-height: 0;
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
|
|
54
|
+
svg {
|
|
55
|
+
width: 16px;
|
|
56
|
+
height: 16px;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
59
|
+
// export const BalanceSpinnerWrapper = styled.span`
|
|
60
|
+
// display: inline-flex;
|
|
61
|
+
// align-items: center;
|
|
62
|
+
// margin-left: 8px;
|
|
63
|
+
// svg {
|
|
64
|
+
// width: 14px;
|
|
65
|
+
// height: 14px;
|
|
66
|
+
// }
|
|
67
|
+
// `
|
|
68
|
+
const InfoIconWrapper = styled.span `
|
|
69
|
+
color: var(--ck-body-color-muted);
|
|
70
|
+
opacity: 0.6;
|
|
71
|
+
line-height: 0;
|
|
72
|
+
|
|
73
|
+
&:hover {
|
|
74
|
+
opacity: 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
svg {
|
|
78
|
+
display: block;
|
|
79
|
+
width: 14px;
|
|
80
|
+
height: 14px;
|
|
81
|
+
vertical-align: middle;
|
|
82
|
+
}
|
|
83
|
+
`;
|
|
84
|
+
const ButtonRow = styled.div `
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: column;
|
|
87
|
+
gap: 4px;
|
|
88
|
+
margin-top: 24px;
|
|
89
|
+
`;
|
|
90
|
+
const StatusMessage = styled.div `
|
|
91
|
+
margin-top: 16px;
|
|
92
|
+
font-size: 14px;
|
|
93
|
+
font-weight: ${(props) => (props.$status === 'idle' ? '600' : '500')};
|
|
94
|
+
color: ${(props) => {
|
|
95
|
+
if (props.$status === 'success')
|
|
96
|
+
return 'var(--ck-body-color-valid)';
|
|
97
|
+
if (props.$status === 'error')
|
|
98
|
+
return 'var(--ck-body-color-danger)';
|
|
99
|
+
return 'var(--ck-body-color)';
|
|
100
|
+
}};
|
|
101
|
+
text-align: center;
|
|
102
|
+
`;
|
|
103
|
+
const ErrorContainer = styled.div `
|
|
104
|
+
margin-top: 16px;
|
|
105
|
+
padding: 16px;
|
|
106
|
+
background: var(--ck-body-background-secondary);
|
|
107
|
+
border-radius: 12px;
|
|
108
|
+
border: 1px solid var(--ck-body-color-danger, rgba(255, 71, 71, 0.2));
|
|
109
|
+
`;
|
|
110
|
+
const ErrorTitle = styled.div `
|
|
111
|
+
font-size: 15px;
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
color: var(--ck-body-color-danger);
|
|
114
|
+
margin-bottom: 8px;
|
|
115
|
+
`;
|
|
116
|
+
const ErrorMessage = styled.div `
|
|
117
|
+
font-size: 14px;
|
|
118
|
+
color: var(--ck-body-color);
|
|
119
|
+
margin-bottom: 8px;
|
|
120
|
+
line-height: 1.4;
|
|
121
|
+
`;
|
|
122
|
+
const ErrorAction = styled.div `
|
|
123
|
+
font-size: 13px;
|
|
124
|
+
color: var(--ck-body-color-muted);
|
|
125
|
+
line-height: 1.4;
|
|
126
|
+
`;
|
|
127
|
+
|
|
128
|
+
export { AddressValue, AmountValue, ButtonRow, CheckIconWrapper, ErrorAction, ErrorContainer, ErrorMessage, ErrorTitle, FeesValue, InfoIconWrapper, StatusMessage, SummaryItem, SummaryLabel, SummaryList };
|
|
129
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useProviders } from '../../../hooks/openfort/useProviders.js';
|
|
3
|
+
import { ModalHeading } from '../../Common/Modal/styles.js';
|
|
4
|
+
import PoweredByFooter from '../../Common/PoweredByFooter/index.js';
|
|
5
|
+
import { ScrollArea } from '../../Common/ScrollArea/index.js';
|
|
6
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
7
|
+
import { ProviderButton } from '../Providers/index.js';
|
|
8
|
+
|
|
9
|
+
const SocialProviders = () => {
|
|
10
|
+
const { remainingSocialProviders } = useProviders();
|
|
11
|
+
return (jsxs(PageContent, { children: [jsx(ModalHeading, { children: "Other socials" }), jsx(ScrollArea, { mobileDirection: 'horizontal', children: remainingSocialProviders.map((auth) => (jsx(ProviderButton, { provider: auth }, auth))) }), jsx(PoweredByFooter, { showDisclaimer: true })] }));
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { SocialProviders as default };
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SolanaSendConfirmation(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
+
import { createSolanaRpc, address, pipe, createTransactionMessage, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, appendTransactionMessageInstruction, compileTransaction, getBase64EncodedWireTransaction, getBase58Encoder } from '@solana/kit';
|
|
4
|
+
import { useState, useRef, useCallback, useEffect } from 'react';
|
|
5
|
+
import { TickIcon } from '../../../assets/icons.js';
|
|
6
|
+
import { OpenfortError, OpenfortReactErrorType } from '../../../types.js';
|
|
7
|
+
import { invalidateBalance } from '../../../hooks/useBalance.js';
|
|
8
|
+
import { getExplorerUrl } from '../../../shared/utils/explorer.js';
|
|
9
|
+
import { BASE_FEE_LAMPORTS } from '../../../solana/constants.js';
|
|
10
|
+
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
11
|
+
import { solToLamports, formatSol } from '../../../solana/hooks/utils.js';
|
|
12
|
+
import { useSolanaContext } from '../../../solana/SolanaContext.js';
|
|
13
|
+
import { createTransferSolInstruction } from '../../../solana/utils/transfer.js';
|
|
14
|
+
import 'detect-browser';
|
|
15
|
+
import { truncateSolanaAddress } from '../../../utils/format.js';
|
|
16
|
+
import Button from '../../Common/Button/index.js';
|
|
17
|
+
import { CopyText } from '../../Common/CopyToClipboard/CopyText.js';
|
|
18
|
+
import Loader from '../../Common/Loading/index.js';
|
|
19
|
+
import { ModalHeading, ModalBody } from '../../Common/Modal/styles.js';
|
|
20
|
+
import { routes } from '../../Openfort/types.js';
|
|
21
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
22
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
23
|
+
import { sanitizeForParsing } from '../Send/utils.js';
|
|
24
|
+
import { ButtonRow, SummaryList, SummaryItem, SummaryLabel, AmountValue, AddressValue, FeesValue, CheckIconWrapper, ErrorContainer, ErrorTitle, ErrorMessage } from '../SendConfirmation/styles.js';
|
|
25
|
+
|
|
26
|
+
const CONFIRM_POLL_MS = 500;
|
|
27
|
+
const CONFIRM_TIMEOUT_MS = 60000;
|
|
28
|
+
async function waitForConfirmation(rpcUrl, signature) {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
const deadline = Date.now() + CONFIRM_TIMEOUT_MS;
|
|
31
|
+
while (Date.now() < deadline) {
|
|
32
|
+
const res = await fetch(rpcUrl, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
body: JSON.stringify({
|
|
36
|
+
jsonrpc: '2.0',
|
|
37
|
+
id: 1,
|
|
38
|
+
method: 'getSignatureStatuses',
|
|
39
|
+
params: [[signature], { searchTransactionHistory: true }],
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
const data = await res.json();
|
|
43
|
+
const status = (_b = (_a = data.result) === null || _a === void 0 ? void 0 : _a.value) === null || _b === void 0 ? void 0 : _b[0];
|
|
44
|
+
if (status === null || status === void 0 ? void 0 : status.err)
|
|
45
|
+
throw new Error(typeof status.err === 'object' ? JSON.stringify(status.err) : String(status.err));
|
|
46
|
+
if ((status === null || status === void 0 ? void 0 : status.confirmationStatus) === 'confirmed' || (status === null || status === void 0 ? void 0 : status.confirmationStatus) === 'finalized')
|
|
47
|
+
return;
|
|
48
|
+
await new Promise((r) => setTimeout(r, CONFIRM_POLL_MS));
|
|
49
|
+
}
|
|
50
|
+
throw new OpenfortError('Transaction confirmation timed out', OpenfortReactErrorType.UNEXPECTED_ERROR);
|
|
51
|
+
}
|
|
52
|
+
const ED25519_SIGNATURE_LENGTH = 64;
|
|
53
|
+
function decodeSignatureToBytes(signature) {
|
|
54
|
+
const encoded = getBase58Encoder().encode(signature);
|
|
55
|
+
let bytes = new Uint8Array(encoded);
|
|
56
|
+
if (bytes.length === ED25519_SIGNATURE_LENGTH + 1) {
|
|
57
|
+
bytes = bytes.slice(0, ED25519_SIGNATURE_LENGTH);
|
|
58
|
+
}
|
|
59
|
+
if (bytes.length === ED25519_SIGNATURE_LENGTH)
|
|
60
|
+
return bytes;
|
|
61
|
+
throw new OpenfortError(`Invalid signature: expected ${ED25519_SIGNATURE_LENGTH} bytes, got ${bytes.length}.`, OpenfortReactErrorType.CONFIGURATION_ERROR);
|
|
62
|
+
}
|
|
63
|
+
function SolanaSendConfirmation() {
|
|
64
|
+
var _a;
|
|
65
|
+
const { rpcUrl, cluster } = useSolanaContext();
|
|
66
|
+
const { sendForm, setRoute, triggerResize } = useOpenfort();
|
|
67
|
+
const wallet = useSolanaEmbeddedWallet();
|
|
68
|
+
const walletAddress = wallet.status === 'connected' ? (_a = wallet.activeWallet) === null || _a === void 0 ? void 0 : _a.address : undefined;
|
|
69
|
+
const provider = wallet.status === 'connected' ? wallet.provider : null;
|
|
70
|
+
const [txStatus, setTxStatus] = useState('idle');
|
|
71
|
+
const [txSignature, setTxSignature] = useState(null);
|
|
72
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
73
|
+
const confirmAbortRef = useRef(null);
|
|
74
|
+
const normalisedAmount = sanitizeForParsing(sendForm.amount);
|
|
75
|
+
const parsedAmount = normalisedAmount && !Number.isNaN(parseFloat(normalisedAmount)) && parseFloat(normalisedAmount) > 0
|
|
76
|
+
? solToLamports(parseFloat(normalisedAmount))
|
|
77
|
+
: null;
|
|
78
|
+
const recipient = sendForm.recipient.trim();
|
|
79
|
+
const isSponsored = false;
|
|
80
|
+
const canProceed = !!provider &&
|
|
81
|
+
!!walletAddress &&
|
|
82
|
+
!!recipient &&
|
|
83
|
+
parsedAmount !== null &&
|
|
84
|
+
parsedAmount > BigInt(0) &&
|
|
85
|
+
txStatus === 'idle';
|
|
86
|
+
const handleConfirm = useCallback(async () => {
|
|
87
|
+
var _a;
|
|
88
|
+
if (!canProceed || !provider || !walletAddress || !parsedAmount || parsedAmount <= BigInt(0))
|
|
89
|
+
return;
|
|
90
|
+
setErrorMessage(null);
|
|
91
|
+
setTxStatus('signing');
|
|
92
|
+
try {
|
|
93
|
+
const rpc = createSolanaRpc(rpcUrl);
|
|
94
|
+
const { value: blockhash } = await rpc.getLatestBlockhash().send();
|
|
95
|
+
const fromAddress = address(walletAddress);
|
|
96
|
+
const transferInstruction = createTransferSolInstruction(walletAddress, recipient, parsedAmount);
|
|
97
|
+
const message = pipe(createTransactionMessage({ version: 0 }), (msg) => setTransactionMessageFeePayer(fromAddress, msg), (msg) => setTransactionMessageLifetimeUsingBlockhash(blockhash, msg), (msg) => appendTransactionMessageInstruction(transferInstruction, msg));
|
|
98
|
+
const compiled = compileTransaction(message);
|
|
99
|
+
const signed = await provider.signTransaction({ messageBytes: compiled.messageBytes });
|
|
100
|
+
const signatureBytes = decodeSignatureToBytes(signed.signature);
|
|
101
|
+
const signedTransaction = {
|
|
102
|
+
messageBytes: compiled.messageBytes,
|
|
103
|
+
signatures: { ...compiled.signatures, [fromAddress]: signatureBytes },
|
|
104
|
+
};
|
|
105
|
+
const encodedWire = getBase64EncodedWireTransaction(signedTransaction);
|
|
106
|
+
setTxStatus('sending');
|
|
107
|
+
await rpc
|
|
108
|
+
.sendTransaction(encodedWire, {
|
|
109
|
+
encoding: 'base64',
|
|
110
|
+
preflightCommitment: 'confirmed',
|
|
111
|
+
skipPreflight: false,
|
|
112
|
+
})
|
|
113
|
+
.send();
|
|
114
|
+
(_a = confirmAbortRef.current) === null || _a === void 0 ? void 0 : _a.abort();
|
|
115
|
+
const confirmController = new AbortController();
|
|
116
|
+
confirmAbortRef.current = confirmController;
|
|
117
|
+
await waitForConfirmation(rpcUrl, signed.signature);
|
|
118
|
+
setTxSignature(signed.signature);
|
|
119
|
+
setTxStatus('confirmed');
|
|
120
|
+
invalidateBalance();
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
if (err instanceof DOMException && err.name === 'AbortError')
|
|
124
|
+
return;
|
|
125
|
+
setTxStatus('error');
|
|
126
|
+
const msg = err instanceof OpenfortError ? err.message : err instanceof Error ? err.message : String(err);
|
|
127
|
+
setErrorMessage(msg || 'Transaction failed');
|
|
128
|
+
}
|
|
129
|
+
}, [canProceed, provider, walletAddress, parsedAmount, recipient, rpcUrl]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
return () => {
|
|
132
|
+
var _a;
|
|
133
|
+
(_a = confirmAbortRef.current) === null || _a === void 0 ? void 0 : _a.abort();
|
|
134
|
+
};
|
|
135
|
+
}, []);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
setTimeout(triggerResize, 10);
|
|
138
|
+
}, [txStatus, errorMessage, triggerResize]);
|
|
139
|
+
const feeDisplay = `~${formatSol(BASE_FEE_LAMPORTS, 6)} SOL`;
|
|
140
|
+
const explorerUrl = txSignature && cluster ? getExplorerUrl(ChainTypeEnum.SVM, { txHash: txSignature, cluster }) : undefined;
|
|
141
|
+
const handleOpenBlockExplorer = () => {
|
|
142
|
+
if (explorerUrl)
|
|
143
|
+
window.open(explorerUrl, '_blank', 'noopener,noreferrer');
|
|
144
|
+
};
|
|
145
|
+
if (txStatus === 'confirmed') {
|
|
146
|
+
return (jsxs(PageContent, { onBack: routes.SOL_CONNECTED, children: [jsx(Loader, { isSuccess: true, header: "Transfer Sent", description: `${normalisedAmount || '0'} SOL sent successfully` }), jsxs(ButtonRow, { children: [jsx(Button, { variant: "primary", onClick: handleOpenBlockExplorer, children: "View on Explorer" }), jsx(Button, { variant: "secondary", onClick: () => setRoute(routes.SOL_CONNECTED), children: "Back to profile" })] })] }));
|
|
147
|
+
}
|
|
148
|
+
return (jsxs(PageContent, { onBack: routes.SOL_SEND, children: [jsx(ModalHeading, { children: "Confirm transfer" }), jsx(ModalBody, { children: "Review the transaction details before sending." }), jsxs(SummaryList, { children: [jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "Sending" }), jsxs(AmountValue, { children: [normalisedAmount || '0', " SOL"] })] }), jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "From" }), jsx(AddressValue, { children: walletAddress ? (jsx(CopyText, { size: "1rem", value: walletAddress, children: truncateSolanaAddress(walletAddress) })) : ('--') })] }), jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "To" }), jsx(AddressValue, { children: recipient ? (jsx(CopyText, { size: "1rem", value: recipient, children: truncateSolanaAddress(recipient) })) : ('--') })] }), jsxs(SummaryItem, { children: [jsx(SummaryLabel, { children: "Network fee" }), jsxs(FeesValue, { "$completed": isSponsored, children: [feeDisplay, jsx(CheckIconWrapper, { children: jsx(TickIcon, {}) })] })] }), isSponsored ] }), errorMessage && (jsxs(ErrorContainer, { children: [jsx(ErrorTitle, { children: "Transaction failed" }), jsx(ErrorMessage, { children: errorMessage })] })), jsxs(ButtonRow, { children: [jsxs(Button, { variant: "primary", onClick: handleConfirm, disabled: !canProceed, waiting: txStatus === 'signing' || txStatus === 'sending', children: [txStatus === 'idle' && 'Confirm', txStatus === 'signing' && 'Signing...', txStatus === 'sending' && 'Sending...', txStatus === 'error' && 'Try again'] }), jsx(Button, { variant: "secondary", onClick: () => setRoute(routes.SOL_SEND), disabled: txStatus !== 'idle', children: "Cancel" })] })] }));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export { SolanaSendConfirmation as default };
|
|
152
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function SolanaWallets(): import("react/jsx-runtime").JSX.Element;
|