@getpara/react-sdk 1.6.1-dev.0 → 1.7.1
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/{modal/components/AddFunds/MoonPayEmbed.js → MoonPayEmbed-Q2HP2BFI.js} +3 -1
- 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 +6659 -6
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.d.ts +1 -0
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +2 -1
- package/dist/modal/components/common.d.ts +4 -0
- package/dist/modal/index.d.ts +1 -0
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +13 -0
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +11 -0
- package/dist/modal/providers/ExternalWalletContext.d.ts +15 -1
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +11 -0
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +2 -0
- package/dist/modal/types/commonTypes.d.ts +12 -2
- package/dist/modal/types/externalWallets.d.ts +2 -0
- package/dist/modal/types/modalProps.d.ts +6 -0
- package/dist/modal/utils/steps.d.ts +2 -0
- package/dist/provider/utils/constants.d.ts +5 -0
- package/package.json +5 -5
- package/dist/modal/ParaModal.js +0 -337
- package/dist/modal/components/Account/Account.js +0 -69
- package/dist/modal/components/AddFunds/AddFunds.js +0 -220
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -72
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -43
- package/dist/modal/components/AddFunds/index.js +0 -4
- package/dist/modal/components/AuthInput/AuthInput.js +0 -283
- package/dist/modal/components/AuthInput/countryCodes.js +0 -42
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -33
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -253
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -37
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -113
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -33
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -18
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -10
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -18
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -44
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -52
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -93
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -29
- package/dist/modal/components/Body/Body.js +0 -304
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -94
- package/dist/modal/components/ChainSwitch/config.js +0 -17
- package/dist/modal/components/Controls/Controls.js +0 -74
- package/dist/modal/components/Controls/Selects.js +0 -213
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -151
- package/dist/modal/components/ExternalWalletStep/config.js +0 -17
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -172
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -123
- package/dist/modal/components/Footer/Footer.js +0 -93
- package/dist/modal/components/Header/Header.js +0 -43
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -50
- package/dist/modal/components/Hero/Hero.js +0 -122
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -55
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -28
- package/dist/modal/components/ModalContent/ModalContent.js +0 -310
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -81
- package/dist/modal/components/OAuth/OAuth.js +0 -153
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -139
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -23
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -77
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -101
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -141
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -88
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -24
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -159
- package/dist/modal/components/Waiting/Waiting.js +0 -17
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -34
- package/dist/modal/components/WalletCard/WalletCard.js +0 -127
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -52
- package/dist/modal/components/common.js +0 -83
- package/dist/modal/components/index.js +0 -2
- package/dist/modal/constants/constants.js +0 -111
- package/dist/modal/constants/defaults.js +0 -10
- package/dist/modal/constants/oAuthLogos.js +0 -24
- package/dist/modal/hooks/useActiveWallet.js +0 -15
- package/dist/modal/hooks/useCreateAccount.js +0 -72
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -39
- package/dist/modal/hooks/useGoBack.js +0 -35
- package/dist/modal/hooks/useSetLoginURLs.js +0 -45
- package/dist/modal/index.js +0 -32
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -34
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -38
- package/dist/modal/providers/ExternalWalletContext.js +0 -275
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -19
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -20
- package/dist/modal/stores/index.js +0 -4
- package/dist/modal/stores/modal/actions.js +0 -70
- package/dist/modal/stores/modal/useModalStore.js +0 -65
- package/dist/modal/stores/theme/actions.js +0 -28
- package/dist/modal/stores/theme/useThemeStore.js +0 -21
- package/dist/modal/stores/userInfo/actions.js +0 -30
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -31
- package/dist/modal/types/modalProps.js +0 -12
- package/dist/modal/utils/authLayoutHelpers.js +0 -8
- package/dist/modal/utils/getMailtoLink.js +0 -10
- package/dist/modal/utils/getTileButtonFlex.js +0 -20
- package/dist/modal/utils/openPopup.js +0 -60
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -31
- package/dist/modal/utils/steps.js +0 -228
- package/dist/modal/utils/stringFormatters.js +0 -14
- package/dist/modal/utils/validateOnRampConfig.js +0 -32
- package/dist/provider/ParaProvider.js +0 -22
- package/dist/provider/actions/checkIfUserExists.js +0 -21
- package/dist/provider/actions/createUser.js +0 -26
- package/dist/provider/actions/getAccount.js +0 -22
- package/dist/provider/actions/getWallet.js +0 -14
- package/dist/provider/actions/initiateLogin.js +0 -20
- package/dist/provider/actions/keepSessionAlive.js +0 -20
- package/dist/provider/actions/logout.js +0 -17
- package/dist/provider/actions/signMessage.js +0 -20
- package/dist/provider/actions/signTransaction.js +0 -20
- package/dist/provider/actions/waitForAccountCreation.js +0 -21
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -21
- package/dist/provider/hooks/index.js +0 -4
- package/dist/provider/hooks/mutations/index.js +0 -24
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
- package/dist/provider/hooks/mutations/useLogout.js +0 -30
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -33
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -33
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- package/dist/provider/hooks/queries/index.js +0 -8
- package/dist/provider/hooks/queries/useAccount.js +0 -21
- package/dist/provider/hooks/queries/useWallet.js +0 -22
- package/dist/provider/hooks/utils/index.js +0 -10
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -74
- package/dist/provider/hooks/utils/useClient.js +0 -10
- package/dist/provider/hooks/utils/useEventListeners.js +0 -105
- package/dist/provider/hooks/utils/useInternalClient.js +0 -10
- package/dist/provider/hooks/utils/useModal.js +0 -17
- package/dist/provider/hooks/utils/useWalletState.js +0 -33
- package/dist/provider/index.js +0 -8
- package/dist/provider/stores/getters.js +0 -13
- package/dist/provider/stores/slices/client.js +0 -9
- package/dist/provider/stores/slices/index.js +0 -4
- package/dist/provider/stores/slices/modal.js +0 -9
- package/dist/provider/stores/slices/wallet.js +0 -11
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.js +0 -27
- package/dist/provider/types/provider.js +0 -1
- package/dist/provider/types/query.js +0 -1
- package/dist/provider/types/utils.js +0 -1
- package/dist/provider/utils/renameMutations.js +0 -16
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const waitForLoginAndSetup = (para, args) => __async(void 0, null, function* () {
|
|
6
|
-
if (!para) {
|
|
7
|
-
throw new Error("no para instance");
|
|
8
|
-
}
|
|
9
|
-
if (!args) {
|
|
10
|
-
throw new Error("no valid args passed to waitForLoginAndSetup");
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
const resp = yield para.waitForLoginAndSetup(args);
|
|
14
|
-
if (resp.isError) {
|
|
15
|
-
throw new Error("error during waitForLoginAndSetup");
|
|
16
|
-
}
|
|
17
|
-
return resp;
|
|
18
|
-
} catch (e) {
|
|
19
|
-
throw new Error(e);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
export {
|
|
23
|
-
waitForLoginAndSetup
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const waitForPasskeyAndCreateWallet = (para) => __async(void 0, null, function* () {
|
|
6
|
-
if (!para) {
|
|
7
|
-
throw new Error("no para instance");
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
const resp = yield para.waitForPasskeyAndCreateWallet();
|
|
11
|
-
if (!resp) {
|
|
12
|
-
throw new Error("error during waitForAccountCreation");
|
|
13
|
-
}
|
|
14
|
-
return resp;
|
|
15
|
-
} catch (e) {
|
|
16
|
-
throw new Error(e);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
export {
|
|
20
|
-
waitForPasskeyAndCreateWallet
|
|
21
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useWaitForLoginAndSetup } from "./useWaitForLoginAndSetup.js";
|
|
4
|
-
import { useWaitForAccountCreation } from "./useWaitForAccountCreation.js";
|
|
5
|
-
import { useWaitForPasskeyAndCreateWallet } from "./useWaitForPasskeyAndCreateWallet.js";
|
|
6
|
-
import { useCreateUser } from "./useCreateUser.js";
|
|
7
|
-
import { useCheckIfUserExists } from "./useCheckIfUserExists.js";
|
|
8
|
-
import { useInitiateLogin } from "./useInitiateLogin.js";
|
|
9
|
-
import { useLogout } from "./useLogout.js";
|
|
10
|
-
import { useKeepSessionAlive } from "./useKeepSessionAlive.js";
|
|
11
|
-
import { useSignMessage } from "./useSignMessage.js";
|
|
12
|
-
import { useSignTransaction } from "./useSignTransaction.js";
|
|
13
|
-
export {
|
|
14
|
-
useCheckIfUserExists,
|
|
15
|
-
useCreateUser,
|
|
16
|
-
useInitiateLogin,
|
|
17
|
-
useKeepSessionAlive,
|
|
18
|
-
useLogout,
|
|
19
|
-
useSignMessage,
|
|
20
|
-
useSignTransaction,
|
|
21
|
-
useWaitForAccountCreation,
|
|
22
|
-
useWaitForLoginAndSetup,
|
|
23
|
-
useWaitForPasskeyAndCreateWallet
|
|
24
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { checkIfUserExists } from "../../actions/checkIfUserExists.js";
|
|
8
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
9
|
-
const useCheckIfUserExists = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const mutation = useMutation({
|
|
12
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
13
|
-
return yield checkIfUserExists(client, args);
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
return renameMutations(
|
|
17
|
-
mutation,
|
|
18
|
-
"checkIfUserExists"
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
useCheckIfUserExists
|
|
23
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { createUser } from "../../actions/createUser.js";
|
|
8
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
9
|
-
const useCreateUser = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const mutation = useMutation({
|
|
12
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
13
|
-
return yield createUser(client, args);
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
return renameMutations(mutation, "createUser");
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
useCreateUser
|
|
20
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { initiateLogin } from "../../actions/initiateLogin.js";
|
|
8
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
9
|
-
const useInitiateLogin = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const mutation = useMutation({
|
|
12
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
13
|
-
return yield initiateLogin(client, args);
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
return renameMutations(
|
|
17
|
-
mutation,
|
|
18
|
-
"initiateLogin"
|
|
19
|
-
);
|
|
20
|
-
};
|
|
21
|
-
export {
|
|
22
|
-
useInitiateLogin
|
|
23
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { keepSessionAlive } from "../../actions/keepSessionAlive.js";
|
|
8
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
9
|
-
const useKeepSessionAlive = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const mutation = useMutation({
|
|
12
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
13
|
-
return yield keepSessionAlive(client);
|
|
14
|
-
})
|
|
15
|
-
});
|
|
16
|
-
return renameMutations(mutation, "keepSessionAlive");
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
useKeepSessionAlive
|
|
20
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { logout } from "../../actions/logout.js";
|
|
8
|
-
import { useStore } from "../../stores/useStore.js";
|
|
9
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
10
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
11
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
12
|
-
const useLogout = () => {
|
|
13
|
-
const client = useClient();
|
|
14
|
-
const queryClient = useQueryClient();
|
|
15
|
-
const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
|
|
16
|
-
const mutation = useMutation({
|
|
17
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
18
|
-
return yield logout(client);
|
|
19
|
-
}),
|
|
20
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
21
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
22
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
23
|
-
clearSelectedWallet();
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
return renameMutations(mutation, "logout");
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useLogout
|
|
30
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
-
import { useMutation } from "@tanstack/react-query";
|
|
8
|
-
import { useClient, useWallet } from "../index.js";
|
|
9
|
-
import { signMessage } from "../../actions/signMessage.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useSignMessage = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const { data: wallet } = useWallet();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
16
|
-
let walletId = args == null ? void 0 : args.walletId;
|
|
17
|
-
if (!walletId) {
|
|
18
|
-
walletId = wallet == null ? void 0 : wallet.id;
|
|
19
|
-
}
|
|
20
|
-
if (!walletId) {
|
|
21
|
-
throw Error("no wallet id found");
|
|
22
|
-
}
|
|
23
|
-
return yield signMessage(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
return renameMutations(
|
|
27
|
-
mutation,
|
|
28
|
-
"signMessage"
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
useSignMessage
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async,
|
|
4
|
-
__spreadProps,
|
|
5
|
-
__spreadValues
|
|
6
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
7
|
-
import { useMutation } from "@tanstack/react-query";
|
|
8
|
-
import { useClient, useWallet } from "../index.js";
|
|
9
|
-
import { signTransaction } from "../../actions/signTransaction.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useSignTransaction = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const { data: wallet } = useWallet();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
16
|
-
let walletId = args == null ? void 0 : args.walletId;
|
|
17
|
-
if (!walletId) {
|
|
18
|
-
walletId = wallet == null ? void 0 : wallet.id;
|
|
19
|
-
}
|
|
20
|
-
if (!walletId) {
|
|
21
|
-
throw Error("no wallet id found");
|
|
22
|
-
}
|
|
23
|
-
return yield signTransaction(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
24
|
-
})
|
|
25
|
-
});
|
|
26
|
-
return renameMutations(
|
|
27
|
-
mutation,
|
|
28
|
-
"signTransaction"
|
|
29
|
-
);
|
|
30
|
-
};
|
|
31
|
-
export {
|
|
32
|
-
useSignTransaction
|
|
33
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { waitForAccountCreation } from "../../actions/waitForAccountCreation.js";
|
|
8
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
9
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useWaitForAccountCreation = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
16
|
-
return yield waitForAccountCreation(client);
|
|
17
|
-
}),
|
|
18
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
19
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
20
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
return renameMutations(
|
|
24
|
-
mutation,
|
|
25
|
-
"waitForAccountCreation"
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useWaitForAccountCreation
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { waitForLoginAndSetup } from "../../actions/waitForLoginAndSetup.js";
|
|
8
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
9
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useWaitForLoginAndSetup = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
16
|
-
return yield waitForLoginAndSetup(client, args);
|
|
17
|
-
}),
|
|
18
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
19
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
20
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
return renameMutations(
|
|
24
|
-
mutation,
|
|
25
|
-
"waitForLoginAndSetup"
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useWaitForLoginAndSetup
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { waitForPasskeyAndCreateWallet } from "../../actions/waitForPasskeyAndCreateWallet.js";
|
|
8
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
9
|
-
import { WALLET_BASE_KEY } from "../queries/useWallet.js";
|
|
10
|
-
import { renameMutations } from "../../utils/renameMutations.js";
|
|
11
|
-
const useWaitForPasskeyAndCreateWallet = () => {
|
|
12
|
-
const client = useClient();
|
|
13
|
-
const queryClient = useQueryClient();
|
|
14
|
-
const mutation = useMutation({
|
|
15
|
-
mutationFn: () => __async(void 0, null, function* () {
|
|
16
|
-
return yield waitForPasskeyAndCreateWallet(client);
|
|
17
|
-
}),
|
|
18
|
-
onSettled: () => __async(void 0, null, function* () {
|
|
19
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
20
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
21
|
-
})
|
|
22
|
-
});
|
|
23
|
-
return renameMutations(
|
|
24
|
-
mutation,
|
|
25
|
-
"waitForPasskeyAndCreateWallet"
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
useWaitForPasskeyAndCreateWallet
|
|
30
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../../chunk-MMUBH76A.js";
|
|
5
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6
|
-
import { useClient } from "../index.js";
|
|
7
|
-
import { getAccount } from "../../actions/getAccount.js";
|
|
8
|
-
const ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
|
|
9
|
-
const useAccount = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
return useQuery({
|
|
12
|
-
queryKey: [ACCOUNT_BASE_KEY, client == null ? void 0 : client.getUserId()],
|
|
13
|
-
queryFn: () => __async(void 0, null, function* () {
|
|
14
|
-
return yield getAccount(client);
|
|
15
|
-
})
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
ACCOUNT_BASE_KEY,
|
|
20
|
-
useAccount
|
|
21
|
-
};
|
|
@@ -1,22 +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
|
-
const WALLET_BASE_KEY = "PARA_WALLET";
|
|
9
|
-
const useWallet = () => {
|
|
10
|
-
const client = useClient();
|
|
11
|
-
const { selectedWallet } = useWalletState();
|
|
12
|
-
return useQuery({
|
|
13
|
-
queryKey: [WALLET_BASE_KEY, client == null ? void 0 : client.getUserId(), selectedWallet.id, selectedWallet.type],
|
|
14
|
-
queryFn: () => __async(void 0, null, function* () {
|
|
15
|
-
return yield getWallet(client, selectedWallet);
|
|
16
|
-
})
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export {
|
|
20
|
-
WALLET_BASE_KEY,
|
|
21
|
-
useWallet
|
|
22
|
-
};
|
|
@@ -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 { data: account } = 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 ((account == null ? void 0 : account.isConnected) && !client.isUsingExternalWallet()) {
|
|
22
|
-
setupSessionMonitoring();
|
|
23
|
-
} else {
|
|
24
|
-
clearSessionMonitoring();
|
|
25
|
-
}
|
|
26
|
-
return () => clearSessionMonitoring();
|
|
27
|
-
}, [client, account, disabled]);
|
|
28
|
-
const getSessionExpiry = () => __async(void 0, null, function* () {
|
|
29
|
-
try {
|
|
30
|
-
const sessionCookie = yield 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
|
-
};
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
-
import { useClient, useWalletState } from "../index.js";
|
|
6
|
-
import {
|
|
7
|
-
ParaEvent
|
|
8
|
-
} from "@getpara/web-sdk";
|
|
9
|
-
import { ACCOUNT_BASE_KEY } from "../queries/useAccount.js";
|
|
10
|
-
import { useStore } from "../../stores/useStore.js";
|
|
11
|
-
import { WALLET_BASE_KEY } from "../../hooks/queries/useWallet.js";
|
|
12
|
-
const useEventListeners = ({
|
|
13
|
-
onLogin,
|
|
14
|
-
onLogout,
|
|
15
|
-
onAccountSetup,
|
|
16
|
-
onAccountCreation,
|
|
17
|
-
onSignMessage,
|
|
18
|
-
onSignTransaction,
|
|
19
|
-
onWalletCreated,
|
|
20
|
-
onPregenWalletClaimed,
|
|
21
|
-
onExternalWalletChange,
|
|
22
|
-
onWalletsChange
|
|
23
|
-
} = {}) => {
|
|
24
|
-
const queryClient = useQueryClient();
|
|
25
|
-
const client = useClient();
|
|
26
|
-
const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
|
|
27
|
-
const { selectedWallet, setSelectedWallet } = useWalletState();
|
|
28
|
-
const loginListener = (event) => {
|
|
29
|
-
loginOrSetupListener();
|
|
30
|
-
onLogin == null ? void 0 : onLogin(event);
|
|
31
|
-
};
|
|
32
|
-
const accountSetupListener = (event) => {
|
|
33
|
-
loginOrSetupListener();
|
|
34
|
-
onAccountSetup == null ? void 0 : onAccountSetup(event);
|
|
35
|
-
};
|
|
36
|
-
const loginOrSetupListener = () => {
|
|
37
|
-
queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
38
|
-
queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
39
|
-
};
|
|
40
|
-
const accountCreationListener = (event) => {
|
|
41
|
-
onAccountCreation == null ? void 0 : onAccountCreation(event);
|
|
42
|
-
};
|
|
43
|
-
const logoutListener = (event) => {
|
|
44
|
-
queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
45
|
-
clearSelectedWallet();
|
|
46
|
-
onLogout == null ? void 0 : onLogout(event);
|
|
47
|
-
};
|
|
48
|
-
const signMessageListener = (event) => {
|
|
49
|
-
onSignMessage == null ? void 0 : onSignMessage(event);
|
|
50
|
-
};
|
|
51
|
-
const signTransactionListener = (event) => {
|
|
52
|
-
onSignTransaction == null ? void 0 : onSignTransaction(event);
|
|
53
|
-
};
|
|
54
|
-
const walletChangeListener = (event) => {
|
|
55
|
-
updateSelectedWallet();
|
|
56
|
-
onWalletsChange == null ? void 0 : onWalletsChange(event);
|
|
57
|
-
};
|
|
58
|
-
const externalWalletChangeListener = (event) => {
|
|
59
|
-
updateSelectedWallet();
|
|
60
|
-
onExternalWalletChange == null ? void 0 : onExternalWalletChange(event);
|
|
61
|
-
};
|
|
62
|
-
const walletCreatedListener = (event) => {
|
|
63
|
-
onWalletCreated == null ? void 0 : onWalletCreated(event);
|
|
64
|
-
};
|
|
65
|
-
const pregenWalletClaimedListener = (event) => {
|
|
66
|
-
onPregenWalletClaimed == null ? void 0 : onPregenWalletClaimed(event);
|
|
67
|
-
};
|
|
68
|
-
const updateSelectedWallet = () => {
|
|
69
|
-
if (!client) {
|
|
70
|
-
clearSelectedWallet();
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
if (!(selectedWallet == null ? void 0 : selectedWallet.id) || !client.findWallet(selectedWallet == null ? void 0 : selectedWallet.id)) {
|
|
74
|
-
const defaultWallet = client.findWallet(void 0, void 0, { forbidPregen: true });
|
|
75
|
-
setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
useEffect(() => {
|
|
79
|
-
window.addEventListener(ParaEvent.LOGIN_EVENT, loginListener);
|
|
80
|
-
window.addEventListener(ParaEvent.ACCOUNT_SETUP_EVENT, accountSetupListener);
|
|
81
|
-
window.addEventListener(ParaEvent.ACCOUNT_CREATION_EVENT, accountCreationListener);
|
|
82
|
-
window.addEventListener(ParaEvent.LOGOUT_EVENT, logoutListener);
|
|
83
|
-
window.addEventListener(ParaEvent.SIGN_MESSAGE_EVENT, signMessageListener);
|
|
84
|
-
window.addEventListener(ParaEvent.SIGN_TRANSACTION_EVENT, signTransactionListener);
|
|
85
|
-
window.addEventListener(ParaEvent.WALLETS_CHANGE_EVENT, walletChangeListener);
|
|
86
|
-
window.addEventListener(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, externalWalletChangeListener);
|
|
87
|
-
window.addEventListener(ParaEvent.WALLET_CREATED, walletCreatedListener);
|
|
88
|
-
window.addEventListener(ParaEvent.PREGEN_WALLET_CLAIMED, pregenWalletClaimedListener);
|
|
89
|
-
return () => {
|
|
90
|
-
window.removeEventListener(ParaEvent.LOGIN_EVENT, loginListener);
|
|
91
|
-
window.removeEventListener(ParaEvent.ACCOUNT_SETUP_EVENT, accountSetupListener);
|
|
92
|
-
window.removeEventListener(ParaEvent.ACCOUNT_CREATION_EVENT, accountCreationListener);
|
|
93
|
-
window.removeEventListener(ParaEvent.LOGOUT_EVENT, logoutListener);
|
|
94
|
-
window.removeEventListener(ParaEvent.SIGN_MESSAGE_EVENT, signMessageListener);
|
|
95
|
-
window.removeEventListener(ParaEvent.SIGN_TRANSACTION_EVENT, signTransactionListener);
|
|
96
|
-
window.removeEventListener(ParaEvent.WALLETS_CHANGE_EVENT, walletChangeListener);
|
|
97
|
-
window.removeEventListener(ParaEvent.EXTERNAL_WALLET_CHANGE_EVENT, externalWalletChangeListener);
|
|
98
|
-
window.removeEventListener(ParaEvent.WALLET_CREATED, walletCreatedListener);
|
|
99
|
-
window.removeEventListener(ParaEvent.PREGEN_WALLET_CLAIMED, pregenWalletClaimedListener);
|
|
100
|
-
};
|
|
101
|
-
}, [client]);
|
|
102
|
-
};
|
|
103
|
-
export {
|
|
104
|
-
useEventListeners
|
|
105
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import "../../../chunk-MMUBH76A.js";
|
|
3
|
-
import { useStore } from "../../stores/useStore.js";
|
|
4
|
-
const useModal = () => {
|
|
5
|
-
const isOpen = useStore((state) => state.isOpen);
|
|
6
|
-
const setIsOpen = useStore((state) => state.setIsOpen);
|
|
7
|
-
const openModal = () => {
|
|
8
|
-
setIsOpen(true);
|
|
9
|
-
};
|
|
10
|
-
const closeModal = () => {
|
|
11
|
-
setIsOpen(false);
|
|
12
|
-
};
|
|
13
|
-
return { isOpen, openModal, closeModal };
|
|
14
|
-
};
|
|
15
|
-
export {
|
|
16
|
-
useModal
|
|
17
|
-
};
|