@daimo/pay 1.6.1 → 1.6.3
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/README.md +4 -4
- package/build/index.d.ts +251 -249
- package/build/index.js +12039 -0
- package/build/index.js.map +1 -0
- package/package.json +6 -5
- package/build/package.json.js +0 -101
- package/build/package.json.js.map +0 -1
- package/build/src/assets/ScanIconWithLogos.js +0 -34
- package/build/src/assets/ScanIconWithLogos.js.map +0 -1
- package/build/src/assets/browsers.js +0 -13
- package/build/src/assets/browsers.js.map +0 -1
- package/build/src/assets/chains.js +0 -70
- package/build/src/assets/chains.js.map +0 -1
- package/build/src/assets/coins.js +0 -6
- package/build/src/assets/coins.js.map +0 -1
- package/build/src/assets/crepe.js +0 -8
- package/build/src/assets/crepe.js.map +0 -1
- package/build/src/assets/icons.js +0 -29
- package/build/src/assets/icons.js.map +0 -1
- package/build/src/assets/logos.js +0 -153
- package/build/src/assets/logos.js.map +0 -1
- package/build/src/assets/wallet.js +0 -8
- package/build/src/assets/wallet.js.map +0 -1
- package/build/src/assets/wave.js +0 -6
- package/build/src/assets/wave.js.map +0 -1
- package/build/src/components/Common/Alert/index.js +0 -10
- package/build/src/components/Common/Alert/index.js.map +0 -1
- package/build/src/components/Common/Alert/styles.js +0 -55
- package/build/src/components/Common/Alert/styles.js.map +0 -1
- package/build/src/components/Common/AmountInput/AmountInputField.js +0 -59
- package/build/src/components/Common/AmountInput/AmountInputField.js.map +0 -1
- package/build/src/components/Common/AmountInput/index.js +0 -147
- package/build/src/components/Common/AmountInput/index.js.map +0 -1
- package/build/src/components/Common/Avatar/index.js +0 -66
- package/build/src/components/Common/Avatar/index.js.map +0 -1
- package/build/src/components/Common/Avatar/styles.js +0 -59
- package/build/src/components/Common/Avatar/styles.js.map +0 -1
- package/build/src/components/Common/BrowserIcon/index.js +0 -28
- package/build/src/components/Common/BrowserIcon/index.js.map +0 -1
- package/build/src/components/Common/BrowserIcon/styles.js +0 -20
- package/build/src/components/Common/BrowserIcon/styles.js.map +0 -1
- package/build/src/components/Common/Button/index.js +0 -38
- package/build/src/components/Common/Button/index.js.map +0 -1
- package/build/src/components/Common/Button/styles.js +0 -291
- package/build/src/components/Common/Button/styles.js.map +0 -1
- package/build/src/components/Common/Chain/index.js +0 -25
- package/build/src/components/Common/Chain/index.js.map +0 -1
- package/build/src/components/Common/Chain/styles.js +0 -94
- package/build/src/components/Common/Chain/styles.js.map +0 -1
- package/build/src/components/Common/ChainSelectList/index.js +0 -107
- package/build/src/components/Common/ChainSelectList/index.js.map +0 -1
- package/build/src/components/Common/ChainSelectList/styles.js +0 -228
- package/build/src/components/Common/ChainSelectList/styles.js.map +0 -1
- package/build/src/components/Common/ConnectorList/index.js +0 -71
- package/build/src/components/Common/ConnectorList/index.js.map +0 -1
- package/build/src/components/Common/ConnectorList/styles.js +0 -314
- package/build/src/components/Common/ConnectorList/styles.js.map +0 -1
- package/build/src/components/Common/CopyToClipboard/CopyToClipboardIcon.js +0 -71
- package/build/src/components/Common/CopyToClipboard/CopyToClipboardIcon.js.map +0 -1
- package/build/src/components/Common/CopyToClipboard/index.js +0 -51
- package/build/src/components/Common/CopyToClipboard/index.js.map +0 -1
- package/build/src/components/Common/CustomQRCode/QRCode.js +0 -69
- package/build/src/components/Common/CustomQRCode/QRCode.js.map +0 -1
- package/build/src/components/Common/CustomQRCode/index.js +0 -22
- package/build/src/components/Common/CustomQRCode/index.js.map +0 -1
- package/build/src/components/Common/CustomQRCode/styles.js +0 -155
- package/build/src/components/Common/CustomQRCode/styles.js.map +0 -1
- package/build/src/components/Common/FitText/index.js +0 -27
- package/build/src/components/Common/FitText/index.js.map +0 -1
- package/build/src/components/Common/Modal/index.js +0 -301
- package/build/src/components/Common/Modal/index.js.map +0 -1
- package/build/src/components/Common/Modal/styles.js +0 -661
- package/build/src/components/Common/Modal/styles.js.map +0 -1
- package/build/src/components/Common/OptionsList/index.js +0 -106
- package/build/src/components/Common/OptionsList/index.js.map +0 -1
- package/build/src/components/Common/OptionsList/styles.js +0 -165
- package/build/src/components/Common/OptionsList/styles.js.map +0 -1
- package/build/src/components/Common/OrderHeader/index.js +0 -128
- package/build/src/components/Common/OrderHeader/index.js.map +0 -1
- package/build/src/components/Common/PaymentBreakdown/index.js +0 -48
- package/build/src/components/Common/PaymentBreakdown/index.js.map +0 -1
- package/build/src/components/Common/Portal/index.js +0 -31
- package/build/src/components/Common/Portal/index.js.map +0 -1
- package/build/src/components/Common/PoweredByFooter/index.js +0 -79
- package/build/src/components/Common/PoweredByFooter/index.js.map +0 -1
- package/build/src/components/Common/ScrollArea/index.js +0 -62
- package/build/src/components/Common/ScrollArea/index.js.map +0 -1
- package/build/src/components/Common/ScrollArea/styles.js +0 -168
- package/build/src/components/Common/ScrollArea/styles.js.map +0 -1
- package/build/src/components/Common/Spinner/index.js +0 -24
- package/build/src/components/Common/Spinner/index.js.map +0 -1
- package/build/src/components/Common/Spinner/styles.js +0 -22
- package/build/src/components/Common/Spinner/styles.js.map +0 -1
- package/build/src/components/Common/SwitchButton/index.js +0 -39
- package/build/src/components/Common/SwitchButton/index.js.map +0 -1
- package/build/src/components/Common/ThemedButton/index.js +0 -25
- package/build/src/components/Common/ThemedButton/index.js.map +0 -1
- package/build/src/components/Common/ThemedButton/styles.js +0 -152
- package/build/src/components/Common/ThemedButton/styles.js.map +0 -1
- package/build/src/components/Common/TokenChainLogo/index.js +0 -24
- package/build/src/components/Common/TokenChainLogo/index.js.map +0 -1
- package/build/src/components/Common/Tooltip/index.js +0 -97
- package/build/src/components/Common/Tooltip/index.js.map +0 -1
- package/build/src/components/Common/Tooltip/styles.js +0 -81
- package/build/src/components/Common/Tooltip/styles.js.map +0 -1
- package/build/src/components/Common/WalletChainLogo/index.js +0 -24
- package/build/src/components/Common/WalletChainLogo/index.js.map +0 -1
- package/build/src/components/DaimoPay.js +0 -280
- package/build/src/components/DaimoPay.js.map +0 -1
- package/build/src/components/DaimoPayButton/index.js +0 -158
- package/build/src/components/DaimoPayButton/index.js.map +0 -1
- package/build/src/components/DaimoPayButton/styles.js +0 -50
- package/build/src/components/DaimoPayButton/styles.js.map +0 -1
- package/build/src/components/DaimoPayModal/ConnectUsing.js +0 -45
- package/build/src/components/DaimoPayModal/ConnectUsing.js.map +0 -1
- package/build/src/components/DaimoPayModal/ConnectWithInjector/index.js +0 -202
- package/build/src/components/DaimoPayModal/ConnectWithInjector/index.js.map +0 -1
- package/build/src/components/DaimoPayModal/ConnectWithInjector/styles.js +0 -133
- package/build/src/components/DaimoPayModal/ConnectWithInjector/styles.js.map +0 -1
- package/build/src/components/DaimoPayModal/ConnectWithQRCode.js +0 -75
- package/build/src/components/DaimoPayModal/ConnectWithQRCode.js.map +0 -1
- package/build/src/components/DaimoPayModal/index.js +0 -206
- package/build/src/components/DaimoPayModal/index.js.map +0 -1
- package/build/src/components/DaimoPayThemeProvider/DaimoPayThemeProvider.js +0 -21
- package/build/src/components/DaimoPayThemeProvider/DaimoPayThemeProvider.js.map +0 -1
- package/build/src/components/Pages/About/graphics.js +0 -187
- package/build/src/components/Pages/About/graphics.js.map +0 -1
- package/build/src/components/Pages/About/index.js +0 -131
- package/build/src/components/Pages/About/index.js.map +0 -1
- package/build/src/components/Pages/About/styles.js +0 -144
- package/build/src/components/Pages/About/styles.js.map +0 -1
- package/build/src/components/Pages/Confirmation/index.js +0 -105
- package/build/src/components/Pages/Confirmation/index.js.map +0 -1
- package/build/src/components/Pages/Connectors/index.js +0 -20
- package/build/src/components/Pages/Connectors/index.js.map +0 -1
- package/build/src/components/Pages/Connectors/styles.js +0 -267
- package/build/src/components/Pages/Connectors/styles.js.map +0 -1
- package/build/src/components/Pages/DownloadApp/index.js +0 -30
- package/build/src/components/Pages/DownloadApp/index.js.map +0 -1
- package/build/src/components/Pages/MobileConnectors/index.js +0 -78
- package/build/src/components/Pages/MobileConnectors/index.js.map +0 -1
- package/build/src/components/Pages/MobileConnectors/styles.js +0 -65
- package/build/src/components/Pages/MobileConnectors/styles.js.map +0 -1
- package/build/src/components/Pages/Onboarding/index.js +0 -18
- package/build/src/components/Pages/Onboarding/index.js.map +0 -1
- package/build/src/components/Pages/Onboarding/styles.js +0 -229
- package/build/src/components/Pages/Onboarding/styles.js.map +0 -1
- package/build/src/components/Pages/PayWithToken/index.js +0 -111
- package/build/src/components/Pages/PayWithToken/index.js.map +0 -1
- package/build/src/components/Pages/SelectAmount/index.js +0 -16
- package/build/src/components/Pages/SelectAmount/index.js.map +0 -1
- package/build/src/components/Pages/SelectDepositAddressAmount/index.js +0 -61
- package/build/src/components/Pages/SelectDepositAddressAmount/index.js.map +0 -1
- package/build/src/components/Pages/SelectDepositAddressChain/index.js +0 -38
- package/build/src/components/Pages/SelectDepositAddressChain/index.js.map +0 -1
- package/build/src/components/Pages/SelectExternalAmount/index.js +0 -63
- package/build/src/components/Pages/SelectExternalAmount/index.js.map +0 -1
- package/build/src/components/Pages/SelectMethod/index.js +0 -205
- package/build/src/components/Pages/SelectMethod/index.js.map +0 -1
- package/build/src/components/Pages/SelectToken/index.js +0 -61
- package/build/src/components/Pages/SelectToken/index.js.map +0 -1
- package/build/src/components/Pages/Solana/ConnectSolana/index.js +0 -80
- package/build/src/components/Pages/Solana/ConnectSolana/index.js.map +0 -1
- package/build/src/components/Pages/Solana/ConnectorSolana/index.js +0 -55
- package/build/src/components/Pages/Solana/ConnectorSolana/index.js.map +0 -1
- package/build/src/components/Pages/Solana/PayWithSolanaToken/index.js +0 -62
- package/build/src/components/Pages/Solana/PayWithSolanaToken/index.js.map +0 -1
- package/build/src/components/Pages/Solana/SelectSolanaAmount/index.js +0 -16
- package/build/src/components/Pages/Solana/SelectSolanaAmount/index.js.map +0 -1
- package/build/src/components/Pages/Solana/SelectSolanaToken/index.js +0 -59
- package/build/src/components/Pages/Solana/SelectSolanaToken/index.js.map +0 -1
- package/build/src/components/Pages/SwitchNetworks/index.js +0 -26
- package/build/src/components/Pages/SwitchNetworks/index.js.map +0 -1
- package/build/src/components/Pages/WaitingDepositAddress/index.js +0 -51
- package/build/src/components/Pages/WaitingDepositAddress/index.js.map +0 -1
- package/build/src/components/Pages/WaitingExternal/index.js +0 -53
- package/build/src/components/Pages/WaitingExternal/index.js.map +0 -1
- package/build/src/components/Spinners/CircleSpinner/index.js +0 -15
- package/build/src/components/Spinners/CircleSpinner/index.js.map +0 -1
- package/build/src/components/Spinners/CircleSpinner/styles.js +0 -118
- package/build/src/components/Spinners/CircleSpinner/styles.js.map +0 -1
- package/build/src/components/Spinners/ExternalPaymentSpinner/index.js +0 -20
- package/build/src/components/Spinners/ExternalPaymentSpinner/index.js.map +0 -1
- package/build/src/components/Spinners/SquircleSpinner/index.js +0 -15
- package/build/src/components/Spinners/SquircleSpinner/index.js.map +0 -1
- package/build/src/components/Spinners/SquircleSpinner/styles.js +0 -66
- package/build/src/components/Spinners/SquircleSpinner/styles.js.map +0 -1
- package/build/src/components/Spinners/TokenLogoSpinner/index.js +0 -13
- package/build/src/components/Spinners/TokenLogoSpinner/index.js.map +0 -1
- package/build/src/components/Spinners/TokenLogoSpinner/styles.js +0 -40
- package/build/src/components/Spinners/TokenLogoSpinner/styles.js.map +0 -1
- package/build/src/components/Spinners/styles.js +0 -33
- package/build/src/components/Spinners/styles.js.map +0 -1
- package/build/src/components/contexts/solana/index.js +0 -11
- package/build/src/components/contexts/solana/index.js.map +0 -1
- package/build/src/components/contexts/web3/index.js +0 -46
- package/build/src/components/contexts/web3/index.js.map +0 -1
- package/build/src/constants/defaultTheme.js +0 -6
- package/build/src/constants/defaultTheme.js.map +0 -1
- package/build/src/defaultConfig.js +0 -63
- package/build/src/defaultConfig.js.map +0 -1
- package/build/src/defaultConnectors.js +0 -43
- package/build/src/defaultConnectors.js.map +0 -1
- package/build/src/hooks/connectors/useWalletConnectUri.js +0 -93
- package/build/src/hooks/connectors/useWalletConnectUri.js.map +0 -1
- package/build/src/hooks/useChainIsSupported.js +0 -12
- package/build/src/hooks/useChainIsSupported.js.map +0 -1
- package/build/src/hooks/useChains.js +0 -11
- package/build/src/hooks/useChains.js.map +0 -1
- package/build/src/hooks/useConnect.js +0 -45
- package/build/src/hooks/useConnect.js.map +0 -1
- package/build/src/hooks/useConnectCallback.js +0 -18
- package/build/src/hooks/useConnectCallback.js.map +0 -1
- package/build/src/hooks/useConnectors.js +0 -29
- package/build/src/hooks/useConnectors.js.map +0 -1
- package/build/src/hooks/useDaimoPayStatus.js +0 -24
- package/build/src/hooks/useDaimoPayStatus.js.map +0 -1
- package/build/src/hooks/useDepositAddressOptions.js +0 -31
- package/build/src/hooks/useDepositAddressOptions.js.map +0 -1
- package/build/src/hooks/useEnsFallbackConfig.js +0 -16
- package/build/src/hooks/useEnsFallbackConfig.js.map +0 -1
- package/build/src/hooks/useExternalPaymentOptions.js +0 -49
- package/build/src/hooks/useExternalPaymentOptions.js.map +0 -1
- package/build/src/hooks/useFitText.js +0 -148
- package/build/src/hooks/useFitText.js.map +0 -1
- package/build/src/hooks/useFocusTrap.js +0 -60
- package/build/src/hooks/useFocusTrap.js.map +0 -1
- package/build/src/hooks/useGoogleFont.js +0 -45
- package/build/src/hooks/useGoogleFont.js.map +0 -1
- package/build/src/hooks/useIsMobile.js +0 -17
- package/build/src/hooks/useIsMobile.js.map +0 -1
- package/build/src/hooks/useIsMounted.js +0 -12
- package/build/src/hooks/useIsMounted.js.map +0 -1
- package/build/src/hooks/useLastConnector.js +0 -24
- package/build/src/hooks/useLastConnector.js.map +0 -1
- package/build/src/hooks/useLocales.js +0 -67
- package/build/src/hooks/useLocales.js.map +0 -1
- package/build/src/hooks/useLockBodyScroll.js +0 -53
- package/build/src/hooks/useLockBodyScroll.js.map +0 -1
- package/build/src/hooks/useOrderUsdLimits.js +0 -26
- package/build/src/hooks/useOrderUsdLimits.js.map +0 -1
- package/build/src/hooks/usePayWithSolanaToken.js +0 -50
- package/build/src/hooks/usePayWithSolanaToken.js.map +0 -1
- package/build/src/hooks/usePayWithToken.js +0 -58
- package/build/src/hooks/usePayWithToken.js.map +0 -1
- package/build/src/hooks/usePaymentState.js +0 -283
- package/build/src/hooks/usePaymentState.js.map +0 -1
- package/build/src/hooks/usePrevious.js +0 -14
- package/build/src/hooks/usePrevious.js.map +0 -1
- package/build/src/hooks/useSolanaPaymentOptions.js +0 -39
- package/build/src/hooks/useSolanaPaymentOptions.js.map +0 -1
- package/build/src/hooks/useWalletConnectModal.js +0 -52
- package/build/src/hooks/useWalletConnectModal.js.map +0 -1
- package/build/src/hooks/useWalletPaymentOptions.js +0 -50
- package/build/src/hooks/useWalletPaymentOptions.js.map +0 -1
- package/build/src/hooks/useWindowSize.js +0 -23
- package/build/src/hooks/useWindowSize.js.map +0 -1
- package/build/src/index.js +0 -10
- package/build/src/index.js.map +0 -1
- package/build/src/localizations/index.js +0 -57
- package/build/src/localizations/index.js.map +0 -1
- package/build/src/localizations/locales/ar-AE.js +0 -97
- package/build/src/localizations/locales/ar-AE.js.map +0 -1
- package/build/src/localizations/locales/ca-AD.js +0 -95
- package/build/src/localizations/locales/ca-AD.js.map +0 -1
- package/build/src/localizations/locales/ee-EE.js +0 -95
- package/build/src/localizations/locales/ee-EE.js.map +0 -1
- package/build/src/localizations/locales/en-US.js +0 -95
- package/build/src/localizations/locales/en-US.js.map +0 -1
- package/build/src/localizations/locales/es-ES.js +0 -95
- package/build/src/localizations/locales/es-ES.js.map +0 -1
- package/build/src/localizations/locales/fa-IR.js +0 -95
- package/build/src/localizations/locales/fa-IR.js.map +0 -1
- package/build/src/localizations/locales/fr-FR.js +0 -95
- package/build/src/localizations/locales/fr-FR.js.map +0 -1
- package/build/src/localizations/locales/ja-JP.js +0 -95
- package/build/src/localizations/locales/ja-JP.js.map +0 -1
- package/build/src/localizations/locales/pt-BR.js +0 -95
- package/build/src/localizations/locales/pt-BR.js.map +0 -1
- package/build/src/localizations/locales/ru-RU.js +0 -95
- package/build/src/localizations/locales/ru-RU.js.map +0 -1
- package/build/src/localizations/locales/tr-TR.js +0 -95
- package/build/src/localizations/locales/tr-TR.js.map +0 -1
- package/build/src/localizations/locales/vi-VN.js +0 -95
- package/build/src/localizations/locales/vi-VN.js.map +0 -1
- package/build/src/localizations/locales/zh-CN.js +0 -95
- package/build/src/localizations/locales/zh-CN.js.map +0 -1
- package/build/src/styles/defaultTheme.js +0 -89
- package/build/src/styles/defaultTheme.js.map +0 -1
- package/build/src/styles/index.js +0 -329
- package/build/src/styles/index.js.map +0 -1
- package/build/src/styles/styled/index.js +0 -16
- package/build/src/styles/styled/index.js.map +0 -1
- package/build/src/styles/themes/base.js +0 -141
- package/build/src/styles/themes/base.js.map +0 -1
- package/build/src/styles/themes/index.js +0 -13
- package/build/src/styles/themes/index.js.map +0 -1
- package/build/src/styles/themes/midnight.js +0 -76
- package/build/src/styles/themes/midnight.js.map +0 -1
- package/build/src/styles/themes/minimal.js +0 -96
- package/build/src/styles/themes/minimal.js.map +0 -1
- package/build/src/styles/themes/nouns.js +0 -81
- package/build/src/styles/themes/nouns.js.map +0 -1
- package/build/src/styles/themes/retro.js +0 -106
- package/build/src/styles/themes/retro.js.map +0 -1
- package/build/src/styles/themes/rounded.js +0 -106
- package/build/src/styles/themes/rounded.js.map +0 -1
- package/build/src/styles/themes/soft.js +0 -71
- package/build/src/styles/themes/soft.js.map +0 -1
- package/build/src/styles/themes/web95.js +0 -132
- package/build/src/styles/themes/web95.js.map +0 -1
- package/build/src/utils/exports.js +0 -7
- package/build/src/utils/exports.js.map +0 -1
- package/build/src/utils/format.js +0 -83
- package/build/src/utils/format.js.map +0 -1
- package/build/src/utils/index.js +0 -39
- package/build/src/utils/index.js.map +0 -1
- package/build/src/utils/p3.js +0 -16
- package/build/src/utils/p3.js.map +0 -1
- package/build/src/utils/platform.js +0 -13
- package/build/src/utils/platform.js.map +0 -1
- package/build/src/utils/supportUrl.js +0 -18
- package/build/src/utils/supportUrl.js.map +0 -1
- package/build/src/utils/trpc.js +0 -19
- package/build/src/utils/trpc.js.map +0 -1
- package/build/src/utils/validateInput.js +0 -36
- package/build/src/utils/validateInput.js.map +0 -1
- package/build/src/utils/wallets.js +0 -14
- package/build/src/utils/wallets.js.map +0 -1
- package/build/src/wallets/index.js +0 -32
- package/build/src/wallets/index.js.map +0 -1
- package/build/src/wallets/useWallets.js +0 -90
- package/build/src/wallets/useWallets.js.map +0 -1
- package/build/src/wallets/walletConfigs.js +0 -337
- package/build/src/wallets/walletConfigs.js.map +0 -1
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useMemo, useEffect } from 'react';
|
|
3
|
-
import { usePayContext, ROUTES } from '../../DaimoPay.js';
|
|
4
|
-
import { PageContent } from '../../Common/Modal/styles.js';
|
|
5
|
-
import { ExternalPaymentOptions, getAddressContraction } from '@daimo/pay-common';
|
|
6
|
-
import { useWallet } from '@solana/wallet-adapter-react';
|
|
7
|
-
import { useAccount, useDisconnect } from 'wagmi';
|
|
8
|
-
import { Solana, Bitcoin, Tron, Zcash, Ethereum } from '../../../assets/chains.js';
|
|
9
|
-
import { MetaMask, Rainbow, Coinbase, Rabby } from '../../../assets/logos.js';
|
|
10
|
-
import useIsMobile from '../../../hooks/useIsMobile.js';
|
|
11
|
-
import { walletConfigs } from '../../../wallets/walletConfigs.js';
|
|
12
|
-
import OptionsList from '../../Common/OptionsList/index.js';
|
|
13
|
-
import { OrderHeader } from '../../Common/OrderHeader/index.js';
|
|
14
|
-
import PoweredByFooter from '../../Common/PoweredByFooter/index.js';
|
|
15
|
-
import WalletChainLogo from '../../Common/WalletChainLogo/index.js';
|
|
16
|
-
|
|
17
|
-
// Get 3 icons, skipping the one that is already connected
|
|
18
|
-
function getBestUnconnectedWalletIcons(connector) {
|
|
19
|
-
const icons = [];
|
|
20
|
-
const strippedId = connector?.id.toLowerCase(); // some connector ids can have weird casing and or suffixes and prefixes
|
|
21
|
-
const [isMetaMask, isRainbow, isCoinbase] = [
|
|
22
|
-
strippedId?.includes("metamask"),
|
|
23
|
-
strippedId?.includes("rainbow"),
|
|
24
|
-
strippedId?.includes("coinbase"),
|
|
25
|
-
];
|
|
26
|
-
if (!isMetaMask)
|
|
27
|
-
icons.push(jsx(MetaMask, {}));
|
|
28
|
-
if (!isRainbow)
|
|
29
|
-
icons.push(jsx(Rainbow, {}));
|
|
30
|
-
if (!isCoinbase)
|
|
31
|
-
icons.push(jsx(Coinbase, {}));
|
|
32
|
-
if (icons.length < 3)
|
|
33
|
-
icons.push(jsx(Rabby, {}));
|
|
34
|
-
return icons;
|
|
35
|
-
}
|
|
36
|
-
function getSolanaOption(isOnIOS) {
|
|
37
|
-
const { wallets } = useWallet();
|
|
38
|
-
const { setRoute } = usePayContext();
|
|
39
|
-
if (wallets.length === 0 && !isOnIOS)
|
|
40
|
-
return null;
|
|
41
|
-
return {
|
|
42
|
-
id: "solana",
|
|
43
|
-
title: "Pay on Solana",
|
|
44
|
-
icons: [jsx(Solana, {})],
|
|
45
|
-
onClick: () => {
|
|
46
|
-
setRoute(ROUTES.SOLANA_CONNECT);
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function getDepositAddressOption(depositAddressOptions) {
|
|
51
|
-
const { setRoute, paymentState } = usePayContext();
|
|
52
|
-
// TODO: API should serve the subtitle and disabled
|
|
53
|
-
const disabled = !paymentState.isDepositFlow &&
|
|
54
|
-
!depositAddressOptions.loading &&
|
|
55
|
-
depositAddressOptions.options.length === 0;
|
|
56
|
-
const subtitle = disabled ? "Minimum $20.00" : "Bitcoin, Tron, Zcash...";
|
|
57
|
-
return {
|
|
58
|
-
id: "depositAddress",
|
|
59
|
-
title: "Pay on another chain",
|
|
60
|
-
subtitle,
|
|
61
|
-
icons: [jsx(Bitcoin, {}), jsx(Tron, {}), jsx(Zcash, {})],
|
|
62
|
-
onClick: () => {
|
|
63
|
-
setRoute(ROUTES.SELECT_DEPOSIT_ADDRESS_CHAIN);
|
|
64
|
-
},
|
|
65
|
-
disabled,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const SelectMethod = () => {
|
|
69
|
-
const isMobile = useIsMobile();
|
|
70
|
-
const isOnIOS = useMemo(() => {
|
|
71
|
-
return /iPad|iPhone/.test(navigator.userAgent);
|
|
72
|
-
}, []);
|
|
73
|
-
const { address, chain, isConnected: isEthConnected, connector, } = useAccount();
|
|
74
|
-
const { connected: isSolanaConnected, wallet: solanaWallet, publicKey, } = useWallet();
|
|
75
|
-
const { setRoute, paymentState, wcWallet, setWcWallet, log } = usePayContext();
|
|
76
|
-
const { disconnectAsync } = useDisconnect();
|
|
77
|
-
const { daimoPayOrder, setSelectedExternalOption, externalPaymentOptions, depositAddressOptions, senderEnsName, } = paymentState;
|
|
78
|
-
const paymentOptions = daimoPayOrder?.metadata.payer?.paymentOptions;
|
|
79
|
-
// Extract the currently connect WalletConnect wallet
|
|
80
|
-
useEffect(() => {
|
|
81
|
-
connector?.getProvider()?.then((p) => {
|
|
82
|
-
let name = p.session?.peer?.metadata?.name;
|
|
83
|
-
if (p.isCoinbaseWallet)
|
|
84
|
-
name = "Coinbase Wallet";
|
|
85
|
-
if (name == null)
|
|
86
|
-
name = "Unknown";
|
|
87
|
-
const wallet = Object.values(walletConfigs).find((c) => c.name === name || name.includes(c.shortName));
|
|
88
|
-
log(`[SELECT_METHOD] wcWallet: ${wallet?.name} ${wallet != null}`, p);
|
|
89
|
-
setWcWallet(wallet);
|
|
90
|
-
});
|
|
91
|
-
}, [connector]);
|
|
92
|
-
const getConnectedWalletOptions = () => {
|
|
93
|
-
const showChainLogo = isEthConnected && isSolanaConnected;
|
|
94
|
-
const connectedOptions = [];
|
|
95
|
-
if (isEthConnected) {
|
|
96
|
-
const ethWalletDisplayName = senderEnsName ?? (address ? getAddressContraction(address) : "wallet");
|
|
97
|
-
let walletIcon;
|
|
98
|
-
if (connector?.icon) {
|
|
99
|
-
walletIcon = jsx("img", { src: connector.icon, alt: connector.name });
|
|
100
|
-
}
|
|
101
|
-
else if (wcWallet?.icon) {
|
|
102
|
-
walletIcon = (jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: wcWallet.icon }));
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
walletIcon = jsx(MetaMask, {});
|
|
106
|
-
}
|
|
107
|
-
const connectedEthWalletOption = {
|
|
108
|
-
id: "connectedWallet",
|
|
109
|
-
title: `Pay with ${ethWalletDisplayName}`,
|
|
110
|
-
icons: [
|
|
111
|
-
jsx(WalletChainLogo, { walletIcon: walletIcon, walletName: connector?.name || "Wallet", chainLogo: showChainLogo ? jsx(Ethereum, {}) : null }, "eth"),
|
|
112
|
-
],
|
|
113
|
-
onClick: () => {
|
|
114
|
-
setRoute(ROUTES.SELECT_TOKEN, {
|
|
115
|
-
event: "click-wallet",
|
|
116
|
-
walletId: connector?.id,
|
|
117
|
-
chainId: chain?.id,
|
|
118
|
-
address: address,
|
|
119
|
-
});
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
connectedOptions.push(connectedEthWalletOption);
|
|
123
|
-
}
|
|
124
|
-
if (isSolanaConnected) {
|
|
125
|
-
const solWalletDisplayName = getAddressContraction(publicKey?.toBase58() ?? "");
|
|
126
|
-
const connectedSolWalletOption = {
|
|
127
|
-
id: "connectedSolanaWallet",
|
|
128
|
-
title: `Pay with ${solWalletDisplayName}`,
|
|
129
|
-
icons: solanaWallet?.adapter.icon
|
|
130
|
-
? [
|
|
131
|
-
jsx(WalletChainLogo, { walletIcon: solanaWallet.adapter.icon, walletName: solanaWallet.adapter.name, chainLogo: showChainLogo && jsx(Solana, {}) }),
|
|
132
|
-
]
|
|
133
|
-
: [
|
|
134
|
-
jsx(WalletChainLogo, { walletIcon: jsx(Solana, {}), walletName: "Default wallet icon", chainLogo: null }),
|
|
135
|
-
],
|
|
136
|
-
onClick: () => {
|
|
137
|
-
setRoute(ROUTES.SOLANA_SELECT_TOKEN, {
|
|
138
|
-
event: "click-wallet",
|
|
139
|
-
walletId: solanaWallet?.adapter.name,
|
|
140
|
-
chainId: "solana",
|
|
141
|
-
address: publicKey?.toBase58(),
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
connectedOptions.push(connectedSolWalletOption);
|
|
146
|
-
}
|
|
147
|
-
return connectedOptions;
|
|
148
|
-
};
|
|
149
|
-
// Solana payment option
|
|
150
|
-
// Include by default if paymentOptions not provided
|
|
151
|
-
const includeSolana = paymentOptions == null ||
|
|
152
|
-
paymentOptions.includes(ExternalPaymentOptions.Solana);
|
|
153
|
-
// Deposit address options, e.g. Bitcoin, Tron, Zcash, etc.
|
|
154
|
-
// Include by default if paymentOptions not provided
|
|
155
|
-
const includeDepositAddressOption = paymentOptions == null ||
|
|
156
|
-
paymentOptions.includes(ExternalPaymentOptions.ExternalChains);
|
|
157
|
-
const connectedWalletOptions = getConnectedWalletOptions();
|
|
158
|
-
const unconnectedWalletOption = {
|
|
159
|
-
id: "unconnectedWallet",
|
|
160
|
-
title: isEthConnected || isSolanaConnected
|
|
161
|
-
? `Pay with another wallet`
|
|
162
|
-
: `Pay with wallet`,
|
|
163
|
-
icons: getBestUnconnectedWalletIcons(connector),
|
|
164
|
-
onClick: async () => {
|
|
165
|
-
await disconnectAsync();
|
|
166
|
-
setRoute(ROUTES.CONNECTORS);
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
const options = [];
|
|
170
|
-
options.push(...connectedWalletOptions);
|
|
171
|
-
options.push(unconnectedWalletOption);
|
|
172
|
-
log(`[SELECT_METHOD] loading: ${externalPaymentOptions.loading}, options: ${JSON.stringify(externalPaymentOptions.options)}`);
|
|
173
|
-
if (includeSolana) {
|
|
174
|
-
const solanaOption = getSolanaOption(isOnIOS);
|
|
175
|
-
if (solanaOption) {
|
|
176
|
-
options.push(solanaOption);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
// External payment options, e.g. Binance, Coinbase, etc.
|
|
180
|
-
options.push(...(externalPaymentOptions.options ?? []).map((option) => ({
|
|
181
|
-
id: option.id,
|
|
182
|
-
title: option.cta,
|
|
183
|
-
icons: [option.logoURI],
|
|
184
|
-
onClick: () => {
|
|
185
|
-
setSelectedExternalOption(option);
|
|
186
|
-
const meta = { event: "click-option", option: option.id };
|
|
187
|
-
if (paymentState.isDepositFlow) {
|
|
188
|
-
setRoute(ROUTES.SELECT_EXTERNAL_AMOUNT, meta);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
setRoute(ROUTES.WAITING_EXTERNAL, meta);
|
|
192
|
-
}
|
|
193
|
-
},
|
|
194
|
-
disabled: option.disabled,
|
|
195
|
-
subtitle: option.message,
|
|
196
|
-
})));
|
|
197
|
-
if (includeDepositAddressOption) {
|
|
198
|
-
const depositAddressOption = getDepositAddressOption(depositAddressOptions);
|
|
199
|
-
options.push(depositAddressOption);
|
|
200
|
-
}
|
|
201
|
-
return (jsxs(PageContent, { children: [jsx(OrderHeader, {}), jsx(OptionsList, { requiredSkeletons: isMobile ? 4 : 3, isLoading: externalPaymentOptions.loading, options: externalPaymentOptions.loading ? [] : options }), jsx(PoweredByFooter, {})] }));
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export { SelectMethod as default };
|
|
205
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { usePayContext, ROUTES } from '../../DaimoPay.js';
|
|
3
|
-
import { PageContent, ModalContent, ModalH1 } from '../../Common/Modal/styles.js';
|
|
4
|
-
import { getChainName } from '@daimo/pay-common';
|
|
5
|
-
import { formatUsd, roundTokenAmount } from '../../../utils/format.js';
|
|
6
|
-
import Button from '../../Common/Button/index.js';
|
|
7
|
-
import OptionsList from '../../Common/OptionsList/index.js';
|
|
8
|
-
import { OrderHeader } from '../../Common/OrderHeader/index.js';
|
|
9
|
-
import TokenChainLogo from '../../Common/TokenChainLogo/index.js';
|
|
10
|
-
|
|
11
|
-
function getDaimoTokenKey(token) {
|
|
12
|
-
return `${token.chainId}-${token.token}`;
|
|
13
|
-
}
|
|
14
|
-
const SelectToken = () => {
|
|
15
|
-
const { setRoute, paymentState } = usePayContext();
|
|
16
|
-
const { isDepositFlow, walletPaymentOptions, setSelectedTokenOption } = paymentState;
|
|
17
|
-
const optionsList = walletPaymentOptions.options?.map((option) => {
|
|
18
|
-
const chainName = getChainName(option.balance.token.chainId);
|
|
19
|
-
const titlePrice = isDepositFlow
|
|
20
|
-
? formatUsd(option.balance.usd)
|
|
21
|
-
: roundTokenAmount(option.required.amount, option.required.token);
|
|
22
|
-
const title = `${titlePrice} ${option.balance.token.symbol} on ${chainName}`;
|
|
23
|
-
const balanceStr = `${roundTokenAmount(option.balance.amount, option.balance.token)} ${option.balance.token.symbol}`;
|
|
24
|
-
const subtitle = option.disabledReason ??
|
|
25
|
-
`${isDepositFlow ? "" : "Balance: "}${balanceStr}`;
|
|
26
|
-
const disabled = option.disabledReason != null;
|
|
27
|
-
return {
|
|
28
|
-
id: getDaimoTokenKey(option.balance.token),
|
|
29
|
-
title,
|
|
30
|
-
subtitle,
|
|
31
|
-
icons: [
|
|
32
|
-
jsx(TokenChainLogo, { token: option.balance.token }, getDaimoTokenKey(option.balance.token)),
|
|
33
|
-
],
|
|
34
|
-
onClick: () => {
|
|
35
|
-
setSelectedTokenOption(option);
|
|
36
|
-
const meta = {
|
|
37
|
-
event: "click-token",
|
|
38
|
-
tokenSymbol: option.balance.token.symbol,
|
|
39
|
-
chainId: option.balance.token.chainId,
|
|
40
|
-
};
|
|
41
|
-
if (isDepositFlow) {
|
|
42
|
-
setRoute(ROUTES.SELECT_AMOUNT, meta);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
setRoute(ROUTES.PAY_WITH_TOKEN, meta);
|
|
46
|
-
}
|
|
47
|
-
},
|
|
48
|
-
disabled,
|
|
49
|
-
};
|
|
50
|
-
}) ?? [];
|
|
51
|
-
return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true }), !walletPaymentOptions.isLoading && optionsList.length === 0 && (jsxs(ModalContent, { style: {
|
|
52
|
-
display: "flex",
|
|
53
|
-
alignItems: "center",
|
|
54
|
-
justifyContent: "center",
|
|
55
|
-
paddingTop: 16,
|
|
56
|
-
paddingBottom: 16,
|
|
57
|
-
}, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD), children: "Select Another Method" })] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: walletPaymentOptions.isLoading, options: optionsList })] }));
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export { SelectToken as default };
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { PageContent, ModalContent, ModalH1 } from '../../../Common/Modal/styles.js';
|
|
3
|
-
import { useWallet } from '@solana/wallet-adapter-react';
|
|
4
|
-
import { SquircleIcon, Phantom, Solflare, Backpack } from '../../../../assets/logos.js';
|
|
5
|
-
import { isMobile } from '../../../../utils/index.js';
|
|
6
|
-
import Button from '../../../Common/Button/index.js';
|
|
7
|
-
import OptionsList from '../../../Common/OptionsList/index.js';
|
|
8
|
-
import { usePayContext, ROUTES } from '../../../DaimoPay.js';
|
|
9
|
-
|
|
10
|
-
const ConnectSolana = () => {
|
|
11
|
-
const { setSolanaConnector, setRoute, log } = usePayContext();
|
|
12
|
-
const solanaWallets = useWallet();
|
|
13
|
-
const options = solanaWallets.wallets.map((wallet) => ({
|
|
14
|
-
id: wallet.adapter.name,
|
|
15
|
-
title: `${wallet.adapter.name}`,
|
|
16
|
-
icons: [
|
|
17
|
-
jsx(SquircleIcon, { icon: wallet.adapter.icon, alt: wallet.adapter.name }),
|
|
18
|
-
],
|
|
19
|
-
onClick: async () => {
|
|
20
|
-
log("wallet.adapter.name ", wallet.adapter.name);
|
|
21
|
-
setSolanaConnector(wallet.adapter.name);
|
|
22
|
-
if (solanaWallets.connected) {
|
|
23
|
-
await solanaWallets.disconnect();
|
|
24
|
-
}
|
|
25
|
-
setRoute(ROUTES.SOLANA_CONNECTOR, {
|
|
26
|
-
event: "click-solana-wallet",
|
|
27
|
-
walletName: wallet.adapter.name,
|
|
28
|
-
});
|
|
29
|
-
},
|
|
30
|
-
}));
|
|
31
|
-
const defaultOptions = [
|
|
32
|
-
{
|
|
33
|
-
id: "phantom",
|
|
34
|
-
title: "Open in Phantom",
|
|
35
|
-
icons: [
|
|
36
|
-
jsx(SquircleIcon, { icon: (props) => jsx(Phantom, { ...props, background: true }), alt: "Phantom" }),
|
|
37
|
-
],
|
|
38
|
-
onClick: () => window.open(`https://phantom.app/ul/browse/${encodeURIComponent(window.location.href)}?ref=${encodeURIComponent(window.location.origin)}`),
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: "solflare",
|
|
42
|
-
title: "Open in Solflare",
|
|
43
|
-
icons: [
|
|
44
|
-
jsx(SquircleIcon, { icon: (props) => jsx(Solflare, { ...props, background: true }), alt: "Solflare" }),
|
|
45
|
-
],
|
|
46
|
-
onClick: () => window.open(`https://solflare.com/ul/v1/browse/${encodeURIComponent(window.location.href)}?ref=${encodeURIComponent(window.location.origin)}`, "_blank"),
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
id: "backpack",
|
|
50
|
-
title: "Open in Backpack",
|
|
51
|
-
icons: [
|
|
52
|
-
jsx(SquircleIcon, { icon: (props) => jsx(Backpack, { ...props, background: true }), alt: "Backpack" }),
|
|
53
|
-
],
|
|
54
|
-
onClick: () => window.open(`https://backpack.app/ul/v1/browse/${encodeURIComponent(window.location.href)}?ref=${encodeURIComponent(window.location.origin)}`, "_blank"),
|
|
55
|
-
},
|
|
56
|
-
];
|
|
57
|
-
return (jsxs(PageContent, { style: {
|
|
58
|
-
height: "100%",
|
|
59
|
-
}, children: [solanaWallets.wallets.length === 0 && !isMobile() && (jsxs(ModalContent, { style: {
|
|
60
|
-
display: "flex",
|
|
61
|
-
flexDirection: "column",
|
|
62
|
-
alignItems: "center",
|
|
63
|
-
justifyContent: "center",
|
|
64
|
-
paddingTop: 16,
|
|
65
|
-
paddingBottom: 16,
|
|
66
|
-
gap: 16,
|
|
67
|
-
}, children: [jsx(ModalH1, { children: "No Solana wallets detected." }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD, { event: "click-select-another" }), children: "Select Another Method" })] })), isMobile() &&
|
|
68
|
-
(solanaWallets.wallets.length === 0 ||
|
|
69
|
-
(solanaWallets.wallets.length > 0 &&
|
|
70
|
-
solanaWallets.wallets[0].adapter.name ===
|
|
71
|
-
"Mobile Wallet Adapter")) && (jsx(ModalContent, { style: {
|
|
72
|
-
display: "flex",
|
|
73
|
-
flexDirection: "column",
|
|
74
|
-
gap: 16,
|
|
75
|
-
}, children: jsx(OptionsList, { options: defaultOptions }) })), solanaWallets.wallets.length > 0 &&
|
|
76
|
-
solanaWallets.wallets[0].adapter.name !== "Mobile Wallet Adapter" && (jsx(OptionsList, { options: options }))] }));
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
export { ConnectSolana as default };
|
|
80
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { PageContent, ModalContent, ModalH1, ModalBody } from '../../../Common/Modal/styles.js';
|
|
4
|
-
import { useWallet } from '@solana/wallet-adapter-react';
|
|
5
|
-
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
|
-
import styled from '../../../../styles/styled/index.js';
|
|
7
|
-
import { usePayContext, ROUTES } from '../../../DaimoPay.js';
|
|
8
|
-
import SquircleSpinner from '../../../Spinners/SquircleSpinner/index.js';
|
|
9
|
-
|
|
10
|
-
const ConnectSolana = () => {
|
|
11
|
-
const solanaWallets = useWallet();
|
|
12
|
-
const isConnected = solanaWallets.connected;
|
|
13
|
-
const { solanaConnector, setRoute } = usePayContext();
|
|
14
|
-
const selectedWallet = solanaWallets.wallets.find((wallet) => wallet.adapter.name === solanaConnector);
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (!solanaConnector)
|
|
17
|
-
return;
|
|
18
|
-
solanaWallets.select(solanaConnector);
|
|
19
|
-
}, [solanaConnector]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (isConnected) {
|
|
22
|
-
// Wait so user can see it's connected
|
|
23
|
-
const meta = {
|
|
24
|
-
event: "wait-solana-connected",
|
|
25
|
-
walletName: solanaWallets.wallet?.adapter.name,
|
|
26
|
-
};
|
|
27
|
-
setTimeout(() => setRoute(ROUTES.SOLANA_SELECT_TOKEN, meta), 500);
|
|
28
|
-
}
|
|
29
|
-
}, [isConnected]);
|
|
30
|
-
if (!solanaConnector)
|
|
31
|
-
return null;
|
|
32
|
-
return (jsxs(PageContent, { children: [jsx(LoadingContainer, { children: jsx(AnimationContainer, { children: jsx(AnimatePresence, { children: jsx(SquircleSpinner, { logo: jsx("div", { style: { borderRadius: "22.5%", overflow: "hidden" }, children: jsx("img", { src: selectedWallet?.adapter.icon, alt: selectedWallet?.adapter.name }) }), loading: true }) }) }) }), jsx(ModalContent, { style: { paddingBottom: 0 }, children: isConnected ? (jsx(ModalH1, { children: "Connected" })) : (jsxs(Fragment, { children: [jsx(ModalH1, { children: "Requesting Connection" }), jsxs(ModalBody, { children: ["Open ", selectedWallet?.adapter.name, " to continue."] })] })) })] }));
|
|
33
|
-
};
|
|
34
|
-
const LoadingContainer = styled(motion.div) `
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: center;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
margin: 10px auto 16px;
|
|
39
|
-
height: 120px;
|
|
40
|
-
`;
|
|
41
|
-
const AnimationContainer = styled(motion.div) `
|
|
42
|
-
user-select: none;
|
|
43
|
-
position: relative;
|
|
44
|
-
--spinner-error-opacity: 0;
|
|
45
|
-
&:before {
|
|
46
|
-
content: "";
|
|
47
|
-
position: absolute;
|
|
48
|
-
inset: 1px;
|
|
49
|
-
opacity: 0;
|
|
50
|
-
background: var(--ck-body-color-danger);
|
|
51
|
-
}
|
|
52
|
-
`;
|
|
53
|
-
|
|
54
|
-
export { LoadingContainer, ConnectSolana as default };
|
|
55
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
import { usePayContext, ROUTES } from '../../../DaimoPay.js';
|
|
4
|
-
import { WalletSignTransactionError, WalletSendTransactionError } from '@solana/wallet-adapter-base';
|
|
5
|
-
import { PageContent, ModalContent, ModalH1 } from '../../../Common/Modal/styles.js';
|
|
6
|
-
import { assert } from '@daimo/pay-common';
|
|
7
|
-
import Button from '../../../Common/Button/index.js';
|
|
8
|
-
import PaymentBreakdown from '../../../Common/PaymentBreakdown/index.js';
|
|
9
|
-
import TokenLogoSpinner from '../../../Spinners/TokenLogoSpinner/index.js';
|
|
10
|
-
|
|
11
|
-
var PayState;
|
|
12
|
-
(function (PayState) {
|
|
13
|
-
PayState["RequestingPayment"] = "Requesting Payment";
|
|
14
|
-
PayState["RequestCancelled"] = "Payment Cancelled";
|
|
15
|
-
PayState["RequestFailed"] = "Payment Failed";
|
|
16
|
-
PayState["RequestSuccessful"] = "Payment Successful";
|
|
17
|
-
})(PayState || (PayState = {}));
|
|
18
|
-
const PayWithSolanaToken = () => {
|
|
19
|
-
const { triggerResize, paymentState, setRoute } = usePayContext();
|
|
20
|
-
const { payParams, generatePreviewOrder, selectedSolanaTokenOption, payWithSolanaToken, } = paymentState;
|
|
21
|
-
const [payState, setPayState] = useState(PayState.RequestingPayment);
|
|
22
|
-
const handleTransfer = async () => {
|
|
23
|
-
try {
|
|
24
|
-
setPayState(PayState.RequestingPayment);
|
|
25
|
-
assert(!!selectedSolanaTokenOption, "[PAY SOLANA] No token option selected");
|
|
26
|
-
await payWithSolanaToken(selectedSolanaTokenOption.required.token.token);
|
|
27
|
-
setPayState(PayState.RequestSuccessful);
|
|
28
|
-
setTimeout(() => {
|
|
29
|
-
setRoute(ROUTES.CONFIRMATION, { event: "wait-pay-with-solana" });
|
|
30
|
-
}, 200);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
console.error(error);
|
|
34
|
-
if (error instanceof WalletSignTransactionError ||
|
|
35
|
-
error instanceof WalletSendTransactionError) {
|
|
36
|
-
setPayState(PayState.RequestCancelled);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
setPayState(PayState.RequestFailed);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
let transferTimeout; // Prevent double-triggering in React dev strict mode.
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (!selectedSolanaTokenOption)
|
|
46
|
-
return;
|
|
47
|
-
// Give user time to see the UI before opening
|
|
48
|
-
transferTimeout = setTimeout(handleTransfer, 100);
|
|
49
|
-
return () => clearTimeout(transferTimeout);
|
|
50
|
-
}, []);
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
triggerResize();
|
|
53
|
-
}, [payState]);
|
|
54
|
-
return (jsxs(PageContent, { children: [selectedSolanaTokenOption && (jsx(TokenLogoSpinner, { token: selectedSolanaTokenOption.required.token })), jsxs(ModalContent, { style: { paddingBottom: 0 }, children: [jsx(ModalH1, { children: payState }), selectedSolanaTokenOption && (jsx(PaymentBreakdown, { paymentOption: selectedSolanaTokenOption })), payState === PayState.RequestCancelled && (jsx(Button, { onClick: handleTransfer, children: "Retry Payment" })), payState === PayState.RequestFailed && (jsx(Button, { onClick: () => {
|
|
55
|
-
assert(payParams != null, "[PAY SOLANA] payParams cannot be null in deposit flow");
|
|
56
|
-
generatePreviewOrder(payParams);
|
|
57
|
-
setRoute(ROUTES.SELECT_METHOD, { event: "click-select-another" });
|
|
58
|
-
}, children: "Select Another Method" }))] })] }));
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export { PayWithSolanaToken as default };
|
|
62
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { usePayContext, ROUTES } from '../../../DaimoPay.js';
|
|
3
|
-
import MultiCurrencySelectAmount from '../../../Common/AmountInput/index.js';
|
|
4
|
-
import { PageContent } from '../../../Common/Modal/styles.js';
|
|
5
|
-
|
|
6
|
-
const SelectSolanaAmount = () => {
|
|
7
|
-
const { paymentState } = usePayContext();
|
|
8
|
-
const { selectedSolanaTokenOption, setSelectedSolanaTokenOption } = paymentState;
|
|
9
|
-
if (selectedSolanaTokenOption == null) {
|
|
10
|
-
return jsx(PageContent, {});
|
|
11
|
-
}
|
|
12
|
-
return (jsx(MultiCurrencySelectAmount, { selectedTokenOption: selectedSolanaTokenOption, setSelectedTokenOption: setSelectedSolanaTokenOption, nextPage: ROUTES.SOLANA_PAY_WITH_TOKEN }));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { SelectSolanaAmount as default };
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { usePayContext, ROUTES } from '../../../DaimoPay.js';
|
|
3
|
-
import { PageContent, ModalContent, ModalH1 } from '../../../Common/Modal/styles.js';
|
|
4
|
-
import { formatUsd, roundTokenAmount } from '../../../../utils/format.js';
|
|
5
|
-
import Button from '../../../Common/Button/index.js';
|
|
6
|
-
import OptionsList from '../../../Common/OptionsList/index.js';
|
|
7
|
-
import { OrderHeader } from '../../../Common/OrderHeader/index.js';
|
|
8
|
-
import TokenChainLogo from '../../../Common/TokenChainLogo/index.js';
|
|
9
|
-
|
|
10
|
-
function getDaimoSolanaTokenKey(token) {
|
|
11
|
-
return `${token.chainId}-${token.token}`;
|
|
12
|
-
}
|
|
13
|
-
const SelectSolanaToken = () => {
|
|
14
|
-
const { paymentState, setRoute } = usePayContext();
|
|
15
|
-
const { isDepositFlow, solanaPaymentOptions, setSelectedSolanaTokenOption } = paymentState;
|
|
16
|
-
const optionsList = solanaPaymentOptions.options?.map((option) => {
|
|
17
|
-
const titlePrice = isDepositFlow
|
|
18
|
-
? formatUsd(option.balance.usd)
|
|
19
|
-
: roundTokenAmount(option.required.amount, option.required.token);
|
|
20
|
-
const title = `${titlePrice} ${option.balance.token.symbol} on Solana`;
|
|
21
|
-
const balanceStr = `${roundTokenAmount(option.balance.amount, option.balance.token)} ${option.balance.token.symbol}`;
|
|
22
|
-
const subtitle = option.disabledReason ??
|
|
23
|
-
`${isDepositFlow ? "" : "Balance: "}${balanceStr}`;
|
|
24
|
-
const disabled = option.disabledReason != null;
|
|
25
|
-
return {
|
|
26
|
-
id: getDaimoSolanaTokenKey(option.balance.token),
|
|
27
|
-
title,
|
|
28
|
-
subtitle,
|
|
29
|
-
icons: [
|
|
30
|
-
jsx(TokenChainLogo, { token: option.balance.token }, getDaimoSolanaTokenKey(option.balance.token)),
|
|
31
|
-
],
|
|
32
|
-
onClick: () => {
|
|
33
|
-
setSelectedSolanaTokenOption(option);
|
|
34
|
-
const meta = {
|
|
35
|
-
event: "click-solana-token",
|
|
36
|
-
tokenSymbol: option.balance.token.symbol,
|
|
37
|
-
chainId: option.balance.token.chainId,
|
|
38
|
-
};
|
|
39
|
-
if (isDepositFlow) {
|
|
40
|
-
setRoute(ROUTES.SOLANA_SELECT_AMOUNT, meta);
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
setRoute(ROUTES.SOLANA_PAY_WITH_TOKEN, meta);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
disabled,
|
|
47
|
-
};
|
|
48
|
-
}) ?? [];
|
|
49
|
-
return (jsxs(PageContent, { children: [jsx(OrderHeader, { minified: true }), !solanaPaymentOptions.isLoading && optionsList.length === 0 && (jsxs(ModalContent, { style: {
|
|
50
|
-
display: "flex",
|
|
51
|
-
alignItems: "center",
|
|
52
|
-
justifyContent: "center",
|
|
53
|
-
paddingTop: 16,
|
|
54
|
-
paddingBottom: 16,
|
|
55
|
-
}, children: [jsx(ModalH1, { children: "Insufficient balance." }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD), children: "Select Another Method" })] })), jsx(OptionsList, { requiredSkeletons: 4, isLoading: solanaPaymentOptions.isLoading, options: optionsList })] }));
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export { SelectSolanaToken as default };
|
|
59
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useConnect, useDisconnect, useAccount } from 'wagmi';
|
|
3
|
-
import ChainSelectList from '../../Common/ChainSelectList/index.js';
|
|
4
|
-
import { PageContent, ModalContent, ModalBody } from '../../Common/Modal/styles.js';
|
|
5
|
-
import useLocales from '../../../hooks/useLocales.js';
|
|
6
|
-
import { DisconnectIcon } from '../../../assets/icons.js';
|
|
7
|
-
import { useChainIsSupported } from '../../../hooks/useChainIsSupported.js';
|
|
8
|
-
import { isSafeConnector } from '../../../utils/index.js';
|
|
9
|
-
import Button from '../../Common/Button/index.js';
|
|
10
|
-
import { OrDivider } from '../../Common/Modal/index.js';
|
|
11
|
-
|
|
12
|
-
const SwitchNetworks = () => {
|
|
13
|
-
const { reset } = useConnect();
|
|
14
|
-
const { disconnect } = useDisconnect();
|
|
15
|
-
const { connector, chain } = useAccount();
|
|
16
|
-
const isChainSupported = useChainIsSupported(chain?.id);
|
|
17
|
-
const locales = useLocales({});
|
|
18
|
-
const onDisconnect = () => {
|
|
19
|
-
disconnect();
|
|
20
|
-
reset();
|
|
21
|
-
};
|
|
22
|
-
return (jsx(PageContent, { style: { width: 278 }, children: jsxs(ModalContent, { style: { padding: 0, marginTop: -10 }, children: [!isChainSupported && (jsxs(ModalBody, { children: [locales.warnings_chainUnsupported, " ", locales.warnings_chainUnsupportedResolve] })), jsx("div", { style: { padding: "6px 8px" }, children: jsx(ChainSelectList, { variant: "secondary" }) }), !isChainSupported && !isSafeConnector(connector?.id) && (jsxs("div", { style: { paddingTop: 12 }, children: [jsx(OrDivider, {}), jsx(Button, { icon: jsx(DisconnectIcon, {}), variant: "secondary", onClick: onDisconnect, children: locales.disconnect })] }))] }) }));
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { SwitchNetworks as default };
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { useEffect, useState } from 'react';
|
|
3
|
-
import { usePayContext, ROUTES } from '../../DaimoPay.js';
|
|
4
|
-
import { PageContent, ModalContent, ModalH1, ModalBody } from '../../Common/Modal/styles.js';
|
|
5
|
-
import { getAddressContraction } from '@daimo/pay-common';
|
|
6
|
-
import ScanIconWithLogos from '../../../assets/ScanIconWithLogos.js';
|
|
7
|
-
import Button from '../../Common/Button/index.js';
|
|
8
|
-
import CopyToClipboard from '../../Common/CopyToClipboard/index.js';
|
|
9
|
-
import CustomQRCode from '../../Common/CustomQRCode/index.js';
|
|
10
|
-
import { OrDivider } from '../../Common/Modal/index.js';
|
|
11
|
-
|
|
12
|
-
const WaitingDepositAddress = () => {
|
|
13
|
-
const context = usePayContext();
|
|
14
|
-
const { triggerResize, paymentState, setRoute } = context;
|
|
15
|
-
const trpc = context.trpc;
|
|
16
|
-
const { daimoPayOrder, payWithDepositAddress, selectedDepositAddressOption } = paymentState;
|
|
17
|
-
useEffect(() => {
|
|
18
|
-
const checkForSourcePayment = async () => {
|
|
19
|
-
if (!daimoPayOrder || !selectedDepositAddressOption)
|
|
20
|
-
return;
|
|
21
|
-
const found = await trpc.findSourcePayment.query({
|
|
22
|
-
orderId: daimoPayOrder.id.toString(),
|
|
23
|
-
});
|
|
24
|
-
if (found) {
|
|
25
|
-
setRoute(ROUTES.CONFIRMATION);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
// Check every 10 seconds, bitcoin takes a while
|
|
29
|
-
const interval = setInterval(checkForSourcePayment, 10000);
|
|
30
|
-
return () => clearInterval(interval);
|
|
31
|
-
}, [daimoPayOrder?.id]);
|
|
32
|
-
const [details, setDetails] = useState();
|
|
33
|
-
const [failed, setFailed] = useState(false);
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
if (!selectedDepositAddressOption)
|
|
36
|
-
return;
|
|
37
|
-
payWithDepositAddress(selectedDepositAddressOption.id).then((details) => {
|
|
38
|
-
if (!details)
|
|
39
|
-
setFailed(true);
|
|
40
|
-
else
|
|
41
|
-
setDetails(details);
|
|
42
|
-
});
|
|
43
|
-
}, [selectedDepositAddressOption]);
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
triggerResize();
|
|
46
|
-
}, [details]);
|
|
47
|
-
return (jsx(PageContent, { children: failed ? (jsxs(ModalContent, { style: { marginLeft: 24, marginRight: 24 }, children: [jsxs(ModalH1, { children: [selectedDepositAddressOption?.id, " unavailable"] }), jsxs(ModalBody, { children: ["We're unable to process ", selectedDepositAddressOption?.id, " payments at this time. Please select another payment method."] }), jsx(Button, { onClick: () => setRoute(ROUTES.SELECT_METHOD, { event: "click-select-another" }), children: "Select Another Method" })] })) : (jsxs(ModalContent, { children: [jsx(CustomQRCode, { value: details?.uri, image: jsx("img", { src: selectedDepositAddressOption?.logoURI, width: "100%", height: "100%" }), tooltipMessage: jsxs(Fragment, { children: [jsx(ScanIconWithLogos, { logo: jsx("img", { src: selectedDepositAddressOption?.logoURI }) }), jsxs("span", { children: ["Use a ", selectedDepositAddressOption?.id, " wallet to scan"] })] }) }), details && (jsxs(Fragment, { children: [jsx(OrDivider, {}), jsxs(ModalBody, { children: ["Send exactly ", details.amount, " ", details.suffix, " to", " ", getAddressContraction(details.address), " and return to this page. Confirmation should appear in a few minutes."] }), jsx(CopyToClipboard, { variant: "button", string: details.address, children: "Copy Address" }), jsx(CopyToClipboard, { variant: "left", string: details.amount, children: "Copy Amount" })] }))] })) }));
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
export { WaitingDepositAddress as default };
|
|
51
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|