@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,70 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
+
import { embeddedWalletId } from '../../../constants/openfort.js';
|
|
4
|
+
import { useEthereumEmbeddedWallet } from '../../../ethereum/hooks/useEthereumEmbeddedWallet.js';
|
|
5
|
+
import { toSolanaUserWallet } from '../../../hooks/openfort/walletTypes.js';
|
|
6
|
+
import { useResolvedIdentity } from '../../../hooks/useResolvedIdentity.js';
|
|
7
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
8
|
+
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
9
|
+
import 'detect-browser';
|
|
10
|
+
import 'react';
|
|
11
|
+
import { truncateEthAddress } from '../../../utils/format.js';
|
|
12
|
+
import { walletConfigs } from '../../../wallets/walletConfigs.js';
|
|
13
|
+
import Button from '../../Common/Button/index.js';
|
|
14
|
+
import { ModalHeading } from '../../Common/Modal/styles.js';
|
|
15
|
+
import { WalletRecoveryIcon } from '../../Common/WalletRecoveryIcon/index.js';
|
|
16
|
+
import { recoverRoute } from '../../Openfort/routeHelpers.js';
|
|
17
|
+
import { routes } from '../../Openfort/types.js';
|
|
18
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
19
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
20
|
+
import { ProvidersButton, ProviderLabel, ProviderIcon } from '../Providers/styles.js';
|
|
21
|
+
|
|
22
|
+
function WalletRow({ chainType, wallet, }) {
|
|
23
|
+
var _a;
|
|
24
|
+
const { setRoute } = useOpenfort();
|
|
25
|
+
const identity = useResolvedIdentity({
|
|
26
|
+
address: wallet.address,
|
|
27
|
+
chainType,
|
|
28
|
+
enabled: !!wallet.address,
|
|
29
|
+
});
|
|
30
|
+
const display = chainType === ChainTypeEnum.SVM
|
|
31
|
+
? wallet.address.length > 12
|
|
32
|
+
? `${wallet.address.slice(0, 4)}...${wallet.address.slice(-4)}`
|
|
33
|
+
: wallet.address
|
|
34
|
+
: identity.status === 'success'
|
|
35
|
+
? ((_a = identity.name) !== null && _a !== void 0 ? _a : truncateEthAddress(wallet.address))
|
|
36
|
+
: truncateEthAddress(wallet.address);
|
|
37
|
+
const walletIcon = () => {
|
|
38
|
+
var _a;
|
|
39
|
+
if (wallet.id === embeddedWalletId) {
|
|
40
|
+
return jsx(WalletRecoveryIcon, { recovery: wallet.recoveryMethod });
|
|
41
|
+
}
|
|
42
|
+
if (chainType === ChainTypeEnum.EVM) {
|
|
43
|
+
const walletConfig = (_a = Object.entries(walletConfigs).find(([key]) => key.includes(wallet.id))) === null || _a === void 0 ? void 0 : _a[1];
|
|
44
|
+
if (walletConfig)
|
|
45
|
+
return walletConfig.icon;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
};
|
|
49
|
+
const handleClick = () => {
|
|
50
|
+
if (chainType === ChainTypeEnum.SVM) {
|
|
51
|
+
const walletForRoute = toSolanaUserWallet(wallet);
|
|
52
|
+
setRoute(recoverRoute(chainType, walletForRoute));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setRoute(recoverRoute(chainType, wallet));
|
|
56
|
+
};
|
|
57
|
+
return (jsx(ProvidersButton, { children: jsxs(Button, { onClick: handleClick, children: [jsx(ProviderLabel, { children: display }), jsx(ProviderIcon, { children: walletIcon() })] }) }));
|
|
58
|
+
}
|
|
59
|
+
function SelectWalletToRecover() {
|
|
60
|
+
const { chainType } = useOpenfortCore();
|
|
61
|
+
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
62
|
+
const solanaWallet = useSolanaEmbeddedWallet();
|
|
63
|
+
const embeddedWallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
64
|
+
const wallets = embeddedWallet.wallets;
|
|
65
|
+
const list = wallets.map((wallet) => jsx(WalletRow, { chainType: chainType, wallet: wallet }, wallet.id));
|
|
66
|
+
return (jsxs(PageContent, { onBack: routes.PROVIDERS, logoutOnBack: true, children: [jsx(ModalHeading, { children: "Select a wallet to recover" }), list] }));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export { SelectWalletToRecover as default };
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const EthereumSend: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { parseUnits, isAddress, formatUnits } from 'viem';
|
|
4
|
+
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
5
|
+
import Button from '../../Common/Button/index.js';
|
|
6
|
+
import { Arrow, ArrowChevron } from '../../Common/Button/styles.js';
|
|
7
|
+
import Input from '../../Common/Input/index.js';
|
|
8
|
+
import { ModalHeading } from '../../Common/Modal/styles.js';
|
|
9
|
+
import { routes } from '../../Openfort/types.js';
|
|
10
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
11
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
12
|
+
import { Form, Field, FieldLabel, TokenSelectorButton, TokenSelectorContent, TokenSelectorValue, TokenSelectorRight, AmountInputWrapper, MaxButton, HelperText, ErrorText } from './styles.js';
|
|
13
|
+
import { isSameToken, sanitizeForParsing, formatBalance, sanitizeAmountInput } from './utils.js';
|
|
14
|
+
|
|
15
|
+
const EthereumSend = () => {
|
|
16
|
+
var _a, _b, _c, _d;
|
|
17
|
+
const { sendForm, setSendForm, setRoute } = useOpenfort();
|
|
18
|
+
const { data: assets } = useEthereumWalletAssets();
|
|
19
|
+
const matchedToken = useMemo(() => assets === null || assets === void 0 ? void 0 : assets.find((asset) => isSameToken(asset, sendForm.asset)), [assets, sendForm.asset]);
|
|
20
|
+
const selectedTokenOption = matchedToken !== null && matchedToken !== void 0 ? matchedToken : assets === null || assets === void 0 ? void 0 : assets[0];
|
|
21
|
+
const selectedToken = selectedTokenOption !== null && selectedTokenOption !== void 0 ? selectedTokenOption : sendForm.asset;
|
|
22
|
+
const selectedBalanceValue = selectedTokenOption === null || selectedTokenOption === void 0 ? void 0 : selectedTokenOption.balance;
|
|
23
|
+
const selectedDecimalsValue = selectedToken.type === 'erc20' ? ((_b = (_a = selectedToken.metadata) === null || _a === void 0 ? void 0 : _a.decimals) !== null && _b !== void 0 ? _b : 18) : 18;
|
|
24
|
+
const selectedSymbol = (_d = (_c = selectedToken.metadata) === null || _c === void 0 ? void 0 : _c.symbol) !== null && _d !== void 0 ? _d : '';
|
|
25
|
+
const parsedAmount = useMemo(() => {
|
|
26
|
+
const rawAmount = sanitizeForParsing(sendForm.amount);
|
|
27
|
+
if (!rawAmount)
|
|
28
|
+
return null;
|
|
29
|
+
try {
|
|
30
|
+
return parseUnits(rawAmount, selectedDecimalsValue);
|
|
31
|
+
}
|
|
32
|
+
catch (_error) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}, [sendForm.amount, selectedDecimalsValue]);
|
|
36
|
+
const recipientValid = isAddress(sendForm.recipient);
|
|
37
|
+
const insufficientBalance = parsedAmount !== null && selectedBalanceValue !== undefined ? parsedAmount > selectedBalanceValue : false;
|
|
38
|
+
const hasAmount = parsedAmount !== null && parsedAmount > BigInt(0);
|
|
39
|
+
const amountValid = hasAmount && !insufficientBalance;
|
|
40
|
+
const canProceed = recipientValid && amountValid;
|
|
41
|
+
const handleSubmit = (event) => {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
if (!canProceed)
|
|
44
|
+
return;
|
|
45
|
+
const normalized = sanitizeForParsing(sendForm.amount);
|
|
46
|
+
if (!normalized)
|
|
47
|
+
return;
|
|
48
|
+
setSendForm((prev) => ({
|
|
49
|
+
...prev,
|
|
50
|
+
amount: normalized,
|
|
51
|
+
asset: prev.asset,
|
|
52
|
+
}));
|
|
53
|
+
setRoute(routes.SEND_CONFIRMATION);
|
|
54
|
+
};
|
|
55
|
+
const handleRecipientChange = (event) => {
|
|
56
|
+
setSendForm((prev) => ({
|
|
57
|
+
...prev,
|
|
58
|
+
recipient: event.target.value,
|
|
59
|
+
}));
|
|
60
|
+
};
|
|
61
|
+
const handleAmountChange = (event) => {
|
|
62
|
+
const raw = sanitizeAmountInput(event.target.value);
|
|
63
|
+
if (raw === '' || /^[0-9]*\.?[0-9]*$/.test(raw)) {
|
|
64
|
+
setSendForm((prev) => ({
|
|
65
|
+
...prev,
|
|
66
|
+
amount: raw,
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const handleMax = () => {
|
|
71
|
+
if (!selectedBalanceValue)
|
|
72
|
+
return;
|
|
73
|
+
const maxAmount = formatUnits(selectedBalanceValue, selectedDecimalsValue);
|
|
74
|
+
setSendForm((prev) => ({
|
|
75
|
+
...prev,
|
|
76
|
+
amount: maxAmount,
|
|
77
|
+
}));
|
|
78
|
+
};
|
|
79
|
+
const handleOpenTokenSelector = () => {
|
|
80
|
+
setRoute(routes.SEND_TOKEN_SELECT);
|
|
81
|
+
};
|
|
82
|
+
const availableLabel = formatBalance(selectedBalanceValue, selectedDecimalsValue);
|
|
83
|
+
const maxDisabled = !selectedBalanceValue;
|
|
84
|
+
return (jsxs(PageContent, { onBack: routes.CONNECTED, children: [jsx(ModalHeading, { children: "Send assets" }), jsxs(Form, { onSubmit: handleSubmit, children: [jsxs(Field, { children: [jsx(FieldLabel, { children: "Asset" }), jsxs(TokenSelectorButton, { type: "button", onClick: handleOpenTokenSelector, children: [jsx(TokenSelectorContent, { children: jsx(TokenSelectorValue, { "$primary": true, children: selectedSymbol || 'Select token' }) }), jsxs(TokenSelectorRight, { children: [jsx(TokenSelectorValue, { children: availableLabel === '--' ? '--' : `${availableLabel} ${selectedSymbol !== null && selectedSymbol !== void 0 ? selectedSymbol : ''}` }), jsx(Arrow, { width: "13", height: "12", viewBox: "0 0 13 12", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx(ArrowChevron, { stroke: "currentColor", d: "M7.51431 1.5L11.757 5.74264M7.5 10.4858L11.7426 6.24314", strokeWidth: "2", strokeLinecap: "round" }) })] })] })] }), jsxs(Field, { children: [jsx(FieldLabel, { children: "Amount" }), jsxs(AmountInputWrapper, { children: [jsx(Input, { placeholder: "0.00", value: sendForm.amount, onChange: handleAmountChange, inputMode: "decimal", autoComplete: "off", style: { paddingRight: '86px' } }), jsx(MaxButton, { type: "button", onClick: handleMax, disabled: maxDisabled, children: "Max" })] }), jsxs(HelperText, { children: ["Available: ", availableLabel, " ", selectedSymbol] }), sendForm.amount && parsedAmount === null && jsx(ErrorText, { children: "Enter a valid amount." }), insufficientBalance && jsx(ErrorText, { children: "Insufficient balance for this transfer." })] }), jsxs(Field, { children: [jsx(FieldLabel, { children: "Recipient address" }), jsx(Input, { placeholder: "0x...", value: sendForm.recipient, onChange: handleRecipientChange, autoComplete: "off" }), sendForm.recipient && !recipientValid && jsx(ErrorText, { children: "Enter a valid wallet address." })] }), jsx(Button, { variant: "primary", disabled: !canProceed, children: "Review transfer" })] })] }));
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export { EthereumSend };
|
|
88
|
+
//# sourceMappingURL=EthereumSend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EthereumSend.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function SolanaSend(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { fetchSolanaBalance } from '../../../hooks/useBalance.js';
|
|
4
|
+
import { useAsyncData } from '../../../shared/hooks/useAsyncData.js';
|
|
5
|
+
import { isValidSolanaAddress } from '../../../shared/utils/validation.js';
|
|
6
|
+
import { BASE_FEE_LAMPORTS, RENT_EXEMPT_MINIMUM_LAMPORTS } from '../../../solana/constants.js';
|
|
7
|
+
import { useSolanaEmbeddedWallet } from '../../../solana/hooks/useSolanaEmbeddedWallet.js';
|
|
8
|
+
import { solToLamports, formatSol } from '../../../solana/hooks/utils.js';
|
|
9
|
+
import { useSolanaContext } from '../../../solana/SolanaContext.js';
|
|
10
|
+
import { logger } from '../../../utils/logger.js';
|
|
11
|
+
import Button from '../../Common/Button/index.js';
|
|
12
|
+
import Input from '../../Common/Input/index.js';
|
|
13
|
+
import { ModalHeading } from '../../Common/Modal/styles.js';
|
|
14
|
+
import { routes } from '../../Openfort/types.js';
|
|
15
|
+
import { useOpenfort } from '../../Openfort/useOpenfort.js';
|
|
16
|
+
import { PageContent } from '../../PageContent/index.js';
|
|
17
|
+
import { Form, Field, FieldLabel, AmountInputWrapper, MaxButton, HelperText, ErrorText } from './styles.js';
|
|
18
|
+
import { sanitizeForParsing, sanitizeAmountInput } from './utils.js';
|
|
19
|
+
|
|
20
|
+
const RENT_EXEMPT_LAMPORTS = RENT_EXEMPT_MINIMUM_LAMPORTS;
|
|
21
|
+
function SolanaSend() {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
const { rpcUrl } = useSolanaContext();
|
|
24
|
+
const { sendForm, setSendForm, setRoute } = useOpenfort();
|
|
25
|
+
const wallet = useSolanaEmbeddedWallet();
|
|
26
|
+
const recipient = sendForm.recipient;
|
|
27
|
+
const amount = sendForm.amount;
|
|
28
|
+
const walletAddress = wallet.status === 'connected' ? (_a = wallet.activeWallet) === null || _a === void 0 ? void 0 : _a.address : undefined;
|
|
29
|
+
const provider = wallet.status === 'connected' ? wallet.provider : null;
|
|
30
|
+
const balanceResult = useAsyncData({
|
|
31
|
+
queryKey: ['solana-balance', walletAddress, rpcUrl],
|
|
32
|
+
queryFn: async () => {
|
|
33
|
+
if (!walletAddress || !rpcUrl)
|
|
34
|
+
return null;
|
|
35
|
+
try {
|
|
36
|
+
const result = await fetchSolanaBalance(walletAddress, rpcUrl, 'confirmed');
|
|
37
|
+
return { value: result.value };
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
logger.error('Failed to fetch Solana balance:', error);
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
enabled: Boolean(walletAddress && rpcUrl),
|
|
45
|
+
});
|
|
46
|
+
const balanceLamports = (_c = (_b = balanceResult.data) === null || _b === void 0 ? void 0 : _b.value) !== null && _c !== void 0 ? _c : BigInt(0);
|
|
47
|
+
const recipientValid = recipient.length > 0 && isValidSolanaAddress(recipient);
|
|
48
|
+
const amountNum = amount === '' || amount === '.' ? null : parseFloat(amount);
|
|
49
|
+
const amountLamports = amountNum !== null && !Number.isNaN(amountNum) && amountNum > 0 ? solToLamports(amountNum) : null;
|
|
50
|
+
const insufficientBalance = amountLamports !== null && balanceLamports !== undefined ? amountLamports > balanceLamports : false;
|
|
51
|
+
const belowRentExempt = amountLamports !== null && balanceLamports !== undefined
|
|
52
|
+
? balanceLamports - amountLamports < RENT_EXEMPT_LAMPORTS
|
|
53
|
+
: false;
|
|
54
|
+
const hasAmount = amountLamports !== null && amountLamports > BigInt(0);
|
|
55
|
+
const amountValid = hasAmount && !insufficientBalance && !belowRentExempt;
|
|
56
|
+
const maxLamports = balanceLamports > BASE_FEE_LAMPORTS ? balanceLamports - BASE_FEE_LAMPORTS - RENT_EXEMPT_LAMPORTS : BigInt(0);
|
|
57
|
+
const maxLamportsSafe = maxLamports > BigInt(0) ? maxLamports : BigInt(0);
|
|
58
|
+
const canProceed = recipientValid && amountValid && !!provider;
|
|
59
|
+
const handleMax = useCallback(() => {
|
|
60
|
+
if (maxLamportsSafe <= BigInt(0))
|
|
61
|
+
return;
|
|
62
|
+
setSendForm((prev) => ({ ...prev, amount: formatSol(maxLamportsSafe, 9) }));
|
|
63
|
+
}, [maxLamportsSafe, setSendForm]);
|
|
64
|
+
const handleSubmit = (event) => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
if (!canProceed || !amountLamports || amountLamports <= BigInt(0))
|
|
67
|
+
return;
|
|
68
|
+
const normalized = sanitizeForParsing(amount);
|
|
69
|
+
if (!normalized)
|
|
70
|
+
return;
|
|
71
|
+
setSendForm((prev) => ({
|
|
72
|
+
...prev,
|
|
73
|
+
amount: normalized,
|
|
74
|
+
recipient,
|
|
75
|
+
asset: prev.asset,
|
|
76
|
+
}));
|
|
77
|
+
setRoute(routes.SOL_SEND_CONFIRMATION);
|
|
78
|
+
};
|
|
79
|
+
const handleRecipientChange = (e) => {
|
|
80
|
+
setSendForm((prev) => ({ ...prev, recipient: e.target.value }));
|
|
81
|
+
};
|
|
82
|
+
const handleAmountChange = (e) => {
|
|
83
|
+
const raw = sanitizeAmountInput(e.target.value);
|
|
84
|
+
if (raw === '' || /^[0-9]*\.?[0-9]*$/.test(raw)) {
|
|
85
|
+
setSendForm((prev) => ({ ...prev, amount: raw }));
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const availableLabel = balanceResult.data != null ? formatSol(balanceLamports) : '--';
|
|
89
|
+
return (jsxs(PageContent, { onBack: routes.SOL_CONNECTED, children: [jsx(ModalHeading, { children: "Send SOL" }), jsxs(Form, { onSubmit: handleSubmit, children: [jsxs(Field, { children: [jsx(FieldLabel, { children: "Amount" }), jsxs(AmountInputWrapper, { children: [jsx(Input, { placeholder: "0.00", value: amount, onChange: handleAmountChange, inputMode: "decimal", autoComplete: "off", style: { paddingRight: '86px' } }), jsx(MaxButton, { type: "button", onClick: handleMax, disabled: maxLamportsSafe <= BigInt(0), children: "Max" })] }), jsxs(HelperText, { children: ["Available: ", availableLabel, " SOL"] }), amount && amountNum !== null && Number.isNaN(amountNum) && jsx(ErrorText, { children: "Enter a valid amount." }), insufficientBalance && jsx(ErrorText, { children: "Insufficient balance for this transfer." }), belowRentExempt && jsx(ErrorText, { children: "Leave enough for rent-exempt minimum (~0.00089 SOL)." })] }), jsxs(Field, { children: [jsx(FieldLabel, { children: "Recipient address" }), jsx(Input, { placeholder: "Base58 address...", value: recipient, onChange: handleRecipientChange, autoComplete: "off" }), recipient && !recipientValid && jsx(ErrorText, { children: "Enter a valid Solana address." })] }), jsx(Button, { variant: "primary", disabled: !canProceed, type: "submit", children: "Review transfer" })] })] }));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export { SolanaSend };
|
|
93
|
+
//# sourceMappingURL=SolanaSend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SolanaSend.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ChainTypeEnum } from '@openfort/openfort-js';
|
|
3
|
+
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
4
|
+
import { EthereumSend } from './EthereumSend.js';
|
|
5
|
+
import { SolanaSend } from './SolanaSend.js';
|
|
6
|
+
|
|
7
|
+
const SEND_REGISTRY = {
|
|
8
|
+
[ChainTypeEnum.EVM]: EthereumSend,
|
|
9
|
+
[ChainTypeEnum.SVM]: SolanaSend,
|
|
10
|
+
};
|
|
11
|
+
const Send = () => {
|
|
12
|
+
const { chainType } = useOpenfortCore();
|
|
13
|
+
const Component = SEND_REGISTRY[chainType];
|
|
14
|
+
return Component ? jsx(Component, {}) : jsx(EthereumSend, {});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export { Send as default };
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import styled from '../../../styles/styled/index.js';
|
|
2
|
+
|
|
3
|
+
const Form = styled.form `
|
|
4
|
+
display: flex;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
gap: 20px;
|
|
7
|
+
margin-top: 20px;
|
|
8
|
+
`;
|
|
9
|
+
const Field = styled.div `
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
text-align: left;
|
|
13
|
+
`;
|
|
14
|
+
const FieldLabel = styled.span `
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
font-weight: 600;
|
|
17
|
+
color: var(--ck-body-color);
|
|
18
|
+
`;
|
|
19
|
+
const TokenSelectorButton = styled.button `
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
width: 100%;
|
|
24
|
+
margin-top: 12px;
|
|
25
|
+
padding: 12px 16px;
|
|
26
|
+
border-radius: var(--ck-secondary-button-border-radius);
|
|
27
|
+
border: 1px solid var(--ck-body-divider);
|
|
28
|
+
background: var(--ck-secondary-button-background);
|
|
29
|
+
color: var(--ck-body-color);
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
|
|
32
|
+
text-align: left;
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background: var(--ck-secondary-button-hover-background);
|
|
36
|
+
border-color: var(--ck-body-color-muted);
|
|
37
|
+
}
|
|
38
|
+
`;
|
|
39
|
+
const TokenSelectorContent = styled.div `
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
gap: 2px;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
`;
|
|
45
|
+
const TokenSelectorValue = styled.span `
|
|
46
|
+
font-size: ${(props) => (props.$primary ? '15px' : '13px')};
|
|
47
|
+
font-weight: ${(props) => (props.$primary ? 600 : 500)};
|
|
48
|
+
color: ${(props) => {
|
|
49
|
+
if (props.$primary)
|
|
50
|
+
return 'var(--ck-body-color)';
|
|
51
|
+
if (props.$muted)
|
|
52
|
+
return 'var(--ck-body-color-muted)';
|
|
53
|
+
return 'var(--ck-body-color-muted)';
|
|
54
|
+
}};
|
|
55
|
+
white-space: nowrap;
|
|
56
|
+
overflow: hidden;
|
|
57
|
+
text-overflow: ellipsis;
|
|
58
|
+
`;
|
|
59
|
+
const TokenSelectorRight = styled.div `
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
gap: 6px;
|
|
63
|
+
color: var(--ck-body-color-muted);
|
|
64
|
+
`;
|
|
65
|
+
const AmountInputWrapper = styled.div `
|
|
66
|
+
position: relative;
|
|
67
|
+
margin-top: 12px;
|
|
68
|
+
|
|
69
|
+
> div {
|
|
70
|
+
margin: 0;
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
const MaxButton = styled.button `
|
|
74
|
+
position: absolute;
|
|
75
|
+
right: 12px;
|
|
76
|
+
top: 50%;
|
|
77
|
+
transform: translateY(-50%);
|
|
78
|
+
padding: 6px 14px;
|
|
79
|
+
border-radius: 16px;
|
|
80
|
+
border: 1px solid var(--ck-body-divider);
|
|
81
|
+
background: var(--ck-body-background);
|
|
82
|
+
color: var(--ck-body-color);
|
|
83
|
+
font-size: 12px;
|
|
84
|
+
font-weight: 600;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
|
|
87
|
+
|
|
88
|
+
&:hover {
|
|
89
|
+
background: var(--ck-secondary-button-hover-background);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
&:disabled {
|
|
93
|
+
opacity: 0.5;
|
|
94
|
+
cursor: not-allowed;
|
|
95
|
+
background: var(--ck-body-background-secondary);
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
const HelperText = styled.span `
|
|
99
|
+
display: block;
|
|
100
|
+
margin-top: 8px;
|
|
101
|
+
font-size: 13px;
|
|
102
|
+
color: var(--ck-body-color-muted);
|
|
103
|
+
`;
|
|
104
|
+
const ErrorText = styled.span `
|
|
105
|
+
display: block;
|
|
106
|
+
margin-top: 6px;
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
color: var(--ck-body-color-danger);
|
|
109
|
+
`;
|
|
110
|
+
|
|
111
|
+
export { AmountInputWrapper, ErrorText, Field, FieldLabel, Form, HelperText, MaxButton, TokenSelectorButton, TokenSelectorContent, TokenSelectorRight, TokenSelectorValue };
|
|
112
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Asset } from '../../Openfort/types';
|
|
2
|
-
export declare
|
|
2
|
+
export declare function sanitizeAmountInput(value: string): string;
|
|
3
3
|
export declare const sanitizeForParsing: (value: string) => string | null;
|
|
4
4
|
export declare const formatBalance: (value: bigint | undefined, decimals: number) => string;
|
|
5
5
|
export declare const formatBalanceWithSymbol: (value: bigint | undefined, decimals: number, symbol: string) => string;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { formatUnits } from 'viem';
|
|
2
|
+
|
|
3
|
+
function sanitizeAmountInput(value) {
|
|
4
|
+
const normalized = value.replace(/,/g, '.');
|
|
5
|
+
const trimmed = normalized.trim();
|
|
6
|
+
if (trimmed === '' || trimmed === '.')
|
|
7
|
+
return trimmed;
|
|
8
|
+
const match = trimmed.match(/^([0-9]*)(\.?)([0-9]*)$/);
|
|
9
|
+
return match ? match[1] + match[2] + match[3] : '';
|
|
10
|
+
}
|
|
11
|
+
const sanitizeForParsing = (value) => {
|
|
12
|
+
const trimmed = value.trim();
|
|
13
|
+
if (!trimmed)
|
|
14
|
+
return null;
|
|
15
|
+
if (trimmed === '.')
|
|
16
|
+
return null;
|
|
17
|
+
let normalized = trimmed;
|
|
18
|
+
if (normalized.startsWith('.'))
|
|
19
|
+
normalized = `0${normalized}`;
|
|
20
|
+
if (normalized.endsWith('.'))
|
|
21
|
+
normalized = normalized.slice(0, -1);
|
|
22
|
+
if (!normalized)
|
|
23
|
+
return null;
|
|
24
|
+
return normalized;
|
|
25
|
+
};
|
|
26
|
+
const formatBalance = (value, decimals) => {
|
|
27
|
+
if (value === undefined)
|
|
28
|
+
return '--';
|
|
29
|
+
const formatted = formatUnits(value, decimals);
|
|
30
|
+
const [integer, fraction] = formatted.split('.');
|
|
31
|
+
if (!fraction)
|
|
32
|
+
return integer;
|
|
33
|
+
const trimmedFraction = fraction.replace(/0+$/, '');
|
|
34
|
+
if (!trimmedFraction)
|
|
35
|
+
return integer;
|
|
36
|
+
return `${integer}.${trimmedFraction.slice(0, 6)}`;
|
|
37
|
+
};
|
|
38
|
+
const formatBalanceWithSymbol = (value, decimals, symbol) => {
|
|
39
|
+
const balance = formatBalance(value, decimals);
|
|
40
|
+
return balance === '--' ? '--' : `${balance} ${symbol}`;
|
|
41
|
+
};
|
|
42
|
+
const isSameToken = (a, b) => {
|
|
43
|
+
if (a.type !== b.type)
|
|
44
|
+
return false;
|
|
45
|
+
if (a.type === 'native')
|
|
46
|
+
return true;
|
|
47
|
+
// At this point, a.type === 'erc20' and b.type === 'erc20'
|
|
48
|
+
if (a.type === 'erc20' && b.type === 'erc20') {
|
|
49
|
+
return a.address.toLowerCase() === b.address.toLowerCase();
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
};
|
|
53
|
+
const getAssetSymbol = (asset) => {
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a = asset.metadata) === null || _a === void 0 ? void 0 : _a.symbol) || (asset.type === 'native' ? 'ETH' : 'UNKNOWN');
|
|
56
|
+
};
|
|
57
|
+
const getAssetDecimals = (asset) => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
return (_b = (_a = asset.metadata) === null || _a === void 0 ? void 0 : _a.decimals) !== null && _b !== void 0 ? _b : 18;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { formatBalance, formatBalanceWithSymbol, getAssetDecimals, getAssetSymbol, isSameToken, sanitizeAmountInput, sanitizeForParsing };
|
|
63
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { createPublicClient, http, formatUnits } from 'viem';
|
|
3
|
+
import { useEthereumWalletAssets } from '../../../ethereum/hooks/useEthereumWalletAssets.js';
|
|
4
|
+
import { useAsyncData } from '../../../shared/hooks/useAsyncData.js';
|
|
5
|
+
import { logger } from '../../../utils/logger.js';
|
|
6
|
+
import { getDefaultEthereumRpcUrl } from '../../../utils/rpc.js';
|
|
7
|
+
import Tooltip from '../../Common/Tooltip/index.js';
|
|
8
|
+
import { formatBalance } from '../Send/utils.js';
|
|
9
|
+
import { InfoIconWrapper } from './styles.js';
|
|
10
|
+
|
|
11
|
+
const InfoIcon = () => (jsxs("svg", { "aria-hidden": "true", width: "14", height: "14", viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("circle", { cx: "7", cy: "7", r: "6", stroke: "currentColor", strokeWidth: "1.5" }), jsx("path", { d: "M7 10V6.5M7 4.5H7.005", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" })] }));
|
|
12
|
+
const usdFormatter = new Intl.NumberFormat('en-US', {
|
|
13
|
+
style: 'currency',
|
|
14
|
+
currency: 'USD',
|
|
15
|
+
minimumFractionDigits: 2,
|
|
16
|
+
maximumFractionDigits: 4,
|
|
17
|
+
});
|
|
18
|
+
const EstimatedFees = ({ account, to, value, data, chainId, nativeSymbol, enabled = true, hideInfoIcon = false, }) => {
|
|
19
|
+
var _a, _b, _c;
|
|
20
|
+
const { data: assets } = useEthereumWalletAssets();
|
|
21
|
+
const pricePerToken = (_c = (_b = (_a = assets === null || assets === void 0 ? void 0 : assets.find((a) => a.type === 'native')) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.fiat) === null || _c === void 0 ? void 0 : _c.value;
|
|
22
|
+
const gas = useAsyncData({
|
|
23
|
+
queryKey: ['gas-estimate', account, to, value, data, chainId],
|
|
24
|
+
queryFn: async () => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (!account || !to || !chainId)
|
|
27
|
+
return null;
|
|
28
|
+
try {
|
|
29
|
+
const rpcUrl = getDefaultEthereumRpcUrl(chainId);
|
|
30
|
+
const publicClient = createPublicClient({ transport: http(rpcUrl) });
|
|
31
|
+
const [gasEstimate, feesPerGas] = await Promise.all([
|
|
32
|
+
publicClient.estimateGas({
|
|
33
|
+
account,
|
|
34
|
+
to,
|
|
35
|
+
value: value !== null && value !== void 0 ? value : BigInt(0),
|
|
36
|
+
data: data !== null && data !== void 0 ? data : '0x',
|
|
37
|
+
}),
|
|
38
|
+
publicClient.estimateFeesPerGas(),
|
|
39
|
+
]);
|
|
40
|
+
const estimatedCost = gasEstimate * ((_a = feesPerGas.maxFeePerGas) !== null && _a !== void 0 ? _a : BigInt(0));
|
|
41
|
+
return { estimatedCost, gasLimit: gasEstimate };
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
logger.error('Failed to estimate gas:', error);
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
enabled: enabled && !!account && !!to && !!chainId,
|
|
49
|
+
});
|
|
50
|
+
// Handle query states
|
|
51
|
+
if (!gas.data || gas.error) {
|
|
52
|
+
return jsx(Fragment, { children: "--" });
|
|
53
|
+
}
|
|
54
|
+
const gasCost = gas.data.estimatedCost;
|
|
55
|
+
const gasUnits = gas.data.gasLimit;
|
|
56
|
+
if (pricePerToken !== undefined) {
|
|
57
|
+
const gasCostInEth = Number.parseFloat(formatUnits(gasCost, 18));
|
|
58
|
+
const gasCostInUsd = gasCostInEth * pricePerToken;
|
|
59
|
+
return (jsxs(Fragment, { children: ["\u2248 ", usdFormatter.format(gasCostInUsd), !hideInfoIcon && (jsx(Tooltip, { message: `${gasUnits.toString()} gas units (paid in ${nativeSymbol})`, delay: 0.2, children: jsx(InfoIconWrapper, { children: jsx(InfoIcon, {}) }) }))] }));
|
|
60
|
+
}
|
|
61
|
+
// Fallback to native token if price not available
|
|
62
|
+
return (jsxs(Fragment, { children: ["\u2248 ", formatBalance(gasCost, 18), " ", nativeSymbol, !hideInfoIcon && (jsx(Tooltip, { message: `${gasUnits.toString()} gas units`, delay: 0.2, children: jsx(InfoIconWrapper, { children: jsx(InfoIcon, {}) }) }))] }));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { EstimatedFees };
|
|
66
|
+
//# sourceMappingURL=EstimatedFees.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EstimatedFees.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|