@getpara/react-sdk 2.0.0-dev.3 → 2.0.0-dev.5
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/dist/cosmos/actions/getCosmjsAminoSigner.d.ts +8 -0
- package/dist/cosmos/actions/getCosmjsAminoSigner.js +16 -0
- package/dist/cosmos/actions/getCosmjsProtoSigner.d.ts +8 -0
- package/dist/cosmos/actions/getCosmjsProtoSigner.js +16 -0
- package/dist/cosmos/actions/index.d.ts +2 -0
- package/dist/cosmos/actions/index.js +3 -0
- package/dist/cosmos/hooks/index.d.ts +2 -0
- package/dist/cosmos/hooks/index.js +3 -0
- package/dist/cosmos/hooks/useCosmjsAminoSigner.d.ts +11 -0
- package/dist/cosmos/hooks/useCosmjsAminoSigner.js +37 -0
- package/dist/cosmos/hooks/useCosmjsProtoSigner.d.ts +11 -0
- package/dist/cosmos/hooks/useCosmjsProtoSigner.js +37 -0
- package/dist/cosmos/index.d.ts +2 -0
- package/dist/cosmos/index.js +3 -0
- package/dist/css/modal.css +14 -1
- package/dist/evm/actions/getViemAccount.d.ts +22 -0
- package/dist/evm/actions/getViemAccount.js +20 -0
- package/dist/evm/actions/getViemClient.d.ts +7659 -0
- package/dist/evm/actions/getViemClient.js +25 -0
- package/dist/evm/actions/index.d.ts +2 -0
- package/dist/evm/actions/index.js +3 -0
- package/dist/evm/hooks/index.d.ts +2 -0
- package/dist/evm/hooks/index.js +3 -0
- package/dist/evm/hooks/useViemAccount.d.ts +26 -0
- package/dist/evm/hooks/useViemAccount.js +32 -0
- package/dist/evm/hooks/useViemClient.d.ts +7663 -0
- package/dist/evm/hooks/useViemClient.js +30 -0
- package/dist/evm/index.d.ts +2 -0
- package/dist/evm/index.js +3 -0
- package/dist/index.d.ts +3 -5
- package/dist/index.js +4 -4
- package/dist/provider/ParaProvider.d.ts +1 -2
- package/dist/provider/ParaProvider.js +13 -106
- package/dist/public/PPMori-Regular.woff2 +0 -0
- package/dist/public/PPMori-SemiBold.woff2 +0 -0
- package/dist/solana/actions/getSolanaSigner.d.ts +8 -0
- package/dist/solana/actions/getSolanaSigner.js +15 -0
- package/dist/solana/actions/index.d.ts +1 -0
- package/dist/solana/actions/index.js +2 -0
- package/dist/solana/hooks/index.d.ts +1 -0
- package/dist/solana/hooks/index.js +2 -0
- package/dist/solana/hooks/useSolanaSigner.d.ts +12 -0
- package/dist/solana/hooks/useSolanaSigner.js +32 -0
- package/dist/solana/index.d.ts +2 -0
- package/dist/solana/index.js +3 -0
- package/package.json +19 -29
- package/styles.css/package.json +1 -1
- package/dist/cli/cli.mjs +0 -50
- package/dist/modal/ParaModal.d.ts +0 -2
- package/dist/modal/ParaModal.js +0 -301
- package/dist/modal/components/Account/Account.d.ts +0 -5
- package/dist/modal/components/Account/Account.js +0 -148
- package/dist/modal/components/Account/AccountProfile.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfile.js +0 -168
- package/dist/modal/components/Account/AccountProfileLink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLink.js +0 -206
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +0 -111
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +0 -1
- package/dist/modal/components/Account/AccountProfileUnlink.js +0 -47
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFunds.js +0 -69
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsAsset.js +0 -125
- package/dist/modal/components/AddFunds/AddFundsAwaiting.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -78
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +0 -31
- package/dist/modal/components/AddFunds/AddFundsContext.js +0 -160
- package/dist/modal/components/AddFunds/AddFundsDone.d.ts +0 -6
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -49
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsProvider.js +0 -109
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsReceive.js +0 -83
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +0 -1
- package/dist/modal/components/AddFunds/AddFundsSettings.js +0 -237
- package/dist/modal/components/AddFunds/MoonPayEmbed.d.ts +0 -2
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -7
- package/dist/modal/components/AddFunds/common.d.ts +0 -19
- package/dist/modal/components/AddFunds/common.js +0 -24
- package/dist/modal/components/AddFunds/index.d.ts +0 -3
- package/dist/modal/components/AddFunds/index.js +0 -4
- package/dist/modal/components/AuthInput/AuthInput.d.ts +0 -20
- package/dist/modal/components/AuthInput/AuthInput.js +0 -277
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +0 -7
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
- package/dist/modal/components/AuthInput/phoneMasks.d.ts +0 -247
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -50
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +0 -9
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -164
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +0 -9
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -85
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.d.ts +0 -1
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.d.ts +0 -1
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.d.ts +0 -1
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +0 -5
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -49
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +0 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -62
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +0 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -48
- package/dist/modal/components/Body/AnimatedHeightWrapper.d.ts +0 -6
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
- package/dist/modal/components/Body/Body.d.ts +0 -11
- package/dist/modal/components/Body/Body.js +0 -350
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +0 -1
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -95
- package/dist/modal/components/ChainSwitch/config.d.ts +0 -7
- package/dist/modal/components/ChainSwitch/config.js +0 -17
- package/dist/modal/components/Controls/Controls.d.ts +0 -5
- package/dist/modal/components/Controls/Controls.js +0 -78
- package/dist/modal/components/Controls/Selects.d.ts +0 -2
- package/dist/modal/components/Controls/Selects.js +0 -173
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +0 -75
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +0 -8
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -175
- package/dist/modal/components/ExternalWalletStep/config.d.ts +0 -7
- package/dist/modal/components/ExternalWalletStep/config.js +0 -17
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +0 -1
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +0 -39
- package/dist/modal/components/ExternalWallets/ExternalWallets.d.ts +0 -1
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -184
- package/dist/modal/components/Footer/Footer.d.ts +0 -1
- package/dist/modal/components/Footer/Footer.js +0 -95
- package/dist/modal/components/Header/Header.d.ts +0 -1
- package/dist/modal/components/Header/Header.js +0 -43
- package/dist/modal/components/Header/hooks/useStepTitle.d.ts +0 -3
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -61
- package/dist/modal/components/Hero/Hero.d.ts +0 -1
- package/dist/modal/components/Hero/Hero.js +0 -116
- package/dist/modal/components/IFrameStep/IFrameStep.d.ts +0 -1
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -59
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +0 -5
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -44
- package/dist/modal/components/ModalContent/ModalContent.d.ts +0 -10
- package/dist/modal/components/ModalContent/ModalContent.js +0 -88
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +0 -3
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -31
- package/dist/modal/components/OAuth/OAuth.d.ts +0 -6
- package/dist/modal/components/OAuth/OAuth.js +0 -79
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +0 -8
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -74
- package/dist/modal/components/OnRampComponents/AddingFunds.d.ts +0 -1
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.d.ts +0 -9
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.d.ts +0 -6
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -107
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.d.ts +0 -5
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -132
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.d.ts +0 -5
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -27
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +0 -12
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -160
- package/dist/modal/components/Waiting/Waiting.d.ts +0 -6
- package/dist/modal/components/Waiting/Waiting.js +0 -17
- package/dist/modal/components/WalletCard/PartnerIcon.d.ts +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
- package/dist/modal/components/WalletCard/WalletCard.d.ts +0 -18
- package/dist/modal/components/WalletCard/WalletCard.js +0 -128
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.d.ts +0 -6
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -83
- package/dist/modal/components/common.d.ts +0 -59
- package/dist/modal/components/common.js +0 -261
- package/dist/modal/components/index.d.ts +0 -1
- package/dist/modal/components/index.js +0 -2
- package/dist/modal/constants/constants.d.ts +0 -40
- package/dist/modal/constants/constants.js +0 -142
- package/dist/modal/constants/defaults.d.ts +0 -5
- package/dist/modal/constants/defaults.js +0 -10
- package/dist/modal/constants/oAuthLogos.d.ts +0 -17
- package/dist/modal/constants/oAuthLogos.js +0 -158
- package/dist/modal/constants/walletTypeConfig.d.ts +0 -6
- package/dist/modal/constants/walletTypeConfig.js +0 -13
- package/dist/modal/hooks/useGoBack.d.ts +0 -1
- package/dist/modal/hooks/useGoBack.js +0 -43
- package/dist/modal/hooks/useTelegramLogin.d.ts +0 -12
- package/dist/modal/hooks/useTelegramLogin.js +0 -65
- package/dist/modal/index.d.ts +0 -8
- package/dist/modal/index.js +0 -29
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/index.js +0 -2
- package/dist/modal/stores/modal/actions.d.ts +0 -3
- package/dist/modal/stores/modal/actions.js +0 -135
- package/dist/modal/stores/modal/useModalStore.d.ts +0 -103
- package/dist/modal/stores/modal/useModalStore.js +0 -73
- package/dist/modal/types/commonTypes.d.ts +0 -6
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/modalProps.d.ts +0 -129
- package/dist/modal/types/modalProps.js +0 -12
- package/dist/modal/utils/authInputHelpers.d.ts +0 -5
- package/dist/modal/utils/authInputHelpers.js +0 -41
- package/dist/modal/utils/authLayoutHelpers.d.ts +0 -3
- package/dist/modal/utils/authLayoutHelpers.js +0 -8
- package/dist/modal/utils/countryCodes.d.ts +0 -8
- package/dist/modal/utils/countryCodes.js +0 -45
- package/dist/modal/utils/getMailtoLink.d.ts +0 -1
- package/dist/modal/utils/getMailtoLink.js +0 -10
- package/dist/modal/utils/getTileButtonFlex.d.ts +0 -1
- package/dist/modal/utils/getTileButtonFlex.js +0 -20
- package/dist/modal/utils/getWalletDisplayName.d.ts +0 -5
- package/dist/modal/utils/getWalletDisplayName.js +0 -22
- package/dist/modal/utils/isPasskeySupported.d.ts +0 -1
- package/dist/modal/utils/isPasskeySupported.js +0 -15
- package/dist/modal/utils/openPopup.d.ts +0 -6
- package/dist/modal/utils/openPopup.js +0 -60
- package/dist/modal/utils/routeMobileExternalWallet.d.ts +0 -1
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
- package/dist/modal/utils/steps.d.ts +0 -133
- package/dist/modal/utils/steps.js +0 -273
- package/dist/modal/utils/stringFormatters.d.ts +0 -5
- package/dist/modal/utils/stringFormatters.js +0 -19
- package/dist/modal/utils/validateOnRampConfig.d.ts +0 -5
- package/dist/modal/utils/validateOnRampConfig.js +0 -32
- package/dist/provider/actions/getEmbeddedAccount.d.ts +0 -26
- package/dist/provider/actions/getEmbeddedAccount.js +0 -52
- package/dist/provider/actions/getWallet.d.ts +0 -5
- package/dist/provider/actions/getWallet.js +0 -18
- package/dist/provider/actions/index.d.ts +0 -47
- package/dist/provider/actions/index.js +0 -79
- package/dist/provider/actions/utils.d.ts +0 -4
- package/dist/provider/actions/utils.js +0 -34
- package/dist/provider/components/CosmosWalletWrapper.d.ts +0 -11
- package/dist/provider/components/CosmosWalletWrapper.js +0 -43
- package/dist/provider/components/EvmWalletWrapper.d.ts +0 -12
- package/dist/provider/components/EvmWalletWrapper.js +0 -43
- package/dist/provider/components/ExternalWalletWrapper.d.ts +0 -8
- package/dist/provider/components/ExternalWalletWrapper.js +0 -140
- package/dist/provider/components/SolanaWalletWrapper.d.ts +0 -9
- package/dist/provider/components/SolanaWalletWrapper.js +0 -44
- package/dist/provider/external/getParaCosmosConnector.d.ts +0 -7
- package/dist/provider/external/getParaCosmosConnector.js +0 -19
- package/dist/provider/external/getParaCosmosLib.d.ts +0 -4
- package/dist/provider/external/getParaCosmosLib.js +0 -16
- package/dist/provider/external/getParaEvmConnector.d.ts +0 -7
- package/dist/provider/external/getParaEvmConnector.js +0 -19
- package/dist/provider/external/getParaEvmLib.d.ts +0 -4
- package/dist/provider/external/getParaEvmLib.js +0 -16
- package/dist/provider/external/getParaSolanaConnector.d.ts +0 -7
- package/dist/provider/external/getParaSolanaConnector.js +0 -19
- package/dist/provider/external/getParaSolanaLib.d.ts +0 -4
- package/dist/provider/external/getParaSolanaLib.js +0 -16
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +0 -8
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +0 -8
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +0 -2
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +0 -8
- package/dist/provider/hooks/index.d.ts +0 -3
- package/dist/provider/hooks/index.js +0 -4
- package/dist/provider/hooks/mutations/core.d.ts +0 -27
- package/dist/provider/hooks/mutations/core.js +0 -66
- package/dist/provider/hooks/mutations/index.d.ts +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -9
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +0 -9
- package/dist/provider/hooks/mutations/useLinkAccount.js +0 -18
- package/dist/provider/hooks/mutations/utils.d.ts +0 -12
- package/dist/provider/hooks/mutations/utils.js +0 -90
- package/dist/provider/hooks/queries/core.d.ts +0 -4
- package/dist/provider/hooks/queries/core.js +0 -16
- package/dist/provider/hooks/queries/index.d.ts +0 -4
- package/dist/provider/hooks/queries/index.js +0 -11
- package/dist/provider/hooks/queries/useAccount.d.ts +0 -90
- package/dist/provider/hooks/queries/useAccount.js +0 -135
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +0 -5
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +0 -24
- package/dist/provider/hooks/queries/useWallet.d.ts +0 -5
- package/dist/provider/hooks/queries/useWallet.js +0 -26
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +0 -6
- package/dist/provider/hooks/queries/useWalletBalance.js +0 -55
- package/dist/provider/hooks/queries/utils.d.ts +0 -7
- package/dist/provider/hooks/queries/utils.js +0 -25
- package/dist/provider/hooks/utils/index.d.ts +0 -3
- package/dist/provider/hooks/utils/index.js +0 -10
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.d.ts +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
- package/dist/provider/hooks/utils/useClient.d.ts +0 -5
- package/dist/provider/hooks/utils/useClient.js +0 -10
- package/dist/provider/hooks/utils/useEventListeners.d.ts +0 -2
- package/dist/provider/hooks/utils/useEventListeners.js +0 -157
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +0 -4
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +0 -27
- package/dist/provider/hooks/utils/useInternalClient.d.ts +0 -5
- package/dist/provider/hooks/utils/useInternalClient.js +0 -10
- package/dist/provider/hooks/utils/useModal.d.ts +0 -11
- package/dist/provider/hooks/utils/useModal.js +0 -27
- package/dist/provider/hooks/utils/useWalletState.d.ts +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -48
- package/dist/provider/index.d.ts +0 -6
- package/dist/provider/index.js +0 -11
- package/dist/provider/providers/AccountLinkProvider.d.ts +0 -47
- package/dist/provider/providers/AccountLinkProvider.js +0 -452
- package/dist/provider/providers/AuthProvider.d.ts +0 -37
- package/dist/provider/providers/AuthProvider.js +0 -523
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/CosmosExternalWalletProvider.js +0 -66
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/EvmExternalWalletProvider.js +0 -74
- package/dist/provider/providers/ExternalWalletProvider.d.ts +0 -59
- package/dist/provider/providers/ExternalWalletProvider.js +0 -596
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +0 -7
- package/dist/provider/providers/SolanaExternalWalletProvider.js +0 -66
- package/dist/provider/stores/getters.d.ts +0 -4
- package/dist/provider/stores/getters.js +0 -13
- package/dist/provider/stores/setters.d.ts +0 -1
- package/dist/provider/stores/setters.js +0 -7
- package/dist/provider/stores/slices/analytics.d.ts +0 -3
- package/dist/provider/stores/slices/analytics.js +0 -9
- package/dist/provider/stores/slices/client.d.ts +0 -3
- package/dist/provider/stores/slices/client.js +0 -9
- package/dist/provider/stores/slices/config.d.ts +0 -3
- package/dist/provider/stores/slices/config.js +0 -9
- package/dist/provider/stores/slices/externalWallets.d.ts +0 -3
- package/dist/provider/stores/slices/externalWallets.js +0 -46
- package/dist/provider/stores/slices/index.d.ts +0 -5
- package/dist/provider/stores/slices/index.js +0 -6
- package/dist/provider/stores/slices/modal.d.ts +0 -3
- package/dist/provider/stores/slices/modal.js +0 -18
- package/dist/provider/stores/slices/wallet.d.ts +0 -3
- package/dist/provider/stores/slices/wallet.js +0 -13
- package/dist/provider/stores/types.d.ts +0 -76
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.d.ts +0 -17
- package/dist/provider/stores/useStore.js +0 -34
- package/dist/provider/types/externalWalletProviders.d.ts +0 -12
- package/dist/provider/types/externalWalletProviders.js +0 -1
- package/dist/provider/types/provider.d.ts +0 -161
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.d.ts +0 -3
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.d.ts +0 -45
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/constants.d.ts +0 -5
- package/dist/provider/utils/constants.js +0 -10
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +0 -7
- package/dist/provider/utils/paraConfigTypeGuards.js +0 -13
- package/dist/provider/utils/renameMutations.d.ts +0 -5
- package/dist/provider/utils/renameMutations.js +0 -18
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { TWalletType } from '@getpara/web-sdk';
|
|
3
|
-
import { BalanceManagement, ChainManagement, CommonWallet, ExternalWalletContextType, TExternalWallet } from '@getpara/react-common';
|
|
4
|
-
import { ExternalWalletInfo, VerifyExternalWalletParams } from '@getpara/web-sdk';
|
|
5
|
-
import { CosmosSignResult } from '@getpara/cosmos-wallet-connectors';
|
|
6
|
-
export declare const useWalletDisplayHelpers: (wallet: CommonWallet | undefined) => {
|
|
7
|
-
showExtension: boolean;
|
|
8
|
-
showMobile: boolean;
|
|
9
|
-
isCosmosMobileWallet: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare const defaultExternalWallet: {
|
|
12
|
-
wallets: never[];
|
|
13
|
-
chains: never[];
|
|
14
|
-
chainId: undefined;
|
|
15
|
-
wallet: undefined;
|
|
16
|
-
qrUri: undefined;
|
|
17
|
-
chainIdSwitchingTo: undefined;
|
|
18
|
-
walletDisplayHelpers: {
|
|
19
|
-
showExtension: boolean;
|
|
20
|
-
showMobile: boolean;
|
|
21
|
-
isCosmosMobileWallet: boolean;
|
|
22
|
-
};
|
|
23
|
-
username: undefined;
|
|
24
|
-
avatar: undefined;
|
|
25
|
-
connectExternalWallet: () => Promise<void>;
|
|
26
|
-
disconnectExternalWallet: () => Promise<void>;
|
|
27
|
-
switchChain: () => Promise<void>;
|
|
28
|
-
setChainIdSwitchingTo: () => void;
|
|
29
|
-
connectEmbeddedToExternalConnectors: () => Promise<void>;
|
|
30
|
-
verifyWalletSignature: () => Promise<any>;
|
|
31
|
-
signMessage: () => Promise<any>;
|
|
32
|
-
isSigningMessage: boolean;
|
|
33
|
-
getWalletBalance: () => Promise<undefined>;
|
|
34
|
-
requestInfo: (_: TExternalWallet) => Promise<ExternalWalletInfo>;
|
|
35
|
-
disconnectBase: (_: TExternalWallet) => Promise<void>;
|
|
36
|
-
};
|
|
37
|
-
type Value = Omit<ExternalWalletContextType<CosmosSignResult>, 'disconnect' | 'signVerificationMessage' | 'requestInfo'> & ChainManagement<string, void> & BalanceManagement & {
|
|
38
|
-
wallet?: CommonWallet;
|
|
39
|
-
qrUri?: string;
|
|
40
|
-
chainIdSwitchingTo?: string;
|
|
41
|
-
walletDisplayHelpers: {
|
|
42
|
-
showExtension: boolean;
|
|
43
|
-
showMobile: boolean;
|
|
44
|
-
isCosmosMobileWallet: boolean;
|
|
45
|
-
};
|
|
46
|
-
username?: string;
|
|
47
|
-
avatar?: string;
|
|
48
|
-
connectExternalWallet: (wallet: CommonWallet, isMobile?: boolean, isManualWalletConnect?: boolean) => Promise<void>;
|
|
49
|
-
disconnectExternalWallet: () => Promise<void>;
|
|
50
|
-
setChainIdSwitchingTo: (chainId?: string) => void;
|
|
51
|
-
connectEmbeddedToExternalConnectors: () => Promise<void>;
|
|
52
|
-
isSigningMessage: boolean;
|
|
53
|
-
verifyWalletSignature: () => Promise<VerifyExternalWalletParams | undefined>;
|
|
54
|
-
requestInfo: (_: TExternalWallet, __: TWalletType) => Promise<ExternalWalletInfo>;
|
|
55
|
-
};
|
|
56
|
-
export declare const ExternalWalletContext: import("react").Context<Value>;
|
|
57
|
-
export declare function ExternalWalletProvider({ children }: PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
58
|
-
export declare const useExternalWallets: () => Value;
|
|
59
|
-
export {};
|
|
@@ -1,596 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../chunk-MMUBH76A.js";
|
|
6
|
-
import { jsx } from "react/jsx-runtime";
|
|
7
|
-
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
8
|
-
import { isMobile, truncateAddress } from "@getpara/web-sdk";
|
|
9
|
-
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
10
|
-
import { useStore } from "../stores/useStore.js";
|
|
11
|
-
import { ModalStep } from "../../modal/index.js";
|
|
12
|
-
import { useModalStore } from "../../modal/stores/index.js";
|
|
13
|
-
import { useVerifyExternalWallet, useWalletState } from "../hooks/index.js";
|
|
14
|
-
import {
|
|
15
|
-
COSMOS_WALLETS,
|
|
16
|
-
EVM_WALLETS,
|
|
17
|
-
SOLANA_WALLETS
|
|
18
|
-
} from "@getpara/web-sdk";
|
|
19
|
-
import { useAuthActions } from "./AuthProvider.js";
|
|
20
|
-
const useWalletDisplayHelpers = (wallet) => {
|
|
21
|
-
const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
|
|
22
|
-
return {
|
|
23
|
-
// Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
|
|
24
|
-
// Also show the extension connection if on desktop for a solana wallet (no walletConnect)
|
|
25
|
-
showExtension: !isMobile() && ((wallet == null ? void 0 : wallet.isExtension) && (wallet == null ? void 0 : wallet.installed) || !(wallet == null ? void 0 : wallet.isMobile) || (wallet == null ? void 0 : wallet.type) === "SOLANA"),
|
|
26
|
-
// Show the mobile screen if on mobile and the wallet is a mobile wallet or if on desktop and the wallet isn't installed
|
|
27
|
-
showMobile: isMobile() && (wallet == null ? void 0 : wallet.isMobile) || !isMobile() && !(wallet == null ? void 0 : wallet.installed),
|
|
28
|
-
isCosmosMobileWallet: (wallet == null ? void 0 : wallet.type) === "COSMOS" && !!isUsingMobileConnector
|
|
29
|
-
};
|
|
30
|
-
};
|
|
31
|
-
const defaultExternalWallet = {
|
|
32
|
-
wallets: [],
|
|
33
|
-
chains: [],
|
|
34
|
-
chainId: void 0,
|
|
35
|
-
wallet: void 0,
|
|
36
|
-
qrUri: void 0,
|
|
37
|
-
chainIdSwitchingTo: void 0,
|
|
38
|
-
walletDisplayHelpers: { showExtension: false, showMobile: false, isCosmosMobileWallet: false },
|
|
39
|
-
username: void 0,
|
|
40
|
-
avatar: void 0,
|
|
41
|
-
connectExternalWallet: () => Promise.resolve(),
|
|
42
|
-
disconnectExternalWallet: () => Promise.resolve(),
|
|
43
|
-
switchChain: () => Promise.resolve(),
|
|
44
|
-
setChainIdSwitchingTo: () => {
|
|
45
|
-
},
|
|
46
|
-
connectEmbeddedToExternalConnectors: () => Promise.resolve(),
|
|
47
|
-
verifyWalletSignature: () => Promise.resolve({}),
|
|
48
|
-
signMessage: () => Promise.resolve({}),
|
|
49
|
-
isSigningMessage: false,
|
|
50
|
-
getWalletBalance: () => Promise.resolve(void 0),
|
|
51
|
-
requestInfo: (_) => Promise.resolve({}),
|
|
52
|
-
disconnectBase: (_) => Promise.resolve()
|
|
53
|
-
};
|
|
54
|
-
const ExternalWalletContext = createContext(defaultExternalWallet);
|
|
55
|
-
function ExternalWalletProvider({ children }) {
|
|
56
|
-
const evmContext = useStore((state) => state.evmContext);
|
|
57
|
-
const cosmosContext = useStore((state) => state.cosmosContext);
|
|
58
|
-
const solanaContext = useStore((state) => state.solanaContext);
|
|
59
|
-
const externalWallets = useStore((state) => state.externalWallets);
|
|
60
|
-
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
61
|
-
const includeWalletVerification = useStore((state) => state.includeWalletVerification);
|
|
62
|
-
const connectionOnly = useStore((state) => state.connectionOnly);
|
|
63
|
-
const {
|
|
64
|
-
wallets: evmWallets,
|
|
65
|
-
disconnect: evmDisconnect,
|
|
66
|
-
chains: evmChains,
|
|
67
|
-
chainId: evmChainId,
|
|
68
|
-
switchChain: evmSwitchChain,
|
|
69
|
-
username: evmUsername,
|
|
70
|
-
avatar: evmAvatar,
|
|
71
|
-
connectParaEmbedded: evmConnectParaEmbedded,
|
|
72
|
-
signMessage: evmSignMessage,
|
|
73
|
-
signVerificationMessage: evmSignVerificationMessage,
|
|
74
|
-
getWalletBalance: evmGetWalletBalance,
|
|
75
|
-
requestInfo: evmRequestInfo,
|
|
76
|
-
disconnectBase: evmDisconnectBase,
|
|
77
|
-
farcasterStatus: evmFarcasterStatus
|
|
78
|
-
} = useContext(evmContext);
|
|
79
|
-
const {
|
|
80
|
-
wallets: solanaWallets,
|
|
81
|
-
disconnect: solanaDisconnect,
|
|
82
|
-
signMessage: solanaSignMessage,
|
|
83
|
-
signVerificationMessage: solanaSignVerificationMessage,
|
|
84
|
-
requestInfo: solanaRequestInfo,
|
|
85
|
-
disconnectBase: solanaDisconnectBase
|
|
86
|
-
} = useContext(solanaContext);
|
|
87
|
-
const {
|
|
88
|
-
wallets: cosmosWallets,
|
|
89
|
-
disconnect: cosmosDisconnect,
|
|
90
|
-
chains: cosmosChains,
|
|
91
|
-
chainId: cosmosChainId,
|
|
92
|
-
switchChain: cosmosSwitchChain,
|
|
93
|
-
connectParaEmbedded: cosmosConnectParaEmbedded,
|
|
94
|
-
signMessage: cosmosSignMessage,
|
|
95
|
-
signVerificationMessage: cosmosSignVerificationMessage,
|
|
96
|
-
requestInfo: cosmosRequestInfo,
|
|
97
|
-
disconnectBase: cosmosDisconnectBase
|
|
98
|
-
} = useContext(cosmosContext);
|
|
99
|
-
const onLoginRef = useStore((state) => state.onLoginRef);
|
|
100
|
-
const setStep = useModalStore((state) => state.setStep);
|
|
101
|
-
const setStepDirection = useModalStore((state) => state.setStepDirection);
|
|
102
|
-
const setIsExternalWalletConnecting = useModalStore((state) => state.setIsExternalWalletConnecting);
|
|
103
|
-
const isExternalWalletConnecting = useModalStore((state) => state.isExternalWalletConnecting);
|
|
104
|
-
const setSelectedExternalWalletId = useModalStore((state) => state.setSelectedExternalWalletId);
|
|
105
|
-
const selectedExternalWalletId = useModalStore((state) => state.selectedExternalWalletId);
|
|
106
|
-
const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
|
|
107
|
-
const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
|
|
108
|
-
const para = useInternalClient();
|
|
109
|
-
const { setSelectedWallet } = useWalletState();
|
|
110
|
-
const { onNewAuthState } = useAuthActions();
|
|
111
|
-
const { mutateAsync: verifyExternalWallet } = useVerifyExternalWallet();
|
|
112
|
-
const [qrUri, setQrUri] = useState();
|
|
113
|
-
const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState();
|
|
114
|
-
const [isSigningMessage, setIsSigningMessage] = useState(false);
|
|
115
|
-
const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter(
|
|
116
|
-
(w) => (w.internalId !== "FARCASTER" || (para == null ? void 0 : para.isFarcasterMiniApp)) && externalWallets.includes(w.id.toUpperCase())
|
|
117
|
-
).sort(
|
|
118
|
-
(a, b) => externalWallets.indexOf(a.id.toUpperCase()) - externalWallets.indexOf(b.id.toUpperCase())
|
|
119
|
-
).sort((a, b) => a.installed === b.installed ? 0 : a.installed ? -1 : 1);
|
|
120
|
-
const wallet = useMemo(
|
|
121
|
-
() => wallets.find((w) => w.internalId === selectedExternalWalletId),
|
|
122
|
-
[wallets, selectedExternalWalletId]
|
|
123
|
-
);
|
|
124
|
-
const updateQrUri = () => __async(this, null, function* () {
|
|
125
|
-
var _a;
|
|
126
|
-
const uri = yield (_a = wallet == null ? void 0 : wallet.getQrUri) == null ? void 0 : _a.call(wallet);
|
|
127
|
-
setQrUri(uri);
|
|
128
|
-
});
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (wallet) {
|
|
131
|
-
if (!qrUri) {
|
|
132
|
-
updateQrUri();
|
|
133
|
-
}
|
|
134
|
-
} else if (qrUri) {
|
|
135
|
-
setQrUri(void 0);
|
|
136
|
-
}
|
|
137
|
-
}, [wallet]);
|
|
138
|
-
const getWalletBalance = useCallback(() => __async(this, null, function* () {
|
|
139
|
-
var _a;
|
|
140
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
141
|
-
switch (walletType) {
|
|
142
|
-
case "EVM": {
|
|
143
|
-
return yield evmGetWalletBalance();
|
|
144
|
-
}
|
|
145
|
-
default: {
|
|
146
|
-
return void 0;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}), [evmGetWalletBalance, selectedExternalWalletId]);
|
|
150
|
-
const chains = useMemo(() => {
|
|
151
|
-
var _a;
|
|
152
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
153
|
-
switch (walletType) {
|
|
154
|
-
case "COSMOS": {
|
|
155
|
-
return cosmosChains;
|
|
156
|
-
}
|
|
157
|
-
case "EVM": {
|
|
158
|
-
return evmChains;
|
|
159
|
-
}
|
|
160
|
-
default: {
|
|
161
|
-
return [];
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
165
|
-
const chainId = useMemo(() => {
|
|
166
|
-
var _a;
|
|
167
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
168
|
-
switch (walletType) {
|
|
169
|
-
case "COSMOS": {
|
|
170
|
-
return cosmosChainId;
|
|
171
|
-
}
|
|
172
|
-
case "EVM": {
|
|
173
|
-
return evmChainId == null ? void 0 : evmChainId.toString();
|
|
174
|
-
}
|
|
175
|
-
default: {
|
|
176
|
-
return void 0;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, [cosmosChains, evmChains, selectedExternalWalletId]);
|
|
180
|
-
const switchChain = useCallback(
|
|
181
|
-
(chainId2) => __async(this, null, function* () {
|
|
182
|
-
var _a;
|
|
183
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
184
|
-
if (walletType) {
|
|
185
|
-
let resp;
|
|
186
|
-
setExternalWalletError();
|
|
187
|
-
setChainIdSwitchingTo(chainId2);
|
|
188
|
-
switch (walletType) {
|
|
189
|
-
case "COSMOS": {
|
|
190
|
-
setStep(ModalStep.CHAIN_SWITCH);
|
|
191
|
-
resp = yield cosmosSwitchChain(chainId2);
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
case "EVM": {
|
|
195
|
-
setStep(ModalStep.CHAIN_SWITCH);
|
|
196
|
-
resp = yield evmSwitchChain(parseInt(chainId2));
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
default: {
|
|
200
|
-
resp = {};
|
|
201
|
-
break;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
if (resp.error) {
|
|
205
|
-
setExternalWalletError(resp.error);
|
|
206
|
-
} else {
|
|
207
|
-
setChainIdSwitchingTo(void 0);
|
|
208
|
-
setStepDirection(-1);
|
|
209
|
-
setStep(ModalStep.ACCOUNT_MAIN);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}),
|
|
213
|
-
[evmSwitchChain, cosmosSwitchChain]
|
|
214
|
-
);
|
|
215
|
-
const verifyWalletSignature = useCallback(() => __async(this, null, function* () {
|
|
216
|
-
var _a;
|
|
217
|
-
setExternalWalletError();
|
|
218
|
-
const wallet2 = Object.values(para.externalWallets)[0];
|
|
219
|
-
const walletType = wallet2 == null ? void 0 : wallet2.type;
|
|
220
|
-
let verifyExternalWalletParams;
|
|
221
|
-
const withVerification = includeWalletVerification;
|
|
222
|
-
const isConnectionOnly = connectionOnly;
|
|
223
|
-
const withFullParaAuth = (wallet2 == null ? void 0 : wallet2.name) ? externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase()) : false;
|
|
224
|
-
const defaultWalletInfo = {
|
|
225
|
-
withVerification,
|
|
226
|
-
isConnectionOnly,
|
|
227
|
-
withFullParaAuth,
|
|
228
|
-
provider: wallet2.name,
|
|
229
|
-
providerId: wallet2.externalProviderId,
|
|
230
|
-
isExternal: true
|
|
231
|
-
};
|
|
232
|
-
switch (walletType) {
|
|
233
|
-
case "COSMOS":
|
|
234
|
-
{
|
|
235
|
-
const { address, signature, error, cosmosPublicKeyHex, cosmosSigner, addressBech32 } = yield cosmosSignVerificationMessage();
|
|
236
|
-
if (error) {
|
|
237
|
-
setExternalWalletError([error]);
|
|
238
|
-
} else if (signature && address) {
|
|
239
|
-
verifyExternalWalletParams = {
|
|
240
|
-
externalWallet: __spreadValues({
|
|
241
|
-
type: "COSMOS",
|
|
242
|
-
address,
|
|
243
|
-
addressBech32
|
|
244
|
-
}, defaultWalletInfo),
|
|
245
|
-
signedMessage: signature,
|
|
246
|
-
cosmosPublicKeyHex,
|
|
247
|
-
cosmosSigner
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
break;
|
|
252
|
-
case "EVM":
|
|
253
|
-
{
|
|
254
|
-
const { signature, error, address } = yield evmSignVerificationMessage();
|
|
255
|
-
if (error) {
|
|
256
|
-
setExternalWalletError([error]);
|
|
257
|
-
} else if (signature && address) {
|
|
258
|
-
verifyExternalWalletParams = {
|
|
259
|
-
externalWallet: __spreadValues({
|
|
260
|
-
type: "EVM",
|
|
261
|
-
address
|
|
262
|
-
}, defaultWalletInfo),
|
|
263
|
-
signedMessage: signature
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
break;
|
|
268
|
-
case "SOLANA":
|
|
269
|
-
{
|
|
270
|
-
const { signature, error, address } = yield solanaSignVerificationMessage();
|
|
271
|
-
if (error) {
|
|
272
|
-
setExternalWalletError([error]);
|
|
273
|
-
} else if (signature && address) {
|
|
274
|
-
verifyExternalWalletParams = {
|
|
275
|
-
externalWallet: __spreadValues({
|
|
276
|
-
type: "SOLANA",
|
|
277
|
-
address
|
|
278
|
-
}, defaultWalletInfo),
|
|
279
|
-
signedMessage: signature
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
break;
|
|
284
|
-
default:
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
if (!(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.externalWallet) || !(verifyExternalWalletParams == null ? void 0 : verifyExternalWalletParams.signedMessage)) {
|
|
288
|
-
console.error("No signature or address found on the verifyWalletSignature response.");
|
|
289
|
-
setExternalWalletError(["Signature verification failed."]);
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
try {
|
|
293
|
-
const d = yield verifyExternalWallet(verifyExternalWalletParams);
|
|
294
|
-
if (wallet2 && (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes((_a = wallet2.name) == null ? void 0 : _a.toUpperCase()))) {
|
|
295
|
-
yield onNewAuthState(d);
|
|
296
|
-
} else {
|
|
297
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
298
|
-
}
|
|
299
|
-
} catch (e) {
|
|
300
|
-
console.error("Error verifying signature:", e);
|
|
301
|
-
setExternalWalletError(["Signature verification failed."]);
|
|
302
|
-
}
|
|
303
|
-
return verifyExternalWalletParams;
|
|
304
|
-
}), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage, wallet]);
|
|
305
|
-
const signMessage = useCallback(
|
|
306
|
-
(_0) => __async(this, [_0], function* ({ message, externalWallet: _externalWallet }) {
|
|
307
|
-
var _a;
|
|
308
|
-
setExternalWalletError();
|
|
309
|
-
setIsSigningMessage(true);
|
|
310
|
-
let externalWallet = _externalWallet;
|
|
311
|
-
const walletType = (externalWallet == null ? void 0 : externalWallet.type) || ((_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type);
|
|
312
|
-
let response;
|
|
313
|
-
try {
|
|
314
|
-
switch (walletType) {
|
|
315
|
-
case "COSMOS":
|
|
316
|
-
{
|
|
317
|
-
const { address, signature, error, cosmosPublicKeyHex, cosmosSigner } = yield cosmosSignMessage({
|
|
318
|
-
message,
|
|
319
|
-
externalWallet
|
|
320
|
-
});
|
|
321
|
-
if (error) {
|
|
322
|
-
throw new Error(error);
|
|
323
|
-
} else if (signature && address) {
|
|
324
|
-
response = { address, signature, cosmosPublicKeyHex, cosmosSigner };
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
break;
|
|
328
|
-
case "EVM":
|
|
329
|
-
{
|
|
330
|
-
const { address, signature, error } = yield evmSignMessage({ message, externalWallet });
|
|
331
|
-
if (error) {
|
|
332
|
-
throw new Error(error);
|
|
333
|
-
} else if (signature && address) {
|
|
334
|
-
response = { address, signature };
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
break;
|
|
338
|
-
case "SOLANA":
|
|
339
|
-
{
|
|
340
|
-
const { signature, error, address } = yield solanaSignMessage({ message });
|
|
341
|
-
if (error) {
|
|
342
|
-
throw new Error(error);
|
|
343
|
-
} else if (signature && address) {
|
|
344
|
-
response = { address, signature };
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
break;
|
|
348
|
-
default:
|
|
349
|
-
break;
|
|
350
|
-
}
|
|
351
|
-
setIsSigningMessage(false);
|
|
352
|
-
return response;
|
|
353
|
-
} catch (error) {
|
|
354
|
-
setIsSigningMessage(false);
|
|
355
|
-
throw error;
|
|
356
|
-
}
|
|
357
|
-
}),
|
|
358
|
-
[cosmosSignMessage, evmSignMessage, solanaSignMessage]
|
|
359
|
-
);
|
|
360
|
-
const connectExternalWallet = useCallback(
|
|
361
|
-
(wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
|
|
362
|
-
if (isExternalWalletConnecting && isManualWalletConnect) {
|
|
363
|
-
yield evmDisconnect();
|
|
364
|
-
yield solanaDisconnect();
|
|
365
|
-
yield cosmosDisconnect();
|
|
366
|
-
setQrUri(void 0);
|
|
367
|
-
setIsExternalWalletConnecting(false);
|
|
368
|
-
}
|
|
369
|
-
if (isResetAfterManualWalletConnect || isManualWalletConnect || !isExternalWalletConnecting) {
|
|
370
|
-
setExternalWalletError();
|
|
371
|
-
setIsExternalWalletConnecting(true);
|
|
372
|
-
setIsUsingMobileConnector(isMobileConnect);
|
|
373
|
-
const { address, error, authState } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect, connectionOnly) : wallet2.connect(connectionOnly);
|
|
374
|
-
if (error) {
|
|
375
|
-
setExternalWalletError([error]);
|
|
376
|
-
setIsUsingMobileConnector();
|
|
377
|
-
if (isManualWalletConnect && error === "Connection request rejected") {
|
|
378
|
-
setExternalWalletError();
|
|
379
|
-
yield connectExternalWallet(wallet2, false, false, true);
|
|
380
|
-
yield updateQrUri();
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
} else if (address) {
|
|
384
|
-
if (!!authState && ((externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.name.toUpperCase())) || includeWalletVerification)) {
|
|
385
|
-
onNewAuthState(authState);
|
|
386
|
-
} else {
|
|
387
|
-
setStep(ModalStep.LOGIN_DONE);
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
setIsExternalWalletConnecting(false);
|
|
391
|
-
}
|
|
392
|
-
}),
|
|
393
|
-
[isExternalWalletConnecting, externalWalletsWithFullAuth, connectionOnly, includeWalletVerification]
|
|
394
|
-
);
|
|
395
|
-
const requestInfo = (providerId, type) => __async(this, null, function* () {
|
|
396
|
-
switch (type) {
|
|
397
|
-
case "EVM": {
|
|
398
|
-
const externalWallet = yield evmRequestInfo(providerId);
|
|
399
|
-
return externalWallet;
|
|
400
|
-
}
|
|
401
|
-
case "SOLANA": {
|
|
402
|
-
const externalWallet = yield solanaRequestInfo(providerId);
|
|
403
|
-
return externalWallet;
|
|
404
|
-
}
|
|
405
|
-
case "COSMOS": {
|
|
406
|
-
const externalWallet = yield cosmosRequestInfo(providerId);
|
|
407
|
-
return externalWallet;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
const disconnectBase = (providerId) => __async(this, null, function* () {
|
|
412
|
-
const [isEvm, isSolana, _isCosmos] = [
|
|
413
|
-
EVM_WALLETS.includes(providerId),
|
|
414
|
-
SOLANA_WALLETS.includes(providerId),
|
|
415
|
-
COSMOS_WALLETS.includes(providerId)
|
|
416
|
-
];
|
|
417
|
-
switch (true) {
|
|
418
|
-
case isEvm:
|
|
419
|
-
yield evmDisconnectBase(providerId);
|
|
420
|
-
break;
|
|
421
|
-
case isSolana:
|
|
422
|
-
yield solanaDisconnectBase(providerId);
|
|
423
|
-
break;
|
|
424
|
-
default: {
|
|
425
|
-
yield cosmosDisconnectBase();
|
|
426
|
-
break;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
});
|
|
430
|
-
const disconnectExternalWallet = () => __async(this, null, function* () {
|
|
431
|
-
yield para.logout();
|
|
432
|
-
yield evmDisconnect();
|
|
433
|
-
yield cosmosDisconnect();
|
|
434
|
-
setSelectedExternalWalletId();
|
|
435
|
-
yield solanaDisconnect();
|
|
436
|
-
});
|
|
437
|
-
const walletDisplayHelpers = useWalletDisplayHelpers(wallet);
|
|
438
|
-
const username = useMemo(() => {
|
|
439
|
-
let username2;
|
|
440
|
-
const storedExternalWallet = Object.values(para.externalWallets || {})[0];
|
|
441
|
-
if (storedExternalWallet) {
|
|
442
|
-
const walletType = storedExternalWallet == null ? void 0 : storedExternalWallet.type;
|
|
443
|
-
switch (walletType) {
|
|
444
|
-
case "EVM": {
|
|
445
|
-
username2 = evmUsername ? evmUsername.startsWith("0x") ? truncateAddress(evmUsername, "EVM") : evmUsername : void 0;
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
default: {
|
|
449
|
-
username2 = storedExternalWallet.address && storedExternalWallet.type ? truncateAddress(storedExternalWallet.address, storedExternalWallet.type) : void 0;
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
return username2;
|
|
455
|
-
}, [evmUsername, wallet]);
|
|
456
|
-
const avatar = useMemo(() => {
|
|
457
|
-
var _a;
|
|
458
|
-
const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
|
|
459
|
-
if (walletType) {
|
|
460
|
-
switch (walletType) {
|
|
461
|
-
case "EVM": {
|
|
462
|
-
return evmAvatar;
|
|
463
|
-
}
|
|
464
|
-
default: {
|
|
465
|
-
return void 0;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
}, [evmAvatar, wallet]);
|
|
470
|
-
const connectEmbeddedToExternalConnectors = useCallback(() => __async(this, null, function* () {
|
|
471
|
-
const evmWallet = para.findWallet(void 0, void 0, { type: ["EVM"] });
|
|
472
|
-
const cosmosWallet = para.findWallet(void 0, void 0, { type: ["COSMOS"] });
|
|
473
|
-
if (evmWallet) {
|
|
474
|
-
try {
|
|
475
|
-
const { error } = yield evmConnectParaEmbedded();
|
|
476
|
-
if (error) {
|
|
477
|
-
console.warn("Failed to connect Para EVM wallet to Wagmi:", error);
|
|
478
|
-
} else {
|
|
479
|
-
if (evmWallet) {
|
|
480
|
-
setSelectedWallet({ id: evmWallet.id, type: "EVM" });
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
} catch (err) {
|
|
484
|
-
console.warn("Error calling connectParaEvmWallet:", err);
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
if (cosmosWallet) {
|
|
488
|
-
try {
|
|
489
|
-
const { error } = yield cosmosConnectParaEmbedded();
|
|
490
|
-
if (error) {
|
|
491
|
-
console.warn("Failed to connect Para Cosmos wallet to Graz:", error);
|
|
492
|
-
} else {
|
|
493
|
-
if (cosmosWallet) {
|
|
494
|
-
setSelectedWallet({ id: cosmosWallet.id, type: "COSMOS" });
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
} catch (err) {
|
|
498
|
-
console.warn("Error calling connectParaCosmosWallet:", err);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
}), [evmConnectParaEmbedded, cosmosConnectParaEmbedded]);
|
|
502
|
-
useEffect(() => {
|
|
503
|
-
onLoginRef.current = () => __async(this, null, function* () {
|
|
504
|
-
yield connectEmbeddedToExternalConnectors();
|
|
505
|
-
});
|
|
506
|
-
}, [connectEmbeddedToExternalConnectors]);
|
|
507
|
-
useEffect(() => {
|
|
508
|
-
function loginFarcasterMiniApp() {
|
|
509
|
-
return __async(this, null, function* () {
|
|
510
|
-
if (para.isReady && para.isFarcasterMiniApp) {
|
|
511
|
-
const isEvm = para.supportedWalletTypes.some(({ type }) => type === "EVM");
|
|
512
|
-
const isAwaitingEvmLogin = isEvm && (evmFarcasterStatus == null ? void 0 : evmFarcasterStatus.isConnected) && !Object.values(para.externalWallets || {}).some(
|
|
513
|
-
(w) => w.type === "EVM" && w.externalProviderId === "FARCASTER" && w.address === evmFarcasterStatus.address
|
|
514
|
-
);
|
|
515
|
-
const isAwaitingLogin = isAwaitingEvmLogin;
|
|
516
|
-
if (isAwaitingLogin) {
|
|
517
|
-
yield para.loginExternalWallet({
|
|
518
|
-
externalWallet: [
|
|
519
|
-
...isAwaitingEvmLogin ? [
|
|
520
|
-
{
|
|
521
|
-
type: "EVM",
|
|
522
|
-
provider: "Farcaster",
|
|
523
|
-
providerId: "FARCASTER",
|
|
524
|
-
address: evmFarcasterStatus.address,
|
|
525
|
-
isConnectionOnly: true
|
|
526
|
-
}
|
|
527
|
-
] : []
|
|
528
|
-
]
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
});
|
|
533
|
-
}
|
|
534
|
-
loginFarcasterMiniApp();
|
|
535
|
-
}, [para.isReady, para.isFarcasterMiniApp, evmFarcasterStatus]);
|
|
536
|
-
return /* @__PURE__ */ jsx(
|
|
537
|
-
ExternalWalletContext.Provider,
|
|
538
|
-
{
|
|
539
|
-
value: useMemo(
|
|
540
|
-
() => ({
|
|
541
|
-
wallets,
|
|
542
|
-
chains,
|
|
543
|
-
chainId,
|
|
544
|
-
wallet,
|
|
545
|
-
qrUri,
|
|
546
|
-
walletDisplayHelpers,
|
|
547
|
-
chainIdSwitchingTo,
|
|
548
|
-
username,
|
|
549
|
-
avatar,
|
|
550
|
-
connectExternalWallet,
|
|
551
|
-
disconnectExternalWallet,
|
|
552
|
-
switchChain,
|
|
553
|
-
setChainIdSwitchingTo,
|
|
554
|
-
connectEmbeddedToExternalConnectors,
|
|
555
|
-
signMessage,
|
|
556
|
-
isSigningMessage,
|
|
557
|
-
verifyWalletSignature,
|
|
558
|
-
getWalletBalance,
|
|
559
|
-
requestInfo,
|
|
560
|
-
disconnectBase
|
|
561
|
-
}),
|
|
562
|
-
[
|
|
563
|
-
wallets,
|
|
564
|
-
chains,
|
|
565
|
-
chainId,
|
|
566
|
-
wallet,
|
|
567
|
-
qrUri,
|
|
568
|
-
walletDisplayHelpers,
|
|
569
|
-
chainIdSwitchingTo,
|
|
570
|
-
username,
|
|
571
|
-
avatar,
|
|
572
|
-
disconnectExternalWallet,
|
|
573
|
-
connectExternalWallet,
|
|
574
|
-
switchChain,
|
|
575
|
-
setChainIdSwitchingTo,
|
|
576
|
-
connectEmbeddedToExternalConnectors,
|
|
577
|
-
signMessage,
|
|
578
|
-
isSigningMessage,
|
|
579
|
-
verifyWalletSignature,
|
|
580
|
-
getWalletBalance,
|
|
581
|
-
requestInfo,
|
|
582
|
-
disconnectBase
|
|
583
|
-
]
|
|
584
|
-
),
|
|
585
|
-
children
|
|
586
|
-
}
|
|
587
|
-
);
|
|
588
|
-
}
|
|
589
|
-
const useExternalWallets = () => useContext(ExternalWalletContext);
|
|
590
|
-
export {
|
|
591
|
-
ExternalWalletContext,
|
|
592
|
-
ExternalWalletProvider,
|
|
593
|
-
defaultExternalWallet,
|
|
594
|
-
useExternalWallets,
|
|
595
|
-
useWalletDisplayHelpers
|
|
596
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { ParaSolanaProviderProps } from '@getpara/solana-wallet-connectors';
|
|
3
|
-
import { ExternalWalletProviderCommon, ParaSolanaProviderConfigNoWallets } from '../types/externalWalletProviders.js';
|
|
4
|
-
export declare function SolanaExternalWalletProvider({ children, isUsing, wallets: walletsFromProps, ...rest }: Omit<ParaSolanaProviderProps, 'config'> & {
|
|
5
|
-
config: ParaSolanaProviderConfigNoWallets;
|
|
6
|
-
} & PropsWithChildren & ExternalWalletProviderCommon): string | number | boolean | Iterable<import("react").ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
7
|
-
export declare const MemoizedSolanaExternalWalletProvider: import("react").MemoExoticComponent<typeof SolanaExternalWalletProvider>;
|