@openfort/react 1.0.1 → 1.0.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/build/components/Openfort/OpenfortProvider.js +8 -6
- package/build/components/Openfort/OpenfortProvider.js.map +1 -1
- package/build/components/Pages/CreateWallet/index.js +34 -14
- package/build/components/Pages/CreateWallet/index.js.map +1 -1
- package/build/components/Pages/LoadWallets/index.js +7 -4
- package/build/components/Pages/LoadWallets/index.js.map +1 -1
- package/build/constants/openfort.d.ts +3 -0
- package/build/constants/openfort.js +5 -1
- package/build/constants/openfort.js.map +1 -1
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js +4 -3
- package/build/ethereum/hooks/useEthereumEmbeddedWallet.js.map +1 -1
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js +5 -4
- package/build/hooks/openfort/auth/useConnectToWalletPostAuth.js.map +1 -1
- package/build/version.d.ts +1 -1
- package/build/version.js +1 -1
- package/package.json +1 -1
|
@@ -9,12 +9,14 @@ import { CoreOpenfortProvider } from '../../openfort/CoreOpenfortProvider.js';
|
|
|
9
9
|
import { logger } from '../../utils/logger.js';
|
|
10
10
|
import { buildChainFromConfig } from '../../utils/rpc.js';
|
|
11
11
|
import { isFamily } from '../../utils/wallets.js';
|
|
12
|
-
import { EmbeddedWalletWagmiSync } from '../../wagmi/useEmbeddedWalletWagmiSync.js';
|
|
13
12
|
import { OpenfortContext, UIContext } from './context.js';
|
|
14
13
|
import { UIAuthProvider, routes, defaultSendFormState, defaultBuyFormState, notStoredInHistoryRoutes } from './types.js';
|
|
15
14
|
|
|
16
|
-
const SolanaContextProvider = lazy(() => import('../../solana/SolanaContext.js').then((m) => ({ default: m.SolanaContextProvider })));
|
|
17
|
-
const
|
|
15
|
+
const SolanaContextProvider = lazy(() => import(/* @vite-ignore */ '../../solana/SolanaContext.js').then((m) => ({ default: m.SolanaContextProvider })));
|
|
16
|
+
const LazyEmbeddedWalletWagmiSync = lazy(() => import(/* @vite-ignore */ '../../wagmi/useEmbeddedWalletWagmiSync.js').then((m) => ({
|
|
17
|
+
default: m.EmbeddedWalletWagmiSync,
|
|
18
|
+
})));
|
|
19
|
+
const LazyConnectKitModal = lazy(() => import(/* @vite-ignore */ '../ConnectModal/index.js'));
|
|
18
20
|
let openfortProviderWarnedNoWagmi = false;
|
|
19
21
|
/**
|
|
20
22
|
* Root provider for Openfort. Wrap your app with this to enable connect modal, auth, and wallet features.
|
|
@@ -92,8 +94,8 @@ const OpenfortProvider = ({ children, uiConfig, onConnect, onDisconnect, debugMo
|
|
|
92
94
|
defaultMethod: allowAutomaticRecovery ? RecoveryMethod.AUTOMATIC : RecoveryMethod.PASSWORD,
|
|
93
95
|
},
|
|
94
96
|
authProviders: hasWagmi
|
|
95
|
-
? [UIAuthProvider.GUEST, UIAuthProvider.EMAIL_OTP, UIAuthProvider.WALLET]
|
|
96
|
-
: [UIAuthProvider.GUEST, UIAuthProvider.EMAIL_OTP],
|
|
97
|
+
? [UIAuthProvider.GUEST, UIAuthProvider.EMAIL_OTP, UIAuthProvider.WALLET, UIAuthProvider.GOOGLE]
|
|
98
|
+
: [UIAuthProvider.GUEST, UIAuthProvider.EMAIL_OTP, UIAuthProvider.GOOGLE],
|
|
97
99
|
}), [allowAutomaticRecovery, hasWagmi]);
|
|
98
100
|
const safeUiConfig = useMemo(() => {
|
|
99
101
|
var _a, _b, _c, _d, _e;
|
|
@@ -318,7 +320,7 @@ const OpenfortProvider = ({ children, uiConfig, onConnect, onDisconnect, debugMo
|
|
|
318
320
|
setBuyForm,
|
|
319
321
|
triggerResize,
|
|
320
322
|
]);
|
|
321
|
-
const innerChildren = (jsxs(Fragment, { children: [hasWagmi && jsx(
|
|
323
|
+
const innerChildren = (jsxs(Fragment, { children: [hasWagmi && (jsx(Suspense, { fallback: null, children: jsx(LazyEmbeddedWalletWagmiSync, {}) })), debugModeOptions.debugRoutes && (jsx("pre", { style: {
|
|
322
324
|
position: 'absolute',
|
|
323
325
|
top: 0,
|
|
324
326
|
left: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenfortProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenfortProvider.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { ChainTypeEnum, RecoveryMethod, EmbeddedState } from '@openfort/openfort-js';
|
|
3
3
|
import { motion } from 'framer-motion';
|
|
4
|
-
import { useEffect, useState, useCallback, useMemo } from 'react';
|
|
4
|
+
import { useEffect, useState, useRef, useCallback, useMemo } from 'react';
|
|
5
5
|
import { PlusIcon, PhoneIcon, EmailIcon, FingerPrintIcon, KeyIcon, ShieldIcon, LockIcon } from '../../../assets/icons.js';
|
|
6
6
|
import Logos from '../../../assets/logos.js';
|
|
7
7
|
import { OpenfortError } from '../../../types.js';
|
|
@@ -64,15 +64,17 @@ const OtherMethod = ({ currentMethod, onChangeMethod, }) => {
|
|
|
64
64
|
const CreateWalletAutomaticRecovery = ({ onBack, logoutOnBack, }) => {
|
|
65
65
|
var _a;
|
|
66
66
|
const { embeddedState } = useOpenfortCore();
|
|
67
|
-
const { setRoute, triggerResize } = useOpenfort();
|
|
67
|
+
const { setRoute, triggerResize, walletConfig } = useOpenfort();
|
|
68
68
|
const [recoveryError, setRecoveryError] = useState(null);
|
|
69
69
|
const { create } = useEthereumEmbeddedWallet();
|
|
70
70
|
const { isEnabled: isWalletRecoveryOTPEnabled, requestOTP } = useRecoveryOTP();
|
|
71
71
|
const [shouldCreateWallet, setShouldCreateWallet] = useState(false);
|
|
72
|
+
const isCreatingRef = useRef(false);
|
|
72
73
|
const [needsOTP, setNeedsOTP] = useState(false);
|
|
73
74
|
const [otpResponse, setOtpResponse] = useState(null);
|
|
74
75
|
const [otpStatus, setOtpStatus] = useState('idle');
|
|
75
76
|
const [error, setError] = useState(false);
|
|
77
|
+
const [canSendOtp, setCanSendOtp] = useState(true);
|
|
76
78
|
const handleCompleteOtp = async (otp) => {
|
|
77
79
|
setOtpStatus('loading');
|
|
78
80
|
try {
|
|
@@ -96,13 +98,18 @@ const CreateWalletAutomaticRecovery = ({ onBack, logoutOnBack, }) => {
|
|
|
96
98
|
useEffect(() => {
|
|
97
99
|
if (!shouldCreateWallet)
|
|
98
100
|
return;
|
|
101
|
+
if (isCreatingRef.current)
|
|
102
|
+
return;
|
|
103
|
+
isCreatingRef.current = true;
|
|
99
104
|
(async () => {
|
|
100
105
|
logger.log('Creating wallet Automatic recover');
|
|
101
106
|
try {
|
|
102
107
|
await create({ recoveryMethod: RecoveryMethod.AUTOMATIC });
|
|
108
|
+
setShouldCreateWallet(false);
|
|
103
109
|
setRoute(routes.CONNECTED_SUCCESS);
|
|
104
110
|
}
|
|
105
111
|
catch (err) {
|
|
112
|
+
setShouldCreateWallet(false);
|
|
106
113
|
const { error, isOTPRequired } = handleOtpRecoveryError(err, isWalletRecoveryOTPEnabled);
|
|
107
114
|
if (isOTPRequired && isWalletRecoveryOTPEnabled) {
|
|
108
115
|
try {
|
|
@@ -120,15 +127,19 @@ const CreateWalletAutomaticRecovery = ({ onBack, logoutOnBack, }) => {
|
|
|
120
127
|
setRecoveryError(error);
|
|
121
128
|
}
|
|
122
129
|
}
|
|
130
|
+
finally {
|
|
131
|
+
isCreatingRef.current = false;
|
|
132
|
+
}
|
|
123
133
|
triggerResize();
|
|
124
134
|
})();
|
|
125
135
|
}, [shouldCreateWallet, create, isWalletRecoveryOTPEnabled, requestOTP, triggerResize]);
|
|
126
|
-
const [canSendOtp, setCanSendOtp] = useState(true);
|
|
127
136
|
useEffect(() => {
|
|
128
|
-
if (embeddedState
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
137
|
+
if (embeddedState !== EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED)
|
|
138
|
+
return;
|
|
139
|
+
if ((walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.connectOnLogin) === false)
|
|
140
|
+
return;
|
|
141
|
+
setShouldCreateWallet(true);
|
|
142
|
+
}, [embeddedState, walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.connectOnLogin]);
|
|
132
143
|
const handleResendClick = useCallback(() => {
|
|
133
144
|
setOtpStatus('send-otp');
|
|
134
145
|
setCanSendOtp(false);
|
|
@@ -152,18 +163,23 @@ const CreateWalletAutomaticRecovery = ({ onBack, logoutOnBack, }) => {
|
|
|
152
163
|
return (jsx(PageContent, { onBack: onBack, logoutOnBack: logoutOnBack, children: jsx(Loader, { isError: !!recoveryError, header: recoveryError ? 'Error creating wallet.' : `Creating wallet...`, description: recoveryError ? recoveryError.message : undefined }) }));
|
|
153
164
|
};
|
|
154
165
|
const CreateWalletPasskeyRecovery = ({ onChangeMethod, onBack, logoutOnBack, }) => {
|
|
155
|
-
const { triggerResize, setRoute } = useOpenfort();
|
|
166
|
+
const { triggerResize, setRoute, walletConfig } = useOpenfort();
|
|
156
167
|
const { create } = useEthereumEmbeddedWallet();
|
|
157
168
|
const [shouldCreateWallet, setShouldCreateWallet] = useState(false);
|
|
169
|
+
const isCreatingRef = useRef(false);
|
|
158
170
|
const [recoveryError, setRecoveryError] = useState(null);
|
|
159
171
|
const { embeddedState } = useOpenfortCore();
|
|
160
172
|
useEffect(() => {
|
|
161
173
|
if (!shouldCreateWallet)
|
|
162
174
|
return;
|
|
175
|
+
if (isCreatingRef.current)
|
|
176
|
+
return;
|
|
177
|
+
isCreatingRef.current = true;
|
|
163
178
|
(async () => {
|
|
164
179
|
logger.log('Creating wallet passkey recovery');
|
|
165
180
|
try {
|
|
166
181
|
await create({ recoveryMethod: RecoveryMethod.PASSKEY });
|
|
182
|
+
setShouldCreateWallet(false);
|
|
167
183
|
setRoute(routes.CONNECTED_SUCCESS);
|
|
168
184
|
}
|
|
169
185
|
catch (err) {
|
|
@@ -171,13 +187,18 @@ const CreateWalletPasskeyRecovery = ({ onChangeMethod, onBack, logoutOnBack, })
|
|
|
171
187
|
setRecoveryError(new Error('Failed to create wallet'));
|
|
172
188
|
setShouldCreateWallet(false);
|
|
173
189
|
}
|
|
190
|
+
finally {
|
|
191
|
+
isCreatingRef.current = false;
|
|
192
|
+
}
|
|
174
193
|
})();
|
|
175
194
|
}, [shouldCreateWallet, create]);
|
|
176
195
|
useEffect(() => {
|
|
177
|
-
if (embeddedState
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
196
|
+
if (embeddedState !== EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED)
|
|
197
|
+
return;
|
|
198
|
+
if ((walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.connectOnLogin) === false)
|
|
199
|
+
return;
|
|
200
|
+
setShouldCreateWallet(true);
|
|
201
|
+
}, [embeddedState, walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.connectOnLogin]);
|
|
181
202
|
useEffect(() => {
|
|
182
203
|
if (recoveryError)
|
|
183
204
|
triggerResize();
|
|
@@ -269,8 +290,7 @@ const CreateOrConnectWallet = () => {
|
|
|
269
290
|
};
|
|
270
291
|
const EthereumCreateWallet = () => {
|
|
271
292
|
const { uiConfig, walletConfig, setRoute } = useOpenfort();
|
|
272
|
-
const { user } = useOpenfortCore();
|
|
273
|
-
const { chainType } = useOpenfortCore();
|
|
293
|
+
const { user, chainType } = useOpenfortCore();
|
|
274
294
|
// Use chain-specific hooks
|
|
275
295
|
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
276
296
|
const solanaWallet = useSolanaEmbeddedWallet();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -29,9 +29,8 @@ const errorForChainRegistry = {
|
|
|
29
29
|
}),
|
|
30
30
|
};
|
|
31
31
|
const LoadWallets = () => {
|
|
32
|
-
const { chainType } = useOpenfortCore();
|
|
33
|
-
const {
|
|
34
|
-
const { triggerResize, setRoute, setConnector } = useOpenfort();
|
|
32
|
+
const { chainType, user } = useOpenfortCore();
|
|
33
|
+
const { triggerResize, setRoute, setConnector, walletConfig } = useOpenfort();
|
|
35
34
|
const ethereumWallet = useEthereumEmbeddedWallet();
|
|
36
35
|
const solanaWallet = useSolanaEmbeddedWallet();
|
|
37
36
|
const embeddedWallet = chainType === ChainTypeEnum.EVM ? ethereumWallet : solanaWallet;
|
|
@@ -62,6 +61,10 @@ const LoadWallets = () => {
|
|
|
62
61
|
}
|
|
63
62
|
logger.log('User wallets loaded:', wallets.length);
|
|
64
63
|
if (wallets.length === 0) {
|
|
64
|
+
if ((walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.connectOnLogin) === false) {
|
|
65
|
+
setRoute(routes.CONNECTED);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
65
68
|
setRoute(createRoute(chainType));
|
|
66
69
|
return;
|
|
67
70
|
}
|
|
@@ -80,7 +83,7 @@ const LoadWallets = () => {
|
|
|
80
83
|
return;
|
|
81
84
|
}
|
|
82
85
|
setRoute(routes.SELECT_WALLET_TO_RECOVER);
|
|
83
|
-
}, [loadingUX, isLoadingWallets, wallets, user, chainType, setRoute, setConnector]);
|
|
86
|
+
}, [loadingUX, isLoadingWallets, wallets, user, chainType, setRoute, setConnector, walletConfig]);
|
|
84
87
|
const { isError: isErrorFromChain, message: errorMessageFromChain } = errorForChainRegistry[chainType](errorWallets);
|
|
85
88
|
const isError = !user || isErrorFromChain;
|
|
86
89
|
const errorMessage = !user ? undefined : errorMessageFromChain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { AccountTypeEnum } from '@openfort/openfort-js';
|
|
1
2
|
/**
|
|
2
3
|
* Identifier for the Openfort embedded wallet connector.
|
|
3
4
|
* Used when identifying the embedded wallet in connector lists.
|
|
4
5
|
*/
|
|
5
6
|
export declare const embeddedWalletId = "xyz.openfort";
|
|
7
|
+
/** Default account type when none is specified in walletConfig or create options. */
|
|
8
|
+
export declare const DEFAULT_ACCOUNT_TYPE = AccountTypeEnum.EOA;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { AccountTypeEnum } from '@openfort/openfort-js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Identifier for the Openfort embedded wallet connector.
|
|
3
5
|
* Used when identifying the embedded wallet in connector lists.
|
|
4
6
|
*/
|
|
5
7
|
const embeddedWalletId = 'xyz.openfort';
|
|
8
|
+
/** Default account type when none is specified in walletConfig or create options. */
|
|
9
|
+
const DEFAULT_ACCOUNT_TYPE = AccountTypeEnum.EOA;
|
|
6
10
|
|
|
7
|
-
export { embeddedWalletId };
|
|
11
|
+
export { DEFAULT_ACCOUNT_TYPE, embeddedWalletId };
|
|
8
12
|
//# sourceMappingURL=openfort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openfort.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"openfort.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ChainTypeEnum,
|
|
1
|
+
import { ChainTypeEnum, EmbeddedState, RecoveryMethod } from '@openfort/openfort-js';
|
|
2
2
|
import { useRef, useState, useMemo, useCallback, useEffect } from 'react';
|
|
3
3
|
import { baseSepolia } from 'viem/chains';
|
|
4
4
|
import { useOpenfort } from '../../components/Openfort/useOpenfort.js';
|
|
5
|
+
import { DEFAULT_ACCOUNT_TYPE } from '../../constants/openfort.js';
|
|
5
6
|
import { useConnectionStrategy } from '../../core/ConnectionStrategyContext.js';
|
|
6
7
|
import { OpenfortError, OpenfortReactErrorType } from '../../types.js';
|
|
7
8
|
import { useOpenfortCore } from '../../openfort/useOpenfort.js';
|
|
@@ -131,11 +132,11 @@ function useEthereumEmbeddedWallet(options) {
|
|
|
131
132
|
},
|
|
132
133
|
});
|
|
133
134
|
// Determine account type (use createOptions, then walletConfig, else default to Smart Account)
|
|
134
|
-
const accountType = (_c = (_a = createOptions === null || createOptions === void 0 ? void 0 : createOptions.accountType) !== null && _a !== void 0 ? _a : (_b = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _b === void 0 ? void 0 : _b.accountType) !== null && _c !== void 0 ? _c :
|
|
135
|
+
const accountType = (_c = (_a = createOptions === null || createOptions === void 0 ? void 0 : createOptions.accountType) !== null && _a !== void 0 ? _a : (_b = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _b === void 0 ? void 0 : _b.accountType) !== null && _c !== void 0 ? _c : DEFAULT_ACCOUNT_TYPE;
|
|
135
136
|
const account = await client.embeddedWallet.create({
|
|
136
137
|
chainType: ChainTypeEnum.EVM,
|
|
137
138
|
accountType,
|
|
138
|
-
...(accountType !==
|
|
139
|
+
...(accountType !== DEFAULT_ACCOUNT_TYPE && { chainId: (_d = createOptions === null || createOptions === void 0 ? void 0 : createOptions.chainId) !== null && _d !== void 0 ? _d : creationChainId }),
|
|
139
140
|
recoveryParams,
|
|
140
141
|
});
|
|
141
142
|
await updateEmbeddedAccounts({ silent: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEthereumEmbeddedWallet.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useEthereumEmbeddedWallet.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ChainTypeEnum, RecoveryMethod, EmbeddedState } from '@openfort/openfort-js';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useOpenfort } from '../../../components/Openfort/useOpenfort.js';
|
|
4
|
+
import { DEFAULT_ACCOUNT_TYPE } from '../../../constants/openfort.js';
|
|
4
5
|
import { useOpenfortCore } from '../../../openfort/useOpenfort.js';
|
|
5
6
|
import { buildRecoveryParams } from '../../../shared/utils/recovery.js';
|
|
6
7
|
import { logger } from '../../../utils/logger.js';
|
|
@@ -54,11 +55,11 @@ const useConnectToWalletPostAuth = () => {
|
|
|
54
55
|
getAccessToken: () => client.getAccessToken(),
|
|
55
56
|
getUserId: async () => { var _a; return (_a = (await client.user.get())) === null || _a === void 0 ? void 0 : _a.id; },
|
|
56
57
|
});
|
|
57
|
-
const accountType = (_c = (_b = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _b === void 0 ? void 0 : _b.accountType) !== null && _c !== void 0 ? _c :
|
|
58
|
+
const accountType = (_c = (_b = walletConfig === null || walletConfig === void 0 ? void 0 : walletConfig.ethereum) === null || _b === void 0 ? void 0 : _b.accountType) !== null && _c !== void 0 ? _c : DEFAULT_ACCOUNT_TYPE;
|
|
58
59
|
const account = await client.embeddedWallet.create({
|
|
59
60
|
chainType,
|
|
60
|
-
accountType: chainType === ChainTypeEnum.EVM ? accountType :
|
|
61
|
-
...(chainType === ChainTypeEnum.EVM && accountType !==
|
|
61
|
+
accountType: chainType === ChainTypeEnum.EVM ? accountType : DEFAULT_ACCOUNT_TYPE,
|
|
62
|
+
...(chainType === ChainTypeEnum.EVM && accountType !== DEFAULT_ACCOUNT_TYPE && { chainId }),
|
|
62
63
|
recoveryParams,
|
|
63
64
|
});
|
|
64
65
|
await updateEmbeddedAccounts({ silent: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnectToWalletPostAuth.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useConnectToWalletPostAuth.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const OPENFORT_VERSION = "1.0.
|
|
1
|
+
export declare const OPENFORT_VERSION = "1.0.2";
|
package/build/version.js
CHANGED