@getpara/react-sdk 2.0.0-dev.3 → 2.0.0-dev.4
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/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/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,18 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useAccountLinking } from "../../providers/AccountLinkProvider.js";
|
|
4
|
-
const useLinkAccount = () => {
|
|
5
|
-
const { linkAccount, linkAccountError, linkAccountStatus } = useAccountLinking();
|
|
6
|
-
return {
|
|
7
|
-
linkAccount,
|
|
8
|
-
error: linkAccountError,
|
|
9
|
-
status: linkAccountStatus,
|
|
10
|
-
isPending: linkAccountStatus === "pending",
|
|
11
|
-
isError: linkAccountStatus === "error",
|
|
12
|
-
isIdle: linkAccountStatus === "idle",
|
|
13
|
-
isSuccess: linkAccountStatus === "success"
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
useLinkAccount
|
|
18
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { CoreMethodName, CoreMethodParams, CoreMethods, InternalAction, InternalMethodName, InternalMethodParams, InternalMethods } from '@getpara/web-sdk';
|
|
2
|
-
import { CoreMethodMutationHook, CoreMethodMutationStateHook, InternalMethodMutationHook } from '../../types/utils.js';
|
|
3
|
-
import { CoreAction } from '../../actions/utils.js';
|
|
4
|
-
export declare function generateCoreMutation<const method extends CoreMethodName & keyof CoreMethods>(method: method, action: CoreAction<method>, { delay, defaultParams, }?: {
|
|
5
|
-
delay?: number;
|
|
6
|
-
defaultParams?: CoreMethodParams<method>;
|
|
7
|
-
}): () => CoreMethodMutationHook<method>;
|
|
8
|
-
export declare function generateInternalMutation<const method extends InternalMethodName & keyof InternalMethods>(method: method, action: InternalAction<method>, { delay, defaultParams, }?: {
|
|
9
|
-
delay?: number;
|
|
10
|
-
defaultParams?: InternalMethodParams<method>;
|
|
11
|
-
}): () => InternalMethodMutationHook<method>;
|
|
12
|
-
export declare function generateStateHook<const method extends CoreMethodName & keyof CoreMethods>(method: method): CoreMethodMutationStateHook<method>;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
-
import { renameCoreMutations } from "../../utils/renameMutations.js";
|
|
8
|
-
import { useClient } from "../utils/index.js";
|
|
9
|
-
import { useMutation, useMutationState } from "@tanstack/react-query";
|
|
10
|
-
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
11
|
-
function generateCoreMutation(method, action, {
|
|
12
|
-
delay,
|
|
13
|
-
defaultParams
|
|
14
|
-
} = {}) {
|
|
15
|
-
return () => {
|
|
16
|
-
const para = useClient();
|
|
17
|
-
const mutation = useMutation({
|
|
18
|
-
mutationKey: [method],
|
|
19
|
-
mutationFn: (args) => __async(this, null, function* () {
|
|
20
|
-
if (typeof delay === "number") yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
21
|
-
try {
|
|
22
|
-
const result = yield action(para, args != null ? args : defaultParams);
|
|
23
|
-
return result;
|
|
24
|
-
} catch (error) {
|
|
25
|
-
throw error;
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
});
|
|
29
|
-
return renameCoreMutations(mutation, method);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function generateInternalMutation(method, action, {
|
|
33
|
-
delay,
|
|
34
|
-
defaultParams
|
|
35
|
-
} = {}) {
|
|
36
|
-
return () => {
|
|
37
|
-
const para = useInternalClient();
|
|
38
|
-
const mutation = useMutation({
|
|
39
|
-
mutationKey: [method],
|
|
40
|
-
mutationFn: (args) => __async(this, null, function* () {
|
|
41
|
-
if (typeof delay === "number") yield new Promise((resolve) => setTimeout(resolve, delay));
|
|
42
|
-
try {
|
|
43
|
-
const result = yield action(para, args != null ? args : defaultParams);
|
|
44
|
-
return result;
|
|
45
|
-
} catch (error) {
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
});
|
|
50
|
-
return mutation;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function generateStateHook(method) {
|
|
54
|
-
return () => {
|
|
55
|
-
const frames = useMutationState({
|
|
56
|
-
filters: { mutationKey: [method] },
|
|
57
|
-
select: (mutation) => mutation.state
|
|
58
|
-
});
|
|
59
|
-
const latest = frames[frames.length - 1];
|
|
60
|
-
if (!latest) {
|
|
61
|
-
return {
|
|
62
|
-
data: void 0,
|
|
63
|
-
error: null,
|
|
64
|
-
failureCount: 0,
|
|
65
|
-
isLoading: false,
|
|
66
|
-
isPaused: false,
|
|
67
|
-
isPending: false,
|
|
68
|
-
isError: false,
|
|
69
|
-
isSuccess: false,
|
|
70
|
-
isIdle: true,
|
|
71
|
-
status: "idle",
|
|
72
|
-
variables: void 0,
|
|
73
|
-
context: null,
|
|
74
|
-
failureReason: null,
|
|
75
|
-
submittedAt: 0
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
return __spreadProps(__spreadValues({}, latest), {
|
|
79
|
-
isPending: latest.status === "pending",
|
|
80
|
-
isError: latest.status === "error",
|
|
81
|
-
isSuccess: latest.status === "success",
|
|
82
|
-
isIdle: latest.status === "idle"
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
generateCoreMutation,
|
|
88
|
-
generateInternalMutation,
|
|
89
|
-
generateStateHook
|
|
90
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export declare const useLinkedAccounts: (params?: {
|
|
2
|
-
withMetadata?: boolean;
|
|
3
|
-
} | undefined) => import("../../types/utils.js").CoreMethodQueryHook<"getLinkedAccounts">;
|
|
4
|
-
export declare const useAccountLinkInProgress: (params?: undefined) => import("../../types/utils.js").CoreMethodQueryHook<"accountLinkInProgress">;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import * as actions from "../../actions/index.js";
|
|
4
|
-
import { generateCoreQueryHook } from "./utils.js";
|
|
5
|
-
const useLinkedAccounts = generateCoreQueryHook("getLinkedAccounts", actions.getLinkedAccounts, {
|
|
6
|
-
defaultParams: { withMetadata: false }
|
|
7
|
-
});
|
|
8
|
-
const useAccountLinkInProgress = generateCoreQueryHook(
|
|
9
|
-
"accountLinkInProgress",
|
|
10
|
-
actions.accountLinkInProgress,
|
|
11
|
-
{ isGetter: true }
|
|
12
|
-
);
|
|
13
|
-
export {
|
|
14
|
-
useAccountLinkInProgress,
|
|
15
|
-
useLinkedAccounts
|
|
16
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useAccount } from "./useAccount.js";
|
|
4
|
-
import { useWallet } from "./useWallet.js";
|
|
5
|
-
import { useWalletBalance } from "./useWalletBalance.js";
|
|
6
|
-
export * from "./core.js";
|
|
7
|
-
export {
|
|
8
|
-
useAccount,
|
|
9
|
-
useWallet,
|
|
10
|
-
useWalletBalance
|
|
11
|
-
};
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { Account } from '../../actions/getEmbeddedAccount.js';
|
|
3
|
-
import type { CosmosExternalWalletContextType, UseAccountParameters as UseCosmosAccountParameters } from '@getpara/cosmos-wallet-connectors';
|
|
4
|
-
import type { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
5
|
-
import type { Adapter } from '@getpara/solana-wallet-connectors';
|
|
6
|
-
export declare const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
7
|
-
type EVMAccountType = ReturnType<ReturnType<typeof useContext<EvmExternalWalletContextType>>['useAccount']>;
|
|
8
|
-
type CosmosAccountType = Omit<ReturnType<ReturnType<typeof useContext<CosmosExternalWalletContextType>>['useAccount']>, 'reconnect'>;
|
|
9
|
-
type SolanaAccountType = Pick<Adapter, 'publicKey' | 'name' | 'icon' | 'readyState' | 'supportedTransactionVersions' | 'url'> & {
|
|
10
|
-
isConnected?: boolean;
|
|
11
|
-
isConnecting?: boolean;
|
|
12
|
-
};
|
|
13
|
-
type ConnectionType = 'embedded' | 'external' | 'both' | 'none';
|
|
14
|
-
type ExternalNetwork = 'evm' | 'cosmos' | 'solana';
|
|
15
|
-
/**
|
|
16
|
-
* The return type for the useAccount hook.
|
|
17
|
-
*
|
|
18
|
-
* @property isConnected - Indicates whether there is a wallet connected (either embedded, external or both).
|
|
19
|
-
* @property isLoading - Indicates whether the account is currently loading.
|
|
20
|
-
* @property connectionType - The type of connection for the account:
|
|
21
|
-
* @property embedded - The embedded account object.
|
|
22
|
-
* @property external - An object containing connected external wallet account data:
|
|
23
|
-
* - `evm`: The connected EVM wallet account (if any).
|
|
24
|
-
* - `cosmos`: The connected Cosmos wallet account (if any), with the `reconnect` property omitted.
|
|
25
|
-
* - `solana`: The connected Solana wallet adapter, with only allowed properties included.
|
|
26
|
-
*/
|
|
27
|
-
export type UseAccountReturn = {
|
|
28
|
-
/**
|
|
29
|
-
* Indicates whether there is a wallet connected (either embedded, external or both).
|
|
30
|
-
*/
|
|
31
|
-
isConnected: boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Indicates whether the account is currently loading.
|
|
34
|
-
*/
|
|
35
|
-
isLoading: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* The type of connection for the account.
|
|
38
|
-
* - 'embedded': Only the embedded account is connected.
|
|
39
|
-
* - 'external': Only an external wallet is connected.
|
|
40
|
-
* - 'both': Both embedded and external wallets are connected.
|
|
41
|
-
* - 'none': No wallets are connected.
|
|
42
|
-
*/
|
|
43
|
-
connectionType: ConnectionType;
|
|
44
|
-
/**
|
|
45
|
-
* The embedded account object. Use this instead of the deprecated top-level properties.
|
|
46
|
-
*/
|
|
47
|
-
embedded: Omit<Account, 'isConnected' | 'isGuestMode'> & {
|
|
48
|
-
isConnected: boolean;
|
|
49
|
-
isGuestMode?: boolean;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Connected external wallet account data.
|
|
53
|
-
*/
|
|
54
|
-
external: {
|
|
55
|
-
/**
|
|
56
|
-
* The list of connected external networks, which can include 'evm', 'cosmos', and 'solana'.
|
|
57
|
-
*/
|
|
58
|
-
connectedNetworks: ExternalNetwork[];
|
|
59
|
-
/**
|
|
60
|
-
* The connected EVM wallet (if any), with only allowed properties included.
|
|
61
|
-
*/
|
|
62
|
-
evm: EVMAccountType;
|
|
63
|
-
/**
|
|
64
|
-
* The connected Cosmos wallet (if any), with only allowed properties included.
|
|
65
|
-
*/
|
|
66
|
-
cosmos: CosmosAccountType;
|
|
67
|
-
/**
|
|
68
|
-
* The connected Solana wallet (if any), with only allowed properties included.
|
|
69
|
-
*/
|
|
70
|
-
solana: SolanaAccountType;
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
export type UseAccountParameters = {
|
|
74
|
-
cosmos?: UseCosmosAccountParameters;
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* React Query hook for retrieving the current embedded account and connected external wallets.
|
|
78
|
-
*
|
|
79
|
-
* @returns {UseAccountReturn}
|
|
80
|
-
* The account data object, or undefined while loading.
|
|
81
|
-
*
|
|
82
|
-
* The returned object contains:
|
|
83
|
-
* - `isConnected`: Indicates whether there is a wallet connected (either embedded, external or both).
|
|
84
|
-
* - `isLoading`: Indicates whether the account is currently loading.
|
|
85
|
-
* - `connectionType`: The type of connection for the account:
|
|
86
|
-
* - `embedded`: The embedded account object.
|
|
87
|
-
* - `external`: Connected external wallet data (EVM, Cosmos, Solana).
|
|
88
|
-
*/
|
|
89
|
-
export declare const useAccount: ({ cosmos }?: UseAccountParameters) => UseAccountReturn;
|
|
90
|
-
export {};
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__objRest,
|
|
5
|
-
__spreadProps,
|
|
6
|
-
__spreadValues
|
|
7
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
8
|
-
import { useQuery } from "@tanstack/react-query";
|
|
9
|
-
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
10
|
-
import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
|
|
11
|
-
import { useStore } from "../../stores/useStore.js";
|
|
12
|
-
import { useContext } from "react";
|
|
13
|
-
import { getEmbeddedAccount } from "../../actions/getEmbeddedAccount.js";
|
|
14
|
-
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
15
|
-
function pickSolanaAdapter(adapter) {
|
|
16
|
-
if (!adapter) return { isConnected: false };
|
|
17
|
-
const { connected, connecting, publicKey, name, icon, readyState, supportedTransactionVersions, url } = adapter;
|
|
18
|
-
return {
|
|
19
|
-
isConnected: connected,
|
|
20
|
-
isConnecting: connecting,
|
|
21
|
-
publicKey,
|
|
22
|
-
name,
|
|
23
|
-
icon,
|
|
24
|
-
readyState,
|
|
25
|
-
supportedTransactionVersions,
|
|
26
|
-
url
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function pickCosmosAccount(account) {
|
|
30
|
-
if (!account) return { isConnected: false };
|
|
31
|
-
const _a = account, { reconnect: _ } = _a, rest = __objRest(_a, ["reconnect"]);
|
|
32
|
-
return rest;
|
|
33
|
-
}
|
|
34
|
-
const useAccount = ({ cosmos } = {}) => {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
36
|
-
const client = useInternalClient();
|
|
37
|
-
const { data: isFullyLoggedIn, isSuccess } = useIsFullyLoggedIn();
|
|
38
|
-
const evmContext = useStore((state) => state.evmContext);
|
|
39
|
-
const { useAccount: useEvmAccount } = useContext(evmContext);
|
|
40
|
-
const evmAccount = useEvmAccount();
|
|
41
|
-
const evmQueryKeys = [evmAccount == null ? void 0 : evmAccount.status, evmAccount == null ? void 0 : evmAccount.addresses, evmAccount == null ? void 0 : evmAccount.chainId];
|
|
42
|
-
const cosmosContext = useStore((state) => state.cosmosContext);
|
|
43
|
-
const { useAccount: useCosmosAccount } = useContext(cosmosContext);
|
|
44
|
-
const cosmosAccount = useCosmosAccount(cosmos);
|
|
45
|
-
const cosmosQueryKeys = [cosmosAccount == null ? void 0 : cosmosAccount.status, cosmosAccount == null ? void 0 : cosmosAccount.data];
|
|
46
|
-
const solanaContext = useStore((state) => state.solanaContext);
|
|
47
|
-
const { useWallet: useSolanaWallet } = useContext(solanaContext);
|
|
48
|
-
const solanaWallet = useSolanaWallet();
|
|
49
|
-
const solanaQueryKeys = [
|
|
50
|
-
(_b = (_a = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _a.adapter) == null ? void 0 : _b.connected,
|
|
51
|
-
(_d = (_c = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _c.adapter) == null ? void 0 : _d.connecting,
|
|
52
|
-
(_f = (_e = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _e.adapter) == null ? void 0 : _f.publicKey
|
|
53
|
-
];
|
|
54
|
-
const solanaAdapter = (_g = solanaWallet == null ? void 0 : solanaWallet.wallet) == null ? void 0 : _g.adapter;
|
|
55
|
-
const { data, isLoading } = useQuery({
|
|
56
|
-
enabled: isSuccess && !!client,
|
|
57
|
-
queryKey: [ACCOUNT_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, client == null ? void 0 : client.userId, evmQueryKeys, cosmosQueryKeys, solanaQueryKeys],
|
|
58
|
-
queryFn: () => __async(void 0, null, function* () {
|
|
59
|
-
const paraAccount = yield getEmbeddedAccount(client);
|
|
60
|
-
let connectionType = "none";
|
|
61
|
-
if (paraAccount.isConnected) {
|
|
62
|
-
connectionType = "embedded";
|
|
63
|
-
if (paraAccount.wallets.some((w) => w.isExternal)) {
|
|
64
|
-
connectionType = "both";
|
|
65
|
-
}
|
|
66
|
-
if (paraAccount.wallets.every((w) => w.isExternal) && ((evmAccount == null ? void 0 : evmAccount.isConnected) || (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) || (solanaAdapter == null ? void 0 : solanaAdapter.connected))) {
|
|
67
|
-
connectionType = "external";
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
const isEmbeddedConnected = paraAccount.isConnected && (!!paraAccount.userId || paraAccount.isGuestMode);
|
|
71
|
-
const connectedNetworks = [];
|
|
72
|
-
if (evmAccount == null ? void 0 : evmAccount.isConnected) {
|
|
73
|
-
connectedNetworks.push("evm");
|
|
74
|
-
}
|
|
75
|
-
if (cosmosAccount == null ? void 0 : cosmosAccount.isConnected) {
|
|
76
|
-
connectedNetworks.push("cosmos");
|
|
77
|
-
}
|
|
78
|
-
if (solanaAdapter == null ? void 0 : solanaAdapter.connected) {
|
|
79
|
-
connectedNetworks.push("solana");
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
isConnected: paraAccount.isConnected,
|
|
83
|
-
connectionType,
|
|
84
|
-
embedded: __spreadProps(__spreadValues({}, paraAccount), { isConnected: isEmbeddedConnected }),
|
|
85
|
-
external: {
|
|
86
|
-
connectedNetworks,
|
|
87
|
-
evm: evmAccount != null ? evmAccount : {
|
|
88
|
-
address: void 0,
|
|
89
|
-
addresses: void 0,
|
|
90
|
-
chain: void 0,
|
|
91
|
-
chainId: void 0,
|
|
92
|
-
connector: void 0,
|
|
93
|
-
isConnected: false,
|
|
94
|
-
isReconnecting: false,
|
|
95
|
-
isConnecting: false,
|
|
96
|
-
isDisconnected: true,
|
|
97
|
-
status: "disconnected"
|
|
98
|
-
},
|
|
99
|
-
cosmos: pickCosmosAccount(cosmosAccount),
|
|
100
|
-
solana: pickSolanaAdapter(solanaAdapter)
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
})
|
|
104
|
-
});
|
|
105
|
-
const defaultResp = {
|
|
106
|
-
isConnected: false,
|
|
107
|
-
connectionType: "none",
|
|
108
|
-
isLoading,
|
|
109
|
-
embedded: {
|
|
110
|
-
isConnected: false
|
|
111
|
-
},
|
|
112
|
-
external: {
|
|
113
|
-
connectedNetworks: [],
|
|
114
|
-
evm: {
|
|
115
|
-
address: void 0,
|
|
116
|
-
addresses: void 0,
|
|
117
|
-
chain: void 0,
|
|
118
|
-
chainId: void 0,
|
|
119
|
-
connector: void 0,
|
|
120
|
-
isConnected: false,
|
|
121
|
-
isReconnecting: false,
|
|
122
|
-
isConnecting: false,
|
|
123
|
-
isDisconnected: true,
|
|
124
|
-
status: "disconnected"
|
|
125
|
-
},
|
|
126
|
-
cosmos: { isConnected: false },
|
|
127
|
-
solana: { isConnected: false }
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
return __spreadProps(__spreadValues({}, data != null ? data : defaultResp), { isLoading });
|
|
131
|
-
};
|
|
132
|
-
export {
|
|
133
|
-
ACCOUNT_BASE_KEY,
|
|
134
|
-
useAccount
|
|
135
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6
|
-
import { useInternalClient } from "../utils/useInternalClient.js";
|
|
7
|
-
const IS_FULLY_LOGGED_IN_BASE_KEY = "PARA_FULLY_LOGGED_IN";
|
|
8
|
-
const useIsFullyLoggedIn = () => {
|
|
9
|
-
var _a;
|
|
10
|
-
const client = useInternalClient();
|
|
11
|
-
return useQuery({
|
|
12
|
-
enabled: !!client,
|
|
13
|
-
staleTime: 5e3,
|
|
14
|
-
queryKey: [IS_FULLY_LOGGED_IN_BASE_KEY, (_a = client == null ? void 0 : client.userId) != null ? _a : null],
|
|
15
|
-
queryFn: () => __async(void 0, null, function* () {
|
|
16
|
-
var _a2;
|
|
17
|
-
return (_a2 = yield client == null ? void 0 : client.isFullyLoggedIn()) != null ? _a2 : false;
|
|
18
|
-
})
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
IS_FULLY_LOGGED_IN_BASE_KEY,
|
|
23
|
-
useIsFullyLoggedIn
|
|
24
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6
|
-
import { useClient, useWalletState } from "../index.js";
|
|
7
|
-
import { getWallet } from "../../actions/getWallet.js";
|
|
8
|
-
import { useIsFullyLoggedIn } from "./useIsFullyLoggedIn.js";
|
|
9
|
-
const WALLET_BASE_KEY = "PARA_WALLET";
|
|
10
|
-
const useWallet = () => {
|
|
11
|
-
var _a, _b;
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const { selectedWallet } = useWalletState();
|
|
14
|
-
const { data: isFullyLoggedIn, isSuccess } = useIsFullyLoggedIn();
|
|
15
|
-
return useQuery({
|
|
16
|
-
enabled: !!client && !!selectedWallet && isSuccess,
|
|
17
|
-
queryKey: [WALLET_BASE_KEY, isFullyLoggedIn != null ? isFullyLoggedIn : null, (_a = selectedWallet.id) != null ? _a : null, (_b = selectedWallet.type) != null ? _b : null],
|
|
18
|
-
queryFn: () => __async(void 0, null, function* () {
|
|
19
|
-
return yield getWallet(client, selectedWallet, isFullyLoggedIn);
|
|
20
|
-
})
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
WALLET_BASE_KEY,
|
|
25
|
-
useWallet
|
|
26
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { GetWalletBalanceParams } from '@getpara/web-sdk';
|
|
2
|
-
export declare const WALLET_BALANCE_BASE_KEY = "PARA_WALLET_BALANCE";
|
|
3
|
-
/**
|
|
4
|
-
* Hook for retrieving a wallet balance
|
|
5
|
-
*/
|
|
6
|
-
export declare const useWalletBalance: (args?: Partial<GetWalletBalanceParams>) => import("@tanstack/react-query").UseQueryResult<string | null, Error>;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadValues
|
|
5
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
6
|
-
import { useQuery } from "@tanstack/react-query";
|
|
7
|
-
import { useAccount, useClient, useWallet, useWalletState } from "../index.js";
|
|
8
|
-
import { useStore } from "../../stores/useStore.js";
|
|
9
|
-
import { getWalletBalance } from "../../actions/index.js";
|
|
10
|
-
import { useExternalWallets } from "../../providers/ExternalWalletProvider.js";
|
|
11
|
-
import { useCallback } from "react";
|
|
12
|
-
const WALLET_BALANCE_BASE_KEY = "PARA_WALLET_BALANCE";
|
|
13
|
-
const useWalletBalance = (args) => {
|
|
14
|
-
const client = useClient();
|
|
15
|
-
const { data: selectedWallet } = useWallet();
|
|
16
|
-
const {
|
|
17
|
-
selectedWallet: { type: selectedWalletType }
|
|
18
|
-
} = useWalletState();
|
|
19
|
-
const { embedded } = useAccount();
|
|
20
|
-
const rpcUrl = useStore((state) => state.rpcUrl);
|
|
21
|
-
const { getWalletBalance: getExternalWalletBalance, chainId } = useExternalWallets();
|
|
22
|
-
const queryFn = useCallback(() => __async(void 0, null, function* () {
|
|
23
|
-
var _a, _b, _c;
|
|
24
|
-
const skipGetBalance = !selectedWallet || selectedWalletType && ["COSMOS", "SOLANA"].includes(selectedWalletType);
|
|
25
|
-
if (skipGetBalance) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
if (selectedWallet.isExternal) {
|
|
30
|
-
return (_a = yield getExternalWalletBalance()) != null ? _a : null;
|
|
31
|
-
} else {
|
|
32
|
-
const completeArgs = __spreadValues({ walletId: (_b = selectedWallet == null ? void 0 : selectedWallet.id) != null ? _b : "", rpcUrl }, args);
|
|
33
|
-
return (_c = yield getWalletBalance(client, completeArgs)) != null ? _c : null;
|
|
34
|
-
}
|
|
35
|
-
} catch (err) {
|
|
36
|
-
console.error("Error fetching wallet balance: ", err);
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}), [embedded, selectedWallet, selectedWalletType, rpcUrl, getExternalWalletBalance]);
|
|
40
|
-
return useQuery({
|
|
41
|
-
queryKey: [
|
|
42
|
-
WALLET_BALANCE_BASE_KEY,
|
|
43
|
-
client == null ? void 0 : client.userId,
|
|
44
|
-
selectedWallet == null ? void 0 : selectedWallet.id,
|
|
45
|
-
selectedWallet == null ? void 0 : selectedWallet.type,
|
|
46
|
-
(selectedWallet == null ? void 0 : selectedWallet.isExternal) ? chainId : ""
|
|
47
|
-
],
|
|
48
|
-
queryFn,
|
|
49
|
-
enabled: !!client && !!selectedWallet && !!rpcUrl && !!(embedded == null ? void 0 : embedded.isConnected)
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
export {
|
|
53
|
-
WALLET_BALANCE_BASE_KEY,
|
|
54
|
-
useWalletBalance
|
|
55
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { CoreMethodName, CoreMethodParams, CoreMethods } from '@getpara/web-sdk';
|
|
2
|
-
import { CoreMethodQueryHook } from '../../types/utils.js';
|
|
3
|
-
import { CoreAction } from '../../actions/utils.js';
|
|
4
|
-
export declare function generateCoreQueryHook<const method extends CoreMethodName & keyof CoreMethods>(method: method, action: CoreAction<method>, { isGetter, defaultParams }?: {
|
|
5
|
-
isGetter?: boolean;
|
|
6
|
-
defaultParams?: CoreMethodParams<method>;
|
|
7
|
-
}): (params?: CoreMethodParams<method>) => CoreMethodQueryHook<method>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useClient } from "../utils/index.js";
|
|
6
|
-
import { useQuery } from "@tanstack/react-query";
|
|
7
|
-
function generateCoreQueryHook(method, action, { isGetter = false, defaultParams } = {}) {
|
|
8
|
-
return (params = defaultParams) => {
|
|
9
|
-
var _a;
|
|
10
|
-
const para = useClient();
|
|
11
|
-
return useQuery({
|
|
12
|
-
queryKey: [method, params != null ? params : null, isGetter ? (_a = para == null ? void 0 : para[method]) != null ? _a : null : null],
|
|
13
|
-
queryFn: (_0) => __async(this, [_0], function* ({ queryKey: [_, params2] }) {
|
|
14
|
-
if (!para) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
const result = params2 ? yield action(para, params2) : defaultParams ? yield action(para, defaultParams) : yield action(para);
|
|
18
|
-
return result != null ? result : null;
|
|
19
|
-
})
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
generateCoreQueryHook
|
|
25
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useEffect, useRef } from "react";
|
|
6
|
-
import { useAccount, useKeepSessionAlive, useLogout } from "../index.js";
|
|
7
|
-
import { useInternalClient } from "./useInternalClient.js";
|
|
8
|
-
const SESSION_CHECK_INTERVAL = 6e4;
|
|
9
|
-
const SESSION_REFRESH_THRESHOLD = 3e5;
|
|
10
|
-
const useAutoSessionKeepAlive = ({ disabled }) => {
|
|
11
|
-
const client = useInternalClient();
|
|
12
|
-
const { embedded } = useAccount();
|
|
13
|
-
const { logoutAsync } = useLogout();
|
|
14
|
-
const { keepSessionAliveAsync } = useKeepSessionAlive();
|
|
15
|
-
const sessionCheckInterval = useRef(null);
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!client || disabled) {
|
|
18
|
-
clearSessionMonitoring();
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if ((embedded == null ? void 0 : embedded.isConnected) && !embedded.isGuestMode && client.externalWalletConnectionType !== "CONNECTION_ONLY") {
|
|
22
|
-
setupSessionMonitoring();
|
|
23
|
-
} else {
|
|
24
|
-
clearSessionMonitoring();
|
|
25
|
-
}
|
|
26
|
-
return () => clearSessionMonitoring();
|
|
27
|
-
}, [client, embedded, disabled]);
|
|
28
|
-
const getSessionExpiry = () => __async(void 0, null, function* () {
|
|
29
|
-
try {
|
|
30
|
-
const sessionCookie = yield client == null ? void 0 : client.retrieveSessionCookie();
|
|
31
|
-
if (!sessionCookie) return null;
|
|
32
|
-
const expiresMatch = sessionCookie.match(/Expires=([^;]+)/);
|
|
33
|
-
return expiresMatch ? new Date(expiresMatch[1]) : null;
|
|
34
|
-
} catch (err) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
const setupSessionMonitoring = () => {
|
|
39
|
-
clearSessionMonitoring();
|
|
40
|
-
sessionCheckInterval.current = setInterval(() => __async(void 0, null, function* () {
|
|
41
|
-
const expiry = yield getSessionExpiry();
|
|
42
|
-
if (!expiry) {
|
|
43
|
-
yield logoutAsync({});
|
|
44
|
-
clearSessionMonitoring();
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const timeUntilExpiry = expiry.getTime() - Date.now();
|
|
48
|
-
if (timeUntilExpiry <= 0) {
|
|
49
|
-
yield logoutAsync({});
|
|
50
|
-
clearSessionMonitoring();
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
if (timeUntilExpiry <= SESSION_REFRESH_THRESHOLD) {
|
|
54
|
-
try {
|
|
55
|
-
yield keepSessionAliveAsync();
|
|
56
|
-
setupSessionMonitoring();
|
|
57
|
-
} catch (err) {
|
|
58
|
-
console.error("Failed to keep session alive:", err);
|
|
59
|
-
yield logoutAsync({});
|
|
60
|
-
clearSessionMonitoring();
|
|
61
|
-
}
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}), SESSION_CHECK_INTERVAL);
|
|
65
|
-
};
|
|
66
|
-
const clearSessionMonitoring = () => {
|
|
67
|
-
if (sessionCheckInterval.current) {
|
|
68
|
-
clearInterval(sessionCheckInterval.current);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
export {
|
|
73
|
-
useAutoSessionKeepAlive
|
|
74
|
-
};
|