@getpara/react-sdk 1.8.0 → 2.0.0-alpha.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/{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/cli/cli.mjs +40 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6499 -6
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/modal/components/AuthInput/AuthInput.d.ts +1 -1
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.d.ts +4 -4
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.d.ts +1 -1
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.d.ts +1 -1
- package/dist/modal/components/ChainSwitch/ChainSwitch.d.ts +1 -1
- package/dist/modal/components/Controls/Selects.d.ts +1 -1
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.d.ts +1 -1
- package/dist/modal/components/Footer/Footer.d.ts +1 -1
- package/dist/modal/components/WalletCard/WalletCard.d.ts +2 -2
- package/dist/modal/components/common.d.ts +7 -7
- package/dist/modal/constants/constants.d.ts +1 -1
- package/dist/modal/index.d.ts +0 -2
- package/dist/modal/stores/index.d.ts +0 -2
- package/dist/modal/stores/modal/useModalStore.d.ts +22 -20
- package/dist/modal/types/commonTypes.d.ts +4 -9
- package/dist/modal/types/externalWallets.d.ts +0 -2
- package/dist/modal/types/modalProps.d.ts +1 -33
- package/dist/modal/utils/authLayoutHelpers.d.ts +2 -2
- package/dist/modal/utils/getTileButtonFlex.d.ts +1 -1
- package/dist/modal/utils/isPasskeySupported.d.ts +1 -0
- package/dist/modal/utils/openPopup.d.ts +2 -2
- package/dist/modal/utils/stringFormatters.d.ts +0 -1
- package/dist/provider/ParaProvider.d.ts +3 -1
- package/dist/provider/actions/getAccount.d.ts +19 -7
- package/dist/provider/actions/getWallet.d.ts +1 -1
- package/dist/provider/actions/index.d.ts +25 -0
- package/dist/provider/actions/utils.d.ts +3 -0
- package/dist/provider/components/CosmosWalletWrapper.d.ts +11 -0
- package/dist/provider/components/EvmWalletWrapper.d.ts +12 -0
- package/dist/provider/components/ExternalWalletWrapper.d.ts +8 -0
- package/dist/provider/components/SolanaWalletWrapper.d.ts +9 -0
- package/dist/provider/external/getParaCosmosConnector.d.ts +7 -0
- package/dist/provider/external/getParaEvmConnector.d.ts +7 -0
- package/dist/provider/external/getParaSolanaConnector.d.ts +7 -0
- package/dist/provider/external/stubs/CosmosExternalWalletContextStub.d.ts +12 -0
- package/dist/provider/external/stubs/EvmExternalWalletContextStub.d.ts +3 -0
- package/dist/provider/external/stubs/SolanaExternalWalletContextStub.d.ts +8 -0
- package/dist/provider/hooks/mutations/index.d.ts +25 -10
- package/dist/provider/hooks/mutations/utils.d.ts +4 -0
- package/dist/provider/hooks/queries/index.d.ts +0 -1
- package/dist/provider/hooks/queries/useAccount.d.ts +1 -6
- package/dist/provider/hooks/queries/useWallet.d.ts +1 -1
- package/dist/provider/hooks/utils/useWalletState.d.ts +3 -2
- package/dist/provider/index.d.ts +1 -0
- package/dist/provider/providers/AuthProvider.d.ts +31 -0
- package/dist/provider/providers/CosmosExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/EvmExternalWalletProvider.d.ts +7 -0
- package/dist/provider/providers/ExternalWalletProvider.d.ts +73 -0
- package/dist/provider/providers/SolanaExternalWalletProvider.d.ts +7 -0
- package/dist/provider/stores/getters.d.ts +3 -3
- package/dist/provider/stores/setters.d.ts +1 -0
- package/dist/provider/stores/slices/config.d.ts +3 -0
- package/dist/provider/stores/slices/externalWallets.d.ts +3 -0
- package/dist/provider/stores/slices/index.d.ts +1 -0
- package/dist/provider/stores/types.d.ts +46 -3
- package/dist/provider/types/externalWalletProviders.d.ts +12 -0
- package/dist/provider/types/provider.d.ts +119 -16
- package/dist/provider/types/utils.d.ts +16 -0
- package/dist/provider/utils/paraConfigTypeGuards.d.ts +7 -0
- package/dist/provider/utils/renameMutations.d.ts +3 -0
- package/package.json +19 -7
- package/dist/modal/ParaModal.js +0 -362
- package/dist/modal/components/Account/Account.js +0 -77
- 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 -55
- 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 -308
- 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 -234
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -140
- package/dist/modal/components/ExternalWalletStep/config.js +0 -17
- package/dist/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.js +0 -96
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -172
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.d.ts +0 -8
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -124
- 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 -116
- 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 -324
- 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 -96
- 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.d.ts +0 -1
- package/dist/modal/hooks/useActiveWallet.js +0 -15
- package/dist/modal/hooks/useCreateAccount.d.ts +0 -4
- package/dist/modal/hooks/useCreateAccount.js +0 -72
- package/dist/modal/hooks/useEmbeddedExternalConnection.d.ts +0 -1
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -54
- package/dist/modal/hooks/useGoBack.js +0 -42
- package/dist/modal/hooks/useSetLoginURLs.d.ts +0 -8
- package/dist/modal/hooks/useSetLoginURLs.js +0 -49
- package/dist/modal/hooks/useWalletBalance.d.ts +0 -4
- package/dist/modal/hooks/useWalletBalance.js +0 -47
- package/dist/modal/index.js +0 -33
- package/dist/modal/providers/CosmosExternalWalletContextStub.d.ts +0 -42
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -38
- package/dist/modal/providers/EvmExternalWalletContextStub.d.ts +0 -46
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -55
- package/dist/modal/providers/ExternalWalletContext.d.ts +0 -92
- package/dist/modal/providers/ExternalWalletContext.js +0 -394
- package/dist/modal/providers/SolanaExternalWalletContextStub.d.ts +0 -32
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -32
- package/dist/modal/stores/externalWalletProvider/actions.d.ts +0 -3
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -10
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.d.ts +0 -22
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -21
- 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.d.ts +0 -3
- package/dist/modal/stores/theme/actions.js +0 -28
- package/dist/modal/stores/theme/useThemeStore.d.ts +0 -20
- package/dist/modal/stores/theme/useThemeStore.js +0 -21
- package/dist/modal/stores/userInfo/actions.d.ts +0 -3
- package/dist/modal/stores/userInfo/actions.js +0 -30
- package/dist/modal/stores/userInfo/useUserInfoStore.d.ts +0 -19
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -17
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -32
- 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 -232
- package/dist/modal/utils/stringFormatters.js +0 -19
- package/dist/modal/utils/validateOnRampConfig.js +0 -32
- package/dist/package.json +0 -6
- package/dist/provider/ParaProvider.js +0 -22
- package/dist/provider/actions/checkIfUserExists.d.ts +0 -9
- package/dist/provider/actions/checkIfUserExists.js +0 -21
- package/dist/provider/actions/createUser.d.ts +0 -12
- 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/getWalletBalance.d.ts +0 -2
- package/dist/provider/actions/getWalletBalance.js +0 -14
- package/dist/provider/actions/initiateLogin.d.ts +0 -4
- package/dist/provider/actions/initiateLogin.js +0 -20
- package/dist/provider/actions/keepSessionAlive.d.ts +0 -2
- package/dist/provider/actions/keepSessionAlive.js +0 -20
- package/dist/provider/actions/logout.d.ts +0 -2
- package/dist/provider/actions/logout.js +0 -17
- package/dist/provider/actions/signMessage.d.ts +0 -8
- package/dist/provider/actions/signMessage.js +0 -20
- package/dist/provider/actions/signTransaction.d.ts +0 -8
- package/dist/provider/actions/signTransaction.js +0 -20
- package/dist/provider/actions/waitForAccountCreation.d.ts +0 -2
- package/dist/provider/actions/waitForAccountCreation.js +0 -21
- package/dist/provider/actions/waitForLoginAndSetup.d.ts +0 -6
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -24
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.d.ts +0 -2
- 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.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.d.ts +0 -13
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -20
- package/dist/provider/hooks/mutations/useInitiateLogin.d.ts +0 -14
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.d.ts +0 -12
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -20
- package/dist/provider/hooks/mutations/useLogout.d.ts +0 -12
- package/dist/provider/hooks/mutations/useLogout.js +0 -30
- package/dist/provider/hooks/mutations/useSignMessage.d.ts +0 -15
- package/dist/provider/hooks/mutations/useSignMessage.js +0 -39
- package/dist/provider/hooks/mutations/useSignTransaction.d.ts +0 -14
- package/dist/provider/hooks/mutations/useSignTransaction.js +0 -39
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.d.ts +0 -12
- package/dist/provider/hooks/mutations/useWaitForAccountCreation.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.d.ts +0 -14
- package/dist/provider/hooks/mutations/useWaitForLoginAndSetup.js +0 -30
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.d.ts +0 -13
- package/dist/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.js +0 -30
- package/dist/provider/hooks/queries/index.js +0 -10
- package/dist/provider/hooks/queries/useAccount.js +0 -21
- package/dist/provider/hooks/queries/useWallet.js +0 -22
- package/dist/provider/hooks/queries/useWalletBalance.d.ts +0 -7
- package/dist/provider/hooks/queries/useWalletBalance.js +0 -26
- 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 -13
- 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/constants.d.ts +0 -5
- package/dist/provider/utils/constants.js +0 -11
- package/dist/provider/utils/renameMutations.js +0 -16
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
import { CreateUserType } from "./createUser.js";
|
|
6
|
-
const checkIfUserExists = (para, args) => __async(void 0, null, function* () {
|
|
7
|
-
if (!para) {
|
|
8
|
-
throw new Error("no para instance");
|
|
9
|
-
}
|
|
10
|
-
if (!args) {
|
|
11
|
-
throw new Error("no valid args passed to checkIfUserExists");
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
return yield args.type === CreateUserType.EMAIL ? para.checkIfUserExists({ email: args.identifier }) : para.checkIfUserExistsByPhone({ phone: args.identifier, countryCode: args.countryCode });
|
|
15
|
-
} catch (e) {
|
|
16
|
-
throw new Error(e);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
export {
|
|
20
|
-
checkIfUserExists
|
|
21
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
2
|
-
import { CountryCallingCode } from 'libphonenumber-js';
|
|
3
|
-
export declare enum CreateUserType {
|
|
4
|
-
EMAIL = "EMAIL",
|
|
5
|
-
PHONE = "PHONE"
|
|
6
|
-
}
|
|
7
|
-
export interface CreateUserArgs {
|
|
8
|
-
type: CreateUserType;
|
|
9
|
-
identifier: string;
|
|
10
|
-
countryCode?: CountryCallingCode;
|
|
11
|
-
}
|
|
12
|
-
export declare const createUser: (para?: ParaWeb, args?: CreateUserArgs) => Promise<void>;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
var CreateUserType = /* @__PURE__ */ ((CreateUserType2) => {
|
|
6
|
-
CreateUserType2["EMAIL"] = "EMAIL";
|
|
7
|
-
CreateUserType2["PHONE"] = "PHONE";
|
|
8
|
-
return CreateUserType2;
|
|
9
|
-
})(CreateUserType || {});
|
|
10
|
-
const createUser = (para, args) => __async(void 0, null, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error("no para instance");
|
|
13
|
-
}
|
|
14
|
-
if (!args) {
|
|
15
|
-
throw new Error("no valid args passed to createUser");
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
yield args.type === "EMAIL" /* EMAIL */ ? para.createUser({ email: args.identifier }) : para.createUserByPhone({ phone: args.identifier, countryCode: args.countryCode });
|
|
19
|
-
} catch (e) {
|
|
20
|
-
throw new Error(e);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
export {
|
|
24
|
-
CreateUserType,
|
|
25
|
-
createUser
|
|
26
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const getAccount = (para) => __async(void 0, null, function* () {
|
|
6
|
-
const isLoggedIn = yield para == null ? void 0 : para.isFullyLoggedIn();
|
|
7
|
-
const resp = {
|
|
8
|
-
isConnected: !!isLoggedIn,
|
|
9
|
-
email: void 0,
|
|
10
|
-
phone: void 0,
|
|
11
|
-
wallets: void 0
|
|
12
|
-
};
|
|
13
|
-
if (para && resp.isConnected) {
|
|
14
|
-
resp.email = para.getEmail();
|
|
15
|
-
resp.phone = para.getPhoneNumber();
|
|
16
|
-
resp.wallets = para.getWallets();
|
|
17
|
-
}
|
|
18
|
-
return resp;
|
|
19
|
-
});
|
|
20
|
-
export {
|
|
21
|
-
getAccount
|
|
22
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const getWallet = (para, selectedWallet) => __async(void 0, null, function* () {
|
|
6
|
-
const isLoggedIn = yield para == null ? void 0 : para.isFullyLoggedIn();
|
|
7
|
-
if (!para || !isLoggedIn) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return para.findWallet(selectedWallet == null ? void 0 : selectedWallet.id, selectedWallet == null ? void 0 : selectedWallet.type);
|
|
11
|
-
});
|
|
12
|
-
export {
|
|
13
|
-
getWallet
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const getWalletBalance = (para, args) => __async(void 0, null, function* () {
|
|
6
|
-
const isLoggedIn = yield para == null ? void 0 : para.isFullyLoggedIn();
|
|
7
|
-
if (!para || !isLoggedIn) {
|
|
8
|
-
return null;
|
|
9
|
-
}
|
|
10
|
-
return para.getWalletBalance(args);
|
|
11
|
-
});
|
|
12
|
-
export {
|
|
13
|
-
getWalletBalance
|
|
14
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { Auth } from '@getpara/user-management-client';
|
|
2
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
3
|
-
export type InitiateLoginArgs = Auth;
|
|
4
|
-
export declare const initiateLogin: (para?: ParaWeb, args?: Auth) => Promise<Set<import("@getpara/user-management-client").AuthMethod>>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const initiateLogin = (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 initiateLogin");
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
return yield para.initiateUserLoginV2(args);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
throw new Error(e);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
initiateLogin
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const keepSessionAlive = (para) => __async(void 0, null, function* () {
|
|
6
|
-
if (!para) {
|
|
7
|
-
throw new Error("no para instance");
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
const resp = yield para.keepSessionAlive();
|
|
11
|
-
if (!resp) {
|
|
12
|
-
throw new Error("session expired");
|
|
13
|
-
}
|
|
14
|
-
} catch (e) {
|
|
15
|
-
throw new Error(e);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
keepSessionAlive
|
|
20
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const logout = (para) => __async(void 0, null, function* () {
|
|
6
|
-
if (!para) {
|
|
7
|
-
throw new Error("no para instance");
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
yield para.logout();
|
|
11
|
-
} catch (e) {
|
|
12
|
-
throw new Error(e);
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export {
|
|
16
|
-
logout
|
|
17
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
2
|
-
export interface SignMessageArgs {
|
|
3
|
-
walletId: string;
|
|
4
|
-
messageBase64: string;
|
|
5
|
-
timeoutMs?: number;
|
|
6
|
-
cosmosSignDocBase64?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const signMessage: (para?: ParaWeb, args?: SignMessageArgs) => Promise<import("@getpara/web-sdk").FullSignatureRes>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const signMessage = (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 signMessage");
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
return yield para.signMessage(args);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
throw new Error(e);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
signMessage
|
|
20
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
2
|
-
export interface SignTransactionArgs {
|
|
3
|
-
walletId: string;
|
|
4
|
-
rlpEncodedTxBase64: string;
|
|
5
|
-
chainId: string;
|
|
6
|
-
timeoutMs?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const signTransaction: (para?: ParaWeb, args?: SignTransactionArgs) => Promise<import("@getpara/web-sdk").FullSignatureRes>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const signTransaction = (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 signTransaction");
|
|
11
|
-
}
|
|
12
|
-
try {
|
|
13
|
-
return yield para.signTransaction(args);
|
|
14
|
-
} catch (e) {
|
|
15
|
-
throw new Error(e);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
export {
|
|
19
|
-
signTransaction
|
|
20
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import {
|
|
3
|
-
__async
|
|
4
|
-
} from "../../chunk-MMUBH76A.js";
|
|
5
|
-
const waitForAccountCreation = (para) => __async(void 0, null, function* () {
|
|
6
|
-
if (!para) {
|
|
7
|
-
throw new Error("no para instance");
|
|
8
|
-
}
|
|
9
|
-
try {
|
|
10
|
-
const isComplete = yield para.waitForAccountCreation();
|
|
11
|
-
if (!isComplete) {
|
|
12
|
-
throw new Error("error during waitForAccountCreation");
|
|
13
|
-
}
|
|
14
|
-
return isComplete;
|
|
15
|
-
} catch (e) {
|
|
16
|
-
throw new Error(e);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
export {
|
|
20
|
-
waitForAccountCreation
|
|
21
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import ParaWeb from '@getpara/web-sdk';
|
|
2
|
-
export interface WaitForLoginAndSetupArgs {
|
|
3
|
-
loginWindow?: Window;
|
|
4
|
-
skipSessionRefresh?: boolean;
|
|
5
|
-
}
|
|
6
|
-
export declare const waitForLoginAndSetup: (para?: ParaWeb, args?: WaitForLoginAndSetupArgs) => Promise<import("@getpara/web-sdk").LoginResponse>;
|
|
@@ -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,13 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { CheckIfUserExistsArgs } from '../../actions/checkIfUserExists.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
type UseCheckIfUserExistsReturnType<TData = boolean, TError = Error, TVariables = CheckIfUserExistsArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
6
|
-
checkIfUserExists: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
checkIfUserExistsAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
}>;
|
|
9
|
-
/**
|
|
10
|
-
* Hook for checking is a user exists
|
|
11
|
-
*/
|
|
12
|
-
export declare const useCheckIfUserExists: () => UseCheckIfUserExistsReturnType<boolean, Error, CheckIfUserExistsArgs, unknown>;
|
|
13
|
-
export {};
|
|
@@ -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,13 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { CreateUserArgs } from '../../actions/createUser.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
type UseCreateUserReturnType<TData = void, TError = Error, TVariables = CreateUserArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
6
|
-
createUser: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
createUserAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
}>;
|
|
9
|
-
/**
|
|
10
|
-
* Hook for creating a new user
|
|
11
|
-
*/
|
|
12
|
-
export declare const useCreateUser: () => UseCreateUserReturnType<void, Error, CreateUserArgs, unknown>;
|
|
13
|
-
export {};
|
|
@@ -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,14 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { InitiateLoginArgs } from '../../actions/initiateLogin.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
import { AuthMethod } from '@getpara/web-sdk';
|
|
6
|
-
type UseInitiateLoginReturnType<TData = Set<AuthMethod>, TError = Error, TVariables = InitiateLoginArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
7
|
-
initiateLogin: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
initiateLoginAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* Hook for initiating a user login
|
|
12
|
-
*/
|
|
13
|
-
export declare const useInitiateLogin: () => UseInitiateLoginReturnType<Set<AuthMethod>, Error, InitiateLoginArgs, unknown>;
|
|
14
|
-
export {};
|
|
@@ -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,12 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { Compute } from '../../types/utils.js';
|
|
3
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
4
|
-
type UseKeepSessionAliveReturnType<TData = void, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
5
|
-
keepSessionAlive: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
6
|
-
keepSessionAliveAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Hook for keeping a session alive
|
|
10
|
-
*/
|
|
11
|
-
export declare const useKeepSessionAlive: () => UseKeepSessionAliveReturnType<void, Error, void, unknown>;
|
|
12
|
-
export {};
|
|
@@ -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,12 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { Compute } from '../../types/utils.js';
|
|
3
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
4
|
-
type UseLogoutReturnType<TData = void, TError = Error, TVariables = void, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
5
|
-
logout: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
6
|
-
logoutAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
7
|
-
}>;
|
|
8
|
-
/**
|
|
9
|
-
* Hook for logging out a user
|
|
10
|
-
*/
|
|
11
|
-
export declare const useLogout: () => UseLogoutReturnType<void, Error, void, unknown>;
|
|
12
|
-
export {};
|
|
@@ -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,15 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { SignMessageArgs } from '../../actions/signMessage.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
import { FullSignatureRes } from '@getpara/web-sdk';
|
|
6
|
-
type SignMessageMutationArgs = Omit<SignMessageArgs, 'walletId'> & Partial<Pick<SignMessageArgs, 'walletId'>>;
|
|
7
|
-
type UseSignMessageReturnType<TData = FullSignatureRes, TError = Error, TVariables = SignMessageMutationArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
8
|
-
signMessage: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
9
|
-
signMessageAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Hook for signing a message
|
|
13
|
-
*/
|
|
14
|
-
export declare const useSignMessage: () => UseSignMessageReturnType<FullSignatureRes, Error, SignMessageMutationArgs, unknown>;
|
|
15
|
-
export {};
|
|
@@ -1,39 +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
|
-
import { EXTERNAL_WALLET_PACKAGE_BY_TYPE } from "../../utils/constants.js";
|
|
12
|
-
const useSignMessage = () => {
|
|
13
|
-
const client = useClient();
|
|
14
|
-
const { data: wallet } = useWallet();
|
|
15
|
-
const mutation = useMutation({
|
|
16
|
-
mutationFn: (args) => __async(void 0, null, function* () {
|
|
17
|
-
let walletId = args == null ? void 0 : args.walletId;
|
|
18
|
-
if (!walletId) {
|
|
19
|
-
if (wallet.isExternal) {
|
|
20
|
-
throw Error(
|
|
21
|
-
`Cannot sign with Capsule using an external wallet. Try using the methods from ${wallet.type ? EXTERNAL_WALLET_PACKAGE_BY_TYPE[wallet.type] : "the external wallet provider package"}.`
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
walletId = wallet == null ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error("no wallet id found");
|
|
28
|
-
}
|
|
29
|
-
return yield signMessage(client, __spreadProps(__spreadValues({}, args), { walletId }));
|
|
30
|
-
})
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(
|
|
33
|
-
mutation,
|
|
34
|
-
"signMessage"
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
export {
|
|
38
|
-
useSignMessage
|
|
39
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { UseMutateAsyncFunction, UseMutateFunction } from '@tanstack/react-query';
|
|
2
|
-
import { SignTransactionArgs } from '../../actions/signTransaction.js';
|
|
3
|
-
import { Compute } from '../../types/utils.js';
|
|
4
|
-
import { UseMutationReturnType } from '../../types/query.js';
|
|
5
|
-
import { FullSignatureRes } from '@getpara/web-sdk';
|
|
6
|
-
type UseSignTransactionReturnType<TData = FullSignatureRes, TError = Error, TVariables = SignTransactionArgs, TContext = unknown> = Compute<UseMutationReturnType<TData, TError, TVariables, TContext> & {
|
|
7
|
-
signTransaction: UseMutateFunction<TData, TError, TVariables, TContext>;
|
|
8
|
-
signTransactionAsync: UseMutateAsyncFunction<TData, TError, TVariables, TContext>;
|
|
9
|
-
}>;
|
|
10
|
-
/**
|
|
11
|
-
* Hook for signing a transaction
|
|
12
|
-
*/
|
|
13
|
-
export declare const useSignTransaction: () => UseSignTransactionReturnType<FullSignatureRes, Error, SignTransactionArgs, unknown>;
|
|
14
|
-
export {};
|