@getpara/react-sdk 1.1.0 → 1.3.0
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/MoonPayEmbed-GAWXP6V7.js +2 -0
- package/dist/MoonPayEmbed-GAWXP6V7.js.br +0 -0
- package/dist/MoonPayEmbed-GAWXP6V7.js.gz +0 -0
- package/dist/index.js +675 -5
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/provider/hooks/utils/useEventListeners.d.ts +1 -1
- package/dist/provider/stores/useStore.d.ts +7 -2
- package/dist/provider/types/provider.d.ts +15 -3
- package/package.json +8 -7
- package/dist/modal/ParaModal.js +0 -281
- package/dist/modal/components/Account/Account.js +0 -60
- package/dist/modal/components/AddFunds/AddFunds.js +0 -147
- package/dist/modal/components/AddFunds/AddFundsAwaiting.js +0 -65
- package/dist/modal/components/AddFunds/AddFundsDone.js +0 -26
- package/dist/modal/components/AddFunds/MoonPayEmbed.js +0 -2
- package/dist/modal/components/AddFunds/index.js +0 -3
- package/dist/modal/components/AuthInput/AuthInput.js +0 -221
- package/dist/modal/components/AuthInput/countryCodes.js +0 -40
- package/dist/modal/components/AuthInput/hooks/useDropdownPosition.js +0 -23
- package/dist/modal/components/AuthInput/phoneMasks.js +0 -247
- package/dist/modal/components/AuthMainStep/AuthMainStep.js +0 -21
- package/dist/modal/components/AuthMainStep/AuthMainStepContent.js +0 -89
- package/dist/modal/components/AuthOptions/AuthOptions.js +0 -28
- package/dist/modal/components/AwaitingBiometricsStep/AwaitingBiometricsStep.js +0 -7
- package/dist/modal/components/AwaitingOAuthStep/AwaitingOAuthStep.js +0 -5
- package/dist/modal/components/AwaitingPasswordStep/AwaitingPasswordStep.js +0 -7
- package/dist/modal/components/AwaitingWalletCreationStep/AwaitingWalletCreationStep.js +0 -18
- package/dist/modal/components/BiometricCreationStep/BiometricCreationStep.js +0 -17
- package/dist/modal/components/BiometricLoginStep/BiometricLoginStep.js +0 -131
- package/dist/modal/components/Body/AnimatedHeightWrapper.js +0 -26
- package/dist/modal/components/Body/Body.js +0 -232
- package/dist/modal/components/ChainSwitch/ChainSwitch.js +0 -77
- package/dist/modal/components/ChainSwitch/config.js +0 -11
- package/dist/modal/components/Controls/Controls.js +0 -54
- package/dist/modal/components/Controls/Selects.js +0 -159
- package/dist/modal/components/ExternalWalletStep/ExternalWalletStep.js +0 -116
- package/dist/modal/components/ExternalWalletStep/config.js +0 -11
- package/dist/modal/components/ExternalWallets/ExternalWallets.js +0 -142
- package/dist/modal/components/ExternalWalletsWrapper/ExternalWalletsWrapper.js +0 -119
- package/dist/modal/components/Footer/Footer.js +0 -71
- package/dist/modal/components/Header/Header.js +0 -24
- package/dist/modal/components/Header/hooks/useStepTitle.js +0 -42
- package/dist/modal/components/Hero/Hero.js +0 -119
- package/dist/modal/components/IFrameStep/IFrameStep.js +0 -41
- package/dist/modal/components/LoginDoneStep/LoginDoneStep.js +0 -19
- package/dist/modal/components/ModalContent/ModalContent.js +0 -280
- package/dist/modal/components/OAuth/FarcasterOAuthStep.js +0 -82
- package/dist/modal/components/OAuth/OAuth.js +0 -125
- package/dist/modal/components/OAuth/TelegramOAuthStep.js +0 -133
- package/dist/modal/components/OnRampComponents/AddingFunds.js +0 -10
- package/dist/modal/components/OnRampComponents/OnRampProviderButton.js +0 -72
- package/dist/modal/components/RecoverySecretStep/RecoverySecretStep.js +0 -67
- package/dist/modal/components/Setup2FAStep/Setup2FAStep.js +0 -105
- package/dist/modal/components/StripeComponents/StripeComponents.js +0 -78
- package/dist/modal/components/TwoFactorDoneStep/TwoFactorDoneStep.js +0 -8
- package/dist/modal/components/VerificationCodeStep/VerificationCodeStep.js +0 -135
- package/dist/modal/components/Waiting/Waiting.js +0 -6
- package/dist/modal/components/WalletCard/PartnerIcon.js +0 -29
- package/dist/modal/components/WalletCard/WalletCard.js +0 -93
- package/dist/modal/components/WalletCreationDoneStep/WalletCreationDoneStep.js +0 -50
- package/dist/modal/components/common.js +0 -67
- package/dist/modal/components/index.js +0 -1
- package/dist/modal/constants/constants.js +0 -93
- package/dist/modal/constants/defaults.js +0 -5
- package/dist/modal/constants/oAuthLogos.js +0 -18
- package/dist/modal/hooks/useActiveWallet.js +0 -11
- package/dist/modal/hooks/useEmbeddedExternalConnection.js +0 -46
- package/dist/modal/hooks/useGoBack.js +0 -34
- package/dist/modal/index.js +0 -9
- package/dist/modal/providers/CosmosExternalWalletContextStub.js +0 -18
- package/dist/modal/providers/EvmExternalWalletContextStub.js +0 -22
- package/dist/modal/providers/ExternalWalletContext.js +0 -253
- package/dist/modal/providers/SolanaExternalWalletContextStub.js +0 -12
- package/dist/modal/stores/externalWalletProvider/actions.js +0 -5
- package/dist/modal/stores/externalWalletProvider/useExternalWalletProviderStore.js +0 -13
- package/dist/modal/stores/index.js +0 -3
- package/dist/modal/stores/modal/actions.js +0 -64
- package/dist/modal/stores/modal/useModalStore.js +0 -41
- package/dist/modal/stores/para/actions.js +0 -5
- package/dist/modal/stores/para/useParaStore.js +0 -3
- package/dist/modal/stores/theme/actions.js +0 -24
- package/dist/modal/stores/theme/useThemeStore.js +0 -14
- package/dist/modal/stores/userInfo/actions.js +0 -34
- package/dist/modal/stores/userInfo/useUserInfoStore.js +0 -9
- package/dist/modal/types/commonTypes.js +0 -1
- package/dist/modal/types/externalWallets.js +0 -21
- package/dist/modal/types/modalProps.js +0 -7
- package/dist/modal/utils/authLayoutHelpers.js +0 -2
- package/dist/modal/utils/getMailtoLink.js +0 -5
- package/dist/modal/utils/getTileButtonFlex.js +0 -15
- package/dist/modal/utils/isPasskeySupported.js +0 -10
- package/dist/modal/utils/openPopup.js +0 -55
- package/dist/modal/utils/routeMobileExternalWallet.js +0 -35
- package/dist/modal/utils/steps.js +0 -215
- package/dist/modal/utils/stringFormatters.js +0 -12
- package/dist/modal/utils/validateOnRampConfig.js +0 -26
- package/dist/provider/ParaProvider.js +0 -16
- package/dist/provider/actions/checkIfUserExists.js +0 -26
- package/dist/provider/actions/createUser.js +0 -30
- package/dist/provider/actions/getAccount.js +0 -24
- package/dist/provider/actions/getWallet.js +0 -16
- package/dist/provider/actions/initiateLogin.js +0 -23
- package/dist/provider/actions/keepSessionAlive.js +0 -23
- package/dist/provider/actions/logout.js +0 -20
- package/dist/provider/actions/signMessage.js +0 -23
- package/dist/provider/actions/signTransaction.js +0 -23
- package/dist/provider/actions/waitForAccountCreation.js +0 -24
- package/dist/provider/actions/waitForLoginAndSetup.js +0 -27
- package/dist/provider/actions/waitForPasskeyAndCreateWallet.js +0 -24
- package/dist/provider/hooks/index.js +0 -3
- package/dist/provider/hooks/mutations/index.js +0 -10
- package/dist/provider/hooks/mutations/useCheckIfUserExists.js +0 -23
- package/dist/provider/hooks/mutations/useCreateUser.js +0 -23
- package/dist/provider/hooks/mutations/useInitiateLogin.js +0 -23
- package/dist/provider/hooks/mutations/useKeepSessionAlive.js +0 -23
- package/dist/provider/hooks/mutations/useLogout.js +0 -33
- 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 -2
- package/dist/provider/hooks/queries/useAccount.js +0 -23
- package/dist/provider/hooks/queries/useWallet.js +0 -24
- package/dist/provider/hooks/utils/index.js +0 -3
- package/dist/provider/hooks/utils/useAutoSessionKeepAlive.js +0 -79
- package/dist/provider/hooks/utils/useClient.js +0 -8
- package/dist/provider/hooks/utils/useEventListeners.js +0 -87
- package/dist/provider/hooks/utils/useInternalClient.js +0 -9
- package/dist/provider/hooks/utils/useModal.js +0 -15
- package/dist/provider/hooks/utils/useWalletState.js +0 -33
- package/dist/provider/index.js +0 -3
- package/dist/provider/stores/getters.js +0 -5
- package/dist/provider/stores/slices/client.js +0 -4
- package/dist/provider/stores/slices/index.js +0 -3
- package/dist/provider/stores/slices/modal.js +0 -4
- package/dist/provider/stores/slices/wallet.js +0 -6
- package/dist/provider/stores/types.js +0 -1
- package/dist/provider/stores/useStore.js +0 -12
- 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 -19
- /package/dist/{modal/css → css}/modal.css +0 -0
- /package/dist/{modal/public → public}/Inter-VariableFont_slnt,wght.ttf +0 -0
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { CreateUserType } from './createUser.js';
|
|
11
|
-
export const checkIfUserExists = (para, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
12
|
-
if (!para) {
|
|
13
|
-
throw new Error('no para instance');
|
|
14
|
-
}
|
|
15
|
-
if (!args) {
|
|
16
|
-
throw new Error('no valid args passed to checkIfUserExists');
|
|
17
|
-
}
|
|
18
|
-
try {
|
|
19
|
-
return yield (args.type === CreateUserType.EMAIL
|
|
20
|
-
? para.checkIfUserExists({ email: args.identifier })
|
|
21
|
-
: para.checkIfUserExistsByPhone({ phone: args.identifier, countryCode: args.countryCode }));
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
throw new Error(e);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export var CreateUserType;
|
|
11
|
-
(function (CreateUserType) {
|
|
12
|
-
CreateUserType["EMAIL"] = "EMAIL";
|
|
13
|
-
CreateUserType["PHONE"] = "PHONE";
|
|
14
|
-
})(CreateUserType || (CreateUserType = {}));
|
|
15
|
-
export const createUser = (para, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
if (!para) {
|
|
17
|
-
throw new Error('no para instance');
|
|
18
|
-
}
|
|
19
|
-
if (!args) {
|
|
20
|
-
throw new Error('no valid args passed to createUser');
|
|
21
|
-
}
|
|
22
|
-
try {
|
|
23
|
-
yield (args.type === CreateUserType.EMAIL
|
|
24
|
-
? para.createUser({ email: args.identifier })
|
|
25
|
-
: para.createUserByPhone({ phone: args.identifier, countryCode: args.countryCode }));
|
|
26
|
-
}
|
|
27
|
-
catch (e) {
|
|
28
|
-
throw new Error(e);
|
|
29
|
-
}
|
|
30
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const getAccount = (para) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const isLoggedIn = yield (para === null || para === void 0 ? void 0 : para.isFullyLoggedIn());
|
|
12
|
-
const resp = {
|
|
13
|
-
isConnected: !!isLoggedIn,
|
|
14
|
-
email: undefined,
|
|
15
|
-
phone: undefined,
|
|
16
|
-
wallets: undefined,
|
|
17
|
-
};
|
|
18
|
-
if (para && resp.isConnected) {
|
|
19
|
-
resp.email = para.getEmail();
|
|
20
|
-
resp.phone = para.getPhoneNumber();
|
|
21
|
-
resp.wallets = para.getWallets();
|
|
22
|
-
}
|
|
23
|
-
return resp;
|
|
24
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const getWallet = (para, selectedWallet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
const isLoggedIn = yield (para === null || para === void 0 ? void 0 : para.isFullyLoggedIn());
|
|
12
|
-
if (!para || !isLoggedIn) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return para.findWallet(selectedWallet === null || selectedWallet === void 0 ? void 0 : selectedWallet.id, selectedWallet === null || selectedWallet === void 0 ? void 0 : selectedWallet.type);
|
|
16
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const initiateLogin = (para, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
if (!args) {
|
|
15
|
-
throw new Error('no valid args passed to initiateLogin');
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
return yield para.initiateUserLoginV2(args);
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
throw new Error(e);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const keepSessionAlive = (para) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const resp = yield para.keepSessionAlive();
|
|
16
|
-
if (!resp) {
|
|
17
|
-
throw new Error('session expired');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
throw new Error(e);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const logout = (para) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
yield para.logout();
|
|
16
|
-
}
|
|
17
|
-
catch (e) {
|
|
18
|
-
throw new Error(e);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const signMessage = (para, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
if (!args) {
|
|
15
|
-
throw new Error('no valid args passed to signMessage');
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
return yield para.signMessage(args);
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
throw new Error(e);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const signTransaction = (para, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
if (!args) {
|
|
15
|
-
throw new Error('no valid args passed to signTransaction');
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
return yield para.signTransaction(args);
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
throw new Error(e);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const waitForAccountCreation = (para) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const isComplete = yield para.waitForAccountCreation();
|
|
16
|
-
if (!isComplete) {
|
|
17
|
-
throw new Error('error during waitForAccountCreation');
|
|
18
|
-
}
|
|
19
|
-
return isComplete;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
throw new Error(e);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const waitForLoginAndSetup = (para, args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
if (!args) {
|
|
15
|
-
throw new Error('no valid args passed to waitForLoginAndSetup');
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const resp = yield para.waitForLoginAndSetup(args);
|
|
19
|
-
if (resp.isError) {
|
|
20
|
-
throw new Error('error during waitForLoginAndSetup');
|
|
21
|
-
}
|
|
22
|
-
return resp;
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
throw new Error(e);
|
|
26
|
-
}
|
|
27
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
export const waitForPasskeyAndCreateWallet = (para) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
-
if (!para) {
|
|
12
|
-
throw new Error('no para instance');
|
|
13
|
-
}
|
|
14
|
-
try {
|
|
15
|
-
const resp = yield para.waitForPasskeyAndCreateWallet();
|
|
16
|
-
if (!resp) {
|
|
17
|
-
throw new Error('error during waitForAccountCreation');
|
|
18
|
-
}
|
|
19
|
-
return resp;
|
|
20
|
-
}
|
|
21
|
-
catch (e) {
|
|
22
|
-
throw new Error(e);
|
|
23
|
-
}
|
|
24
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { useWaitForLoginAndSetup } from './useWaitForLoginAndSetup.js';
|
|
2
|
-
export { useWaitForAccountCreation } from './useWaitForAccountCreation.js';
|
|
3
|
-
export { useWaitForPasskeyAndCreateWallet } from './useWaitForPasskeyAndCreateWallet.js';
|
|
4
|
-
export { useCreateUser } from './useCreateUser.js';
|
|
5
|
-
export { useCheckIfUserExists } from './useCheckIfUserExists.js';
|
|
6
|
-
export { useInitiateLogin } from './useInitiateLogin.js';
|
|
7
|
-
export { useLogout } from './useLogout.js';
|
|
8
|
-
export { useKeepSessionAlive } from './useKeepSessionAlive.js';
|
|
9
|
-
export { useSignMessage } from './useSignMessage.js';
|
|
10
|
-
export { useSignTransaction } from './useSignTransaction.js';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { checkIfUserExists } from '../../actions/checkIfUserExists.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for checking is a user exists
|
|
16
|
-
*/
|
|
17
|
-
export const useCheckIfUserExists = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const mutation = useMutation({
|
|
20
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () { return yield checkIfUserExists(client, args); }),
|
|
21
|
-
});
|
|
22
|
-
return renameMutations(mutation, 'checkIfUserExists');
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { createUser } from '../../actions/createUser.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for creating a new user
|
|
16
|
-
*/
|
|
17
|
-
export const useCreateUser = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const mutation = useMutation({
|
|
20
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () { return yield createUser(client, args); }),
|
|
21
|
-
});
|
|
22
|
-
return renameMutations(mutation, 'createUser');
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { initiateLogin } from '../../actions/initiateLogin.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for initiating a user login
|
|
16
|
-
*/
|
|
17
|
-
export const useInitiateLogin = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const mutation = useMutation({
|
|
20
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () { return yield initiateLogin(client, args); }),
|
|
21
|
-
});
|
|
22
|
-
return renameMutations(mutation, 'initiateLogin');
|
|
23
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { keepSessionAlive } from '../../actions/keepSessionAlive.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for keeping a session alive
|
|
16
|
-
*/
|
|
17
|
-
export const useKeepSessionAlive = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const mutation = useMutation({
|
|
20
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield keepSessionAlive(client); }),
|
|
21
|
-
});
|
|
22
|
-
return renameMutations(mutation, 'keepSessionAlive');
|
|
23
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { logout } from '../../actions/logout.js';
|
|
13
|
-
import { useStore } from '../../stores/useStore.js';
|
|
14
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
15
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
16
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
17
|
-
/**
|
|
18
|
-
* Hook for logging out a user
|
|
19
|
-
*/
|
|
20
|
-
export const useLogout = () => {
|
|
21
|
-
const client = useClient();
|
|
22
|
-
const queryClient = useQueryClient();
|
|
23
|
-
const clearSelectedWallet = useStore(state => state.clearSelectedWallet);
|
|
24
|
-
const mutation = useMutation({
|
|
25
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield logout(client); }),
|
|
26
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
28
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
29
|
-
clearSelectedWallet();
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(mutation, 'logout');
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient, useWallet } from '../index.js';
|
|
12
|
-
import { signMessage } from '../../actions/signMessage.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for signing a message
|
|
16
|
-
*/
|
|
17
|
-
export const useSignMessage = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const { data: wallet } = useWallet();
|
|
20
|
-
const mutation = useMutation({
|
|
21
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
let walletId = args === null || args === void 0 ? void 0 : args.walletId;
|
|
23
|
-
if (!walletId) {
|
|
24
|
-
walletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error('no wallet id found');
|
|
28
|
-
}
|
|
29
|
-
return yield signMessage(client, Object.assign(Object.assign({}, args), { walletId }));
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(mutation, 'signMessage');
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation } from '@tanstack/react-query';
|
|
11
|
-
import { useClient, useWallet } from '../index.js';
|
|
12
|
-
import { signTransaction } from '../../actions/signTransaction.js';
|
|
13
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for signing a transaction
|
|
16
|
-
*/
|
|
17
|
-
export const useSignTransaction = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
const { data: wallet } = useWallet();
|
|
20
|
-
const mutation = useMutation({
|
|
21
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
-
let walletId = args === null || args === void 0 ? void 0 : args.walletId;
|
|
23
|
-
if (!walletId) {
|
|
24
|
-
walletId = wallet === null || wallet === void 0 ? void 0 : wallet.id;
|
|
25
|
-
}
|
|
26
|
-
if (!walletId) {
|
|
27
|
-
throw Error('no wallet id found');
|
|
28
|
-
}
|
|
29
|
-
return yield signTransaction(client, Object.assign(Object.assign({}, args), { walletId }));
|
|
30
|
-
}),
|
|
31
|
-
});
|
|
32
|
-
return renameMutations(mutation, 'signTransaction');
|
|
33
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { waitForAccountCreation } from '../../actions/waitForAccountCreation.js';
|
|
13
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
14
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
15
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
16
|
-
/**
|
|
17
|
-
* Hook for waiting for account creation
|
|
18
|
-
*/
|
|
19
|
-
export const useWaitForAccountCreation = () => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const queryClient = useQueryClient();
|
|
22
|
-
const mutation = useMutation({
|
|
23
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield waitForAccountCreation(client); }),
|
|
24
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
26
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
return renameMutations(mutation, 'waitForAccountCreation');
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { waitForLoginAndSetup } from '../../actions/waitForLoginAndSetup.js';
|
|
13
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
14
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
15
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
16
|
-
/**
|
|
17
|
-
* Hook for waiting for user login and account setup
|
|
18
|
-
*/
|
|
19
|
-
export const useWaitForLoginAndSetup = () => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const queryClient = useQueryClient();
|
|
22
|
-
const mutation = useMutation({
|
|
23
|
-
mutationFn: (args) => __awaiter(void 0, void 0, void 0, function* () { return yield waitForLoginAndSetup(client, args); }),
|
|
24
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
26
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
return renameMutations(mutation, 'waitForLoginAndSetup');
|
|
30
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { waitForPasskeyAndCreateWallet } from '../../actions/waitForPasskeyAndCreateWallet.js';
|
|
13
|
-
import { ACCOUNT_BASE_KEY } from '../queries/useAccount.js';
|
|
14
|
-
import { WALLET_BASE_KEY } from '../queries/useWallet.js';
|
|
15
|
-
import { renameMutations } from '../../utils/renameMutations.js';
|
|
16
|
-
/**
|
|
17
|
-
* Hook for waiting for session setup and wallet creation
|
|
18
|
-
*/
|
|
19
|
-
export const useWaitForPasskeyAndCreateWallet = () => {
|
|
20
|
-
const client = useClient();
|
|
21
|
-
const queryClient = useQueryClient();
|
|
22
|
-
const mutation = useMutation({
|
|
23
|
-
mutationFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield waitForPasskeyAndCreateWallet(client); }),
|
|
24
|
-
onSettled: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
-
yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
|
|
26
|
-
yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
|
|
27
|
-
}),
|
|
28
|
-
});
|
|
29
|
-
return renameMutations(mutation, 'waitForPasskeyAndCreateWallet');
|
|
30
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { useQuery } from '@tanstack/react-query';
|
|
11
|
-
import { useClient } from '../index.js';
|
|
12
|
-
import { getAccount } from '../../actions/getAccount.js';
|
|
13
|
-
export const ACCOUNT_BASE_KEY = 'PARA_ACCOUNT';
|
|
14
|
-
/**
|
|
15
|
-
* Hook for retrieving a user account
|
|
16
|
-
*/
|
|
17
|
-
export const useAccount = () => {
|
|
18
|
-
const client = useClient();
|
|
19
|
-
return useQuery({
|
|
20
|
-
queryKey: [ACCOUNT_BASE_KEY, client === null || client === void 0 ? void 0 : client.getUserId()],
|
|
21
|
-
queryFn: () => __awaiter(void 0, void 0, void 0, function* () { return yield getAccount(client); }),
|
|
22
|
-
});
|
|
23
|
-
};
|