@getpara/react-sdk 2.0.0-dev.0 → 2.0.0-dev.2

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/index.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  import { CpslAuthModal, defineCustomElements, generateTheme } from "@getpara/react-components";
11
11
 
12
12
  // src/modal/components/ModalContent/ModalContent.tsx
13
- import { createContext as createContext5, forwardRef as forwardRef2, useEffect as useEffect26, useImperativeHandle, useMemo as useMemo17, useState as useState17 } from "react";
13
+ import { createContext as createContext5, forwardRef as forwardRef2, useEffect as useEffect27, useImperativeHandle, useMemo as useMemo17, useState as useState18 } from "react";
14
14
  import { entityToWallet, EnabledFlow as EnabledFlow4 } from "@getpara/web-sdk";
15
15
 
16
16
  // src/modal/stores/modal/useModalStore.ts
@@ -24,6 +24,7 @@ var ModalStep = /* @__PURE__ */ ((ModalStep2) => {
24
24
  ModalStep2["EX_WALLET_MORE"] = "EX_WALLET_MORE";
25
25
  ModalStep2["EX_WALLET_SELECTED"] = "EX_WALLET_SELECTED";
26
26
  ModalStep2["VERIFICATIONS"] = "VERIFICATIONS";
27
+ ModalStep2["EXTERNAL_WALLET_VERIFICATION"] = "EXTERNAL_WALLET_VERIFICATION";
27
28
  ModalStep2["AWAITING_OAUTH"] = "AWAITING_OAUTH";
28
29
  ModalStep2["FARCASTER_OAUTH"] = "FARCASTER_OAUTH";
29
30
  ModalStep2["BIOMETRIC_CREATION"] = "BIOMETRIC_CREATION";
@@ -55,6 +56,7 @@ var RESET_TO_AUTH_STEPS = [
55
56
  "EX_WALLET_MORE" /* EX_WALLET_MORE */,
56
57
  "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */,
57
58
  "VERIFICATIONS" /* VERIFICATIONS */,
59
+ "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */,
58
60
  "AWAITING_OAUTH" /* AWAITING_OAUTH */,
59
61
  "FARCASTER_OAUTH" /* FARCASTER_OAUTH */,
60
62
  "TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */,
@@ -98,6 +100,7 @@ var SignUpPreviousStep = {
98
100
  ["EX_WALLET_MORE" /* EX_WALLET_MORE */]: "AUTH_MAIN" /* AUTH_MAIN */,
99
101
  ["EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */]: "AUTH_MAIN" /* AUTH_MAIN */,
100
102
  ["VERIFICATIONS" /* VERIFICATIONS */]: "AUTH_MAIN" /* AUTH_MAIN */,
103
+ ["EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */]: "AUTH_MAIN" /* AUTH_MAIN */,
101
104
  ["AWAITING_OAUTH" /* AWAITING_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
102
105
  ["TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
103
106
  ["FARCASTER_OAUTH" /* FARCASTER_OAUTH */]: "AUTH_MAIN" /* AUTH_MAIN */,
@@ -186,18 +189,18 @@ var getActions = (set, get) => ({
186
189
  const isLogin = get().flow === "login";
187
190
  const isAccount = get().flow === "account";
188
191
  const currentStep = get().step;
189
- const webAuthURLForCreate = get().webAuthURLForCreate;
192
+ const signupState = get().getSignupState();
190
193
  const iFrameUrl = get().iFrameUrl;
191
194
  const refs = get().refs;
192
195
  let prevStep = (isAccount ? AccountPreviousStep : isLogin ? LoginPreviousStep : SignUpPreviousStep)[currentStep];
193
- if (currentStep === "PASSWORD_CREATION" /* PASSWORD_CREATION */ && iFrameUrl && !webAuthURLForCreate) {
196
+ if (currentStep === "PASSWORD_CREATION" /* PASSWORD_CREATION */ && iFrameUrl && !(signupState == null ? void 0 : signupState.passkeyUrl)) {
194
197
  prevStep = "AUTH_MAIN" /* AUTH_MAIN */;
195
198
  }
196
199
  if (currentStep === "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */) {
197
200
  set({ selectedExternalWalletId: void 0, isExternalWalletConnecting: false, externalWalletError: void 0 });
198
201
  }
199
202
  if (prevStep) {
200
- set({ step: prevStep, stepDirection: -1 });
203
+ set({ authStepRoute: void 0, step: prevStep, stepDirection: -1 });
201
204
  onModalStepChange == null ? void 0 : onModalStepChange({ previousStep: currentStep, currentStep: prevStep, canGoBack: get().hasPreviousStep() });
202
205
  }
203
206
  (_a = refs.popupWindow.current) == null ? void 0 : _a.close();
@@ -212,6 +215,22 @@ var getActions = (set, get) => ({
212
215
  setFlow: (flow) => set({ flow }),
213
216
  isLogin: () => get().flow === "login",
214
217
  isAccount: () => get().flow === "account",
218
+ setAuthState: (authState) => {
219
+ const newFlow = (authState == null ? void 0 : authState.stage) === "signup" || (authState == null ? void 0 : authState.stage) === "login" ? authState.stage : void 0;
220
+ set(__spreadValues({ authState }, newFlow ? { flow: newFlow } : {}));
221
+ },
222
+ getVerifyState: () => {
223
+ const authState = get().authState;
224
+ return (authState == null ? void 0 : authState.stage) === "verify" ? authState : void 0;
225
+ },
226
+ getLoginState: () => {
227
+ const authState = get().authState;
228
+ return (authState == null ? void 0 : authState.stage) === "login" ? authState : void 0;
229
+ },
230
+ getSignupState: () => {
231
+ const authState = get().authState;
232
+ return (authState == null ? void 0 : authState.stage) === "signup" ? authState : void 0;
233
+ },
215
234
  setWebAuthURLForLogin: (url) => set({ webAuthURLForLogin: url }),
216
235
  setWebAuthURLForCreate: (url) => set({ webAuthURLForCreate: url }),
217
236
  setPasswordUrlForLogin: (url) => set({ passwordUrlForLogin: url }),
@@ -226,6 +245,7 @@ var getActions = (set, get) => ({
226
245
  setIsUsingMobileConnector: (isUsingMobileConnector) => set({ isUsingMobileConnector }),
227
246
  setStepDirection: (stepDirection) => set({ stepDirection }),
228
247
  setFarcasterConnectUri: (farcasterConnectUri) => set({ farcasterConnectUri }),
248
+ setTwoFactorStatus: (twoFactorStatus) => set({ twoFactorStatus }),
229
249
  setBiometricLocationHints: (biometricLocationHints) => set({ biometricLocationHints }),
230
250
  setIFrameUrl: (iFrameUrl) => set({ iFrameUrl }),
231
251
  setIsIFrameReady: (isIFrameReady) => set({ isIFrameReady }),
@@ -261,6 +281,7 @@ import { createRef } from "react";
261
281
  var DEFAULT_MODAL_STATE = {
262
282
  flow: void 0,
263
283
  stepDirection: 1,
284
+ authState: void 0,
264
285
  webAuthURLForLogin: void 0,
265
286
  webAuthURLForCreate: void 0,
266
287
  passwordUrlForLogin: void 0,
@@ -273,6 +294,7 @@ var DEFAULT_MODAL_STATE = {
273
294
  externalWalletError: void 0,
274
295
  activeWallet: [void 0, void 0],
275
296
  farcasterConnectUri: void 0,
297
+ twoFactorStatus: void 0,
276
298
  biometricLocationHints: void 0,
277
299
  iFrameUrl: void 0,
278
300
  isIFrameReady: void 0,
@@ -297,6 +319,7 @@ var useModalStore = create()(
297
319
  storage: createJSONStorage(() => localStorage),
298
320
  partialize: (state) => ({
299
321
  step: state.step,
322
+ authState: state.authState,
300
323
  webAuthURLForLogin: state.webAuthURLForLogin,
301
324
  webAuthURLForCreate: state.webAuthURLForCreate,
302
325
  passwordUrlForLogin: state.passwordUrlForLogin,
@@ -346,7 +369,7 @@ var DEFAULT_USER_INFO_STATE = {
346
369
  var useUserInfoStore = create2((set, get) => __spreadValues(__spreadValues({}, DEFAULT_USER_INFO_STATE), getActions2(set, get)));
347
370
 
348
371
  // src/modal/components/Body/Body.tsx
349
- import { styled as styled27 } from "styled-components";
372
+ import { styled as styled28 } from "styled-components";
350
373
  import { CpslAlert, CpslIcon as CpslIcon16 } from "@getpara/react-components";
351
374
 
352
375
  // src/modal/components/VerificationCodeStep/VerificationCodeStep.tsx
@@ -422,6 +445,17 @@ var HeroIcon = styled(CpslIcon)`
422
445
  --width: 80px;
423
446
  --icon-color: var(--cpsl-color-text-primary);
424
447
  `;
448
+ var ErrorContainer = styled.div`
449
+ display: flex;
450
+ align-items: center;
451
+ justify-content: center;
452
+ gap: 4px;
453
+ `;
454
+ var ErrorIcon = styled(CpslIcon)`
455
+ --height: 16px;
456
+ --width: 16px;
457
+ --icon-color: var(--cpsl-color-text-error);
458
+ `;
425
459
 
426
460
  // src/modal/components/VerificationCodeStep/VerificationCodeStep.tsx
427
461
  import { AuthMethod } from "@getpara/core-sdk";
@@ -497,9 +531,12 @@ var defaultSolanaExternalWallet = {
497
531
  var SolanaExternalWalletContext = createContext3(defaultSolanaExternalWallet);
498
532
 
499
533
  // src/provider/stores/slices/externalWallets.ts
534
+ import { createRef as createRef2 } from "react";
500
535
  var createExternalWalletsSlice = (set) => ({
501
536
  externalWallets: [],
502
537
  setExternalWallets: (externalWallets) => set({ externalWallets }),
538
+ externalWalletsWithFullAuth: [],
539
+ setExternalWalletsWithFullAuth: (externalWalletsWithFullAuth) => set({ externalWalletsWithFullAuth }),
503
540
  evmContext: EvmExternalWalletContext,
504
541
  setEvmContext: (evmContext) => set({ evmContext }),
505
542
  EvmProvider: void 0,
@@ -523,7 +560,8 @@ var createExternalWalletsSlice = (set) => ({
523
560
  solanaWallets: [],
524
561
  setSolanaWallets: (solanaWallets) => set({ solanaWallets }),
525
562
  isLoadingSolanaLib: true,
526
- setIsLoadingSolanaLib: (isLoadingSolanaLib) => set({ isLoadingSolanaLib })
563
+ setIsLoadingSolanaLib: (isLoadingSolanaLib) => set({ isLoadingSolanaLib }),
564
+ onLoginRef: createRef2()
527
565
  });
528
566
 
529
567
  // src/provider/stores/useStore.ts
@@ -800,13 +838,13 @@ var BiometricLoginStep = () => {
800
838
  }
801
839
  return;
802
840
  }
803
- if (!para.isEmail && !para.isPhone && !para.isFarcaster && !para.isTelegram) {
841
+ if (!para.isEmail && !para.isPhone && !para.isFarcaster && !para.isTelegram && !para.isExternalWalletAuth) {
804
842
  return;
805
843
  }
806
844
  if (!para.loginEncryptionKeyPair) {
807
845
  return;
808
846
  }
809
- const authType = para.isEmail ? "email" : para.isPhone ? "phone" : para.isFarcaster ? "farcaster" : "telegram";
847
+ const authType = para.isEmail ? "email" : para.isPhone ? "phone" : para.isFarcaster ? "farcaster" : para.isTelegram ? "telegram" : "externalWallet";
810
848
  const { partnerId, sessionId, sessionLookupId } = yield para.touchSession();
811
849
  const webAuthUrlForLogin = (supportedAuthMethods == null ? void 0 : supportedAuthMethods.has) && supportedAuthMethods.has(AuthMethod2.PASSKEY) ? yield para.getWebAuthURLForLogin({
812
850
  sessionId,
@@ -1083,30 +1121,45 @@ var useModal = () => {
1083
1121
  };
1084
1122
 
1085
1123
  // src/provider/hooks/utils/useWalletState.ts
1124
+ import { useCallback } from "react";
1086
1125
  var useWalletState = () => {
1087
1126
  const client = useClient();
1088
1127
  const selectedWalletId = useStore((state) => state.selectedWalletId);
1089
1128
  const selectedWalletType = useStore((state) => state.selectedWalletType);
1090
1129
  const setStoredSelectedWallet = useStore((state) => state.setSelectedWallet);
1091
1130
  const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
1092
- const setSelectedWallet = ({ id, type }) => {
1093
- try {
1094
- const validId = client == null ? void 0 : client.findWalletId(id, type ? { type: [type] } : void 0);
1095
- if (validId !== id) {
1131
+ const setSelectedWallet = useCallback(
1132
+ ({ id, type }) => {
1133
+ try {
1134
+ const validId = client == null ? void 0 : client.findWalletId(id, type ? { type: [type] } : void 0);
1135
+ if (validId !== id) {
1136
+ clearSelectedWallet();
1137
+ } else {
1138
+ setStoredSelectedWallet(id, type);
1139
+ }
1140
+ } catch (e) {
1096
1141
  clearSelectedWallet();
1097
- } else {
1098
- setStoredSelectedWallet(id, type);
1099
1142
  }
1100
- } catch (e) {
1143
+ },
1144
+ [client, clearSelectedWallet, setStoredSelectedWallet]
1145
+ );
1146
+ const updateSelectedWallet = useCallback(() => {
1147
+ if (!client) {
1101
1148
  clearSelectedWallet();
1149
+ return;
1102
1150
  }
1103
- };
1151
+ if (!selectedWalletId || !client.findWallet(selectedWalletId)) {
1152
+ const defaultWallet = client.findWallet(void 0, void 0, { forbidPregen: true });
1153
+ setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
1154
+ }
1155
+ }, [clearSelectedWallet, setSelectedWallet, client, selectedWalletId]);
1104
1156
  return {
1105
1157
  selectedWallet: {
1106
1158
  id: selectedWalletId,
1107
1159
  type: selectedWalletType
1108
1160
  },
1109
- setSelectedWallet
1161
+ setSelectedWallet,
1162
+ updateSelectedWallet
1110
1163
  };
1111
1164
  };
1112
1165
 
@@ -1126,7 +1179,7 @@ var getAccount = (para) => __async(void 0, null, function* () {
1126
1179
  if (para && resp.isConnected) {
1127
1180
  resp.email = para.getEmail();
1128
1181
  resp.phone = para.getPhoneNumber();
1129
- resp.wallets = para.getWallets();
1182
+ resp.wallets = para.availableWallets;
1130
1183
  resp.userId = para.getUserId();
1131
1184
  }
1132
1185
  return resp;
@@ -1135,7 +1188,7 @@ var getAccount = (para) => __async(void 0, null, function* () {
1135
1188
  // src/provider/hooks/queries/useAccount.ts
1136
1189
  var ACCOUNT_BASE_KEY = "PARA_ACCOUNT";
1137
1190
  var useAccount = () => {
1138
- const client = useClient();
1191
+ const client = useInternalClient();
1139
1192
  return useQuery({
1140
1193
  queryKey: [ACCOUNT_BASE_KEY, client == null ? void 0 : client.getUserId()],
1141
1194
  queryFn: () => __async(void 0, null, function* () {
@@ -1169,8 +1222,72 @@ var useWallet = () => {
1169
1222
  });
1170
1223
  };
1171
1224
 
1225
+ // src/provider/actions/utils.ts
1226
+ function generateAction(method) {
1227
+ return (para, ...args) => __async(this, null, function* () {
1228
+ if (!para) {
1229
+ throw new Error("no para instance");
1230
+ }
1231
+ return yield para[method](...args);
1232
+ });
1233
+ }
1234
+
1235
+ // src/provider/actions/index.ts
1236
+ var signUpOrLogIn = generateAction("signUpOrLogInV2");
1237
+ var verifyNewAccount = generateAction("verifyNewAccountV2");
1238
+ var waitForLogin = generateAction("waitForLoginV2");
1239
+ var waitForSignup = generateAction("waitForSignupV2");
1240
+ var waitForWalletCreation = generateAction("waitForWalletCreationV2");
1241
+ var verifyOAuth = generateAction("verifyOAuthV2");
1242
+ var verifyFarcaster = generateAction("verifyFarcasterV2");
1243
+ var verifyTelegram = generateAction("verifyTelegramV2");
1244
+ var loginExternalWallet = generateAction("loginExternalWalletV2");
1245
+ var verifyExternalWallet = generateAction("verifyExternalWalletV2");
1246
+ var setup2fa = generateAction("setup2faV2");
1247
+ var enable2fa = generateAction("enable2faV2");
1248
+ var verify2fa = generateAction("verify2faV2");
1249
+ var keepSessionAlive = generateAction("keepSessionAlive");
1250
+ var logout = generateAction("logout");
1251
+ var resendVerificationCode = generateAction("resendVerificationCode");
1252
+ var createWallet = generateAction("createWallet");
1253
+ var createWalletPerType = generateAction("createWalletPerType");
1254
+ var createPregenWallet = generateAction("createPregenWalletV2");
1255
+ var createPregenWalletPerType = generateAction("createPregenWalletPerTypeV2");
1256
+ var claimPregenWallets = generateAction("claimPregenWalletsV2");
1257
+ var hasPregenWallet = generateAction("hasPregenWalletV2");
1258
+ var updatePregenWalletIdentifier = generateAction("updatePregenWalletIdentifierV2");
1259
+ var signMessage = generateAction("signMessage");
1260
+ var signTransaction = generateAction("signTransaction");
1261
+
1262
+ // src/provider/utils/renameMutations.ts
1263
+ function renameMutations(mutationObj, name) {
1264
+ const newMutations = {
1265
+ [name]: mutationObj.mutate,
1266
+ [`${name}Async`]: mutationObj.mutateAsync
1267
+ };
1268
+ return __spreadValues(__spreadValues({}, newMutations), mutationObj);
1269
+ }
1270
+ function renameCoreMutations(mutationObj, name) {
1271
+ return renameMutations(mutationObj, name);
1272
+ }
1273
+
1274
+ // src/provider/hooks/mutations/utils.ts
1275
+ import { useMutation } from "@tanstack/react-query";
1276
+ function generateHook(method, action, defaultParams) {
1277
+ return () => {
1278
+ const para = useClient();
1279
+ const mutation = useMutation({
1280
+ mutationFn: (args) => __async(this, null, function* () {
1281
+ const result = yield action(para, args != null ? args : defaultParams);
1282
+ return result;
1283
+ })
1284
+ });
1285
+ return renameCoreMutations(mutation, method);
1286
+ };
1287
+ }
1288
+
1172
1289
  // src/provider/hooks/mutations/useWaitForLoginAndSetup.ts
1173
- import { useMutation, useQueryClient } from "@tanstack/react-query";
1290
+ import { useMutation as useMutation2, useQueryClient } from "@tanstack/react-query";
1174
1291
 
1175
1292
  // src/provider/actions/waitForLoginAndSetup.ts
1176
1293
  var waitForLoginAndSetup = (para, args) => __async(void 0, null, function* () {
@@ -1191,21 +1308,11 @@ var waitForLoginAndSetup = (para, args) => __async(void 0, null, function* () {
1191
1308
  }
1192
1309
  });
1193
1310
 
1194
- // src/provider/utils/renameMutations.ts
1195
- function renameMutations(mutationObj, name) {
1196
- const _a = mutationObj, { mutate: _, mutateAsync: __ } = _a, mutationNoMutate = __objRest(_a, ["mutate", "mutateAsync"]);
1197
- const newMutations = {
1198
- [name]: mutationObj.mutate,
1199
- [`${name}Async`]: mutationObj.mutateAsync
1200
- };
1201
- return __spreadValues(__spreadValues({}, newMutations), mutationNoMutate);
1202
- }
1203
-
1204
1311
  // src/provider/hooks/mutations/useWaitForLoginAndSetup.ts
1205
1312
  var useWaitForLoginAndSetup = () => {
1206
1313
  const client = useClient();
1207
1314
  const queryClient = useQueryClient();
1208
- const mutation = useMutation({
1315
+ const mutation = useMutation2({
1209
1316
  mutationFn: (args) => __async(void 0, null, function* () {
1210
1317
  return yield waitForLoginAndSetup(client, args);
1211
1318
  }),
@@ -1221,7 +1328,7 @@ var useWaitForLoginAndSetup = () => {
1221
1328
  };
1222
1329
 
1223
1330
  // src/provider/hooks/mutations/useWaitForAccountCreation.ts
1224
- import { useMutation as useMutation2, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1331
+ import { useMutation as useMutation3, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
1225
1332
 
1226
1333
  // src/provider/actions/waitForAccountCreation.ts
1227
1334
  var waitForAccountCreation = (para, args) => __async(void 0, null, function* () {
@@ -1243,7 +1350,7 @@ var waitForAccountCreation = (para, args) => __async(void 0, null, function* ()
1243
1350
  var useWaitForAccountCreation = () => {
1244
1351
  const client = useClient();
1245
1352
  const queryClient = useQueryClient2();
1246
- const mutation = useMutation2({
1353
+ const mutation = useMutation3({
1247
1354
  mutationFn: (args) => __async(void 0, null, function* () {
1248
1355
  return yield waitForAccountCreation(client, args);
1249
1356
  }),
@@ -1259,7 +1366,7 @@ var useWaitForAccountCreation = () => {
1259
1366
  };
1260
1367
 
1261
1368
  // src/provider/hooks/mutations/useWaitForPasskeyAndCreateWallet.ts
1262
- import { useMutation as useMutation3, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
1369
+ import { useMutation as useMutation4, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
1263
1370
 
1264
1371
  // src/provider/actions/waitForPasskeyAndCreateWallet.ts
1265
1372
  var waitForPasskeyAndCreateWallet = (para) => __async(void 0, null, function* () {
@@ -1281,7 +1388,7 @@ var waitForPasskeyAndCreateWallet = (para) => __async(void 0, null, function* ()
1281
1388
  var useWaitForPasskeyAndCreateWallet = () => {
1282
1389
  const client = useClient();
1283
1390
  const queryClient = useQueryClient3();
1284
- const mutation = useMutation3({
1391
+ const mutation = useMutation4({
1285
1392
  mutationFn: () => __async(void 0, null, function* () {
1286
1393
  return yield waitForPasskeyAndCreateWallet(client);
1287
1394
  }),
@@ -1297,7 +1404,7 @@ var useWaitForPasskeyAndCreateWallet = () => {
1297
1404
  };
1298
1405
 
1299
1406
  // src/provider/hooks/mutations/useCreateUser.ts
1300
- import { useMutation as useMutation4 } from "@tanstack/react-query";
1407
+ import { useMutation as useMutation5 } from "@tanstack/react-query";
1301
1408
 
1302
1409
  // src/provider/actions/createUser.ts
1303
1410
  var createUser = (para, args) => __async(void 0, null, function* () {
@@ -1322,7 +1429,7 @@ var createUser = (para, args) => __async(void 0, null, function* () {
1322
1429
  // src/provider/hooks/mutations/useCreateUser.ts
1323
1430
  var useCreateUser = () => {
1324
1431
  const client = useClient();
1325
- const mutation = useMutation4({
1432
+ const mutation = useMutation5({
1326
1433
  mutationFn: (args) => __async(void 0, null, function* () {
1327
1434
  return yield createUser(client, args);
1328
1435
  })
@@ -1331,7 +1438,7 @@ var useCreateUser = () => {
1331
1438
  };
1332
1439
 
1333
1440
  // src/provider/hooks/mutations/useCheckIfUserExists.ts
1334
- import { useMutation as useMutation5 } from "@tanstack/react-query";
1441
+ import { useMutation as useMutation6 } from "@tanstack/react-query";
1335
1442
 
1336
1443
  // src/provider/actions/checkIfUserExists.ts
1337
1444
  var checkIfUserExists = (para, args) => __async(void 0, null, function* () {
@@ -1356,7 +1463,7 @@ var checkIfUserExists = (para, args) => __async(void 0, null, function* () {
1356
1463
  // src/provider/hooks/mutations/useCheckIfUserExists.ts
1357
1464
  var useCheckIfUserExists = () => {
1358
1465
  const client = useClient();
1359
- const mutation = useMutation5({
1466
+ const mutation = useMutation6({
1360
1467
  mutationFn: (args) => __async(void 0, null, function* () {
1361
1468
  return yield checkIfUserExists(client, args);
1362
1469
  })
@@ -1368,7 +1475,7 @@ var useCheckIfUserExists = () => {
1368
1475
  };
1369
1476
 
1370
1477
  // src/provider/hooks/mutations/useInitiateLogin.ts
1371
- import { useMutation as useMutation6 } from "@tanstack/react-query";
1478
+ import { useMutation as useMutation7 } from "@tanstack/react-query";
1372
1479
 
1373
1480
  // src/provider/actions/initiateLogin.ts
1374
1481
  var initiateLogin = (para, args) => __async(void 0, null, function* () {
@@ -1388,7 +1495,7 @@ var initiateLogin = (para, args) => __async(void 0, null, function* () {
1388
1495
  // src/provider/hooks/mutations/useInitiateLogin.ts
1389
1496
  var useInitiateLogin = () => {
1390
1497
  const client = useClient();
1391
- const mutation = useMutation6({
1498
+ const mutation = useMutation7({
1392
1499
  mutationFn: (args) => __async(void 0, null, function* () {
1393
1500
  return yield initiateLogin(client, args);
1394
1501
  })
@@ -1399,44 +1506,11 @@ var useInitiateLogin = () => {
1399
1506
  );
1400
1507
  };
1401
1508
 
1402
- // src/provider/hooks/mutations/useLogout.ts
1403
- import { useMutation as useMutation7, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
1404
-
1405
- // src/provider/actions/logout.ts
1406
- var logout = (para, args) => __async(void 0, null, function* () {
1407
- if (!para) {
1408
- throw new Error("no para instance");
1409
- }
1410
- try {
1411
- yield para.logout(args);
1412
- } catch (e) {
1413
- throw new Error(e);
1414
- }
1415
- });
1416
-
1417
- // src/provider/hooks/mutations/useLogout.ts
1418
- var useLogout = () => {
1419
- const client = useClient();
1420
- const queryClient = useQueryClient4();
1421
- const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
1422
- const mutation = useMutation7({
1423
- mutationFn: (args) => __async(void 0, null, function* () {
1424
- return yield logout(client, args);
1425
- }),
1426
- onSettled: () => __async(void 0, null, function* () {
1427
- yield queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
1428
- yield queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
1429
- clearSelectedWallet();
1430
- })
1431
- });
1432
- return renameMutations(mutation, "logout");
1433
- };
1434
-
1435
1509
  // src/provider/hooks/mutations/useKeepSessionAlive.ts
1436
1510
  import { useMutation as useMutation8 } from "@tanstack/react-query";
1437
1511
 
1438
1512
  // src/provider/actions/keepSessionAlive.ts
1439
- var keepSessionAlive = (para) => __async(void 0, null, function* () {
1513
+ var keepSessionAlive2 = (para) => __async(void 0, null, function* () {
1440
1514
  if (!para) {
1441
1515
  throw new Error("no para instance");
1442
1516
  }
@@ -1455,7 +1529,7 @@ var useKeepSessionAlive = () => {
1455
1529
  const client = useClient();
1456
1530
  const mutation = useMutation8({
1457
1531
  mutationFn: () => __async(void 0, null, function* () {
1458
- return yield keepSessionAlive(client);
1532
+ return yield keepSessionAlive2(client);
1459
1533
  })
1460
1534
  });
1461
1535
  return renameMutations(mutation, "keepSessionAlive");
@@ -1465,7 +1539,7 @@ var useKeepSessionAlive = () => {
1465
1539
  import { useMutation as useMutation9 } from "@tanstack/react-query";
1466
1540
 
1467
1541
  // src/provider/actions/signMessage.ts
1468
- var signMessage = (para, args) => __async(void 0, null, function* () {
1542
+ var signMessage2 = (para, args) => __async(void 0, null, function* () {
1469
1543
  if (!para) {
1470
1544
  throw new Error("no para instance");
1471
1545
  }
@@ -1492,7 +1566,7 @@ var useSignMessage = () => {
1492
1566
  if (!walletId) {
1493
1567
  throw Error("no wallet id found");
1494
1568
  }
1495
- return yield signMessage(client, __spreadProps(__spreadValues({}, args), { walletId }));
1569
+ return yield signMessage2(client, __spreadProps(__spreadValues({}, args), { walletId }));
1496
1570
  })
1497
1571
  });
1498
1572
  return renameMutations(
@@ -1505,7 +1579,7 @@ var useSignMessage = () => {
1505
1579
  import { useMutation as useMutation10 } from "@tanstack/react-query";
1506
1580
 
1507
1581
  // src/provider/actions/signTransaction.ts
1508
- var signTransaction = (para, args) => __async(void 0, null, function* () {
1582
+ var signTransaction2 = (para, args) => __async(void 0, null, function* () {
1509
1583
  if (!para) {
1510
1584
  throw new Error("no para instance");
1511
1585
  }
@@ -1532,7 +1606,7 @@ var useSignTransaction = () => {
1532
1606
  if (!walletId) {
1533
1607
  throw Error("no wallet id found");
1534
1608
  }
1535
- return yield signTransaction(client, __spreadProps(__spreadValues({}, args), { walletId }));
1609
+ return yield signTransaction2(client, __spreadProps(__spreadValues({}, args), { walletId }));
1536
1610
  })
1537
1611
  });
1538
1612
  return renameMutations(
@@ -1541,6 +1615,36 @@ var useSignTransaction = () => {
1541
1615
  );
1542
1616
  };
1543
1617
 
1618
+ // src/provider/hooks/mutations/index.ts
1619
+ var useSignUpOrLogIn = generateHook("signUpOrLogInV2", signUpOrLogIn);
1620
+ var useVerifyNewAccount = generateHook("verifyNewAccountV2", verifyNewAccount);
1621
+ var useWaitForLogin = generateHook("waitForLoginV2", waitForLogin);
1622
+ var useWaitForSignup = generateHook("waitForSignupV2", waitForSignup);
1623
+ var useWaitForWalletCreation = generateHook("waitForWalletCreationV2", waitForWalletCreation);
1624
+ var useVerifyOAuth = generateHook("verifyOAuthV2", verifyOAuth);
1625
+ var useVerifyFarcaster = generateHook("verifyFarcasterV2", verifyFarcaster);
1626
+ var useVerifyTelegram = generateHook("verifyTelegramV2", verifyTelegram);
1627
+ var useLoginExternalWallet = generateHook("loginExternalWalletV2", loginExternalWallet);
1628
+ var useVerifyExternalWallet = generateHook("verifyExternalWalletV2", verifyExternalWallet);
1629
+ var useSetup2fa = generateHook("setup2faV2", setup2fa);
1630
+ var useEnable2fa = generateHook("enable2faV2", enable2fa);
1631
+ var useVerify2fa = generateHook("verify2faV2", verify2fa);
1632
+ var useKeepSessionAliveV2 = generateHook("keepSessionAlive", keepSessionAlive);
1633
+ var useLogout = generateHook("logout", logout);
1634
+ var useResendVerificationCode = generateHook("resendVerificationCode", resendVerificationCode);
1635
+ var useCreateWallet = generateHook("createWallet", createWallet);
1636
+ var useCreateWalletPerType = generateHook("createWalletPerType", createWalletPerType);
1637
+ var useCreatePregenWallet = generateHook("createPregenWalletV2", createPregenWallet);
1638
+ var useCreatePregenWalletPerType = generateHook("createPregenWalletPerTypeV2", createPregenWalletPerType);
1639
+ var useClaimPregenWallets = generateHook("claimPregenWalletsV2", claimPregenWallets);
1640
+ var useHasPregenWallet = generateHook("hasPregenWalletV2", hasPregenWallet);
1641
+ var useUpdatePregenWalletIdentifier = generateHook(
1642
+ "updatePregenWalletIdentifierV2",
1643
+ updatePregenWalletIdentifier
1644
+ );
1645
+ var useSignMessageV2 = generateHook("signMessage", signMessage);
1646
+ var useSignTransactionV2 = generateHook("signTransaction", signTransaction);
1647
+
1544
1648
  // src/provider/hooks/utils/useAutoSessionKeepAlive.ts
1545
1649
  var SESSION_CHECK_INTERVAL = 6e4;
1546
1650
  var SESSION_REFRESH_THRESHOLD = 3e5;
@@ -1608,8 +1712,8 @@ var useAutoSessionKeepAlive = ({ disabled }) => {
1608
1712
  };
1609
1713
 
1610
1714
  // src/provider/hooks/utils/useEventListeners.ts
1611
- import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
1612
- import { useEffect as useEffect5 } from "react";
1715
+ import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
1716
+ import { useCallback as useCallback2, useEffect as useEffect5 } from "react";
1613
1717
  import {
1614
1718
  ParaEvent
1615
1719
  } from "@getpara/web-sdk";
@@ -1625,60 +1729,81 @@ var useEventListeners = ({
1625
1729
  onExternalWalletChange,
1626
1730
  onWalletsChange
1627
1731
  } = {}) => {
1628
- const queryClient = useQueryClient5();
1629
- const client = useClient();
1732
+ const queryClient = useQueryClient4();
1630
1733
  const clearSelectedWallet = useStore((state) => state.clearSelectedWallet);
1631
- const { selectedWallet, setSelectedWallet } = useWalletState();
1632
- const loginListener = (event) => {
1633
- loginOrSetupListener();
1634
- onLogin == null ? void 0 : onLogin(event);
1635
- };
1636
- const accountSetupListener = (event) => {
1637
- loginOrSetupListener();
1638
- onAccountSetup == null ? void 0 : onAccountSetup(event);
1639
- };
1640
- const loginOrSetupListener = () => {
1641
- queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
1642
- queryClient.invalidateQueries({ queryKey: [WALLET_BASE_KEY], exact: false });
1643
- };
1644
- const accountCreationListener = (event) => {
1645
- onAccountCreation == null ? void 0 : onAccountCreation(event);
1646
- };
1647
- const logoutListener = (event) => {
1648
- queryClient.invalidateQueries({ queryKey: [ACCOUNT_BASE_KEY], exact: false });
1649
- clearSelectedWallet();
1650
- onLogout == null ? void 0 : onLogout(event);
1651
- };
1652
- const signMessageListener = (event) => {
1653
- onSignMessage == null ? void 0 : onSignMessage(event);
1654
- };
1655
- const signTransactionListener = (event) => {
1656
- onSignTransaction == null ? void 0 : onSignTransaction(event);
1657
- };
1658
- const walletChangeListener = (event) => {
1659
- updateSelectedWallet();
1660
- onWalletsChange == null ? void 0 : onWalletsChange(event);
1661
- };
1662
- const externalWalletChangeListener = (event) => {
1663
- updateSelectedWallet();
1664
- onExternalWalletChange == null ? void 0 : onExternalWalletChange(event);
1665
- };
1666
- const walletCreatedListener = (event) => {
1667
- onWalletCreated == null ? void 0 : onWalletCreated(event);
1668
- };
1669
- const pregenWalletClaimedListener = (event) => {
1670
- onPregenWalletClaimed == null ? void 0 : onPregenWalletClaimed(event);
1671
- };
1672
- const updateSelectedWallet = () => {
1673
- if (!client) {
1734
+ const { updateSelectedWallet } = useWalletState();
1735
+ const loginOrSetupListener = useCallback2(() => {
1736
+ queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
1737
+ queryClient.refetchQueries({ queryKey: [WALLET_BASE_KEY] });
1738
+ }, [queryClient]);
1739
+ const loginListener = useCallback2(
1740
+ (event) => {
1741
+ loginOrSetupListener();
1742
+ onLogin == null ? void 0 : onLogin(event);
1743
+ },
1744
+ [loginOrSetupListener, onLogin]
1745
+ );
1746
+ const accountSetupListener = useCallback2(
1747
+ (event) => {
1748
+ loginOrSetupListener();
1749
+ onAccountSetup == null ? void 0 : onAccountSetup(event);
1750
+ },
1751
+ [loginOrSetupListener, onAccountSetup]
1752
+ );
1753
+ const accountCreationListener = useCallback2(
1754
+ (event) => {
1755
+ onAccountCreation == null ? void 0 : onAccountCreation(event);
1756
+ },
1757
+ [onAccountCreation]
1758
+ );
1759
+ const logoutListener = useCallback2(
1760
+ (event) => {
1761
+ queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
1674
1762
  clearSelectedWallet();
1675
- return;
1676
- }
1677
- if (!(selectedWallet == null ? void 0 : selectedWallet.id) || !client.findWallet(selectedWallet == null ? void 0 : selectedWallet.id)) {
1678
- const defaultWallet = client.findWallet(void 0, void 0, { forbidPregen: true });
1679
- setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
1680
- }
1681
- };
1763
+ onLogout == null ? void 0 : onLogout(event);
1764
+ },
1765
+ [queryClient, clearSelectedWallet, onLogout]
1766
+ );
1767
+ const signMessageListener = useCallback2(
1768
+ (event) => {
1769
+ onSignMessage == null ? void 0 : onSignMessage(event);
1770
+ },
1771
+ [onSignMessage]
1772
+ );
1773
+ const signTransactionListener = useCallback2(
1774
+ (event) => {
1775
+ onSignTransaction == null ? void 0 : onSignTransaction(event);
1776
+ },
1777
+ [onSignTransaction]
1778
+ );
1779
+ const walletChangeListener = useCallback2(
1780
+ (event) => {
1781
+ queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
1782
+ updateSelectedWallet();
1783
+ onWalletsChange == null ? void 0 : onWalletsChange(event);
1784
+ },
1785
+ [queryClient, updateSelectedWallet, onWalletsChange]
1786
+ );
1787
+ const externalWalletChangeListener = useCallback2(
1788
+ (event) => {
1789
+ queryClient.refetchQueries({ queryKey: [ACCOUNT_BASE_KEY] });
1790
+ updateSelectedWallet();
1791
+ onExternalWalletChange == null ? void 0 : onExternalWalletChange(event);
1792
+ },
1793
+ [queryClient, updateSelectedWallet, onExternalWalletChange]
1794
+ );
1795
+ const walletCreatedListener = useCallback2(
1796
+ (event) => {
1797
+ onWalletCreated == null ? void 0 : onWalletCreated(event);
1798
+ },
1799
+ [onWalletCreated]
1800
+ );
1801
+ const pregenWalletClaimedListener = useCallback2(
1802
+ (event) => {
1803
+ onPregenWalletClaimed == null ? void 0 : onPregenWalletClaimed(event);
1804
+ },
1805
+ [onPregenWalletClaimed]
1806
+ );
1682
1807
  useEffect5(() => {
1683
1808
  window.addEventListener(ParaEvent.LOGIN_EVENT, loginListener);
1684
1809
  window.addEventListener(ParaEvent.ACCOUNT_SETUP_EVENT, accountSetupListener);
@@ -1702,15 +1827,27 @@ var useEventListeners = ({
1702
1827
  window.removeEventListener(ParaEvent.WALLET_CREATED, walletCreatedListener);
1703
1828
  window.removeEventListener(ParaEvent.PREGEN_WALLET_CLAIMED, pregenWalletClaimedListener);
1704
1829
  };
1705
- }, [client]);
1830
+ }, [
1831
+ loginListener,
1832
+ accountSetupListener,
1833
+ accountCreationListener,
1834
+ logoutListener,
1835
+ signMessageListener,
1836
+ signTransactionListener,
1837
+ walletChangeListener,
1838
+ externalWalletChangeListener,
1839
+ walletCreatedListener,
1840
+ pregenWalletClaimedListener
1841
+ ]);
1706
1842
  };
1707
1843
 
1708
1844
  // src/provider/components/ExternalWalletWrapper.tsx
1709
- import { useCallback as useCallback2, useEffect as useEffect10, useMemo as useMemo6 } from "react";
1845
+ import { useCallback as useCallback4, useEffect as useEffect10, useMemo as useMemo6 } from "react";
1710
1846
 
1711
1847
  // src/provider/providers/ExternalWalletProvider.tsx
1712
- import { createContext as createContext4, useCallback, useContext, useEffect as useEffect6, useMemo as useMemo2, useState as useState4 } from "react";
1713
- import { WalletType, isIOS, isIOSWebview, isMobile, truncateAddress } from "@getpara/web-sdk";
1848
+ import { createContext as createContext4, useCallback as useCallback3, useContext, useEffect as useEffect6, useMemo as useMemo2, useState as useState4 } from "react";
1849
+ import { AuthMethod as AuthMethod3, WalletType, isIOS, isIOSWebview, isMobile, truncateAddress } from "@getpara/web-sdk";
1850
+ import { getExternalWalletDisplayName } from "@getpara/react-common";
1714
1851
  import { jsx as jsx4 } from "react/jsx-runtime";
1715
1852
  var defaultExternalWallet = {
1716
1853
  wallets: [],
@@ -1719,12 +1856,7 @@ var defaultExternalWallet = {
1719
1856
  wallet: void 0,
1720
1857
  qrUri: void 0,
1721
1858
  chainIdSwitchingTo: void 0,
1722
- walletDisplayHelpers: {
1723
- showExtension: false,
1724
- showMobile: false,
1725
- isSolanaMobileIOS: false,
1726
- isCosmosMobileWallet: false
1727
- },
1859
+ walletDisplayHelpers: { showExtension: false, showMobile: false, isSolanaMobileIOS: false, isCosmosMobileWallet: false },
1728
1860
  username: void 0,
1729
1861
  avatar: void 0,
1730
1862
  connectExternalWallet: () => Promise.resolve(),
@@ -1732,7 +1864,8 @@ var defaultExternalWallet = {
1732
1864
  switchChain: () => Promise.resolve(),
1733
1865
  setChainIdSwitchingTo: () => {
1734
1866
  },
1735
- connectEmbeddedToExternalConnectors: () => Promise.resolve()
1867
+ connectEmbeddedToExternalConnectors: () => Promise.resolve(),
1868
+ verifyWalletSignature: () => Promise.resolve({})
1736
1869
  };
1737
1870
  var ExternalWalletContext = createContext4(defaultExternalWallet);
1738
1871
  function ExternalWalletProvider({ children }) {
@@ -1740,6 +1873,7 @@ function ExternalWalletProvider({ children }) {
1740
1873
  const cosmosContext = useStore((state) => state.cosmosContext);
1741
1874
  const solanaContext = useStore((state) => state.solanaContext);
1742
1875
  const externalWallets = useStore((state) => state.externalWallets);
1876
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
1743
1877
  const {
1744
1878
  wallets: evmWallets,
1745
1879
  disconnect: evmDisconnect,
@@ -1748,16 +1882,22 @@ function ExternalWalletProvider({ children }) {
1748
1882
  switchChain: evmSwitchChain,
1749
1883
  username: evmUsername,
1750
1884
  avatar: evmAvatar,
1751
- connectParaEmbedded: evmConnectParaEmbedded
1885
+ connectParaEmbedded: evmConnectParaEmbedded,
1886
+ signVerificationMessage: evmSignVerificationMessage
1752
1887
  } = useContext(evmContext);
1753
- const { wallets: solanaWallets, disconnect: solanaDisconnect } = useContext(solanaContext);
1888
+ const {
1889
+ wallets: solanaWallets,
1890
+ disconnect: solanaDisconnect,
1891
+ signVerificationMessage: solanaSignVerificationMessage
1892
+ } = useContext(solanaContext);
1754
1893
  const {
1755
1894
  wallets: cosmosWallets,
1756
1895
  disconnect: cosmosDisconnect,
1757
1896
  chains: cosmosChains,
1758
1897
  chainId: cosmosChainId,
1759
1898
  switchChain: cosmosSwitchChain,
1760
- connectParaEmbedded: cosmosConnectParaEmbedded
1899
+ connectParaEmbedded: cosmosConnectParaEmbedded,
1900
+ signVerificationMessage: cosmosSignVerificationMessage
1761
1901
  } = useContext(cosmosContext);
1762
1902
  const setStep = useModalStore((state) => state.setStep);
1763
1903
  const setStepDirection = useModalStore((state) => state.setStepDirection);
@@ -1768,7 +1908,12 @@ function ExternalWalletProvider({ children }) {
1768
1908
  const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
1769
1909
  const setIsUsingMobileConnector = useModalStore((state) => state.setIsUsingMobileConnector);
1770
1910
  const isUsingMobileConnector = useModalStore((state) => state.isUsingMobileConnector);
1911
+ const setFlow = useModalStore((state) => state.setFlow);
1912
+ const setSupportedAuthMethods = useModalStore((state) => state.setSupportedAuthMethods);
1913
+ const setBiometricLocationHints = useModalStore((state) => state.setBiometricLocationHints);
1771
1914
  const para = useInternalClient();
1915
+ const { setSelectedWallet } = useWalletState();
1916
+ const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
1772
1917
  const [qrUri, setQrUri] = useState4();
1773
1918
  const [chainIdSwitchingTo, setChainIdSwitchingTo] = useState4();
1774
1919
  const wallets = [...evmWallets, ...solanaWallets, ...cosmosWallets].filter((w) => externalWallets.includes(w.id.toUpperCase())).sort(
@@ -1819,7 +1964,7 @@ function ExternalWalletProvider({ children }) {
1819
1964
  }
1820
1965
  }
1821
1966
  }, [cosmosChains, evmChains, selectedExternalWalletId]);
1822
- const switchChain = useCallback(
1967
+ const switchChain = useCallback3(
1823
1968
  (chainId2) => __async(this, null, function* () {
1824
1969
  var _a;
1825
1970
  const walletType = (_a = Object.values(para.externalWallets || {})[0]) == null ? void 0 : _a.type;
@@ -1854,7 +1999,80 @@ function ExternalWalletProvider({ children }) {
1854
1999
  }),
1855
2000
  [evmSwitchChain, cosmosSwitchChain]
1856
2001
  );
1857
- const connectExternalWallet = useCallback(
2002
+ const verifyWalletSignature = useCallback3(() => __async(this, null, function* () {
2003
+ var _a;
2004
+ setExternalWalletError();
2005
+ const walletType = (_a = Object.values(para.externalWallets)[0]) == null ? void 0 : _a.type;
2006
+ if (walletType) {
2007
+ const resp = {
2008
+ address: "",
2009
+ signature: "",
2010
+ cosmosPublicKeyHex: "",
2011
+ cosmosSigner: ""
2012
+ };
2013
+ switch (walletType) {
2014
+ case WalletType.COSMOS: {
2015
+ const { signature, error, cosmosPublicKeyHex, cosmosSigner, address } = yield cosmosSignVerificationMessage();
2016
+ if (error) {
2017
+ setExternalWalletError([error]);
2018
+ } else if (signature) {
2019
+ resp.address = address;
2020
+ resp.signature = signature;
2021
+ resp.cosmosPublicKeyHex = cosmosPublicKeyHex;
2022
+ resp.cosmosSigner = cosmosSigner;
2023
+ }
2024
+ return resp;
2025
+ }
2026
+ case WalletType.EVM: {
2027
+ const { signature, error, address } = yield evmSignVerificationMessage();
2028
+ if (error) {
2029
+ setExternalWalletError([error]);
2030
+ } else if (signature && address) {
2031
+ resp.address = address;
2032
+ resp.signature = signature;
2033
+ }
2034
+ return resp;
2035
+ }
2036
+ case WalletType.SOLANA: {
2037
+ const { signature, error, address } = yield solanaSignVerificationMessage();
2038
+ if (error) {
2039
+ setExternalWalletError([error]);
2040
+ } else if (signature && address) {
2041
+ resp.address = address;
2042
+ resp.signature = signature;
2043
+ }
2044
+ return resp;
2045
+ }
2046
+ default: {
2047
+ return void 0;
2048
+ }
2049
+ }
2050
+ }
2051
+ }), [cosmosSignVerificationMessage, evmSignVerificationMessage, solanaSignVerificationMessage]);
2052
+ const completeFullAuth = (address, type, userExists, isVerified, bufferAddress) => __async(this, null, function* () {
2053
+ setAuthInfo({
2054
+ displayName: getExternalWalletDisplayName({ address, type }),
2055
+ externalWalletAddress: bufferAddress != null ? bufferAddress : address
2056
+ });
2057
+ if (userExists && isVerified) {
2058
+ const supportedAuthMethods = yield para.supportedAuthMethods({ externalWalletAddress: bufferAddress != null ? bufferAddress : address });
2059
+ if (!supportedAuthMethods.size) {
2060
+ setFlow("signup");
2061
+ setStep("EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */);
2062
+ return;
2063
+ }
2064
+ yield para.initiateUserLoginV2({ externalWalletAddress: bufferAddress != null ? bufferAddress : address });
2065
+ const biometricLocationHints = supportedAuthMethods.has(AuthMethod3.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
2066
+ setFlow("login");
2067
+ setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
2068
+ setSupportedAuthMethods(supportedAuthMethods);
2069
+ setBiometricLocationHints(biometricLocationHints);
2070
+ } else {
2071
+ setFlow("signup");
2072
+ setStep("EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */);
2073
+ }
2074
+ });
2075
+ const connectExternalWallet = useCallback3(
1858
2076
  (wallet2, isMobileConnect, isManualWalletConnect, isResetAfterManualWalletConnect) => __async(this, null, function* () {
1859
2077
  if (isExternalWalletConnecting && isManualWalletConnect) {
1860
2078
  yield evmDisconnect();
@@ -1867,7 +2085,7 @@ function ExternalWalletProvider({ children }) {
1867
2085
  setExternalWalletError();
1868
2086
  setIsExternalWalletConnecting(true);
1869
2087
  setIsUsingMobileConnector(isMobileConnect);
1870
- const { address, error } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect) : wallet2.connect();
2088
+ const { address, bufferAddress, error, userExists, isVerified } = yield isMobileConnect ? wallet2.connectMobile(isManualWalletConnect) : wallet2.connect();
1871
2089
  if (error) {
1872
2090
  setExternalWalletError([error]);
1873
2091
  setIsUsingMobileConnector();
@@ -1878,18 +2096,23 @@ function ExternalWalletProvider({ children }) {
1878
2096
  return;
1879
2097
  }
1880
2098
  } else if (address) {
1881
- setStep("LOGIN_DONE" /* LOGIN_DONE */);
2099
+ if (externalWalletsWithFullAuth == null ? void 0 : externalWalletsWithFullAuth.includes(wallet2.id.toUpperCase())) {
2100
+ yield completeFullAuth(address, wallet2.type, userExists, isVerified, bufferAddress);
2101
+ } else {
2102
+ setStep("LOGIN_DONE" /* LOGIN_DONE */);
2103
+ }
1882
2104
  }
1883
2105
  setIsExternalWalletConnecting(false);
1884
2106
  }
1885
2107
  }),
1886
- [isExternalWalletConnecting]
2108
+ [isExternalWalletConnecting, externalWalletsWithFullAuth]
1887
2109
  );
1888
2110
  const disconnectExternalWallet = () => __async(this, null, function* () {
2111
+ yield para.logout();
1889
2112
  yield evmDisconnect();
1890
- yield solanaDisconnect();
1891
2113
  yield cosmosDisconnect();
1892
2114
  setSelectedExternalWalletId();
2115
+ yield solanaDisconnect();
1893
2116
  });
1894
2117
  const walletDisplayHelpers = {
1895
2118
  // Show the extension screen if on web and the wallet is an extension and installed or the wallet isn't a mobile wallet
@@ -1932,11 +2155,16 @@ function ExternalWalletProvider({ children }) {
1932
2155
  }
1933
2156
  }
1934
2157
  }, [evmAvatar, wallet]);
1935
- const connectEmbeddedToExternalConnectors = useCallback(() => __async(this, null, function* () {
2158
+ const connectEmbeddedToExternalConnectors = useCallback3(() => __async(this, null, function* () {
1936
2159
  try {
1937
2160
  const { error } = yield evmConnectParaEmbedded();
1938
2161
  if (error) {
1939
2162
  console.warn("Failed to connect Para EVM wallet to Wagmi:", error);
2163
+ } else {
2164
+ const wallet2 = para.findWallet(void 0, void 0, { type: [WalletType.EVM] });
2165
+ if (wallet2) {
2166
+ setSelectedWallet({ id: wallet2.id, type: WalletType.EVM });
2167
+ }
1940
2168
  }
1941
2169
  } catch (err) {
1942
2170
  console.warn("Error calling connectParaEvmWallet:", err);
@@ -1945,6 +2173,11 @@ function ExternalWalletProvider({ children }) {
1945
2173
  const { error } = yield cosmosConnectParaEmbedded();
1946
2174
  if (error) {
1947
2175
  console.warn("Failed to connect Para Cosmos wallet to Graz:", error);
2176
+ } else {
2177
+ const wallet2 = para.findWallet(void 0, void 0, { type: [WalletType.COSMOS] });
2178
+ if (wallet2) {
2179
+ setSelectedWallet({ id: wallet2.id, type: WalletType.COSMOS });
2180
+ }
1948
2181
  }
1949
2182
  } catch (err) {
1950
2183
  console.warn("Error calling connectParaCosmosWallet:", err);
@@ -1968,7 +2201,8 @@ function ExternalWalletProvider({ children }) {
1968
2201
  disconnectExternalWallet,
1969
2202
  switchChain,
1970
2203
  setChainIdSwitchingTo,
1971
- connectEmbeddedToExternalConnectors
2204
+ connectEmbeddedToExternalConnectors,
2205
+ verifyWalletSignature
1972
2206
  }),
1973
2207
  [
1974
2208
  wallets,
@@ -1984,7 +2218,8 @@ function ExternalWalletProvider({ children }) {
1984
2218
  connectExternalWallet,
1985
2219
  switchChain,
1986
2220
  setChainIdSwitchingTo,
1987
- connectEmbeddedToExternalConnectors
2221
+ connectEmbeddedToExternalConnectors,
2222
+ verifyWalletSignature
1988
2223
  ]
1989
2224
  ),
1990
2225
  children
@@ -2076,6 +2311,7 @@ function EvmExternalWalletProvider(_a) {
2076
2311
  }
2077
2312
 
2078
2313
  // src/provider/components/EvmWalletWrapper.tsx
2314
+ import { EvmWallet } from "@getpara/react-common";
2079
2315
  import { jsx as jsx6 } from "react/jsx-runtime";
2080
2316
  var EvmWalletWrapper = ({
2081
2317
  children,
@@ -2084,13 +2320,15 @@ var EvmWalletWrapper = ({
2084
2320
  onSwitchWallet
2085
2321
  }) => {
2086
2322
  const para = useInternalClient();
2323
+ const { data: wallet } = useWallet();
2324
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
2087
2325
  const wallets = useStore((state) => state.externalWallets);
2088
2326
  const isUsing = wallets.some((w) => w in EvmWallet);
2089
2327
  return /* @__PURE__ */ jsx6(
2090
2328
  EvmExternalWalletProvider,
2091
2329
  {
2092
2330
  config: evmProviderConfig,
2093
- internalConfig: { onSwitchWallet, para },
2331
+ internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth, connectedWallet: wallet },
2094
2332
  wagmiProviderProps,
2095
2333
  isUsing,
2096
2334
  wallets,
@@ -2173,6 +2411,7 @@ function CosmosExternalWalletProvider(_a) {
2173
2411
  var MemoizedCosmosExternalWalletProvider = memo(CosmosExternalWalletProvider);
2174
2412
 
2175
2413
  // src/provider/components/CosmosWalletWrapper.tsx
2414
+ import { CosmosWallet } from "@getpara/react-common";
2176
2415
  import { jsx as jsx8 } from "react/jsx-runtime";
2177
2416
  var CosmosWalletWrapper = ({
2178
2417
  children,
@@ -2181,13 +2420,15 @@ var CosmosWalletWrapper = ({
2181
2420
  onSwitchWallet
2182
2421
  }) => {
2183
2422
  const para = useInternalClient();
2423
+ const { data: wallet } = useWallet();
2424
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
2184
2425
  const wallets = useStore((state) => state.externalWallets);
2185
2426
  const isUsing = wallets.some((w) => w in CosmosWallet);
2186
2427
  return /* @__PURE__ */ jsx8(
2187
2428
  CosmosExternalWalletProvider,
2188
2429
  {
2189
2430
  config: cosmosConnectorConfig,
2190
- internalConfig: { onSwitchWallet, para },
2431
+ internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth, connectedWallet: wallet },
2191
2432
  grazProviderProps,
2192
2433
  isUsing,
2193
2434
  wallets,
@@ -2270,12 +2511,14 @@ function SolanaExternalWalletProvider(_a) {
2270
2511
  var MemoizedSolanaExternalWalletProvider = memo2(SolanaExternalWalletProvider);
2271
2512
 
2272
2513
  // src/provider/components/SolanaWalletWrapper.tsx
2514
+ import { SolanaWallet } from "@getpara/react-common";
2273
2515
  import { jsx as jsx10 } from "react/jsx-runtime";
2274
2516
  var SolanaWalletWrapper = ({
2275
2517
  children,
2276
2518
  solanaProviderConfig,
2277
2519
  onSwitchWallet
2278
2520
  }) => {
2521
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
2279
2522
  const para = useInternalClient();
2280
2523
  const wallets = useStore((state) => state.externalWallets);
2281
2524
  const isUsing = wallets.some((w) => w in SolanaWallet);
@@ -2289,7 +2532,7 @@ var SolanaWalletWrapper = ({
2289
2532
  SolanaExternalWalletProvider,
2290
2533
  {
2291
2534
  config: solanaProviderConfig,
2292
- internalConfig: { onSwitchWallet, para },
2535
+ internalConfig: { onSwitchWallet, para, walletsWithFullAuth: externalWalletsWithFullAuth },
2293
2536
  isUsing,
2294
2537
  wallets,
2295
2538
  children
@@ -2308,13 +2551,14 @@ var ExternalWalletWrapper = ({
2308
2551
  const appName = useStore((state) => state.appName);
2309
2552
  const resetModalState = useModalStore((state) => state.resetState);
2310
2553
  const resetUserInfoState = useUserInfoStore((state) => state.resetState);
2554
+ const wallets = useStore((state) => state.externalWallets);
2311
2555
  useEffect10(() => {
2312
- if (!(walletConnect == null ? void 0 : walletConnect.projectId)) {
2556
+ if (!!wallets.length && !(walletConnect == null ? void 0 : walletConnect.projectId)) {
2313
2557
  console.warn(
2314
2558
  "It is recommended to provide a WalletConnect project id to ensure wallet connection works as expected. Sign up for your free key at https://cloud.walletconnect.com/sign-in"
2315
2559
  );
2316
2560
  }
2317
- }, [walletConnect]);
2561
+ }, [wallets, walletConnect]);
2318
2562
  const evmProviderConfig = useMemo6(
2319
2563
  () => {
2320
2564
  var _a2, _b;
@@ -2353,13 +2597,7 @@ var ExternalWalletWrapper = ({
2353
2597
  uri: (_d = (_c = solanaConnector == null ? void 0 : solanaConnector.config.appIdentity) == null ? void 0 : _c.uri) != null ? _d : appUrl,
2354
2598
  icon: (_f = (_e = solanaConnector == null ? void 0 : solanaConnector.config.appIdentity) == null ? void 0 : _e.icon) != null ? _f : appIcon
2355
2599
  };
2356
- return !solanaConnector ? {
2357
- appIdentity,
2358
- chain: "devnet",
2359
- endpoint: "https://api.devnet.solana.com"
2360
- } : __spreadValues({
2361
- appIdentity
2362
- }, solanaConnector == null ? void 0 : solanaConnector.config);
2600
+ return !solanaConnector ? { appIdentity, chain: "devnet", endpoint: "https://api.devnet.solana.com" } : __spreadValues({ appIdentity }, solanaConnector == null ? void 0 : solanaConnector.config);
2363
2601
  }, [solanaConnector]);
2364
2602
  const cosmosProviderConfig = useMemo6(
2365
2603
  () => !cosmosConnector ? {
@@ -2401,13 +2639,11 @@ var ExternalWalletWrapper = ({
2401
2639
  const connectorsGrazProviderProps = cosmosConnector == null ? void 0 : cosmosConnector.grazProviderProps;
2402
2640
  return __spreadProps(__spreadValues({}, connectorsGrazProviderProps), {
2403
2641
  walletConnect: __spreadProps(__spreadValues({}, connectorsGrazProviderProps == null ? void 0 : connectorsGrazProviderProps.walletConnect), {
2404
- options: __spreadProps(__spreadValues({}, (_a2 = connectorsGrazProviderProps == null ? void 0 : connectorsGrazProviderProps.walletConnect) == null ? void 0 : _a2.options), {
2405
- projectId: (_b = walletConnect == null ? void 0 : walletConnect.projectId) != null ? _b : ""
2406
- })
2642
+ options: __spreadProps(__spreadValues({}, (_a2 = connectorsGrazProviderProps == null ? void 0 : connectorsGrazProviderProps.walletConnect) == null ? void 0 : _a2.options), { projectId: (_b = walletConnect == null ? void 0 : walletConnect.projectId) != null ? _b : "" })
2407
2643
  })
2408
2644
  });
2409
2645
  }, [cosmosConnector, walletConnect == null ? void 0 : walletConnect.projectId]);
2410
- const handleSwitchWallet = useCallback2(({ address, error }) => {
2646
+ const handleSwitchWallet = useCallback4(({ address, error }) => {
2411
2647
  if (error || !address) {
2412
2648
  resetModalState();
2413
2649
  resetUserInfoState();
@@ -2443,6 +2679,7 @@ function isParaWeb(obj) {
2443
2679
 
2444
2680
  // src/provider/ParaProvider.tsx
2445
2681
  import ParaWeb2 from "@getpara/web-sdk";
2682
+ import { ExternalWallet } from "@getpara/react-common";
2446
2683
  import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
2447
2684
  var ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config, externalWalletConfig, paraModalConfig }, ref) => {
2448
2685
  useEventListeners(callbacks);
@@ -2451,6 +2688,8 @@ var ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config,
2451
2688
  const client = useStore((state) => state.client);
2452
2689
  const setExternalWallets = useStore((state) => state.setExternalWallets);
2453
2690
  const externalWallets = useStore((state) => state.externalWallets);
2691
+ const setExternalWalletsWithFullAuth = useStore((state) => state.setExternalWalletsWithFullAuth);
2692
+ const externalWalletsWithFullAuth = useStore((state) => state.externalWalletsWithFullAuth);
2454
2693
  const setModalConfig = useStore((state) => state.setModalConfig);
2455
2694
  const modalConfig = useStore((state) => state.modalConfig);
2456
2695
  const setAppName = useStore((state) => state.setAppName);
@@ -2463,9 +2702,15 @@ var ParaProvider = forwardRef(({ children, paraClientConfig, callbacks, config,
2463
2702
  }, [paraModalConfig]);
2464
2703
  useEffect11(() => {
2465
2704
  var _a;
2466
- if (externalWallets !== (externalWalletConfig == null ? void 0 : externalWalletConfig.wallets))
2705
+ if (externalWallets !== (externalWalletConfig == null ? void 0 : externalWalletConfig.wallets)) {
2467
2706
  setExternalWallets((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.wallets) != null ? _a : Object.values(ExternalWallet));
2707
+ }
2468
2708
  }, [externalWalletConfig == null ? void 0 : externalWalletConfig.wallets]);
2709
+ useEffect11(() => {
2710
+ var _a;
2711
+ if (externalWalletsWithFullAuth !== (externalWalletConfig == null ? void 0 : externalWalletConfig.walletsWithParaAuth))
2712
+ setExternalWalletsWithFullAuth((_a = externalWalletConfig == null ? void 0 : externalWalletConfig.walletsWithParaAuth) != null ? _a : []);
2713
+ }, [externalWalletConfig == null ? void 0 : externalWalletConfig.walletsWithParaAuth]);
2469
2714
  useEffect11(() => {
2470
2715
  if (!isConfigType(paraClientConfig) && !isParaWeb(paraClientConfig)) {
2471
2716
  throw new Error("Invalid Para config");
@@ -2875,6 +3120,8 @@ import { useCopyToClipboard as useCopyToClipboard3, UserIdentifier as UserIdenti
2875
3120
  import { useContext as useContext2 } from "react";
2876
3121
  import { Fragment as Fragment6, jsx as jsx21, jsxs as jsxs12 } from "react/jsx-runtime";
2877
3122
  var BiometricCreationStep = () => {
3123
+ const para = useInternalClient();
3124
+ const appName = useStore((state) => state.appName);
2878
3125
  const { createAccount } = useContext2(ActionsContext);
2879
3126
  const webAuthURLForCreate = useModalStore((state) => state.webAuthURLForCreate);
2880
3127
  const iFrameUrl = useModalStore((state) => state.iFrameUrl);
@@ -2889,7 +3136,7 @@ var BiometricCreationStep = () => {
2889
3136
  const isBoth = !!webAuthURLForCreate && !!iFrameUrl;
2890
3137
  return /* @__PURE__ */ jsxs12(StepContainer, { $wide: true, children: [
2891
3138
  /* @__PURE__ */ jsxs12(InnerStepContainer, { children: [
2892
- /* @__PURE__ */ jsx21(Heading, { variant: "headingS", weight: "bold", children: isBoth ? "Secure Your Account" : "Create Passkey" }),
3139
+ /* @__PURE__ */ jsx21(Heading, { variant: "headingS", weight: "bold", children: para.isExternalWalletAuth ? `Finish setup for your${appName ? ` ${appName}` : ""} wallet` : isBoth ? "Secure Your Account" : "Create Passkey" }),
2893
3140
  authInfo && /* @__PURE__ */ jsx21(UserIdentifier2, __spreadValues({}, authInfo)),
2894
3141
  /* @__PURE__ */ jsx21(CpslText10, { variant: "bodyS", color: "secondary", weight: "medium", children: isBoth ? "Choose a password or set up a passkey" : "Your Passkey keeps your account safe." })
2895
3142
  ] }),
@@ -3322,7 +3569,8 @@ var useGoBack = () => {
3322
3569
  const accountAddFundTab = useModalStore((state) => state.accountAddFundTab);
3323
3570
  const decrementStep = useModalStore((state) => state.decrementStep);
3324
3571
  const resetState = useModalStore((state) => state.resetState);
3325
- const { setChainIdSwitchingTo } = useExternalWallets();
3572
+ const { setChainIdSwitchingTo, disconnectExternalWallet } = useExternalWallets();
3573
+ const para = useInternalClient();
3326
3574
  const goBack = () => {
3327
3575
  if (accountAddFundTab && currentStep === "ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */) {
3328
3576
  setStep(getAddFundsStep(accountAddFundTab));
@@ -3331,8 +3579,13 @@ var useGoBack = () => {
3331
3579
  }
3332
3580
  switch (currentStep) {
3333
3581
  case "AUTH_MAIN" /* AUTH_MAIN */:
3334
- case "AUTH_MORE" /* AUTH_MORE */: {
3582
+ case "AUTH_MORE" /* AUTH_MORE */:
3583
+ case "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */:
3584
+ case "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */: {
3335
3585
  resetState();
3586
+ if (para.isExternalWalletAuth) {
3587
+ disconnectExternalWallet();
3588
+ }
3336
3589
  break;
3337
3590
  }
3338
3591
  case "CHAIN_SWITCH" /* CHAIN_SWITCH */: {
@@ -3451,7 +3704,7 @@ var AddFundsDone = ({ isSuccess, onClose }) => {
3451
3704
  // src/modal/components/OAuth/FarcasterOAuthStep.tsx
3452
3705
  import { useEffect as useEffect16 } from "react";
3453
3706
  import { CpslButton as CpslButton11, CpslIcon as CpslIcon8, CpslQrCode as CpslQrCode4, CpslSpinner as CpslSpinner7, CpslText as CpslText14 } from "@getpara/react-components";
3454
- import { AuthMethod as AuthMethod3, isMobile as isMobile3 } from "@getpara/web-sdk";
3707
+ import { AuthMethod as AuthMethod4, isMobile as isMobile3 } from "@getpara/web-sdk";
3455
3708
  import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
3456
3709
  var FarcasterOAuthStep = () => {
3457
3710
  const setAuthInfo = useUserInfoStore((state) => state.setAuthInfo);
@@ -3480,7 +3733,7 @@ var FarcasterOAuthStep = () => {
3480
3733
  const supportedAuthMethods = yield para.initiateUserLoginV2({ farcasterUsername: username });
3481
3734
  if (supportedAuthMethods.size > 0) {
3482
3735
  setSupportedAuthMethods(supportedAuthMethods);
3483
- const biometricLocationHints = supportedAuthMethods.has(AuthMethod3.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
3736
+ const biometricLocationHints = supportedAuthMethods.has(AuthMethod4.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
3484
3737
  setFlow("login");
3485
3738
  setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
3486
3739
  setBiometricLocationHints(biometricLocationHints);
@@ -3489,13 +3742,13 @@ var FarcasterOAuthStep = () => {
3489
3742
  }
3490
3743
  const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
3491
3744
  setIsIFrameReady(false);
3492
- setFlow("signUp");
3493
- const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod3.PASSKEY);
3745
+ setFlow("signup");
3746
+ const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod4.PASSKEY);
3494
3747
  if (supportsPasskey) {
3495
3748
  setWebAuthURLForCreate(yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "farcaster" })));
3496
3749
  setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
3497
3750
  }
3498
- if (supportedCreateAuthMethods.has(AuthMethod3.PASSWORD)) {
3751
+ if (supportedCreateAuthMethods.has(AuthMethod4.PASSWORD)) {
3499
3752
  setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "farcaster", theme })));
3500
3753
  setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
3501
3754
  }
@@ -3809,7 +4062,7 @@ import { useMemo as useMemo12 } from "react";
3809
4062
  import styled15 from "styled-components";
3810
4063
 
3811
4064
  // src/modal/components/OAuth/OAuth.tsx
3812
- import { AuthMethod as AuthMethod4, OAuthMethod } from "@getpara/web-sdk";
4065
+ import { AuthMethod as AuthMethod5, OAuthMethod } from "@getpara/web-sdk";
3813
4066
  import { styled as styled13 } from "styled-components";
3814
4067
 
3815
4068
  // src/modal/utils/getTileButtonFlex.ts
@@ -3933,7 +4186,7 @@ var OAuth = ({ methods }) => {
3933
4186
  if (userExists) {
3934
4187
  const supportedAuthMethods = yield para.initiateUserLoginV2({ email });
3935
4188
  if (supportedAuthMethods.size > 0) {
3936
- const biometricLocationHints = supportedAuthMethods.has(AuthMethod4.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
4189
+ const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
3937
4190
  setFlow("login");
3938
4191
  setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
3939
4192
  setSupportedAuthMethods(supportedAuthMethods);
@@ -3943,9 +4196,9 @@ var OAuth = ({ methods }) => {
3943
4196
  }
3944
4197
  const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
3945
4198
  setIsIFrameReady(false);
3946
- setFlow("signUp");
3947
- const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod4.PASSKEY);
3948
- const supportsPassword = supportedCreateAuthMethods.has(AuthMethod4.PASSWORD);
4199
+ setFlow("signup");
4200
+ const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod5.PASSKEY);
4201
+ const supportsPassword = supportedCreateAuthMethods.has(AuthMethod5.PASSWORD);
3949
4202
  if (supportsPasskey) {
3950
4203
  setWebAuthURLForCreate(yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "email" })));
3951
4204
  if (!supportsPassword) {
@@ -4334,7 +4587,7 @@ var phoneMasks = {
4334
4587
  };
4335
4588
 
4336
4589
  // src/modal/components/AuthInput/AuthInput.tsx
4337
- import { AuthMethod as AuthMethod5, formatPhoneNumber } from "@getpara/web-sdk";
4590
+ import { AuthMethod as AuthMethod6, formatPhoneNumber } from "@getpara/web-sdk";
4338
4591
  import parsePhoneNumberFromString from "libphonenumber-js";
4339
4592
  import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
4340
4593
  var DEFAULT_COUNTRY = { label: "United States", value: "+1", selectedLabel: "US", icon: "US" };
@@ -4366,7 +4619,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
4366
4619
  const [countryCode, setCountryCode] = useState11(storedCountryCode != null ? storedCountryCode : "+1");
4367
4620
  const [identifier, setIdentifier] = useState11(
4368
4621
  (() => {
4369
- if (!(authInfo == null ? void 0 : authInfo.authType) || ["telegram", "farcaster"].includes(authInfo == null ? void 0 : authInfo.authType)) {
4622
+ if (!(authInfo == null ? void 0 : authInfo.authType) || ["telegram", "farcaster", "externalWallet"].includes(authInfo == null ? void 0 : authInfo.authType)) {
4370
4623
  return "";
4371
4624
  }
4372
4625
  if (authInfo.authType !== "phone") {
@@ -4439,7 +4692,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
4439
4692
  const userExists = yield checkIfUserExistsAsync(auth);
4440
4693
  if (userExists) {
4441
4694
  const supportedAuthMethods = yield initiateLoginAsync(auth);
4442
- const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
4695
+ const biometricLocationHints = supportedAuthMethods.has(AuthMethod6.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
4443
4696
  setFlow("login");
4444
4697
  setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
4445
4698
  setSupportedAuthMethods(supportedAuthMethods);
@@ -4447,7 +4700,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
4447
4700
  return;
4448
4701
  }
4449
4702
  yield createUserAsync(auth);
4450
- setFlow("signUp");
4703
+ setFlow("signup");
4451
4704
  setStep("VERIFICATIONS" /* VERIFICATIONS */);
4452
4705
  return;
4453
4706
  }
@@ -4464,7 +4717,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
4464
4717
  setAuthInfo(auth);
4465
4718
  if (userExists) {
4466
4719
  const supportedAuthMethods = yield initiateLoginAsync(auth);
4467
- const biometricLocationHints = supportedAuthMethods.has(AuthMethod5.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
4720
+ const biometricLocationHints = supportedAuthMethods.has(AuthMethod6.PASSKEY) ? yield para.getUserBiometricLocationHints() : [];
4468
4721
  setFlow("login");
4469
4722
  setStep("BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */);
4470
4723
  setSupportedAuthMethods(supportedAuthMethods);
@@ -4472,7 +4725,7 @@ var AuthInput = ({ disableEmailLogin, disablePhoneLogin }) => {
4472
4725
  return;
4473
4726
  }
4474
4727
  yield createUserAsync(auth);
4475
- setFlow("signUp");
4728
+ setFlow("signup");
4476
4729
  setStep("VERIFICATIONS" /* VERIFICATIONS */);
4477
4730
  return;
4478
4731
  }
@@ -4939,17 +5192,6 @@ var Container8 = styled19(StepContainer)`
4939
5192
  flex: 1;
4940
5193
  justify-content: space-between;
4941
5194
  `;
4942
- var ErrorContainer = styled19.div`
4943
- display: flex;
4944
- align-items: center;
4945
- justify-content: center;
4946
- gap: 4px;
4947
- `;
4948
- var ErrorIcon = styled19(CpslIcon12)`
4949
- --height: 16px;
4950
- --width: 16px;
4951
- --icon-color: var(--cpsl-color-text-error);
4952
- `;
4953
5195
  var Text2 = styled19(CenteredText)`
4954
5196
  white-space: pre-line;
4955
5197
  `;
@@ -5279,6 +5521,8 @@ var AccountSelect = () => {
5279
5521
  const { dropdownMaxHeight, dropdownWidth, mobileAnchor, resize } = useDropdownPosition(containerRef);
5280
5522
  const { setSelectedWallet } = useWalletState();
5281
5523
  const { data: activeWallet } = useWallet();
5524
+ const { data: account } = useAccount();
5525
+ const availableWallets = account == null ? void 0 : account.wallets;
5282
5526
  const ActiveWalletNode = activeWallet ? /* @__PURE__ */ jsxs26(FlexRow, { slot: "selected-item", children: [
5283
5527
  /* @__PURE__ */ jsx40(CpslIdenticon4, { variant: "avatar", size: "14px", hash: para.getIdenticonHash(activeWallet.id, activeWallet.type) }),
5284
5528
  /* @__PURE__ */ jsx40(WalletName, { variant: "bodyXS", color: "contrast", children: getName(para, __spreadProps(__spreadValues({}, activeWallet), { hideWallets })) }),
@@ -5288,8 +5532,8 @@ var AccountSelect = () => {
5288
5532
  if (dropdownMaxHeight && (activeWallet == null ? void 0 : activeWallet.address)) {
5289
5533
  resize();
5290
5534
  }
5291
- }, [activeWallet, para.availableWallets, dropdownMaxHeight]);
5292
- return /* @__PURE__ */ jsx40(Container12, { children: /* @__PURE__ */ jsx40(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: para.availableWallets.length > 1 ? /* @__PURE__ */ jsxs26(
5535
+ }, [activeWallet, availableWallets, dropdownMaxHeight]);
5536
+ return /* @__PURE__ */ jsx40(Container12, { children: /* @__PURE__ */ jsx40(SelectContainer, { ref: containerRef, id: "addressInputContainer", children: availableWallets && availableWallets.length > 1 ? /* @__PURE__ */ jsxs26(
5293
5537
  StyledSelect,
5294
5538
  {
5295
5539
  selectedValue: getValue(activeWallet == null ? void 0 : activeWallet.id, activeWallet == null ? void 0 : activeWallet.type),
@@ -5307,7 +5551,7 @@ var AccountSelect = () => {
5307
5551
  selectedItemVariant: "bodyXS",
5308
5552
  children: [
5309
5553
  activeWallet && ActiveWalletNode,
5310
- para.availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
5554
+ availableWallets.map(({ address, name: _name, id, type, isExternal }) => {
5311
5555
  const key = getValue(id, type);
5312
5556
  const name = _name != null ? _name : getName(para, { type, isExternal, isMenu: true, hideWallets });
5313
5557
  return /* @__PURE__ */ jsx40(StyledSelectItem2, { slot: "items", value: key, children: /* @__PURE__ */ jsxs26(FlexRow, { children: [
@@ -5470,10 +5714,10 @@ var BackButton = styled24(HeaderButton)`
5470
5714
  `;
5471
5715
 
5472
5716
  // src/modal/components/Body/Body.tsx
5473
- import { useEffect as useEffect25, useState as useState16 } from "react";
5717
+ import { useEffect as useEffect26, useState as useState17 } from "react";
5474
5718
 
5475
5719
  // src/modal/components/OAuth/TelegramOAuthStep.tsx
5476
- import { AuthMethod as AuthMethod6, OAuthMethod as OAuthMethod2 } from "@getpara/web-sdk";
5720
+ import { AuthMethod as AuthMethod7, OAuthMethod as OAuthMethod2 } from "@getpara/web-sdk";
5477
5721
  import styled25 from "styled-components";
5478
5722
  import { useEffect as useEffect24, useRef as useRef8, useState as useState15 } from "react";
5479
5723
  import { HeroSpinner } from "@getpara/react-common";
@@ -5537,15 +5781,15 @@ function TelegramOAuthStep() {
5537
5781
  if (isNewUser) {
5538
5782
  const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
5539
5783
  setIsIFrameReady(false);
5540
- setFlow("signUp");
5541
- const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod6.PASSKEY);
5784
+ setFlow("signup");
5785
+ const supportsPasskey = supportedCreateAuthMethods.has(AuthMethod7.PASSKEY);
5542
5786
  if (supportsPasskey) {
5543
5787
  setWebAuthURLForCreate(
5544
5788
  yield para.shortenLoginLink(yield para.getSetUpBiometricsURL({ authType: "telegram" }))
5545
5789
  );
5546
5790
  setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
5547
5791
  }
5548
- if (supportedCreateAuthMethods.has(AuthMethod6.PASSWORD)) {
5792
+ if (supportedCreateAuthMethods.has(AuthMethod7.PASSWORD)) {
5549
5793
  setIFrameUrl(yield para.shortenLoginLink(yield para.getSetupPasswordURL({ authType: "telegram", theme })));
5550
5794
  setAuthStepRoute(supportsPasskey ? "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */ : "PASSWORD_CREATION" /* PASSWORD_CREATION */);
5551
5795
  }
@@ -5663,8 +5907,97 @@ var Container15 = styled26.div`
5663
5907
  }
5664
5908
  `;
5665
5909
 
5910
+ // src/modal/components/ExternalWalletVerificationStep/ExternalWalletVerificationStep.tsx
5911
+ import { CpslButton as CpslButton18, CpslSpinner as CpslSpinner14, CpslText as CpslText21 } from "@getpara/react-components";
5912
+ import { useEffect as useEffect25, useState as useState16 } from "react";
5913
+ import { styled as styled27 } from "styled-components";
5914
+ import { AuthMethod as AuthMethod8 } from "@getpara/core-sdk";
5915
+ import { jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
5916
+ var ExternalWalletVerificationStep = () => {
5917
+ const theme = useStore((state) => {
5918
+ var _a;
5919
+ return (_a = state.modalConfig) == null ? void 0 : _a.theme;
5920
+ });
5921
+ const authInfo = useUserInfoStore((state) => state.getAuthInfo());
5922
+ const setStep = useModalStore((state) => state.setStep);
5923
+ const setWebAuthURLForCreate = useModalStore((state) => state.setWebAuthURLForCreate);
5924
+ const isIFrameReady = useModalStore((state) => state.isIFrameReady);
5925
+ const setIsIFrameReady = useModalStore((state) => state.setIsIFrameReady);
5926
+ const setIFrameUrl = useModalStore((state) => state.setIFrameUrl);
5927
+ const externalWalletError = useModalStore((state) => state.externalWalletError);
5928
+ const setExternalWalletError = useModalStore((state) => state.setExternalWalletError);
5929
+ const para = useInternalClient();
5930
+ const { verifyWalletSignature } = useExternalWallets();
5931
+ const [shouldRouteToStep, setShouldRouteToStep] = useState16();
5932
+ const [isVerifying, setIsVerifying] = useState16(false);
5933
+ useEffect25(() => {
5934
+ handleVerifyWallet();
5935
+ }, []);
5936
+ useEffect25(() => {
5937
+ if (!!shouldRouteToStep && isIFrameReady) {
5938
+ setTimeout(() => {
5939
+ setStep(shouldRouteToStep);
5940
+ setIsVerifying(false);
5941
+ }, 200);
5942
+ }
5943
+ }, [shouldRouteToStep, isIFrameReady]);
5944
+ const handleVerifyWallet = () => __async(void 0, null, function* () {
5945
+ setIsVerifying(true);
5946
+ try {
5947
+ setIsIFrameReady(false);
5948
+ const supportedCreateAuthMethods = yield para.getSupportedCreateAuthMethods();
5949
+ const walletSignature = yield verifyWalletSignature();
5950
+ if (!(walletSignature == null ? void 0 : walletSignature.signature) || !(walletSignature == null ? void 0 : walletSignature.address)) {
5951
+ console.error("No signature or address found on the verifyWalletSignature response.");
5952
+ setIsVerifying(false);
5953
+ return;
5954
+ }
5955
+ const url = yield para.verifyExternalWallet({
5956
+ address: walletSignature.address,
5957
+ signedMessage: walletSignature.signature,
5958
+ cosmosPublicKeyHex: walletSignature.cosmosPublicKeyHex,
5959
+ cosmosSigner: walletSignature.cosmosSigner
5960
+ });
5961
+ if (supportedCreateAuthMethods.has(AuthMethod8.PASSWORD) && supportedCreateAuthMethods.has(AuthMethod8.PASSKEY)) {
5962
+ const passwordAuthUrl = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
5963
+ setWebAuthURLForCreate(yield para.shortenLoginLink(url));
5964
+ setIFrameUrl(yield para.shortenLoginLink(passwordAuthUrl));
5965
+ setShouldRouteToStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
5966
+ return;
5967
+ } else if (supportedCreateAuthMethods.has(AuthMethod8.PASSWORD)) {
5968
+ const url2 = yield para.getSetupPasswordURL({ authType: authInfo == null ? void 0 : authInfo.authType, theme });
5969
+ setIFrameUrl(yield para.shortenLoginLink(url2));
5970
+ setShouldRouteToStep("PASSWORD_CREATION" /* PASSWORD_CREATION */);
5971
+ return;
5972
+ } else {
5973
+ setWebAuthURLForCreate(yield para.shortenLoginLink(url));
5974
+ setStep("BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */);
5975
+ }
5976
+ } catch (e) {
5977
+ console.error("Error verifying signature:", e);
5978
+ setExternalWalletError(["Signature verification failed."]);
5979
+ setIsVerifying(false);
5980
+ }
5981
+ });
5982
+ return /* @__PURE__ */ jsxs30(StepContainer, { $wide: true, children: [
5983
+ /* @__PURE__ */ jsxs30(InnerStepContainer, { children: [
5984
+ /* @__PURE__ */ jsx45(Heading, { variant: "headingS", weight: "bold", children: "Verify Your Wallet" }),
5985
+ /* @__PURE__ */ jsx45(InlineText3, { variant: "bodyS", color: "secondary", children: "Sign the message with your wallet to complete sign up." }),
5986
+ !!(externalWalletError == null ? void 0 : externalWalletError[0]) && /* @__PURE__ */ jsxs30(ErrorContainer, { children: [
5987
+ /* @__PURE__ */ jsx45(ErrorIcon, { icon: "alertCircle" }),
5988
+ /* @__PURE__ */ jsx45(CpslText21, { weight: "semiBold", color: "error", children: externalWalletError == null ? void 0 : externalWalletError[0] })
5989
+ ] })
5990
+ ] }),
5991
+ /* @__PURE__ */ jsx45(InnerStepContainer, { children: isVerifying ? /* @__PURE__ */ jsx45(CpslSpinner14, {}) : /* @__PURE__ */ jsx45(CpslButton18, { onClick: handleVerifyWallet, children: "Retry" }) })
5992
+ ] });
5993
+ };
5994
+ var InlineText3 = styled27(CpslText21)`
5995
+ text-align: center;
5996
+ display: inline-block;
5997
+ `;
5998
+
5666
5999
  // src/modal/components/Body/Body.tsx
5667
- import { Fragment as Fragment19, jsx as jsx45, jsxs as jsxs30 } from "react/jsx-runtime";
6000
+ import { Fragment as Fragment19, jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
5668
6001
  var MIN_HEIGHT = {
5669
6002
  ["ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */]: "680px"
5670
6003
  };
@@ -5686,11 +6019,11 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5686
6019
  return (_a = state.modalConfig) == null ? void 0 : _a.embeddedModal;
5687
6020
  });
5688
6021
  const appName = useStore((state) => state.appName);
5689
- const [isTestModeAlert, setIsTestModeAlert] = useState16(onRampConfig == null ? void 0 : onRampConfig.testMode);
6022
+ const [isTestModeAlert, setIsTestModeAlert] = useState17(onRampConfig == null ? void 0 : onRampConfig.testMode);
5690
6023
  const Content = () => {
5691
6024
  switch (currentStep) {
5692
6025
  case "AUTH_MAIN" /* AUTH_MAIN */: {
5693
- return /* @__PURE__ */ jsx45(
6026
+ return /* @__PURE__ */ jsx46(
5694
6027
  AuthMainStep,
5695
6028
  {
5696
6029
  oAuthMethods,
@@ -5700,10 +6033,10 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5700
6033
  );
5701
6034
  }
5702
6035
  case "EX_WALLET_MORE" /* EX_WALLET_MORE */: {
5703
- return /* @__PURE__ */ jsx45(ExternalWallets, {});
6036
+ return /* @__PURE__ */ jsx46(ExternalWallets, {});
5704
6037
  }
5705
6038
  case "AUTH_MORE" /* AUTH_MORE */: {
5706
- return /* @__PURE__ */ jsx45(
6039
+ return /* @__PURE__ */ jsx46(
5707
6040
  AuthOptions,
5708
6041
  {
5709
6042
  oAuthMethods,
@@ -5713,72 +6046,75 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5713
6046
  );
5714
6047
  }
5715
6048
  case "VERIFICATIONS" /* VERIFICATIONS */: {
5716
- return /* @__PURE__ */ jsx45(VerificationCodeStep, {});
6049
+ return /* @__PURE__ */ jsx46(VerificationCodeStep, {});
6050
+ }
6051
+ case "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */: {
6052
+ return /* @__PURE__ */ jsx46(ExternalWalletVerificationStep, {});
5717
6053
  }
5718
6054
  case "BIOMETRIC_LOGIN" /* BIOMETRIC_LOGIN */: {
5719
- return /* @__PURE__ */ jsx45(BiometricLoginStep, {});
6055
+ return /* @__PURE__ */ jsx46(BiometricLoginStep, {});
5720
6056
  }
5721
6057
  case "SETUP_2FA" /* SETUP_2FA */:
5722
6058
  case "VERIFY_2FA" /* VERIFY_2FA */: {
5723
- return /* @__PURE__ */ jsx45(Setup2FAStep, { onClose });
6059
+ return /* @__PURE__ */ jsx46(Setup2FAStep, { onClose });
5724
6060
  }
5725
6061
  case "LOGIN_DONE" /* LOGIN_DONE */: {
5726
- return /* @__PURE__ */ jsx45(LoginDoneStep, { onClose });
6062
+ return /* @__PURE__ */ jsx46(LoginDoneStep, { onClose });
5727
6063
  }
5728
6064
  case "AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */:
5729
6065
  case "AWAITING_BIOMETRIC_CREATION" /* AWAITING_BIOMETRIC_CREATION */: {
5730
- return /* @__PURE__ */ jsx45(AwaitingBiometricsStep, {});
6066
+ return /* @__PURE__ */ jsx46(AwaitingBiometricsStep, {});
5731
6067
  }
5732
6068
  case "AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */:
5733
6069
  case "AWAITING_PASSWORD_CREATION" /* AWAITING_PASSWORD_CREATION */: {
5734
- return /* @__PURE__ */ jsx45(AwaitingPasswordStep, {});
6070
+ return /* @__PURE__ */ jsx46(AwaitingPasswordStep, {});
5735
6071
  }
5736
6072
  case "AWAITING_WALLET_CREATION" /* AWAITING_WALLET_CREATION */: {
5737
- return /* @__PURE__ */ jsx45(AwaitingWalletCreationStep, {});
6073
+ return /* @__PURE__ */ jsx46(AwaitingWalletCreationStep, {});
5738
6074
  }
5739
6075
  case "WALLET_CREATION_DONE" /* WALLET_CREATION_DONE */: {
5740
- return /* @__PURE__ */ jsx45(WalletCreationDoneStep, { twoFactorAuthEnabled, onClose });
6076
+ return /* @__PURE__ */ jsx46(WalletCreationDoneStep, { twoFactorAuthEnabled, onClose });
5741
6077
  }
5742
6078
  case "SECRET" /* SECRET */: {
5743
- return /* @__PURE__ */ jsx45(RecoverySecretStep, {});
6079
+ return /* @__PURE__ */ jsx46(RecoverySecretStep, {});
5744
6080
  }
5745
6081
  case "TWO_FACTOR_DONE" /* TWO_FACTOR_DONE */: {
5746
- return /* @__PURE__ */ jsx45(TwoFactorDoneStep, { onClose });
6082
+ return /* @__PURE__ */ jsx46(TwoFactorDoneStep, { onClose });
5747
6083
  }
5748
6084
  case "BIOMETRIC_CREATION" /* BIOMETRIC_CREATION */: {
5749
- return /* @__PURE__ */ jsx45(BiometricCreationStep, {});
6085
+ return /* @__PURE__ */ jsx46(BiometricCreationStep, {});
5750
6086
  }
5751
6087
  case "AWAITING_OAUTH" /* AWAITING_OAUTH */: {
5752
- return /* @__PURE__ */ jsx45(AwaitingOAuthStep, {});
6088
+ return /* @__PURE__ */ jsx46(AwaitingOAuthStep, {});
5753
6089
  }
5754
6090
  case "FARCASTER_OAUTH" /* FARCASTER_OAUTH */: {
5755
- return /* @__PURE__ */ jsx45(FarcasterOAuthStep_default, {});
6091
+ return /* @__PURE__ */ jsx46(FarcasterOAuthStep_default, {});
5756
6092
  }
5757
6093
  case "TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */: {
5758
- return /* @__PURE__ */ jsx45(TelegramOAuthStep, {});
6094
+ return /* @__PURE__ */ jsx46(TelegramOAuthStep, {});
5759
6095
  }
5760
6096
  case "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */:
5761
6097
  case "ADD_FUNDS_RECEIVE" /* ADD_FUNDS_RECEIVE */:
5762
6098
  case "ADD_FUNDS_WITHDRAW" /* ADD_FUNDS_WITHDRAW */: {
5763
- return /* @__PURE__ */ jsx45(AddFunds, {});
6099
+ return /* @__PURE__ */ jsx46(AddFunds, {});
5764
6100
  }
5765
6101
  case "ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */: {
5766
- return /* @__PURE__ */ jsx45(AddFundsAwaiting, {});
6102
+ return /* @__PURE__ */ jsx46(AddFundsAwaiting, {});
5767
6103
  }
5768
6104
  case "ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */: {
5769
- return /* @__PURE__ */ jsx45(AddFundsDone, { isSuccess: true, onClose });
6105
+ return /* @__PURE__ */ jsx46(AddFundsDone, { isSuccess: true, onClose });
5770
6106
  }
5771
6107
  case "ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */: {
5772
- return /* @__PURE__ */ jsx45(AddFundsDone, { onClose });
6108
+ return /* @__PURE__ */ jsx46(AddFundsDone, { onClose });
5773
6109
  }
5774
6110
  case "ACCOUNT_MAIN" /* ACCOUNT_MAIN */: {
5775
- return /* @__PURE__ */ jsx45(Account, { onClose });
6111
+ return /* @__PURE__ */ jsx46(Account, { onClose });
5776
6112
  }
5777
6113
  case "EX_WALLET_SELECTED" /* EX_WALLET_SELECTED */: {
5778
- return /* @__PURE__ */ jsx45(ExternalWalletStep, {});
6114
+ return /* @__PURE__ */ jsx46(ExternalWalletStep, {});
5779
6115
  }
5780
6116
  case "CHAIN_SWITCH" /* CHAIN_SWITCH */: {
5781
- return /* @__PURE__ */ jsx45(ChainSwitch, {});
6117
+ return /* @__PURE__ */ jsx46(ChainSwitch, {});
5782
6118
  }
5783
6119
  default: {
5784
6120
  if (IFrameSteps.includes(currentStep)) {
@@ -5787,12 +6123,12 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5787
6123
  }
5788
6124
  }
5789
6125
  };
5790
- useEffect25(() => {
6126
+ useEffect26(() => {
5791
6127
  if (!isTestModeAlert && (onRampConfig == null ? void 0 : onRampConfig.testMode)) {
5792
6128
  setIsTestModeAlert(true);
5793
6129
  }
5794
6130
  }, [onRampConfig == null ? void 0 : onRampConfig.testMode]);
5795
- useEffect25(() => {
6131
+ useEffect26(() => {
5796
6132
  switch (currentStep) {
5797
6133
  case "ADD_FUNDS_BUY" /* ADD_FUNDS_BUY */:
5798
6134
  setAccountAddFundTab(EnabledFlow3.BUY);
@@ -5807,13 +6143,13 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5807
6143
  break;
5808
6144
  }
5809
6145
  }, [currentStep]);
5810
- return /* @__PURE__ */ jsxs30(Container16, { slot: "body", "data-testid": "modal-content", children: [
5811
- !embeddedModal && /* @__PURE__ */ jsxs30(Fragment19, { children: [
5812
- /* @__PURE__ */ jsx45(Controls, { onClose }),
5813
- /* @__PURE__ */ jsx45(Header, {})
6146
+ return /* @__PURE__ */ jsxs31(Container16, { slot: "body", "data-testid": "modal-content", children: [
6147
+ !embeddedModal && /* @__PURE__ */ jsxs31(Fragment19, { children: [
6148
+ /* @__PURE__ */ jsx46(Controls, { onClose }),
6149
+ /* @__PURE__ */ jsx46(Header, {})
5814
6150
  ] }),
5815
- /* @__PURE__ */ jsxs30(AnimatedWrapper, { children: [
5816
- /* @__PURE__ */ jsx45(
6151
+ /* @__PURE__ */ jsxs31(AnimatedWrapper, { children: [
6152
+ /* @__PURE__ */ jsx46(
5817
6153
  AnimatePresence3,
5818
6154
  {
5819
6155
  mode: "popLayout",
@@ -5822,7 +6158,7 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5822
6158
  setStepDirection(1);
5823
6159
  },
5824
6160
  custom: stepDirection,
5825
- children: /* @__PURE__ */ jsxs30(
6161
+ children: /* @__PURE__ */ jsxs31(
5826
6162
  BodyContainer,
5827
6163
  {
5828
6164
  custom: stepDirection,
@@ -5832,8 +6168,8 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5832
6168
  exit: "exit",
5833
6169
  transition: BODY_TRANSITION,
5834
6170
  children: [
5835
- /* @__PURE__ */ jsx45(Hero, {}),
5836
- /* @__PURE__ */ jsxs30(
6171
+ /* @__PURE__ */ jsx46(Hero, {}),
6172
+ /* @__PURE__ */ jsxs31(
5837
6173
  InnerContainer2,
5838
6174
  {
5839
6175
  $embeddedModal: !!embeddedModal,
@@ -5847,13 +6183,13 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5847
6183
  "ADD_FUNDS_AWAITING" /* ADD_FUNDS_AWAITING */,
5848
6184
  "ADD_FUNDS_FAILURE" /* ADD_FUNDS_FAILURE */,
5849
6185
  "ADD_FUNDS_SUCCESS" /* ADD_FUNDS_SUCCESS */
5850
- ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow3.RECEIVE && /* @__PURE__ */ jsx45(TestModeAlert, { children: /* @__PURE__ */ jsxs30("div", { style: { fontSize: "14px" }, children: [
6186
+ ].includes(currentStep) && isTestModeAlert && accountAddFundTab !== EnabledFlow3.RECEIVE && /* @__PURE__ */ jsx46(TestModeAlert, { children: /* @__PURE__ */ jsxs31("div", { style: { fontSize: "14px" }, children: [
5851
6187
  "This Para Modal is configured to run on-ramp services in ",
5852
- /* @__PURE__ */ jsx45("b", { children: "test mode" }),
6188
+ /* @__PURE__ */ jsx46("b", { children: "test mode" }),
5853
6189
  " only, for development purposes. If you are a user of ",
5854
6190
  appName,
5855
6191
  ", please contact support.",
5856
- /* @__PURE__ */ jsx45(CloseButton2, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx45(CloseX, { icon: "x" }) })
6192
+ /* @__PURE__ */ jsx46(CloseButton2, { onClick: () => setIsTestModeAlert(false), children: /* @__PURE__ */ jsx46(CloseX, { icon: "x" }) })
5857
6193
  ] }) })
5858
6194
  ]
5859
6195
  }
@@ -5864,24 +6200,24 @@ var Body = ({ oAuthMethods, twoFactorAuthEnabled, disableEmailLogin, disablePhon
5864
6200
  )
5865
6201
  }
5866
6202
  ),
5867
- /* @__PURE__ */ jsx45(IFrameStep, {})
6203
+ /* @__PURE__ */ jsx46(IFrameStep, {})
5868
6204
  ] })
5869
6205
  ] });
5870
6206
  };
5871
- var Container16 = styled27.div`
6207
+ var Container16 = styled28.div`
5872
6208
  position: relative;
5873
6209
  `;
5874
- var AnimatedWrapper = styled27(AnimatedHeightWrapper)`
6210
+ var AnimatedWrapper = styled28(AnimatedHeightWrapper)`
5875
6211
  margin-top: -16px;
5876
6212
  `;
5877
- var BodyContainer = styled27(motion5.div)`
6213
+ var BodyContainer = styled28(motion5.div)`
5878
6214
  position: relative;
5879
6215
  display: flex;
5880
6216
  flex-direction: column;
5881
6217
  gap: 24px;
5882
6218
  will-change: auto !important;
5883
6219
  `;
5884
- var InnerContainer2 = styled27.div`
6220
+ var InnerContainer2 = styled28.div`
5885
6221
  z-index: 1;
5886
6222
  flex: 1;
5887
6223
  display: flex;
@@ -5912,7 +6248,7 @@ var InnerContainer2 = styled27.div`
5912
6248
  padding: 72px 16px 0px;
5913
6249
  }
5914
6250
  `;
5915
- var TestModeAlert = styled27(CpslAlert)`
6251
+ var TestModeAlert = styled28(CpslAlert)`
5916
6252
  --container-padding-end: 40px;
5917
6253
  position: absolute;
5918
6254
  bottom: 16px;
@@ -5920,7 +6256,7 @@ var TestModeAlert = styled27(CpslAlert)`
5920
6256
  right: 16px;
5921
6257
  z-index: 1000;
5922
6258
  `;
5923
- var CloseButton2 = styled27.button`
6259
+ var CloseButton2 = styled28.button`
5924
6260
  background-color: transparent;
5925
6261
  border: none;
5926
6262
  padding: 4px;
@@ -5929,91 +6265,91 @@ var CloseButton2 = styled27.button`
5929
6265
  top: 0;
5930
6266
  right: 0;
5931
6267
  `;
5932
- var CloseX = styled27(CpslIcon16)`
6268
+ var CloseX = styled28(CpslIcon16)`
5933
6269
  --icon-color: var(--cpsl-color-foreground-0);
5934
6270
  `;
5935
6271
 
5936
6272
  // src/modal/components/Footer/Footer.tsx
5937
- import { styled as styled28 } from "styled-components";
5938
- import { CpslButton as CpslButton18, CpslIcon as CpslIcon17, CpslText as CpslText21 } from "@getpara/react-components";
6273
+ import { styled as styled29 } from "styled-components";
6274
+ import { CpslButton as CpslButton19, CpslIcon as CpslIcon17, CpslText as CpslText22 } from "@getpara/react-components";
5939
6275
  import { useMemo as useMemo16 } from "react";
5940
- import { Fragment as Fragment20, jsx as jsx46, jsxs as jsxs31 } from "react/jsx-runtime";
6276
+ import { Fragment as Fragment20, jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
5941
6277
  var Footer = () => {
5942
6278
  const isAccount = useModalStore((state) => state.isAccount());
5943
6279
  const currentStep = useModalStore((state) => state.step);
5944
6280
  const showFooter = isAccount || getStepHasFooter(currentStep);
5945
6281
  const Content = useMemo16(() => {
5946
6282
  if (isAccount) {
5947
- return /* @__PURE__ */ jsxs31(ConnectContainer, { children: [
5948
- /* @__PURE__ */ jsxs31(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
6283
+ return /* @__PURE__ */ jsxs32(ConnectContainer, { children: [
6284
+ /* @__PURE__ */ jsxs32(ConnectText, { variant: "bodyS", color: "secondary", weight: "medium", children: [
5949
6285
  "Access all your wallet\u2019s features at",
5950
6286
  " ",
5951
- /* @__PURE__ */ jsx46("a", { href: PARA_CONNECT, target: "blank", children: /* @__PURE__ */ jsx46(ClickableText2, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })
6287
+ /* @__PURE__ */ jsx47("a", { href: PARA_CONNECT, target: "blank", children: /* @__PURE__ */ jsx47(ClickableText2, { variant: "bodyS", weight: "medium", children: "Para Connect" }) })
5952
6288
  ] }),
5953
- /* @__PURE__ */ jsx46(CpslButton18, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: /* @__PURE__ */ jsx46(RightChevron, { icon: "chevronUp" }) })
6289
+ /* @__PURE__ */ jsx47(CpslButton19, { as: "a", href: PARA_CONNECT, target: "blank", variant: "ghost", children: /* @__PURE__ */ jsx47(RightChevron, { icon: "chevronUp" }) })
5954
6290
  ] });
5955
6291
  }
5956
- return /* @__PURE__ */ jsxs31(Fragment20, { children: [
5957
- /* @__PURE__ */ jsxs31(InlineText3, { variant: "body2XS", color: "secondary", weight: "medium", children: [
6292
+ return /* @__PURE__ */ jsxs32(Fragment20, { children: [
6293
+ /* @__PURE__ */ jsxs32(InlineText4, { variant: "body2XS", color: "secondary", weight: "medium", children: [
5958
6294
  "By logging in you agree to our",
5959
6295
  " ",
5960
- /* @__PURE__ */ jsx46("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: /* @__PURE__ */ jsx46(ClickableText2, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })
6296
+ /* @__PURE__ */ jsx47("a", { href: PARA_TERMS_AND_CONDITIONS, target: "blank", children: /* @__PURE__ */ jsx47(ClickableText2, { variant: "body2XS", weight: "medium", children: "Terms & Conditions" }) })
5961
6297
  ] }),
5962
- /* @__PURE__ */ jsxs31(PoweredByContainer, { children: [
5963
- /* @__PURE__ */ jsx46(InlineText3, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }),
5964
- /* @__PURE__ */ jsx46(ParaLogo, { icon: "para" })
6298
+ /* @__PURE__ */ jsxs32(PoweredByContainer, { children: [
6299
+ /* @__PURE__ */ jsx47(InlineText4, { variant: "bodyS", color: "secondary", weight: "medium", children: "Powered by" }),
6300
+ /* @__PURE__ */ jsx47(ParaLogo, { icon: "para" })
5965
6301
  ] })
5966
6302
  ] });
5967
6303
  }, [isAccount]);
5968
6304
  if (!showFooter) {
5969
6305
  return null;
5970
6306
  }
5971
- return /* @__PURE__ */ jsx46(FooterContainer, { slot: "footer", children: /* @__PURE__ */ jsx46(FooterContentContainer, { children: Content }) });
6307
+ return /* @__PURE__ */ jsx47(FooterContainer, { slot: "footer", children: /* @__PURE__ */ jsx47(FooterContentContainer, { children: Content }) });
5972
6308
  };
5973
- var FooterContainer = styled28.div`
6309
+ var FooterContainer = styled29.div`
5974
6310
  display: flex;
5975
6311
  flex-direction: column;
5976
6312
  align-items: center;
5977
6313
  gap: 16px;
5978
6314
  padding: 8px 0px;
5979
6315
  `;
5980
- var FooterContentContainer = styled28.div`
6316
+ var FooterContentContainer = styled29.div`
5981
6317
  display: flex;
5982
6318
  flex-direction: column;
5983
6319
  align-items: center;
5984
6320
  gap: 8px;
5985
6321
  `;
5986
- var PoweredByContainer = styled28.div`
6322
+ var PoweredByContainer = styled29.div`
5987
6323
  display: flex;
5988
6324
  gap: 5px;
5989
6325
  align-items: center;
5990
6326
  justify-content: center;
5991
6327
  `;
5992
- var ConnectContainer = styled28.div`
6328
+ var ConnectContainer = styled29.div`
5993
6329
  display: flex;
5994
6330
  gap: 8px;
5995
6331
  align-items: center;
5996
6332
  justify-content: center;
5997
6333
  `;
5998
- var RightChevron = styled28(CpslIcon17)`
6334
+ var RightChevron = styled29(CpslIcon17)`
5999
6335
  transform: rotate(90deg);
6000
6336
 
6001
6337
  /* --icon-color: var(--cpsl-color-text-tertiary); */
6002
6338
  --height: 24px;
6003
6339
  --width: 24px;
6004
6340
  `;
6005
- var InlineText3 = styled28(CpslText21)`
6341
+ var InlineText4 = styled29(CpslText22)`
6006
6342
  text-align: center;
6007
6343
  display: inline-block;
6008
6344
  `;
6009
- var ConnectText = styled28(InlineText3)`
6345
+ var ConnectText = styled29(InlineText4)`
6010
6346
  line-height: 20px;
6011
6347
  `;
6012
- var ClickableText2 = styled28(InlineText3)`
6348
+ var ClickableText2 = styled29(InlineText4)`
6013
6349
  cursor: pointer;
6014
6350
  display: inline-block;
6015
6351
  `;
6016
- var ParaLogo = styled28(CpslIcon17)`
6352
+ var ParaLogo = styled29(CpslIcon17)`
6017
6353
  display: inline-block;
6018
6354
  --icon-color: var(--cpsl-color-text-secondary);
6019
6355
  --width: 49px;
@@ -6062,7 +6398,7 @@ function useCreateAccount() {
6062
6398
  return {
6063
6399
  withPasskey: () => {
6064
6400
  var _a, _b;
6065
- if (!webAuthURLForCreate || ((_a = refs.poll.current) == null ? void 0 : _a.action) === "createPasskey") {
6401
+ if (!webAuthURLForCreate || ((_a = refs.poll.current) == null ? void 0 : _a.action) === "signup") {
6066
6402
  return;
6067
6403
  }
6068
6404
  clearTimeout((_b = refs.poll.current) == null ? void 0 : _b.timeout);
@@ -6073,7 +6409,7 @@ function useCreateAccount() {
6073
6409
  current: refs.popupWindow.current
6074
6410
  });
6075
6411
  refs.poll.current = {
6076
- action: "createPasskey",
6412
+ action: "signup",
6077
6413
  timeout: window.setTimeout(awaitWalletCreationTransition, DEFAULTS.POLLING_INTERVAL_MS)
6078
6414
  };
6079
6415
  if (refs.currentStep.current !== "AWAITING_BIOMETRIC_CREATION" /* AWAITING_BIOMETRIC_CREATION */) {
@@ -6082,12 +6418,12 @@ function useCreateAccount() {
6082
6418
  },
6083
6419
  withPassword: () => {
6084
6420
  var _a, _b;
6085
- if (((_a = refs.poll.current) == null ? void 0 : _a.action) === "createPassword") {
6421
+ if (((_a = refs.poll.current) == null ? void 0 : _a.action) === "signup") {
6086
6422
  return;
6087
6423
  }
6088
6424
  clearTimeout((_b = refs.poll.current) == null ? void 0 : _b.timeout);
6089
6425
  refs.poll.current = {
6090
- action: "createPassword",
6426
+ action: "signup",
6091
6427
  timeout: window.setTimeout(awaitWalletCreationTransition, DEFAULTS.POLLING_INTERVAL_MS)
6092
6428
  };
6093
6429
  if (refs.currentStep.current !== "PASSWORD_CREATION" /* PASSWORD_CREATION */) {
@@ -6099,7 +6435,7 @@ function useCreateAccount() {
6099
6435
 
6100
6436
  // src/modal/components/ModalContent/ModalContent.tsx
6101
6437
  import { formatBiometricHints as formatBiometricHints2 } from "@getpara/react-common";
6102
- import { jsx as jsx47, jsxs as jsxs32 } from "react/jsx-runtime";
6438
+ import { jsx as jsx48, jsxs as jsxs33 } from "react/jsx-runtime";
6103
6439
  var ActionsContext = createContext5({
6104
6440
  createAccount: { withPasskey: () => {
6105
6441
  }, withPassword: () => {
@@ -6137,7 +6473,7 @@ var ModalContent = forwardRef2(
6137
6473
  const authStepRoute = useModalStore((state) => state.authStepRoute);
6138
6474
  const isIFrameReady = useModalStore((state) => state.isIFrameReady);
6139
6475
  const goBack = useGoBack();
6140
- const { connectEmbeddedToExternalConnectors } = useExternalWallets();
6476
+ const { connectEmbeddedToExternalConnectors, disconnectExternalWallet } = useExternalWallets();
6141
6477
  const { waitForLoginAndSetup: waitForLoginAndSetup2 } = useWaitForLoginAndSetup();
6142
6478
  const { waitForPasskeyAndCreateWalletAsync } = useWaitForPasskeyAndCreateWallet();
6143
6479
  const createAccount = useCreateAccount();
@@ -6148,8 +6484,8 @@ var ModalContent = forwardRef2(
6148
6484
  const formattedHints = useMemo17(() => formatBiometricHints2(biometricLocationHints), [biometricLocationHints]);
6149
6485
  const passkeysSupported = useModalStore((state) => state.isPasskeySupported);
6150
6486
  const [hasHints, isOnKnownDevice] = [(biometricLocationHints == null ? void 0 : biometricLocationHints.length) > 0, (_a = formattedHints == null ? void 0 : formattedHints.isOnKnownDevice) != null ? _a : false];
6151
- const [walletCreationInProgress, setWalletCreationInProgress] = useState17(false);
6152
- useEffect26(() => {
6487
+ const [walletCreationInProgress, setWalletCreationInProgress] = useState18(false);
6488
+ useEffect27(() => {
6153
6489
  if (!!authStepRoute && isIFrameReady) {
6154
6490
  setTimeout(() => {
6155
6491
  setStep(authStepRoute);
@@ -6214,7 +6550,7 @@ var ModalContent = forwardRef2(
6214
6550
  );
6215
6551
  });
6216
6552
  }
6217
- useEffect26(() => {
6553
+ useEffect27(() => {
6218
6554
  if (currentStep !== "AWAITING_WALLET_CREATION" /* AWAITING_WALLET_CREATION */ || walletCreationInProgress) {
6219
6555
  return;
6220
6556
  }
@@ -6244,6 +6580,7 @@ var ModalContent = forwardRef2(
6244
6580
  }
6245
6581
  if (walletIds) {
6246
6582
  yield para.setCurrentWalletIds(walletIds);
6583
+ yield connectEmbeddedToExternalConnectors();
6247
6584
  }
6248
6585
  if (recoverySecret && recoverySecretStepEnabled) {
6249
6586
  setRecoveryShare(recoverySecret);
@@ -6258,7 +6595,7 @@ var ModalContent = forwardRef2(
6258
6595
  }
6259
6596
  genWallet();
6260
6597
  }, [isLogin, currentStep]);
6261
- useEffect26(() => {
6598
+ useEffect27(() => {
6262
6599
  const isAwaitingLogin = ["AWAITING_BIOMETRIC_LOGIN" /* AWAITING_BIOMETRIC_LOGIN */, "AWAITING_PASSWORD_LOGIN" /* AWAITING_PASSWORD_LOGIN */].includes(currentStep);
6263
6600
  const isUnknownDeviceWithHints = hasHints && !isOnKnownDevice;
6264
6601
  const isPasskeyUnsupported = !passkeysSupported;
@@ -6300,8 +6637,11 @@ var ModalContent = forwardRef2(
6300
6637
  }, [currentStep, webAuthURLForLogin, passwordUrlForLogin]);
6301
6638
  const handleClose = () => {
6302
6639
  onClose == null ? void 0 : onClose();
6640
+ if (currentStep === "EXTERNAL_WALLET_VERIFICATION" /* EXTERNAL_WALLET_VERIFICATION */ && para.isExternalWalletAuth) {
6641
+ disconnectExternalWallet();
6642
+ }
6303
6643
  };
6304
- useEffect26(() => {
6644
+ useEffect27(() => {
6305
6645
  var _a2, _b;
6306
6646
  refs.currentStep.current = currentStep;
6307
6647
  let resetPoll = false;
@@ -6324,7 +6664,7 @@ var ModalContent = forwardRef2(
6324
6664
  refs.poll.current = null;
6325
6665
  }
6326
6666
  }, [currentStep]);
6327
- useEffect26(() => {
6667
+ useEffect27(() => {
6328
6668
  if (!onRampConfig) {
6329
6669
  para.ctx.client.getOnRampConfig().then((res) => {
6330
6670
  let newOnRampConfig;
@@ -6338,20 +6678,26 @@ var ModalContent = forwardRef2(
6338
6678
  }).catch();
6339
6679
  }
6340
6680
  }, []);
6341
- useEffect26(() => {
6681
+ useEffect27(() => {
6342
6682
  if (!!onRampConfig) {
6343
6683
  setOnRampConfig(__spreadProps(__spreadValues({}, onRampConfig), { testMode: onRampTestMode }));
6344
6684
  }
6345
6685
  }, [onRampTestMode]);
6346
- useEffect26(() => {
6686
+ useEffect27(() => {
6687
+ const init = () => __async(void 0, null, function* () {
6688
+ if (!(yield para.isFullyLoggedIn())) {
6689
+ yield disconnectExternalWallet();
6690
+ }
6691
+ });
6692
+ init();
6347
6693
  return () => {
6348
6694
  var _a2;
6349
6695
  window.clearTimeout((_a2 = refs.poll.current) == null ? void 0 : _a2.timeout);
6350
6696
  para.exitLoops();
6351
6697
  };
6352
6698
  }, []);
6353
- return /* @__PURE__ */ jsxs32(ActionsContext.Provider, { value: { createAccount }, children: [
6354
- /* @__PURE__ */ jsx47(
6699
+ return /* @__PURE__ */ jsxs33(ActionsContext.Provider, { value: { createAccount }, children: [
6700
+ /* @__PURE__ */ jsx48(
6355
6701
  Body,
6356
6702
  {
6357
6703
  oAuthMethods,
@@ -6361,16 +6707,17 @@ var ModalContent = forwardRef2(
6361
6707
  onClose: handleClose
6362
6708
  }
6363
6709
  ),
6364
- /* @__PURE__ */ jsx47(Footer, {})
6710
+ /* @__PURE__ */ jsx48(Footer, {})
6365
6711
  ] });
6366
6712
  }
6367
6713
  );
6368
6714
 
6369
6715
  // src/modal/ParaModal.tsx
6370
- import { forwardRef as forwardRef3, useEffect as useEffect27, useImperativeHandle as useImperativeHandle2, useRef as useRef9, useState as useState18 } from "react";
6371
- import { OAuthMethod as OAuthMethod4, ParaEvent as ParaEvent2 } from "@getpara/web-sdk";
6372
- import styled29 from "styled-components";
6373
- import { jsx as jsx48 } from "react/jsx-runtime";
6716
+ import { forwardRef as forwardRef3, useEffect as useEffect28, useImperativeHandle as useImperativeHandle2, useRef as useRef9, useState as useState19 } from "react";
6717
+ import { OAuthMethod as OAuthMethod4 } from "@getpara/web-sdk";
6718
+ import styled30 from "styled-components";
6719
+ import { getExternalWalletDisplayName as getExternalWalletDisplayName2 } from "@getpara/react-common";
6720
+ import { jsx as jsx49 } from "react/jsx-runtime";
6374
6721
  defineCustomElements();
6375
6722
  var ParaModal = forwardRef3((props, ref) => {
6376
6723
  const storedModalConfig = useStore((state) => state.modalConfig);
@@ -6394,9 +6741,9 @@ var ParaModal = forwardRef3((props, ref) => {
6394
6741
  const { disconnectExternalWallet } = useExternalWallets();
6395
6742
  const { isOpen: storedIsOpen, closeModal } = useModal();
6396
6743
  const para = useInternalClient();
6397
- const { selectedWallet, setSelectedWallet } = useWalletState();
6398
- const [isModalMounted, setIsModalMounted] = useState18(false);
6399
- const [isInit, setIsInit] = useState18(false);
6744
+ const { setSelectedWallet, updateSelectedWallet } = useWalletState();
6745
+ const [isModalMounted, setIsModalMounted] = useState19(false);
6746
+ const [isInit, setIsInit] = useState19(false);
6400
6747
  const externalWallets = useStore((state) => state.externalWallets);
6401
6748
  const _a = __spreadValues(__spreadValues({}, storedModalConfig), props), {
6402
6749
  isOpen: configIsOpen,
@@ -6481,10 +6828,24 @@ var ParaModal = forwardRef3((props, ref) => {
6481
6828
  setStep("TELEGRAM_OAUTH" /* TELEGRAM_OAUTH */);
6482
6829
  }
6483
6830
  break;
6831
+ case para.isExternalWalletAuth:
6832
+ const externalWallets2 = Object.values(para.externalWallets);
6833
+ const externalWalletWithFullAuth = externalWallets2.find((w) => w.isExternalWithParaAuth);
6834
+ if (!(externalWalletWithFullAuth == null ? void 0 : externalWalletWithFullAuth.address) || !(externalWalletWithFullAuth == null ? void 0 : externalWalletWithFullAuth.type)) {
6835
+ break;
6836
+ }
6837
+ setAuthInfo({
6838
+ displayName: getExternalWalletDisplayName2({
6839
+ address: externalWalletWithFullAuth.address,
6840
+ type: externalWalletWithFullAuth.type
6841
+ }),
6842
+ externalWalletAddress: externalWalletWithFullAuth.id
6843
+ });
6844
+ break;
6484
6845
  }
6485
6846
  setIsInit(true);
6486
6847
  });
6487
- useEffect27(() => {
6848
+ useEffect28(() => {
6488
6849
  let _authLayout = authLayout;
6489
6850
  if (!(externalWallets == null ? void 0 : externalWallets.length) && hasExternalWallet(authLayout)) {
6490
6851
  _authLayout = _authLayout.filter((l) => !l.includes("EXTERNAL"));
@@ -6495,44 +6856,30 @@ var ParaModal = forwardRef3((props, ref) => {
6495
6856
  if (JSON.stringify(storedAuthLayout) !== JSON.stringify(_authLayout)) {
6496
6857
  setAuthLayout(_authLayout);
6497
6858
  }
6498
- }, [disableEmailLogin, disablePhoneLogin, oAuthMethods, externalWallets, authLayout]);
6499
- useEffect27(() => {
6859
+ }, [disableEmailLogin, disablePhoneLogin, oAuthMethods, externalWallets, authLayout, storedAuthLayout]);
6860
+ useEffect28(() => {
6500
6861
  if (theme) {
6501
6862
  generateTheme(theme);
6502
6863
  }
6503
6864
  }, [theme]);
6504
- useEffect27(() => {
6865
+ useEffect28(() => {
6505
6866
  setOnModalStepChange(onModalStepChange);
6506
6867
  }, [onModalStepChange]);
6507
- useEffect27(() => {
6868
+ useEffect28(() => {
6508
6869
  if (para) {
6509
6870
  initModal();
6510
6871
  } else {
6511
6872
  console.error("A Para instance must be provided.");
6512
6873
  }
6513
6874
  }, []);
6514
- useEffect27(() => {
6875
+ useEffect28(() => {
6515
6876
  if (isOpen && para) {
6516
6877
  initModal();
6517
6878
  }
6518
6879
  }, [isOpen]);
6519
- const updateActiveWallet = () => {
6520
- if (!(selectedWallet == null ? void 0 : selectedWallet.id) || !para.findWallet(selectedWallet == null ? void 0 : selectedWallet.id)) {
6521
- const defaultWallet = para.findWallet(void 0, void 0, { forbidPregen: true });
6522
- setSelectedWallet({ id: defaultWallet == null ? void 0 : defaultWallet.id, type: defaultWallet == null ? void 0 : defaultWallet.type });
6523
- }
6524
- };
6525
- useEffect27(() => {
6526
- updateActiveWallet();
6880
+ useEffect28(() => {
6881
+ updateSelectedWallet();
6527
6882
  }, [para]);
6528
- useEffect27(() => {
6529
- typeof window !== "undefined" && window.addEventListener(ParaEvent2.WALLETS_CHANGE_EVENT, updateActiveWallet);
6530
- typeof window !== "undefined" && window.addEventListener(ParaEvent2.EXTERNAL_WALLET_CHANGE_EVENT, updateActiveWallet);
6531
- return () => {
6532
- typeof window !== "undefined" && window.removeEventListener(ParaEvent2.WALLETS_CHANGE_EVENT, updateActiveWallet);
6533
- typeof window !== "undefined" && window.removeEventListener(ParaEvent2.EXTERNAL_WALLET_CHANGE_EVENT, updateActiveWallet);
6534
- };
6535
- }, []);
6536
6883
  const handleClose = () => {
6537
6884
  closeModal();
6538
6885
  onClose == null ? void 0 : onClose();
@@ -6576,7 +6923,7 @@ var ParaModal = forwardRef3((props, ref) => {
6576
6923
  }
6577
6924
  return null;
6578
6925
  }
6579
- return /* @__PURE__ */ jsx48(
6926
+ return /* @__PURE__ */ jsx49(
6580
6927
  StyledAuthModal,
6581
6928
  {
6582
6929
  enterTransitionDuration: DEFAULTS.ANIMATION_DURATION,
@@ -6589,7 +6936,7 @@ var ParaModal = forwardRef3((props, ref) => {
6589
6936
  className,
6590
6937
  "data-testid": "modal",
6591
6938
  $embeddedModal: !!embeddedModal,
6592
- children: isModalMounted && ((embeddedModal || bareModal) && isInit || !embeddedModal && !bareModal) && /* @__PURE__ */ jsx48(
6939
+ children: isModalMounted && ((embeddedModal || bareModal) && isInit || !embeddedModal && !bareModal) && /* @__PURE__ */ jsx49(
6593
6940
  ModalContent,
6594
6941
  __spreadValues({
6595
6942
  oAuthMethods,
@@ -6601,7 +6948,7 @@ var ParaModal = forwardRef3((props, ref) => {
6601
6948
  }
6602
6949
  );
6603
6950
  });
6604
- var StyledAuthModal = styled29(CpslAuthModal)`
6951
+ var StyledAuthModal = styled30(CpslAuthModal)`
6605
6952
  ${({ $embeddedModal }) => $embeddedModal && `
6606
6953
  &::part(modal-body-card) {
6607
6954
  --card-box-shadow: none;
@@ -6642,38 +6989,16 @@ function validateOnRampConfig(obj) {
6642
6989
  return true;
6643
6990
  }
6644
6991
 
6645
- // src/modal/types/externalWallets.ts
6646
- var EvmWallet = /* @__PURE__ */ ((EvmWallet2) => {
6647
- EvmWallet2["METAMASK"] = "METAMASK";
6648
- EvmWallet2["RAINBOW"] = "RAINBOW";
6649
- EvmWallet2["COINBASE"] = "COINBASE";
6650
- EvmWallet2["WALLETCONNECT"] = "WALLETCONNECT";
6651
- EvmWallet2["ZERION"] = "ZERION";
6652
- EvmWallet2["RABBY"] = "RABBY";
6653
- return EvmWallet2;
6654
- })(EvmWallet || {});
6655
- var SolanaWallet = /* @__PURE__ */ ((SolanaWallet2) => {
6656
- SolanaWallet2["PHANTOM"] = "PHANTOM";
6657
- SolanaWallet2["GLOW"] = "GLOW";
6658
- SolanaWallet2["BACKPACK"] = "BACKPACK";
6659
- return SolanaWallet2;
6660
- })(SolanaWallet || {});
6661
- var CosmosWallet = /* @__PURE__ */ ((CosmosWallet2) => {
6662
- CosmosWallet2["KEPLR"] = "KEPLR";
6663
- CosmosWallet2["LEAP"] = "LEAP";
6664
- return CosmosWallet2;
6665
- })(CosmosWallet || {});
6666
- var ExternalWallet = __spreadValues(__spreadValues(__spreadValues({}, EvmWallet), SolanaWallet), CosmosWallet);
6667
-
6668
6992
  // src/index.ts
6669
6993
  export * from "@getpara/web-sdk";
6994
+ import { ExternalWallet as ExternalWallet2, EvmWallet as EvmWallet2, SolanaWallet as SolanaWallet2, CosmosWallet as CosmosWallet2 } from "@getpara/react-common";
6670
6995
  import ParaWeb4 from "@getpara/web-sdk";
6671
6996
  var src_default = ParaWeb4;
6672
6997
  export {
6673
6998
  AuthLayout,
6674
- CosmosWallet,
6675
- EvmWallet,
6676
- ExternalWallet,
6999
+ CosmosWallet2 as CosmosWallet,
7000
+ EvmWallet2 as EvmWallet,
7001
+ ExternalWallet2 as ExternalWallet,
6677
7002
  ModalStep,
6678
7003
  NETWORKS,
6679
7004
  ON_RAMP_ASSETS,
@@ -6682,7 +7007,7 @@ export {
6682
7007
  ParaModal,
6683
7008
  ParaProvider,
6684
7009
  SaveRecoverySecret,
6685
- SolanaWallet,
7010
+ SolanaWallet2 as SolanaWallet,
6686
7011
  src_default as default,
6687
7012
  getAssetIcon,
6688
7013
  getAssetName,
@@ -6696,17 +7021,41 @@ export {
6696
7021
  setIsOpen,
6697
7022
  useAccount,
6698
7023
  useCheckIfUserExists,
7024
+ useClaimPregenWallets,
6699
7025
  useClient,
7026
+ useCreatePregenWallet,
7027
+ useCreatePregenWalletPerType,
6700
7028
  useCreateUser,
7029
+ useCreateWallet,
7030
+ useCreateWalletPerType,
7031
+ useEnable2fa,
7032
+ useHasPregenWallet,
6701
7033
  useInitiateLogin,
6702
7034
  useKeepSessionAlive,
7035
+ useKeepSessionAliveV2,
7036
+ useLoginExternalWallet,
6703
7037
  useLogout,
6704
7038
  useModal,
7039
+ useResendVerificationCode,
7040
+ useSetup2fa,
6705
7041
  useSignMessage,
7042
+ useSignMessageV2,
6706
7043
  useSignTransaction,
7044
+ useSignTransactionV2,
7045
+ useSignUpOrLogIn,
7046
+ useUpdatePregenWalletIdentifier,
7047
+ useVerify2fa,
7048
+ useVerifyExternalWallet,
7049
+ useVerifyFarcaster,
7050
+ useVerifyNewAccount,
7051
+ useVerifyOAuth,
7052
+ useVerifyTelegram,
6707
7053
  useWaitForAccountCreation,
7054
+ useWaitForLogin,
6708
7055
  useWaitForLoginAndSetup,
6709
7056
  useWaitForPasskeyAndCreateWallet,
7057
+ useWaitForSignup,
7058
+ useWaitForWalletCreation,
6710
7059
  useWallet,
6711
7060
  useWalletState,
6712
7061
  validateOnRampConfig