@getpara/react-sdk 2.0.0-dev.1 → 2.0.0-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.mjs +22 -7
- package/dist/index.d.ts +0 -1
- package/dist/index.js +6 -7058
- package/dist/modal/ParaModal.js +301 -0
- package/dist/modal/components/Account/Account.js +148 -0
- package/dist/modal/components/Account/AccountProfile.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfile.js +168 -0
- package/dist/modal/components/Account/AccountProfileLink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLink.js +206 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileLinkOptions.js +111 -0
- package/dist/modal/components/Account/AccountProfileUnlink.d.ts +1 -0
- package/dist/modal/components/Account/AccountProfileUnlink.js +47 -0
- package/dist/modal/components/AddFunds/AddFunds.d.ts +0 -2
- package/dist/modal/components/AddFunds/AddFunds.js +69 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsAsset.js +125 -0
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +78 -0
- package/dist/modal/components/AddFunds/AddFundsContext.d.ts +31 -0
- package/dist/modal/components/AddFunds/AddFundsContext.js +160 -0
- package/dist/modal/components/AddFunds/AddFundsDone.js +49 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsProvider.js +109 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsReceive.js +83 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.d.ts +1 -0
- package/dist/modal/components/AddFunds/AddFundsSettings.js +237 -0
- package/dist/{MoonPayEmbed-Q2HP2BFI.js → modal/components/AddFunds/MoonPayEmbed.js} +1 -3
- package/dist/modal/components/AddFunds/common.d.ts +19 -0
- package/dist/modal/components/AddFunds/common.js +24 -0
- package/dist/modal/components/AddFunds/index.js +4 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +17 -3
- package/dist/modal/components/AuthInput/AuthInput.js +277 -0
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +33 -0
- package/dist/modal/components/AuthInput/phoneMasks.js +253 -0
- package/dist/modal/components/AuthMainStep/AuthMainStep.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +50 -0
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.d.ts +4 -3
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +164 -0
- package/dist/modal/components/AuthOptions/AuthOptions.d.ts +4 -3
- package/dist/modal/components/AuthOptions/AuthOptions.js +85 -0
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +18 -0
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +10 -0
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +18 -0
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.d.ts +5 -1
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +49 -0
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -1
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +62 -0
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +48 -0
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +29 -0
- package/dist/modal/components/Body/Body.d.ts +4 -3
- package/dist/modal/components/Body/Body.js +350 -0
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +95 -0
- package/dist/modal/components/ChainSwitch/config.js +17 -0
- package/dist/modal/components/Controls/Controls.js +78 -0
- package/dist/modal/components/Controls/Selects.js +173 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletNetworkSelectStep/ExternalWalletNetworkSelectStep.js +75 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +7 -0
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +175 -0
- package/dist/modal/components/ExternalWalletStep/config.js +17 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +39 -0
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +184 -0
- package/dist/modal/components/Footer/Footer.js +95 -0
- package/dist/modal/components/Header/Header.js +43 -0
- package/dist/modal/components/Header/hooks/useStepTitle.js +61 -0
- package/dist/modal/components/Hero/Hero.js +116 -0
- package/dist/modal/components/IFrameStep/IFrameStep.js +59 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.d.ts +4 -0
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +44 -0
- package/dist/modal/components/ModalContent/ModalContent.d.ts +0 -4
- package/dist/modal/components/ModalContent/ModalContent.js +88 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.d.ts +1 -0
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +31 -0
- package/dist/modal/components/OAuth/OAuth.d.ts +2 -2
- package/dist/modal/components/OAuth/OAuth.js +79 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.d.ts +7 -0
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +74 -0
- package/dist/modal/components/OnRampComponents/AddingFunds.js +23 -0
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +77 -0
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +107 -0
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +132 -0
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +27 -0
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.d.ts +12 -1
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +160 -0
- package/dist/modal/components/Waiting/Waiting.js +17 -0
- package/dist/modal/components/WalletCard/PartnerIcon.js +34 -0
- package/dist/modal/components/WalletCard/WalletCard.d.ts +3 -3
- package/dist/modal/components/WalletCard/WalletCard.js +128 -0
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +83 -0
- package/dist/modal/components/common.d.ts +49 -13
- package/dist/modal/components/common.js +261 -0
- package/dist/modal/components/index.js +2 -0
- package/dist/modal/constants/constants.d.ts +10 -2
- package/dist/modal/constants/constants.js +142 -0
- package/dist/modal/constants/defaults.js +10 -0
- package/dist/modal/constants/oAuthLogos.d.ts +15 -6
- package/dist/modal/constants/oAuthLogos.js +158 -0
- package/dist/modal/constants/walletTypeConfig.d.ts +6 -0
- package/dist/modal/constants/walletTypeConfig.js +13 -0
- package/dist/modal/hooks/useGoBack.js +43 -0
- package/dist/modal/hooks/useTelegramLogin.d.ts +12 -0
- package/dist/modal/hooks/useTelegramLogin.js +65 -0
- package/dist/modal/index.d.ts +1 -1
- package/dist/modal/index.js +29 -0
- package/dist/modal/stores/index.d.ts +0 -1
- package/dist/modal/stores/index.js +2 -0
- package/dist/modal/stores/modal/actions.js +135 -0
- package/dist/modal/stores/modal/useModalStore.d.ts +17 -16
- package/dist/modal/stores/modal/useModalStore.js +73 -0
- package/dist/modal/types/commonTypes.js +1 -0
- package/dist/modal/types/modalProps.d.ts +15 -2
- package/dist/modal/types/modalProps.js +12 -0
- package/dist/modal/utils/authInputHelpers.d.ts +5 -0
- package/dist/modal/utils/authInputHelpers.js +41 -0
- package/dist/modal/utils/authLayoutHelpers.js +8 -0
- package/dist/modal/utils/countryCodes.js +45 -0
- package/dist/modal/utils/getMailtoLink.js +10 -0
- package/dist/modal/utils/getTileButtonFlex.js +20 -0
- package/dist/modal/utils/getWalletDisplayName.d.ts +5 -0
- package/dist/modal/utils/getWalletDisplayName.js +22 -0
- package/dist/modal/utils/isPasskeySupported.js +15 -0
- package/dist/modal/utils/openPopup.js +60 -0
- package/dist/modal/utils/routeMobileExternalWallet.js +31 -0
- package/dist/modal/utils/steps.d.ts +21 -2
- package/dist/modal/utils/steps.js +273 -0
- package/dist/modal/utils/stringFormatters.d.ts +1 -0
- package/dist/modal/utils/stringFormatters.js +19 -0
- package/dist/modal/utils/validateOnRampConfig.js +32 -0
- package/dist/package.json +6 -0
- package/dist/provider/ParaProvider.js +117 -0
- package/dist/provider/actions/getEmbeddedAccount.d.ts +26 -0
- package/dist/provider/actions/getEmbeddedAccount.js +52 -0
- package/dist/provider/actions/getWallet.d.ts +3 -3
- package/dist/provider/actions/getWallet.js +18 -0
- package/dist/provider/actions/index.d.ts +40 -18
- package/dist/provider/actions/index.js +79 -0
- package/dist/provider/actions/utils.d.ts +4 -3
- package/dist/provider/actions/utils.js +34 -0
- package/dist/provider/components/CosmosWalletWrapper.js +43 -0
- package/dist/provider/components/EvmWalletWrapper.js +43 -0
- package/dist/provider/components/ExternalWalletWrapper.js +140 -0
- package/dist/provider/components/SolanaWalletWrapper.js +44 -0
- package/dist/provider/external/getParaCosmosConnector.js +19 -0
- package/dist/provider/external/getParaCosmosLib.d.ts +4 -0
- package/dist/provider/external/getParaCosmosLib.js +16 -0
- package/dist/provider/external/getParaEvmConnector.js +19 -0
- package/dist/provider/external/getParaEvmLib.d.ts +4 -0
- package/dist/provider/external/getParaEvmLib.js +16 -0
- package/dist/provider/external/getParaSolanaConnector.js +19 -0
- package/dist/provider/external/getParaSolanaLib.d.ts +4 -0
- package/dist/provider/external/getParaSolanaLib.js +16 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +1 -11
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +1 -2
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.js +8 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +1 -7
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.js +8 -0
- package/dist/provider/hooks/index.js +4 -0
- package/dist/provider/hooks/mutations/core.d.ts +27 -0
- package/dist/provider/hooks/mutations/core.js +66 -0
- package/dist/provider/hooks/mutations/index.d.ts +3 -34
- package/dist/provider/hooks/mutations/index.js +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.d.ts +9 -0
- package/dist/provider/hooks/mutations/useLinkAccount.js +18 -0
- package/dist/provider/hooks/mutations/utils.d.ts +11 -3
- package/dist/provider/hooks/mutations/utils.js +90 -0
- package/dist/provider/hooks/queries/core.d.ts +4 -0
- package/dist/provider/hooks/queries/core.js +16 -0
- package/dist/provider/hooks/queries/index.d.ts +2 -0
- package/dist/provider/hooks/queries/index.js +11 -0
- package/dist/provider/hooks/queries/useAccount.d.ts +86 -7
- package/dist/provider/hooks/queries/useAccount.js +135 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.d.ts +5 -0
- package/dist/provider/hooks/queries/useIsFullyLoggedIn.js +24 -0
- package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
- package/dist/provider/hooks/queries/useWallet.js +26 -0
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +6 -0
- package/dist/provider/hooks/queries/useWalletBalance.js +55 -0
- package/dist/provider/hooks/queries/utils.d.ts +7 -0
- package/dist/provider/hooks/queries/utils.js +25 -0
- package/dist/provider/hooks/utils/index.js +10 -0
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +74 -0
- package/dist/provider/hooks/utils/useClient.d.ts +1 -1
- package/dist/provider/hooks/utils/useClient.js +10 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
- package/dist/provider/hooks/utils/useEventListeners.js +157 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.d.ts +4 -0
- package/dist/provider/hooks/utils/useFormattedBiometricHints.js +27 -0
- package/dist/provider/hooks/utils/useInternalClient.js +10 -0
- package/dist/provider/hooks/utils/useModal.d.ts +4 -1
- package/dist/provider/hooks/utils/useModal.js +27 -0
- package/dist/provider/hooks/utils/useWalletState.d.ts +3 -3
- package/dist/provider/hooks/utils/useWalletState.js +48 -0
- package/dist/provider/index.d.ts +2 -0
- package/dist/provider/index.js +11 -0
- package/dist/provider/providers/AccountLinkProvider.d.ts +47 -0
- package/dist/provider/providers/AccountLinkProvider.js +452 -0
- package/dist/provider/providers/AuthProvider.d.ts +12 -6
- package/dist/provider/providers/AuthProvider.js +523 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.js +66 -0
- package/dist/provider/providers/EvmExternalWalletProvider.js +74 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +23 -43
- package/dist/provider/providers/ExternalWalletProvider.js +596 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.js +66 -0
- package/dist/provider/stores/getters.d.ts +1 -1
- package/dist/provider/stores/getters.js +13 -0
- package/dist/provider/stores/setters.js +7 -0
- package/dist/provider/stores/slices/analytics.d.ts +3 -0
- package/dist/provider/stores/slices/analytics.js +9 -0
- package/dist/provider/stores/slices/client.js +9 -0
- package/dist/provider/stores/slices/config.js +9 -0
- package/dist/provider/stores/slices/externalWallets.js +46 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/slices/index.js +6 -0
- package/dist/provider/stores/slices/modal.js +18 -0
- package/dist/provider/stores/slices/wallet.js +13 -0
- package/dist/provider/stores/types.d.ts +19 -5
- package/dist/provider/stores/types.js +1 -0
- package/dist/provider/stores/useStore.js +34 -0
- package/dist/provider/types/externalWalletProviders.js +1 -0
- package/dist/provider/types/provider.d.ts +23 -4
- package/dist/provider/types/provider.js +1 -0
- package/dist/provider/types/query.js +1 -0
- package/dist/provider/types/utils.d.ts +28 -5
- package/dist/provider/types/utils.js +1 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/dist/provider/utils/constants.js +10 -0
- package/dist/provider/utils/paraConfigTypeGuards.js +13 -0
- package/dist/provider/utils/renameMutations.d.ts +2 -2
- package/dist/provider/utils/renameMutations.js +18 -0
- package/package.json +40 -39
- package/dist/MoonPayEmbed-Q2HP2BFI.js.br +0 -0
- package/dist/MoonPayEmbed-Q2HP2BFI.js.gz +0 -0
- package/dist/chunk-MMUBH76A.js.br +0 -0
- package/dist/chunk-MMUBH76A.js.gz +0 -0
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/StripeComponents/StripeComponents.d.ts +0 -16
- package/dist/modal/hooks/useCreateAccount.d.ts +0 -4
- package/dist/modal/stores/userInfo/actions.d.ts +0 -3
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
- package/dist/provider/actions/checkIfUserExists.d.ts +0 -4
- package/dist/provider/actions/createUser.d.ts +0 -4
- package/dist/provider/actions/getAccount.d.ts +0 -10
- package/dist/provider/actions/initiateLogin.d.ts +0 -4
- package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
- package/dist/provider/actions/logout.d.ts +0 -5
- package/dist/provider/actions/signMessage.d.ts +0 -8
- package/dist/provider/actions/signTransaction.d.ts +0 -8
- package/dist/provider/actions/waitForAccountCreation.d.ts +0 -5
- package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
- package/dist/provider/hooks/mutations/useCheckIfUserExists.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
- package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
- package/dist/provider/hooks/mutations/useLogout.d.ts +0 -13
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -15
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -13
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
- /package/dist/modal/{components/AuthInput → utils}/countryCodes.d.ts +0 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../chunk-MMUBH76A.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { SolanaExternalWalletProvider } from "../providers/SolanaExternalWalletProvider.js";
|
|
5
|
+
import { useInternalClient } from "../hooks/utils/useInternalClient.js";
|
|
6
|
+
import { useStore } from "../stores/useStore.js";
|
|
7
|
+
import { SOLANA_WALLETS } from "@getpara/web-sdk";
|
|
8
|
+
const SolanaWalletWrapper = ({
|
|
9
|
+
children,
|
|
10
|
+
solanaProviderConfig,
|
|
11
|
+
onSwitchWallet
|
|
12
|
+
}) => {
|
|
13
|
+
const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
|
|
14
|
+
const para = useInternalClient();
|
|
15
|
+
const wallets = useStore((state) => state.externalWallets);
|
|
16
|
+
const connectionOnly = useStore((state) => state.connectionOnly);
|
|
17
|
+
const includeWalletVerification = useStore((state) => state.includeWalletVerification);
|
|
18
|
+
const isUsing = wallets.some((w) => w in SOLANA_WALLETS);
|
|
19
|
+
if (!solanaProviderConfig) {
|
|
20
|
+
if (isUsing) {
|
|
21
|
+
throw new Error("A valid solanaConnector config is required to use an external Solana wallet.");
|
|
22
|
+
}
|
|
23
|
+
return children;
|
|
24
|
+
}
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
SolanaExternalWalletProvider,
|
|
27
|
+
{
|
|
28
|
+
config: solanaProviderConfig,
|
|
29
|
+
internalConfig: {
|
|
30
|
+
onSwitchWallet,
|
|
31
|
+
para,
|
|
32
|
+
walletsWithFullAuth: externalWalletsWithFullAuth,
|
|
33
|
+
connectionOnly,
|
|
34
|
+
includeWalletVerification
|
|
35
|
+
},
|
|
36
|
+
isUsing,
|
|
37
|
+
wallets,
|
|
38
|
+
children
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
SolanaWalletWrapper
|
|
44
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { CosmosExternalWalletContext } from "./stubs/CosmosExternalWalletContextStub.js";
|
|
6
|
+
import { getParaCosmosLib } from "./getParaCosmosLib.js";
|
|
7
|
+
const getParaCosmosConnector = () => __async(void 0, null, function* () {
|
|
8
|
+
let Provider = void 0, context = CosmosExternalWalletContext, wallets = [];
|
|
9
|
+
const { lib } = yield getParaCosmosLib();
|
|
10
|
+
if (lib) {
|
|
11
|
+
Provider = lib.ParaCosmosProvider;
|
|
12
|
+
context = lib.CosmosExternalWalletContext;
|
|
13
|
+
wallets = lib.allWallets;
|
|
14
|
+
}
|
|
15
|
+
return { Provider, context, wallets };
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
getParaCosmosConnector
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
const getParaCosmosLib = () => __async(void 0, null, function* () {
|
|
6
|
+
let lib;
|
|
7
|
+
try {
|
|
8
|
+
lib = yield import("@getpara/cosmos-wallet-connectors");
|
|
9
|
+
} catch (e) {
|
|
10
|
+
lib = void 0;
|
|
11
|
+
}
|
|
12
|
+
return { lib };
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
getParaCosmosLib
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { EvmExternalWalletContext } from "./stubs/EvmExternalWalletContextStub.js";
|
|
6
|
+
import { getParaEvmLib } from "./getParaEvmLib.js";
|
|
7
|
+
const getParaEvmConnector = () => __async(void 0, null, function* () {
|
|
8
|
+
let Provider = void 0, context = EvmExternalWalletContext, wallets = [];
|
|
9
|
+
const { lib } = yield getParaEvmLib();
|
|
10
|
+
if (lib) {
|
|
11
|
+
Provider = lib.ParaEvmProvider;
|
|
12
|
+
context = lib.EvmExternalWalletContext;
|
|
13
|
+
wallets = lib.allWallets;
|
|
14
|
+
}
|
|
15
|
+
return { Provider, context, wallets };
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
getParaEvmConnector
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
const getParaEvmLib = () => __async(void 0, null, function* () {
|
|
6
|
+
let lib;
|
|
7
|
+
try {
|
|
8
|
+
lib = yield import("@getpara/evm-wallet-connectors");
|
|
9
|
+
} catch (e) {
|
|
10
|
+
lib = void 0;
|
|
11
|
+
}
|
|
12
|
+
return { lib };
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
getParaEvmLib
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
import { SolanaExternalWalletContext } from "./stubs/SolanaExternalWalletContextStub.js";
|
|
6
|
+
import { getParaSolanaLib } from "./getParaSolanaLib.js";
|
|
7
|
+
const getParaSolanaConnector = () => __async(void 0, null, function* () {
|
|
8
|
+
let Provider = void 0, context = SolanaExternalWalletContext, wallets = [];
|
|
9
|
+
const { lib } = yield getParaSolanaLib();
|
|
10
|
+
if (lib) {
|
|
11
|
+
Provider = lib.ParaSolanaProvider;
|
|
12
|
+
context = lib.SolanaExternalWalletContext;
|
|
13
|
+
wallets = lib.allWallets;
|
|
14
|
+
}
|
|
15
|
+
return { Provider, context, wallets };
|
|
16
|
+
});
|
|
17
|
+
export {
|
|
18
|
+
getParaSolanaConnector
|
|
19
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
__async
|
|
4
|
+
} from "../../chunk-MMUBH76A.js";
|
|
5
|
+
const getParaSolanaLib = () => __async(void 0, null, function* () {
|
|
6
|
+
let lib;
|
|
7
|
+
try {
|
|
8
|
+
lib = yield import("@getpara/solana-wallet-connectors");
|
|
9
|
+
} catch (e) {
|
|
10
|
+
lib = void 0;
|
|
11
|
+
}
|
|
12
|
+
return { lib };
|
|
13
|
+
});
|
|
14
|
+
export {
|
|
15
|
+
getParaSolanaLib
|
|
16
|
+
};
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import { CosmosExternalWalletContextType } from '@getpara/cosmos-wallet-connectors';
|
|
2
|
-
export declare const defaultCosmosExternalWallet: {
|
|
3
|
-
wallets: never[];
|
|
4
|
-
chains: never[];
|
|
5
|
-
chainId: undefined;
|
|
6
|
-
disconnect: () => Promise<void>;
|
|
7
|
-
switchChain: () => Promise<{}>;
|
|
8
|
-
connectParaEmbedded: () => Promise<{}>;
|
|
9
|
-
signMessage: () => Promise<{}>;
|
|
10
|
-
signVerificationMessage: () => Promise<{}>;
|
|
11
|
-
};
|
|
1
|
+
import { type CosmosExternalWalletContextType } from '@getpara/cosmos-wallet-connectors';
|
|
12
2
|
export declare const CosmosExternalWalletContext: import("react").Context<CosmosExternalWalletContextType>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { defaultCosmosExternalWallet } from "@getpara/react-common";
|
|
4
|
+
import { createContext } from "react";
|
|
5
|
+
const CosmosExternalWalletContext = createContext(defaultCosmosExternalWallet);
|
|
6
|
+
export {
|
|
7
|
+
CosmosExternalWalletContext
|
|
8
|
+
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
2
|
-
export declare const defaultEvmExternalWallet: EvmExternalWalletContextType;
|
|
1
|
+
import { type EvmExternalWalletContextType } from '@getpara/evm-wallet-connectors';
|
|
3
2
|
export declare const EvmExternalWalletContext: import("react").Context<EvmExternalWalletContextType>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
import { defaultEvmExternalWallet } from "@getpara/react-common";
|
|
5
|
+
const EvmExternalWalletContext = createContext(defaultEvmExternalWallet);
|
|
6
|
+
export {
|
|
7
|
+
EvmExternalWalletContext
|
|
8
|
+
};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
import { SolanaExternalWalletContextType } from '@getpara/solana-wallet-connectors';
|
|
2
|
-
export declare const defaultSolanaExternalWallet: {
|
|
3
|
-
wallets: never[];
|
|
4
|
-
disconnect: () => Promise<void>;
|
|
5
|
-
signMessage: () => Promise<{}>;
|
|
6
|
-
signVerificationMessage: () => Promise<{}>;
|
|
7
|
-
};
|
|
1
|
+
import { type SolanaExternalWalletContextType } from '@getpara/solana-wallet-connectors';
|
|
8
2
|
export declare const SolanaExternalWalletContext: import("react").Context<SolanaExternalWalletContextType>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { createContext } from "react";
|
|
4
|
+
import { defaultSolanaExternalWallet } from "@getpara/react-common";
|
|
5
|
+
const SolanaExternalWalletContext = createContext(defaultSolanaExternalWallet);
|
|
6
|
+
export {
|
|
7
|
+
SolanaExternalWalletContext
|
|
8
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const useSignUpOrLogIn: () => import("../../types/utils.js").CoreMethodMutationHook<"signUpOrLogIn">;
|
|
2
|
+
export declare const useVerifyNewAccount: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyNewAccount">;
|
|
3
|
+
export declare const useWaitForLogin: () => import("../../types/utils.js").CoreMethodMutationHook<"waitForLogin">;
|
|
4
|
+
export declare const useWaitForSignup: () => import("../../types/utils.js").CoreMethodMutationHook<"waitForSignup">;
|
|
5
|
+
export declare const useWaitForWalletCreation: () => import("../../types/utils.js").CoreMethodMutationHook<"waitForWalletCreation">;
|
|
6
|
+
export declare const useVerifyOAuth: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyOAuth">;
|
|
7
|
+
export declare const useVerifyFarcaster: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyFarcaster">;
|
|
8
|
+
export declare const useVerifyTelegram: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyTelegram">;
|
|
9
|
+
export declare const useLoginExternalWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"loginExternalWallet">;
|
|
10
|
+
export declare const useVerifyExternalWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"verifyExternalWallet">;
|
|
11
|
+
export declare const useSetup2fa: () => import("../../types/utils.js").CoreMethodMutationHook<"setup2fa">;
|
|
12
|
+
export declare const useEnable2fa: () => import("../../types/utils.js").CoreMethodMutationHook<"enable2fa">;
|
|
13
|
+
export declare const useVerify2fa: () => import("../../types/utils.js").CoreMethodMutationHook<"verify2fa">;
|
|
14
|
+
export declare const useKeepSessionAlive: () => import("../../types/utils.js").CoreMethodMutationHook<"keepSessionAlive">;
|
|
15
|
+
export declare const useLogout: () => import("../../types/utils.js").CoreMethodMutationHook<"logout">;
|
|
16
|
+
export declare const useResendVerificationCode: () => import("../../types/utils.js").CoreMethodMutationHook<"resendVerificationCode">;
|
|
17
|
+
export declare const useCreateWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"createWallet">;
|
|
18
|
+
export declare const useCreateWalletPerType: () => import("../../types/utils.js").CoreMethodMutationHook<"createWalletPerType">;
|
|
19
|
+
export declare const useCreatePregenWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"createPregenWallet">;
|
|
20
|
+
export declare const useCreatePregenWalletPerType: () => import("../../types/utils.js").CoreMethodMutationHook<"createPregenWalletPerType">;
|
|
21
|
+
export declare const useClaimPregenWallets: () => import("../../types/utils.js").CoreMethodMutationHook<"claimPregenWallets">;
|
|
22
|
+
export declare const useHasPregenWallet: () => import("../../types/utils.js").CoreMethodMutationHook<"hasPregenWallet">;
|
|
23
|
+
export declare const useUpdatePregenWalletIdentifier: () => import("../../types/utils.js").CoreMethodMutationHook<"updatePregenWalletIdentifier">;
|
|
24
|
+
export declare const useCreateGuestWallets: () => import("../../types/utils.js").CoreMethodMutationHook<"createGuestWallets">;
|
|
25
|
+
export declare const useSignMessage: () => import("../../types/utils.js").CoreMethodMutationHook<"signMessage">;
|
|
26
|
+
export declare const useSignTransaction: () => import("../../types/utils.js").CoreMethodMutationHook<"signTransaction">;
|
|
27
|
+
export declare const useIssueJwt: () => import("../../types/utils.js").CoreMethodMutationHook<"issueJwt">;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import * as actions from "../../actions/index.js";
|
|
4
|
+
import { generateCoreMutation } from "./utils.js";
|
|
5
|
+
const useSignUpOrLogIn = generateCoreMutation("signUpOrLogIn", actions.signUpOrLogIn);
|
|
6
|
+
const useVerifyNewAccount = generateCoreMutation("verifyNewAccount", actions.verifyNewAccount);
|
|
7
|
+
const useWaitForLogin = generateCoreMutation("waitForLogin", actions.waitForLogin);
|
|
8
|
+
const useWaitForSignup = generateCoreMutation("waitForSignup", actions.waitForSignup);
|
|
9
|
+
const useWaitForWalletCreation = generateCoreMutation("waitForWalletCreation", actions.waitForWalletCreation);
|
|
10
|
+
const useVerifyOAuth = generateCoreMutation("verifyOAuth", actions.verifyOAuth);
|
|
11
|
+
const useVerifyFarcaster = generateCoreMutation("verifyFarcaster", actions.verifyFarcaster);
|
|
12
|
+
const useVerifyTelegram = generateCoreMutation("verifyTelegram", actions.verifyTelegram);
|
|
13
|
+
const useLoginExternalWallet = generateCoreMutation("loginExternalWallet", actions.loginExternalWallet);
|
|
14
|
+
const useVerifyExternalWallet = generateCoreMutation("verifyExternalWallet", actions.verifyExternalWallet);
|
|
15
|
+
const useSetup2fa = generateCoreMutation("setup2fa", actions.setup2fa);
|
|
16
|
+
const useEnable2fa = generateCoreMutation("enable2fa", actions.enable2fa);
|
|
17
|
+
const useVerify2fa = generateCoreMutation("verify2fa", actions.verify2fa);
|
|
18
|
+
const useKeepSessionAlive = generateCoreMutation("keepSessionAlive", actions.keepSessionAlive);
|
|
19
|
+
const useLogout = generateCoreMutation("logout", actions.logout);
|
|
20
|
+
const useResendVerificationCode = generateCoreMutation("resendVerificationCode", actions.resendVerificationCode);
|
|
21
|
+
const useCreateWallet = generateCoreMutation("createWallet", actions.createWallet);
|
|
22
|
+
const useCreateWalletPerType = generateCoreMutation("createWalletPerType", actions.createWalletPerType);
|
|
23
|
+
const useCreatePregenWallet = generateCoreMutation("createPregenWallet", actions.createPregenWallet);
|
|
24
|
+
const useCreatePregenWalletPerType = generateCoreMutation(
|
|
25
|
+
"createPregenWalletPerType",
|
|
26
|
+
actions.createPregenWalletPerType
|
|
27
|
+
);
|
|
28
|
+
const useClaimPregenWallets = generateCoreMutation("claimPregenWallets", actions.claimPregenWallets);
|
|
29
|
+
const useHasPregenWallet = generateCoreMutation("hasPregenWallet", actions.hasPregenWallet);
|
|
30
|
+
const useUpdatePregenWalletIdentifier = generateCoreMutation(
|
|
31
|
+
"updatePregenWalletIdentifier",
|
|
32
|
+
actions.updatePregenWalletIdentifier
|
|
33
|
+
);
|
|
34
|
+
const useCreateGuestWallets = generateCoreMutation("createGuestWallets", actions.createGuestWallets);
|
|
35
|
+
const useSignMessage = generateCoreMutation("signMessage", actions.signMessage);
|
|
36
|
+
const useSignTransaction = generateCoreMutation("signTransaction", actions.signTransaction);
|
|
37
|
+
const useIssueJwt = generateCoreMutation("issueJwt", actions.issueJwt);
|
|
38
|
+
export {
|
|
39
|
+
useClaimPregenWallets,
|
|
40
|
+
useCreateGuestWallets,
|
|
41
|
+
useCreatePregenWallet,
|
|
42
|
+
useCreatePregenWalletPerType,
|
|
43
|
+
useCreateWallet,
|
|
44
|
+
useCreateWalletPerType,
|
|
45
|
+
useEnable2fa,
|
|
46
|
+
useHasPregenWallet,
|
|
47
|
+
useIssueJwt,
|
|
48
|
+
useKeepSessionAlive,
|
|
49
|
+
useLoginExternalWallet,
|
|
50
|
+
useLogout,
|
|
51
|
+
useResendVerificationCode,
|
|
52
|
+
useSetup2fa,
|
|
53
|
+
useSignMessage,
|
|
54
|
+
useSignTransaction,
|
|
55
|
+
useSignUpOrLogIn,
|
|
56
|
+
useUpdatePregenWalletIdentifier,
|
|
57
|
+
useVerify2fa,
|
|
58
|
+
useVerifyExternalWallet,
|
|
59
|
+
useVerifyFarcaster,
|
|
60
|
+
useVerifyNewAccount,
|
|
61
|
+
useVerifyOAuth,
|
|
62
|
+
useVerifyTelegram,
|
|
63
|
+
useWaitForLogin,
|
|
64
|
+
useWaitForSignup,
|
|
65
|
+
useWaitForWalletCreation
|
|
66
|
+
};
|
|
@@ -1,34 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { useCreateUser } from './useCreateUser.js';
|
|
5
|
-
export { useCheckIfUserExists } from './useCheckIfUserExists.js';
|
|
6
|
-
export { useInitiateLogin } from './useInitiateLogin.js';
|
|
7
|
-
export { useKeepSessionAlive } from './useKeepSessionAlive.js';
|
|
8
|
-
export { useSignMessage } from './useSignMessage.js';
|
|
9
|
-
export { useSignTransaction } from './useSignTransaction.js';
|
|
10
|
-
export declare const useSignUpOrLogIn: () => import("../../types/utils.js").CoreMethodHook<"signUpOrLogInV2">;
|
|
11
|
-
export declare const useVerifyNewAccount: () => import("../../types/utils.js").CoreMethodHook<"verifyNewAccountV2">;
|
|
12
|
-
export declare const useWaitForLogin: () => import("../../types/utils.js").CoreMethodHook<"waitForLoginV2">;
|
|
13
|
-
export declare const useWaitForSignup: () => import("../../types/utils.js").CoreMethodHook<"waitForSignupV2">;
|
|
14
|
-
export declare const useWaitForWalletCreation: () => import("../../types/utils.js").CoreMethodHook<"waitForWalletCreationV2">;
|
|
15
|
-
export declare const useVerifyOAuth: () => import("../../types/utils.js").CoreMethodHook<"verifyOAuthV2">;
|
|
16
|
-
export declare const useVerifyFarcaster: () => import("../../types/utils.js").CoreMethodHook<"verifyFarcasterV2">;
|
|
17
|
-
export declare const useVerifyTelegram: () => import("../../types/utils.js").CoreMethodHook<"verifyTelegramV2">;
|
|
18
|
-
export declare const useLoginExternalWallet: () => import("../../types/utils.js").CoreMethodHook<"loginExternalWalletV2">;
|
|
19
|
-
export declare const useVerifyExternalWallet: () => import("../../types/utils.js").CoreMethodHook<"verifyExternalWalletV2">;
|
|
20
|
-
export declare const useSetup2fa: () => import("../../types/utils.js").CoreMethodHook<"setup2faV2">;
|
|
21
|
-
export declare const useEnable2fa: () => import("../../types/utils.js").CoreMethodHook<"enable2faV2">;
|
|
22
|
-
export declare const useVerify2fa: () => import("../../types/utils.js").CoreMethodHook<"verify2faV2">;
|
|
23
|
-
export declare const useKeepSessionAliveV2: () => import("../../types/utils.js").CoreMethodHook<"keepSessionAlive">;
|
|
24
|
-
export declare const useLogout: () => import("../../types/utils.js").CoreMethodHook<"logout">;
|
|
25
|
-
export declare const useResendVerificationCode: () => import("../../types/utils.js").CoreMethodHook<"resendVerificationCode">;
|
|
26
|
-
export declare const useCreateWallet: () => import("../../types/utils.js").CoreMethodHook<"createWallet">;
|
|
27
|
-
export declare const useCreateWalletPerType: () => import("../../types/utils.js").CoreMethodHook<"createWalletPerType">;
|
|
28
|
-
export declare const useCreatePregenWallet: () => import("../../types/utils.js").CoreMethodHook<"createPregenWalletV2">;
|
|
29
|
-
export declare const useCreatePregenWalletPerType: () => import("../../types/utils.js").CoreMethodHook<"createPregenWalletPerTypeV2">;
|
|
30
|
-
export declare const useClaimPregenWallets: () => import("../../types/utils.js").CoreMethodHook<"claimPregenWalletsV2">;
|
|
31
|
-
export declare const useHasPregenWallet: () => import("../../types/utils.js").CoreMethodHook<"hasPregenWalletV2">;
|
|
32
|
-
export declare const useUpdatePregenWalletIdentifier: () => import("../../types/utils.js").CoreMethodHook<"updatePregenWalletIdentifierV2">;
|
|
33
|
-
export declare const useSignMessageV2: () => import("../../types/utils.js").CoreMethodHook<"signMessage">;
|
|
34
|
-
export declare const useSignTransactionV2: () => import("../../types/utils.js").CoreMethodHook<"signTransaction">;
|
|
1
|
+
export * from './core.js';
|
|
2
|
+
export * from './useLinkAccount.js';
|
|
3
|
+
export declare const useCreateGuestWalletsState: import("../../types/utils.js").CoreMethodMutationStateHook<"createGuestWallets">;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import "../../../chunk-MMUBH76A.js";
|
|
3
|
+
import { generateStateHook } from "./utils.js";
|
|
4
|
+
export * from "./core.js";
|
|
5
|
+
export * from "./useLinkAccount.js";
|
|
6
|
+
const useCreateGuestWalletsState = generateStateHook("createGuestWallets");
|
|
7
|
+
export {
|
|
8
|
+
useCreateGuestWalletsState
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const useLinkAccount: () => {
|
|
2
|
+
linkAccount: (_: import("../../providers/AccountLinkProvider.js").ModalLinkAccountArgs) => Promise<void>;
|
|
3
|
+
error: string | null;
|
|
4
|
+
status: import("@tanstack/query-core").MutationStatus;
|
|
5
|
+
isPending: boolean;
|
|
6
|
+
isError: boolean;
|
|
7
|
+
isIdle: boolean;
|
|
8
|
+
isSuccess: boolean;
|
|
9
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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,4 +1,12 @@
|
|
|
1
|
-
import { CoreMethodName, CoreMethodParams, CoreMethods } from '@getpara/web-sdk';
|
|
2
|
-
import {
|
|
1
|
+
import { CoreMethodName, CoreMethodParams, CoreMethods, InternalAction, InternalMethodName, InternalMethodParams, InternalMethods } from '@getpara/web-sdk';
|
|
2
|
+
import { CoreMethodMutationHook, CoreMethodMutationStateHook, InternalMethodMutationHook } from '../../types/utils.js';
|
|
3
3
|
import { CoreAction } from '../../actions/utils.js';
|
|
4
|
-
export declare function
|
|
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>;
|
|
@@ -0,0 +1,90 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
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">;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
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
|
+
};
|