@dynamic-labs/sdk-react-core 4.88.1 → 4.88.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -153
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +12 -12
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +6 -0
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +6 -0
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.cjs +8 -0
- package/src/lib/context/ConnectWithOtpContext/ConnectWithOtpProvider.js +8 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/index.d.ts +1 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/useRestoreOtpVerificationState.cjs +48 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/useRestoreOtpVerificationState.d.ts +16 -0
- package/src/lib/context/ConnectWithOtpContext/hooks/useRestoreOtpVerificationState/useRestoreOtpVerificationState.js +44 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.cjs +88 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.d.ts +16 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/buildEmailOtpHandler.js +84 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildEmailOtpHandler/index.d.ts +1 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.cjs +67 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.d.ts +17 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/buildSmsOtpHandler.js +63 -0
- package/src/lib/context/ConnectWithOtpContext/utils/buildSmsOtpHandler/index.d.ts +1 -0
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.cjs +23 -47
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.d.ts +1 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createEmailHandler.js +23 -47
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.cjs +19 -34
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.d.ts +1 -1
- package/src/lib/context/ConnectWithOtpContext/utils/createSmsHandler.js +19 -34
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/index.d.ts +2 -0
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.cjs +60 -0
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.d.ts +30 -0
- package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.js +54 -0
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.cjs +3 -3
- package/src/lib/utils/hooks/useCreateDynamicEmbeddedWalletMutation/useCreateDynamicEmbeddedWalletMutation.js +4 -4
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +10 -2
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +10 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +11 -10
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +12 -11
- package/src/lib/utils/hooks/useReconcileInstalledWallets/index.d.ts +1 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.cjs +69 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.d.ts +7 -0
- package/src/lib/utils/hooks/useReconcileInstalledWallets/useReconcileInstalledWallets.js +65 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.cjs +42 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.d.ts +17 -0
- package/src/lib/utils/hooks/useWalletList/buildWalletsList.js +38 -0
- package/src/lib/utils/hooks/useWalletList/useWalletList.cjs +27 -26
- package/src/lib/utils/hooks/useWalletList/useWalletList.js +27 -26
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +26 -21
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +26 -21
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
|
|
8
|
+
const STORAGE_KEY = 'dynamic_otp_verification_state';
|
|
9
|
+
// 5 minutes in milliseconds — matches the backend OTP expiry window.
|
|
10
|
+
const OTP_STATE_TTL_MS = 5 * 60 * 1000;
|
|
11
|
+
/**
|
|
12
|
+
* Persists OTP verification state to localStorage so it can survive
|
|
13
|
+
* webview remounts (e.g. Android WebView process kills on low-memory devices).
|
|
14
|
+
*/
|
|
15
|
+
const persistOtpVerificationState = (state) => {
|
|
16
|
+
try {
|
|
17
|
+
const payload = Object.assign(Object.assign({}, state), { createdAt: Date.now() });
|
|
18
|
+
utils.StorageService.setItem(STORAGE_KEY, payload);
|
|
19
|
+
}
|
|
20
|
+
catch (_a) {
|
|
21
|
+
// Storage may not be available in all environments
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Restores previously persisted OTP verification state, if any.
|
|
26
|
+
* Returns null when nothing is stored or storage is unavailable.
|
|
27
|
+
*/
|
|
28
|
+
const restoreOtpVerificationState = () => {
|
|
29
|
+
var _a;
|
|
30
|
+
try {
|
|
31
|
+
const parsed = (_a = utils.StorageService.getItem(STORAGE_KEY)) !== null && _a !== void 0 ? _a : null;
|
|
32
|
+
if (!parsed) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
if (parsed.createdAt && Date.now() - parsed.createdAt > OTP_STATE_TTL_MS) {
|
|
36
|
+
utils.StorageService.removeItem(STORAGE_KEY);
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return parsed;
|
|
40
|
+
}
|
|
41
|
+
catch (_b) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Clears any persisted OTP verification state from localStorage.
|
|
47
|
+
* Called after successful verification or when starting a new OTP flow.
|
|
48
|
+
*/
|
|
49
|
+
const clearOtpVerificationState = () => {
|
|
50
|
+
try {
|
|
51
|
+
utils.StorageService.removeItem(STORAGE_KEY);
|
|
52
|
+
}
|
|
53
|
+
catch (_a) {
|
|
54
|
+
// ignore
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
exports.clearOtpVerificationState = clearOtpVerificationState;
|
|
59
|
+
exports.persistOtpVerificationState = persistOtpVerificationState;
|
|
60
|
+
exports.restoreOtpVerificationState = restoreOtpVerificationState;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PhoneData } from '@dynamic-labs/types';
|
|
2
|
+
type PersistedEmailOtpState = {
|
|
3
|
+
type: 'email';
|
|
4
|
+
verificationUUID: string;
|
|
5
|
+
destination: string;
|
|
6
|
+
captchaToken?: string;
|
|
7
|
+
};
|
|
8
|
+
type PersistedSmsOtpState = {
|
|
9
|
+
type: 'sms';
|
|
10
|
+
verificationUUID: string;
|
|
11
|
+
destination: PhoneData;
|
|
12
|
+
captchaToken?: string;
|
|
13
|
+
};
|
|
14
|
+
export type PersistedOtpState = PersistedEmailOtpState | PersistedSmsOtpState;
|
|
15
|
+
/**
|
|
16
|
+
* Persists OTP verification state to localStorage so it can survive
|
|
17
|
+
* webview remounts (e.g. Android WebView process kills on low-memory devices).
|
|
18
|
+
*/
|
|
19
|
+
export declare const persistOtpVerificationState: (state: PersistedOtpState) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Restores previously persisted OTP verification state, if any.
|
|
22
|
+
* Returns null when nothing is stored or storage is unavailable.
|
|
23
|
+
*/
|
|
24
|
+
export declare const restoreOtpVerificationState: () => PersistedOtpState | null;
|
|
25
|
+
/**
|
|
26
|
+
* Clears any persisted OTP verification state from localStorage.
|
|
27
|
+
* Called after successful verification or when starting a new OTP flow.
|
|
28
|
+
*/
|
|
29
|
+
export declare const clearOtpVerificationState: () => void;
|
|
30
|
+
export {};
|
package/src/lib/context/ConnectWithOtpContext/utils/otpVerificationStorage/otpVerificationStorage.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { StorageService } from '@dynamic-labs/utils';
|
|
3
|
+
|
|
4
|
+
const STORAGE_KEY = 'dynamic_otp_verification_state';
|
|
5
|
+
// 5 minutes in milliseconds — matches the backend OTP expiry window.
|
|
6
|
+
const OTP_STATE_TTL_MS = 5 * 60 * 1000;
|
|
7
|
+
/**
|
|
8
|
+
* Persists OTP verification state to localStorage so it can survive
|
|
9
|
+
* webview remounts (e.g. Android WebView process kills on low-memory devices).
|
|
10
|
+
*/
|
|
11
|
+
const persistOtpVerificationState = (state) => {
|
|
12
|
+
try {
|
|
13
|
+
const payload = Object.assign(Object.assign({}, state), { createdAt: Date.now() });
|
|
14
|
+
StorageService.setItem(STORAGE_KEY, payload);
|
|
15
|
+
}
|
|
16
|
+
catch (_a) {
|
|
17
|
+
// Storage may not be available in all environments
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Restores previously persisted OTP verification state, if any.
|
|
22
|
+
* Returns null when nothing is stored or storage is unavailable.
|
|
23
|
+
*/
|
|
24
|
+
const restoreOtpVerificationState = () => {
|
|
25
|
+
var _a;
|
|
26
|
+
try {
|
|
27
|
+
const parsed = (_a = StorageService.getItem(STORAGE_KEY)) !== null && _a !== void 0 ? _a : null;
|
|
28
|
+
if (!parsed) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
if (parsed.createdAt && Date.now() - parsed.createdAt > OTP_STATE_TTL_MS) {
|
|
32
|
+
StorageService.removeItem(STORAGE_KEY);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return parsed;
|
|
36
|
+
}
|
|
37
|
+
catch (_b) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Clears any persisted OTP verification state from localStorage.
|
|
43
|
+
* Called after successful verification or when starting a new OTP flow.
|
|
44
|
+
*/
|
|
45
|
+
const clearOtpVerificationState = () => {
|
|
46
|
+
try {
|
|
47
|
+
StorageService.removeItem(STORAGE_KEY);
|
|
48
|
+
}
|
|
49
|
+
catch (_a) {
|
|
50
|
+
// ignore
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export { clearOtpVerificationState, persistOtpVerificationState, restoreOtpVerificationState };
|
|
@@ -56,11 +56,11 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
56
56
|
environmentId,
|
|
57
57
|
projectSettings,
|
|
58
58
|
});
|
|
59
|
-
const
|
|
59
|
+
const chainConfigurations = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.chainConfigurations;
|
|
60
60
|
const primaryEmbeddedChain = findPrimaryEmbeddedChain.findPrimaryEmbeddedChain(projectSettings);
|
|
61
|
-
const embeddedChains =
|
|
61
|
+
const embeddedChains = React.useMemo(() => (chainConfigurations || [])
|
|
62
62
|
.filter((chain) => chain.enabled)
|
|
63
|
-
.map((c) => getEmbeddedChain(c.name));
|
|
63
|
+
.map((c) => getEmbeddedChain(c.name)), [chainConfigurations]);
|
|
64
64
|
const createDynamicEmbeddedWalletMutation = React.useCallback((_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
|
|
65
65
|
var _d, _e;
|
|
66
66
|
setIsLoading(true);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { useState, useCallback } from 'react';
|
|
3
|
+
import { useState, useMemo, useCallback } from 'react';
|
|
4
4
|
import { EmbeddedWalletChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
6
|
import '../../../context/DynamicContext/useDynamicContext/useDynamicContext.js';
|
|
@@ -52,11 +52,11 @@ const useCreateDynamicEmbeddedWalletMutation = () => {
|
|
|
52
52
|
environmentId,
|
|
53
53
|
projectSettings,
|
|
54
54
|
});
|
|
55
|
-
const
|
|
55
|
+
const chainConfigurations = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.embeddedWallets) === null || _b === void 0 ? void 0 : _b.chainConfigurations;
|
|
56
56
|
const primaryEmbeddedChain = findPrimaryEmbeddedChain(projectSettings);
|
|
57
|
-
const embeddedChains =
|
|
57
|
+
const embeddedChains = useMemo(() => (chainConfigurations || [])
|
|
58
58
|
.filter((chain) => chain.enabled)
|
|
59
|
-
.map((c) => getEmbeddedChain(c.name));
|
|
59
|
+
.map((c) => getEmbeddedChain(c.name)), [chainConfigurations]);
|
|
60
60
|
const createDynamicEmbeddedWalletMutation = useCallback((_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, walletConnectorOptions, withAuthenticator, options, chains, }) {
|
|
61
61
|
var _d, _e;
|
|
62
62
|
setIsLoading(true);
|
package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs
CHANGED
|
@@ -40,6 +40,12 @@ const useCreateWalletConnectorOptions = (_a) => {
|
|
|
40
40
|
const redirectUrl = settingsUtils.useRedirectUrl();
|
|
41
41
|
const walletConnectorsKey = React.useMemo(() => { var _a; return (_a = serializeWalletConnectors.serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
|
|
42
42
|
const isWalletBookLoaded = React.useMemo(() => walletBook.isWalletBookPopulated(walletBook$1), [walletBook$1]);
|
|
43
|
+
// networkConfigurations can get a fresh object identity on every render even when
|
|
44
|
+
// its content is unchanged (e.g. built inline upstream, churned by a host-app
|
|
45
|
+
// re-render storm). Depending on a stable content signature instead of the object
|
|
46
|
+
// reference keeps a render storm from rebuilding the (potentially 100s-strong)
|
|
47
|
+
// connector list every frame — mirrors walletConnectorsKey above.
|
|
48
|
+
const networkConfigurationsKey = React.useMemo(() => JSON.stringify(networkConfigurations !== null && networkConfigurations !== void 0 ? networkConfigurations : {}), [networkConfigurations]);
|
|
43
49
|
const walletConnectorOptions = React.useMemo(() => {
|
|
44
50
|
if (!projectSettings || !isWalletBookLoaded || !networkConfigurations)
|
|
45
51
|
return [];
|
|
@@ -48,14 +54,16 @@ const useCreateWalletConnectorOptions = (_a) => {
|
|
|
48
54
|
redirectUrl, settings: projectSettings, skipMemo: true, walletBook: walletBook$1, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
|
|
49
55
|
walletConnectorExtensions,
|
|
50
56
|
});
|
|
51
|
-
//
|
|
57
|
+
// walletUiUtils is intentionally excluded (its unstable identity would cause an
|
|
58
|
+
// infinite loop); networkConfigurations is depended on via its content signature
|
|
59
|
+
// (networkConfigurationsKey) so an identity-only churn doesn't rebuild the list.
|
|
52
60
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
53
61
|
}, [
|
|
54
62
|
projectSettings,
|
|
55
63
|
redirectUrl,
|
|
56
64
|
walletConnectorsKey,
|
|
57
65
|
isWalletBookLoaded,
|
|
58
|
-
|
|
66
|
+
networkConfigurationsKey,
|
|
59
67
|
]);
|
|
60
68
|
React.useEffect(() => {
|
|
61
69
|
if (!projectSettings || walletConnectorOptions.length === 0)
|
package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js
CHANGED
|
@@ -36,6 +36,12 @@ const useCreateWalletConnectorOptions = (_a) => {
|
|
|
36
36
|
const redirectUrl = useRedirectUrl();
|
|
37
37
|
const walletConnectorsKey = useMemo(() => { var _a; return (_a = serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
|
|
38
38
|
const isWalletBookLoaded = useMemo(() => isWalletBookPopulated(walletBook), [walletBook]);
|
|
39
|
+
// networkConfigurations can get a fresh object identity on every render even when
|
|
40
|
+
// its content is unchanged (e.g. built inline upstream, churned by a host-app
|
|
41
|
+
// re-render storm). Depending on a stable content signature instead of the object
|
|
42
|
+
// reference keeps a render storm from rebuilding the (potentially 100s-strong)
|
|
43
|
+
// connector list every frame — mirrors walletConnectorsKey above.
|
|
44
|
+
const networkConfigurationsKey = useMemo(() => JSON.stringify(networkConfigurations !== null && networkConfigurations !== void 0 ? networkConfigurations : {}), [networkConfigurations]);
|
|
39
45
|
const walletConnectorOptions = useMemo(() => {
|
|
40
46
|
if (!projectSettings || !isWalletBookLoaded || !networkConfigurations)
|
|
41
47
|
return [];
|
|
@@ -44,14 +50,16 @@ const useCreateWalletConnectorOptions = (_a) => {
|
|
|
44
50
|
redirectUrl, settings: projectSettings, skipMemo: true, walletBook, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
|
|
45
51
|
walletConnectorExtensions,
|
|
46
52
|
});
|
|
47
|
-
//
|
|
53
|
+
// walletUiUtils is intentionally excluded (its unstable identity would cause an
|
|
54
|
+
// infinite loop); networkConfigurations is depended on via its content signature
|
|
55
|
+
// (networkConfigurationsKey) so an identity-only churn doesn't rebuild the list.
|
|
48
56
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
57
|
}, [
|
|
50
58
|
projectSettings,
|
|
51
59
|
redirectUrl,
|
|
52
60
|
walletConnectorsKey,
|
|
53
61
|
isWalletBookLoaded,
|
|
54
|
-
|
|
62
|
+
networkConfigurationsKey,
|
|
55
63
|
]);
|
|
56
64
|
useEffect(() => {
|
|
57
65
|
if (!projectSettings || walletConnectorOptions.length === 0)
|
|
@@ -91,7 +91,7 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
91
91
|
return walletConnector;
|
|
92
92
|
};
|
|
93
93
|
const useDynamicWaas = () => {
|
|
94
|
-
var _a, _b, _c, _d, _e, _f
|
|
94
|
+
var _a, _b, _c, _d, _e, _f;
|
|
95
95
|
const { setShowAuthFlow, handleLogOutWithReason } = useInternalDynamicContext.useInternalDynamicContext();
|
|
96
96
|
const { addedWalletsIds, userWallets } = UserWalletsContext.useInternalUserWallets();
|
|
97
97
|
const user = useUser.useUser();
|
|
@@ -103,14 +103,15 @@ const useDynamicWaas = () => {
|
|
|
103
103
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
104
104
|
const baseClientKeysharesRelayApiUrl = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.customKeyshareRelayBaseUrl;
|
|
105
105
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
106
|
-
const
|
|
107
|
-
const
|
|
108
|
-
const
|
|
106
|
+
const chainConfigurations = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations;
|
|
107
|
+
const enabledChains = React.useMemo(() => chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.filter((c) => c.enabled), [chainConfigurations]);
|
|
108
|
+
const primaryChain = React.useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary), [enabledChains]);
|
|
109
|
+
const enabledChainNames = React.useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name), [enabledChains]);
|
|
109
110
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
110
111
|
const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreationForExternal;
|
|
111
112
|
const defaultWalletVersion = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.defaultWalletVersion;
|
|
112
113
|
const dynamicWaasIsEnabled = defaultWalletVersion === sdkApiCore.EmbeddedWalletVersionEnum.V3;
|
|
113
|
-
const svmGasSponsorshipEnabled = (
|
|
114
|
+
const svmGasSponsorshipEnabled = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _e !== void 0 ? _e : false;
|
|
114
115
|
const svmGasSponsorshipEnabledRef = React.useRef(svmGasSponsorshipEnabled);
|
|
115
116
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
116
117
|
const authToken = getMinAuthToken.getMinAuthToken();
|
|
@@ -175,7 +176,7 @@ const useDynamicWaas = () => {
|
|
|
175
176
|
}, [
|
|
176
177
|
user === null || user === void 0 ? void 0 : user.id,
|
|
177
178
|
user === null || user === void 0 ? void 0 : user.sessionId,
|
|
178
|
-
(
|
|
179
|
+
(_f = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _f === void 0 ? void 0 : _f.length,
|
|
179
180
|
dynamicWaasIsEnabled,
|
|
180
181
|
enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length,
|
|
181
182
|
walletConnectorOptions.length,
|
|
@@ -459,7 +460,7 @@ const useDynamicWaas = () => {
|
|
|
459
460
|
automaticEmbeddedWalletCreationForExternalEnabled,
|
|
460
461
|
enabledChainNames,
|
|
461
462
|
]);
|
|
462
|
-
const importPrivateKey = (
|
|
463
|
+
const importPrivateKey = (_g) => _tslib.__awaiter(void 0, [_g], void 0, function* ({ chainName, privateKey, addressType, legacyWalletId, password, }) {
|
|
463
464
|
const walletConnector = getWaasWalletConnector(chainName);
|
|
464
465
|
if (!walletConnector)
|
|
465
466
|
return;
|
|
@@ -472,7 +473,7 @@ const useDynamicWaas = () => {
|
|
|
472
473
|
});
|
|
473
474
|
yield refresh();
|
|
474
475
|
});
|
|
475
|
-
const upgradeToDynamicWaas = React.useCallback((
|
|
476
|
+
const upgradeToDynamicWaas = React.useCallback((_h) => _tslib.__awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, password, }) {
|
|
476
477
|
isUpgrading.current = true;
|
|
477
478
|
if (!wallet) {
|
|
478
479
|
throw new utils.DynamicError('Wallet to upgrade was not provided');
|
|
@@ -552,14 +553,14 @@ const useDynamicWaas = () => {
|
|
|
552
553
|
values.VerifiedCredentialNameToChainEnum[cred.chain]);
|
|
553
554
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
554
555
|
const processSignOnWalletSettings = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
555
|
-
var
|
|
556
|
+
var _j;
|
|
556
557
|
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
557
558
|
return;
|
|
558
559
|
}
|
|
559
560
|
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
560
561
|
for (const wallet of waasWallets) {
|
|
561
562
|
try {
|
|
562
|
-
const settings = (
|
|
563
|
+
const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
|
|
563
564
|
const { address, chain } = wallet;
|
|
564
565
|
if (!settings || !address || !chain) {
|
|
565
566
|
continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { useRef, useState, useCallback
|
|
3
|
+
import { useMemo, useRef, useState, useCallback } from 'react';
|
|
4
4
|
import { EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum, WalletProviderEnum, ChainEnum } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
6
|
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
@@ -87,7 +87,7 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
|
|
|
87
87
|
return walletConnector;
|
|
88
88
|
};
|
|
89
89
|
const useDynamicWaas = () => {
|
|
90
|
-
var _a, _b, _c, _d, _e, _f
|
|
90
|
+
var _a, _b, _c, _d, _e, _f;
|
|
91
91
|
const { setShowAuthFlow, handleLogOutWithReason } = useInternalDynamicContext();
|
|
92
92
|
const { addedWalletsIds, userWallets } = useInternalUserWallets();
|
|
93
93
|
const user = useUser();
|
|
@@ -99,14 +99,15 @@ const useDynamicWaas = () => {
|
|
|
99
99
|
const relayUrl = (_b = (_a = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _a === void 0 ? void 0 : _a.waas) === null || _b === void 0 ? void 0 : _b.relayUrl;
|
|
100
100
|
const baseClientKeysharesRelayApiUrl = (_d = (_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _c === void 0 ? void 0 : _c.waas) === null || _d === void 0 ? void 0 : _d.customKeyshareRelayBaseUrl;
|
|
101
101
|
const embeddedWalletSettings = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.embeddedWallets;
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
102
|
+
const chainConfigurations = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.chainConfigurations;
|
|
103
|
+
const enabledChains = useMemo(() => chainConfigurations === null || chainConfigurations === void 0 ? void 0 : chainConfigurations.filter((c) => c.enabled), [chainConfigurations]);
|
|
104
|
+
const primaryChain = useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.find((chain) => chain.primary), [enabledChains]);
|
|
105
|
+
const enabledChainNames = useMemo(() => enabledChains === null || enabledChains === void 0 ? void 0 : enabledChains.map((chain) => chain.name), [enabledChains]);
|
|
105
106
|
const automaticEmbeddedWalletCreationEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreation;
|
|
106
107
|
const automaticEmbeddedWalletCreationForExternalEnabled = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.automaticEmbeddedWalletCreationForExternal;
|
|
107
108
|
const defaultWalletVersion = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.defaultWalletVersion;
|
|
108
109
|
const dynamicWaasIsEnabled = defaultWalletVersion === EmbeddedWalletVersionEnum.V3;
|
|
109
|
-
const svmGasSponsorshipEnabled = (
|
|
110
|
+
const svmGasSponsorshipEnabled = (_e = embeddedWalletSettings === null || embeddedWalletSettings === void 0 ? void 0 : embeddedWalletSettings.svmGasSponsorshipEnabled) !== null && _e !== void 0 ? _e : false;
|
|
110
111
|
const svmGasSponsorshipEnabledRef = useRef(svmGasSponsorshipEnabled);
|
|
111
112
|
svmGasSponsorshipEnabledRef.current = svmGasSponsorshipEnabled;
|
|
112
113
|
const authToken = getMinAuthToken();
|
|
@@ -171,7 +172,7 @@ const useDynamicWaas = () => {
|
|
|
171
172
|
}, [
|
|
172
173
|
user === null || user === void 0 ? void 0 : user.id,
|
|
173
174
|
user === null || user === void 0 ? void 0 : user.sessionId,
|
|
174
|
-
(
|
|
175
|
+
(_f = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _f === void 0 ? void 0 : _f.length,
|
|
175
176
|
dynamicWaasIsEnabled,
|
|
176
177
|
enabledChainNames === null || enabledChainNames === void 0 ? void 0 : enabledChainNames.length,
|
|
177
178
|
walletConnectorOptions.length,
|
|
@@ -455,7 +456,7 @@ const useDynamicWaas = () => {
|
|
|
455
456
|
automaticEmbeddedWalletCreationForExternalEnabled,
|
|
456
457
|
enabledChainNames,
|
|
457
458
|
]);
|
|
458
|
-
const importPrivateKey = (
|
|
459
|
+
const importPrivateKey = (_g) => __awaiter(void 0, [_g], void 0, function* ({ chainName, privateKey, addressType, legacyWalletId, password, }) {
|
|
459
460
|
const walletConnector = getWaasWalletConnector(chainName);
|
|
460
461
|
if (!walletConnector)
|
|
461
462
|
return;
|
|
@@ -468,7 +469,7 @@ const useDynamicWaas = () => {
|
|
|
468
469
|
});
|
|
469
470
|
yield refresh();
|
|
470
471
|
});
|
|
471
|
-
const upgradeToDynamicWaas = useCallback((
|
|
472
|
+
const upgradeToDynamicWaas = useCallback((_h) => __awaiter(void 0, [_h], void 0, function* ({ privateKey, wallet, password, }) {
|
|
472
473
|
isUpgrading.current = true;
|
|
473
474
|
if (!wallet) {
|
|
474
475
|
throw new DynamicError('Wallet to upgrade was not provided');
|
|
@@ -548,14 +549,14 @@ const useDynamicWaas = () => {
|
|
|
548
549
|
VerifiedCredentialNameToChainEnum[cred.chain]);
|
|
549
550
|
}, [user === null || user === void 0 ? void 0 : user.verifiedCredentials]);
|
|
550
551
|
const processSignOnWalletSettings = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
551
|
-
var
|
|
552
|
+
var _j;
|
|
552
553
|
if (!(user === null || user === void 0 ? void 0 : user.verifiedCredentials)) {
|
|
553
554
|
return;
|
|
554
555
|
}
|
|
555
556
|
const waasWallets = user.verifiedCredentials.filter((vc) => { var _a; return vc.walletName === 'dynamicwaas' && ((_a = vc.walletProperties) === null || _a === void 0 ? void 0 : _a.settings); });
|
|
556
557
|
for (const wallet of waasWallets) {
|
|
557
558
|
try {
|
|
558
|
-
const settings = (
|
|
559
|
+
const settings = (_j = wallet.walletProperties) === null || _j === void 0 ? void 0 : _j.settings;
|
|
559
560
|
const { address, chain } = wallet;
|
|
560
561
|
if (!settings || !address || !chain) {
|
|
561
562
|
continue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useReconcileInstalledWallets';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var walletOptions = require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
8
|
+
|
|
9
|
+
// The wallet list's installed state is snapshotted once (in
|
|
10
|
+
// useCreateWalletConnectorOptions) and is otherwise only updated by
|
|
11
|
+
// providerReady events. On a typed/address-bar navigation a wallet extension
|
|
12
|
+
// (e.g. Backpack, Solflare) can inject its window provider just after that
|
|
13
|
+
// snapshot runs, so the connector is frozen as "not installed" with no event
|
|
14
|
+
// to recover it and only appears after a reload (DYNT-1074). Re-check the
|
|
15
|
+
// already-instantiated connectors for a short window after load and upgrade any
|
|
16
|
+
// that have since become installed.
|
|
17
|
+
const INSTALLED_WALLET_RECONCILE_INTERVAL_MS = 300;
|
|
18
|
+
const INSTALLED_WALLET_RECONCILE_DURATION_MS = 5000;
|
|
19
|
+
/**
|
|
20
|
+
* Polls the existing wallet connector options for a bounded window and upgrades
|
|
21
|
+
* any whose connector has become installed since the initial snapshot. This is
|
|
22
|
+
* upgrade-only (never downgrades), so a provider that momentarily fails to
|
|
23
|
+
* resolve cannot remove an already-installed wallet from the list.
|
|
24
|
+
*/
|
|
25
|
+
const useReconcileInstalledWallets = (enabled) => {
|
|
26
|
+
React.useEffect(() => {
|
|
27
|
+
if (!enabled) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
const reconcileInstalledWallets = () => {
|
|
31
|
+
const options = walletOptions.getWalletConnectorOptions();
|
|
32
|
+
if (!options) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const upgradedOptions = options
|
|
36
|
+
.filter((option) => {
|
|
37
|
+
if (option.isInstalledOnBrowser) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
// isInstalledOnBrowser reads the window/registry fresh on each call,
|
|
42
|
+
// so this reflects providers injected after the initial snapshot.
|
|
43
|
+
return option.walletConnector.isInstalledOnBrowser();
|
|
44
|
+
}
|
|
45
|
+
catch (_a) {
|
|
46
|
+
// Third-party provider code may throw; treat as not installed.
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
})
|
|
50
|
+
.map((option) => (Object.assign(Object.assign({}, option), { isInstalledOnBrowser: true })));
|
|
51
|
+
if (upgradedOptions.length > 0) {
|
|
52
|
+
// mergeWalletConnectorOptions merges by key, so passing only the
|
|
53
|
+
// upgraded options is safe alongside concurrent providerReady updates.
|
|
54
|
+
walletOptions.mergeWalletConnectorOptions(upgradedOptions);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
reconcileInstalledWallets();
|
|
58
|
+
const intervalId = setInterval(reconcileInstalledWallets, INSTALLED_WALLET_RECONCILE_INTERVAL_MS);
|
|
59
|
+
const timeoutId = setTimeout(() => {
|
|
60
|
+
clearInterval(intervalId);
|
|
61
|
+
}, INSTALLED_WALLET_RECONCILE_DURATION_MS);
|
|
62
|
+
return () => {
|
|
63
|
+
clearInterval(intervalId);
|
|
64
|
+
clearTimeout(timeoutId);
|
|
65
|
+
};
|
|
66
|
+
}, [enabled]);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
exports.useReconcileInstalledWallets = useReconcileInstalledWallets;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Polls the existing wallet connector options for a bounded window and upgrades
|
|
3
|
+
* any whose connector has become installed since the initial snapshot. This is
|
|
4
|
+
* upgrade-only (never downgrades), so a provider that momentarily fails to
|
|
5
|
+
* resolve cannot remove an already-installed wallet from the list.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useReconcileInstalledWallets: (enabled: boolean) => void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { getWalletConnectorOptions, mergeWalletConnectorOptions } from '../../../store/state/walletOptions/walletOptions.js';
|
|
4
|
+
|
|
5
|
+
// The wallet list's installed state is snapshotted once (in
|
|
6
|
+
// useCreateWalletConnectorOptions) and is otherwise only updated by
|
|
7
|
+
// providerReady events. On a typed/address-bar navigation a wallet extension
|
|
8
|
+
// (e.g. Backpack, Solflare) can inject its window provider just after that
|
|
9
|
+
// snapshot runs, so the connector is frozen as "not installed" with no event
|
|
10
|
+
// to recover it and only appears after a reload (DYNT-1074). Re-check the
|
|
11
|
+
// already-instantiated connectors for a short window after load and upgrade any
|
|
12
|
+
// that have since become installed.
|
|
13
|
+
const INSTALLED_WALLET_RECONCILE_INTERVAL_MS = 300;
|
|
14
|
+
const INSTALLED_WALLET_RECONCILE_DURATION_MS = 5000;
|
|
15
|
+
/**
|
|
16
|
+
* Polls the existing wallet connector options for a bounded window and upgrades
|
|
17
|
+
* any whose connector has become installed since the initial snapshot. This is
|
|
18
|
+
* upgrade-only (never downgrades), so a provider that momentarily fails to
|
|
19
|
+
* resolve cannot remove an already-installed wallet from the list.
|
|
20
|
+
*/
|
|
21
|
+
const useReconcileInstalledWallets = (enabled) => {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!enabled) {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
const reconcileInstalledWallets = () => {
|
|
27
|
+
const options = getWalletConnectorOptions();
|
|
28
|
+
if (!options) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const upgradedOptions = options
|
|
32
|
+
.filter((option) => {
|
|
33
|
+
if (option.isInstalledOnBrowser) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
// isInstalledOnBrowser reads the window/registry fresh on each call,
|
|
38
|
+
// so this reflects providers injected after the initial snapshot.
|
|
39
|
+
return option.walletConnector.isInstalledOnBrowser();
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
// Third-party provider code may throw; treat as not installed.
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.map((option) => (Object.assign(Object.assign({}, option), { isInstalledOnBrowser: true })));
|
|
47
|
+
if (upgradedOptions.length > 0) {
|
|
48
|
+
// mergeWalletConnectorOptions merges by key, so passing only the
|
|
49
|
+
// upgraded options is safe alongside concurrent providerReady updates.
|
|
50
|
+
mergeWalletConnectorOptions(upgradedOptions);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
reconcileInstalledWallets();
|
|
54
|
+
const intervalId = setInterval(reconcileInstalledWallets, INSTALLED_WALLET_RECONCILE_INTERVAL_MS);
|
|
55
|
+
const timeoutId = setTimeout(() => {
|
|
56
|
+
clearInterval(intervalId);
|
|
57
|
+
}, INSTALLED_WALLET_RECONCILE_DURATION_MS);
|
|
58
|
+
return () => {
|
|
59
|
+
clearInterval(intervalId);
|
|
60
|
+
clearTimeout(timeoutId);
|
|
61
|
+
};
|
|
62
|
+
}, [enabled]);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { useReconcileInstalledWallets };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var utils = require('@dynamic-labs/utils');
|
|
7
|
+
var index = require('../../functions/walletFilters/index.cjs');
|
|
8
|
+
var walletListBuilder = require('../../functions/walletListBuilder/walletListBuilder.cjs');
|
|
9
|
+
var getEffectiveRecommendedWallets = require('./utils/getEffectiveRecommendedWallets/getEffectiveRecommendedWallets.cjs');
|
|
10
|
+
var getEffectiveWalletFilter = require('./utils/getEffectiveWalletFilter/getEffectiveWalletFilter.cjs');
|
|
11
|
+
|
|
12
|
+
const buildWalletsList = ({ bridgeChainsToConnect, defaultNumberOfWalletsToShow, isWalletConnectList, lastUsedWalletKey, multiWallet, recommendedWallets, searchFilter, selectedTabSettings, userWallets, viewWalletsFilter, walletConnectorOptions, walletGroups, walletsFilter, }) => {
|
|
13
|
+
const getFilteredBridgeChains = (bridgeChainsToConnect === null || bridgeChainsToConnect === void 0 ? void 0 : bridgeChainsToConnect.length) &&
|
|
14
|
+
index.FilterBridgeChainsName(bridgeChainsToConnect[0].chain);
|
|
15
|
+
const filteredBridgeChains = getFilteredBridgeChains && getFilteredBridgeChains(walletConnectorOptions);
|
|
16
|
+
const effectiveRecommendedWallets = getEffectiveRecommendedWallets.getEffectiveRecommendedWallets(selectedTabSettings, recommendedWallets);
|
|
17
|
+
const effectiveWalletsFilter = getEffectiveWalletFilter.getEffectiveWalletFilter(selectedTabSettings, walletsFilter);
|
|
18
|
+
const { numberOfWallets, walletsList } = walletListBuilder.walletListBuilder({
|
|
19
|
+
groupWallets: true,
|
|
20
|
+
inputList: filteredBridgeChains || walletConnectorOptions,
|
|
21
|
+
isWalletConnectList,
|
|
22
|
+
lastUsedWalletKey,
|
|
23
|
+
multiWallet,
|
|
24
|
+
numberOfWalletsToShow: defaultNumberOfWalletsToShow,
|
|
25
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
26
|
+
searchFilter,
|
|
27
|
+
showMoreWalletsWithFilter: true,
|
|
28
|
+
userWallets,
|
|
29
|
+
walletGroups,
|
|
30
|
+
// use both filters if available, else use the viewWalletsFilter or effectiveWalletsFilter
|
|
31
|
+
walletsFilter: viewWalletsFilter && effectiveWalletsFilter
|
|
32
|
+
? utils.pipe(viewWalletsFilter).pipe(effectiveWalletsFilter)
|
|
33
|
+
: viewWalletsFilter || effectiveWalletsFilter,
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
numberOfWallets,
|
|
37
|
+
recommendedWallets: effectiveRecommendedWallets,
|
|
38
|
+
walletsList,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.buildWalletsList = buildWalletsList;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { IDynamicContext } from '../../../context/DynamicContext/types/IDynamicContext';
|
|
2
|
+
import type { useInternalUserWallets } from '../../../context/UserWalletsContext';
|
|
3
|
+
import { WalletGroups, WalletOption, WalletsFilter } from '../../../shared/types';
|
|
4
|
+
export type BuildWalletsListParams = Pick<IDynamicContext, 'bridgeChainsToConnect' | 'defaultNumberOfWalletsToShow' | 'multiWallet' | 'recommendedWallets' | 'selectedTabSettings' | 'walletsFilter'> & {
|
|
5
|
+
isWalletConnectList: boolean;
|
|
6
|
+
lastUsedWalletKey: string | undefined;
|
|
7
|
+
searchFilter: string | undefined;
|
|
8
|
+
userWallets: ReturnType<typeof useInternalUserWallets>['userWallets'];
|
|
9
|
+
viewWalletsFilter: WalletsFilter | undefined;
|
|
10
|
+
walletConnectorOptions: WalletOption[];
|
|
11
|
+
walletGroups: WalletGroups;
|
|
12
|
+
};
|
|
13
|
+
export declare const buildWalletsList: ({ bridgeChainsToConnect, defaultNumberOfWalletsToShow, isWalletConnectList, lastUsedWalletKey, multiWallet, recommendedWallets, searchFilter, selectedTabSettings, userWallets, viewWalletsFilter, walletConnectorOptions, walletGroups, walletsFilter, }: BuildWalletsListParams) => {
|
|
14
|
+
numberOfWallets: number;
|
|
15
|
+
recommendedWallets: import("../../../shared/types").RecommendedWallet[] | undefined;
|
|
16
|
+
walletsList: WalletOption[];
|
|
17
|
+
};
|