@dynamic-labs/sdk-react-core 4.0.0-alpha.41 → 4.0.0-alpha.43
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 +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/index.cjs +1 -1
- package/src/index.js +1 -1
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.cjs +6 -2
- package/src/lib/components/WalletConnectorEvents/WalletConnectorEvents.js +6 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs +2 -2
- package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js +3 -3
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.cjs +5 -4
- package/src/lib/shared/utils/hooks/useGlobalLoading/useGlobalLoading.js +4 -3
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs +6 -6
- package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js +4 -4
- package/src/lib/views/WalletList/data.cjs +1 -0
- package/src/lib/views/WalletList/data.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.0.0-alpha.43](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.42...v4.0.0-alpha.43) (2024-12-09)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add support for OneKey BTC ([#7557](https://github.com/dynamic-labs/dynamic-auth/issues/7557)) ([00f1363](https://github.com/dynamic-labs/dynamic-auth/commit/00f136330bd89ecbd510750641497974b494b149))
|
|
8
|
+
|
|
9
|
+
## [4.0.0-alpha.42](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.41...v4.0.0-alpha.42) (2024-12-06)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
* walletbook loading issues ([#7553](https://github.com/dynamic-labs/dynamic-auth/issues/7553)) ([684ecc3](https://github.com/dynamic-labs/dynamic-auth/commit/684ecc32960e34680088d6cf200318336647ab77))
|
|
15
|
+
|
|
2
16
|
## [4.0.0-alpha.41](https://github.com/dynamic-labs/dynamic-auth/compare/v4.0.0-alpha.40...v4.0.0-alpha.41) (2024-12-05)
|
|
3
17
|
|
|
4
18
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.43",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.570",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"react-i18next": "13.5.0",
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
|
-
"@dynamic-labs/assert-package-version": "4.0.0-alpha.
|
|
17
|
-
"@dynamic-labs/iconic": "4.0.0-alpha.
|
|
18
|
-
"@dynamic-labs/logger": "4.0.0-alpha.
|
|
19
|
-
"@dynamic-labs/multi-wallet": "4.0.0-alpha.
|
|
20
|
-
"@dynamic-labs/rpc-providers": "4.0.0-alpha.
|
|
21
|
-
"@dynamic-labs/store": "4.0.0-alpha.
|
|
22
|
-
"@dynamic-labs/types": "4.0.0-alpha.
|
|
23
|
-
"@dynamic-labs/utils": "4.0.0-alpha.
|
|
24
|
-
"@dynamic-labs/wallet-book": "4.0.0-alpha.
|
|
25
|
-
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.
|
|
16
|
+
"@dynamic-labs/assert-package-version": "4.0.0-alpha.43",
|
|
17
|
+
"@dynamic-labs/iconic": "4.0.0-alpha.43",
|
|
18
|
+
"@dynamic-labs/logger": "4.0.0-alpha.43",
|
|
19
|
+
"@dynamic-labs/multi-wallet": "4.0.0-alpha.43",
|
|
20
|
+
"@dynamic-labs/rpc-providers": "4.0.0-alpha.43",
|
|
21
|
+
"@dynamic-labs/store": "4.0.0-alpha.43",
|
|
22
|
+
"@dynamic-labs/types": "4.0.0-alpha.43",
|
|
23
|
+
"@dynamic-labs/utils": "4.0.0-alpha.43",
|
|
24
|
+
"@dynamic-labs/wallet-book": "4.0.0-alpha.43",
|
|
25
|
+
"@dynamic-labs/wallet-connector-core": "4.0.0-alpha.43",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
package/src/index.cjs
CHANGED
|
@@ -35,6 +35,7 @@ require('@dynamic-labs/utils');
|
|
|
35
35
|
require('./lib/utils/constants/colors.cjs');
|
|
36
36
|
require('./lib/utils/constants/values.cjs');
|
|
37
37
|
require('@dynamic-labs/wallet-connector-core');
|
|
38
|
+
require('@dynamic-labs/wallet-book');
|
|
38
39
|
require('./lib/store/state/loadingAndLifecycle.cjs');
|
|
39
40
|
var useLocalStorage = require('./lib/shared/utils/hooks/useLocalStorage/useLocalStorage.cjs');
|
|
40
41
|
var index$1 = require('./lib/shared/utils/hooks/useOnClickOutside/index.cjs');
|
|
@@ -103,7 +104,6 @@ require('./lib/components/Transition/SlideInUpTransition/SlideInUpTransition.cjs
|
|
|
103
104
|
require('./lib/components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
104
105
|
require('./lib/components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
105
106
|
require('./lib/context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
106
|
-
require('@dynamic-labs/wallet-book');
|
|
107
107
|
require('./lib/context/WalletGroupContext/WalletGroupContext.cjs');
|
|
108
108
|
require('./lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
109
109
|
require('react-focus-lock');
|
package/src/index.js
CHANGED
|
@@ -31,6 +31,7 @@ import '@dynamic-labs/utils';
|
|
|
31
31
|
import './lib/utils/constants/colors.js';
|
|
32
32
|
import './lib/utils/constants/values.js';
|
|
33
33
|
import '@dynamic-labs/wallet-connector-core';
|
|
34
|
+
import '@dynamic-labs/wallet-book';
|
|
34
35
|
import './lib/store/state/loadingAndLifecycle.js';
|
|
35
36
|
export { useLocalStorage } from './lib/shared/utils/hooks/useLocalStorage/useLocalStorage.js';
|
|
36
37
|
export { useOnClickOutside } from './lib/shared/utils/hooks/useOnClickOutside/index.js';
|
|
@@ -99,7 +100,6 @@ import './lib/components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
|
99
100
|
import './lib/components/Transition/OpacityTransition/OpacityTransition.js';
|
|
100
101
|
import './lib/components/OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
101
102
|
import './lib/context/SocialRedirectContext/SocialRedirectContext.js';
|
|
102
|
-
import '@dynamic-labs/wallet-book';
|
|
103
103
|
import './lib/context/WalletGroupContext/WalletGroupContext.js';
|
|
104
104
|
import './lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
105
105
|
import 'react-focus-lock';
|
|
@@ -7,6 +7,7 @@ var React = require('react');
|
|
|
7
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
8
|
var multiWallet = require('@dynamic-labs/multi-wallet');
|
|
9
9
|
var rpcProviders = require('@dynamic-labs/rpc-providers');
|
|
10
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
10
11
|
var useWalletItemActions = require('../../utils/hooks/useWalletItemActions/useWalletItemActions.cjs');
|
|
11
12
|
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
12
13
|
require('@dynamic-labs/sdk-api-core');
|
|
@@ -66,7 +67,6 @@ require('../Popper/Popper/Popper.cjs');
|
|
|
66
67
|
require('../Popper/PopperContext/PopperContext.cjs');
|
|
67
68
|
require('react-focus-lock');
|
|
68
69
|
require('qrcode');
|
|
69
|
-
require('@dynamic-labs/wallet-book');
|
|
70
70
|
require('formik');
|
|
71
71
|
require('../../context/FooterAnimationContext/index.cjs');
|
|
72
72
|
require('../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
@@ -92,7 +92,8 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
92
92
|
const walletConnectorConstructorOptions = React.useMemo(() => {
|
|
93
93
|
var _a, _b;
|
|
94
94
|
if (!connectorProps.projectSettings ||
|
|
95
|
-
!connectorProps.networkConfigurations
|
|
95
|
+
!connectorProps.networkConfigurations ||
|
|
96
|
+
!walletBook.isWalletBookPopulated(connectorProps.walletBook)) {
|
|
96
97
|
return;
|
|
97
98
|
}
|
|
98
99
|
return multiWallet.getWalletConnectorConstructorOptions(Object.assign(Object.assign({}, connectorProps), { chainRpcProviders: rpcProviders.ChainRpcProviders, settings: connectorProps.projectSettings, walletConnectProjectId: (_b = (_a = connectorProps.projectSettings) === null || _a === void 0 ? void 0 : _a.sdk.walletConnect) === null || _b === void 0 ? void 0 : _b.projectId }));
|
|
@@ -138,6 +139,9 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
138
139
|
}
|
|
139
140
|
walletConnectorOptions.setWalletConnectorOptions(updatedConnectors);
|
|
140
141
|
};
|
|
142
|
+
if (!walletBook.isWalletBookPopulated(connectorProps.walletBook)) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
141
145
|
walletConnectorCore.walletConnectorEvents.on('providerReady', handleProviderReady);
|
|
142
146
|
return () => {
|
|
143
147
|
walletConnectorCore.walletConnectorEvents.off('providerReady', handleProviderReady);
|
|
@@ -3,6 +3,7 @@ import { useMemo, useEffect } from 'react';
|
|
|
3
3
|
import { walletConnectorEvents } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import { getWalletConnectorConstructorOptions } from '@dynamic-labs/multi-wallet';
|
|
5
5
|
import { ChainRpcProviders } from '@dynamic-labs/rpc-providers';
|
|
6
|
+
import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
|
|
6
7
|
import { useWalletItemActions } from '../../utils/hooks/useWalletItemActions/useWalletItemActions.js';
|
|
7
8
|
import '../../context/DynamicContext/DynamicContext.js';
|
|
8
9
|
import '@dynamic-labs/sdk-api-core';
|
|
@@ -62,7 +63,6 @@ import '../Popper/Popper/Popper.js';
|
|
|
62
63
|
import '../Popper/PopperContext/PopperContext.js';
|
|
63
64
|
import 'react-focus-lock';
|
|
64
65
|
import 'qrcode';
|
|
65
|
-
import '@dynamic-labs/wallet-book';
|
|
66
66
|
import 'formik';
|
|
67
67
|
import '../../context/FooterAnimationContext/index.js';
|
|
68
68
|
import '../../context/WalletGroupContext/WalletGroupContext.js';
|
|
@@ -88,7 +88,8 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
88
88
|
const walletConnectorConstructorOptions = useMemo(() => {
|
|
89
89
|
var _a, _b;
|
|
90
90
|
if (!connectorProps.projectSettings ||
|
|
91
|
-
!connectorProps.networkConfigurations
|
|
91
|
+
!connectorProps.networkConfigurations ||
|
|
92
|
+
!isWalletBookPopulated(connectorProps.walletBook)) {
|
|
92
93
|
return;
|
|
93
94
|
}
|
|
94
95
|
return getWalletConnectorConstructorOptions(Object.assign(Object.assign({}, connectorProps), { chainRpcProviders: ChainRpcProviders, settings: connectorProps.projectSettings, walletConnectProjectId: (_b = (_a = connectorProps.projectSettings) === null || _a === void 0 ? void 0 : _a.sdk.walletConnect) === null || _b === void 0 ? void 0 : _b.projectId }));
|
|
@@ -134,6 +135,9 @@ const WalletConnectorEvents = ({ connectorProps, }) => {
|
|
|
134
135
|
}
|
|
135
136
|
setWalletConnectorOptions(updatedConnectors);
|
|
136
137
|
};
|
|
138
|
+
if (!isWalletBookPopulated(connectorProps.walletBook)) {
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
137
141
|
walletConnectorEvents.on('providerReady', handleProviderReady);
|
|
138
142
|
return () => {
|
|
139
143
|
walletConnectorEvents.off('providerReady', handleProviderReady);
|
package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.cjs
CHANGED
|
@@ -95,7 +95,7 @@ require('../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
95
95
|
var useInternalDynamicContext = require('../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
96
96
|
|
|
97
97
|
const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
|
|
98
|
-
var _a
|
|
98
|
+
var _a;
|
|
99
99
|
const { walletConnectorOptions } = useInternalDynamicContext.useInternalDynamicContext();
|
|
100
100
|
const { walletBook: walletBook$1 } = walletBook.useWalletBookContext();
|
|
101
101
|
const [selectedUrl, setSelectedUrl] = React.useState('');
|
|
@@ -126,7 +126,7 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
|
|
|
126
126
|
url: links.android,
|
|
127
127
|
},
|
|
128
128
|
];
|
|
129
|
-
if (!
|
|
129
|
+
if (!walletBook.isWalletBookPopulated(walletBook$1)) {
|
|
130
130
|
return jsxRuntime.jsx(Skeleton.Skeleton, { className: 'walletlist-footer-content__container' });
|
|
131
131
|
}
|
|
132
132
|
return (jsxRuntime.jsx("div", { className: 'walletlist-help-content__container', children: jsxRuntime.jsxs(EnterTileAnimation.EnterTileAnimation, { delay: '300ms', children: [jsxRuntime.jsx("div", { className: 'walletlist-help-content__icon', children: jsxRuntime.jsx(walletBook.WalletIcon, { icon: metadata === null || metadata === void 0 ? void 0 : metadata.icon, walletKey: walletKey, style: { height: pixelToRem.pixelToRem(56), width: pixelToRem.pixelToRem(56) } }) }), jsxRuntime.jsxs("div", { className: 'walletlist-help-content__typography-wrapper', children: [jsxRuntime.jsxs(Typography.Typography, { as: 'p', variant: 'title', weight: 'medium', children: ["We recommend installing ", metadata === null || metadata === void 0 ? void 0 : metadata.name] }), jsxRuntime.jsx(Typography.Typography, { as: 'label', variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'walletlist-help-content__typography--label', children: "Select your preferred option below:" })] }), jsxRuntime.jsx("div", { className: 'walletlist-help-content__buttons-wrapper', children: walletLinksElements.map((element, i) => element.isEnabled ? (jsxRuntime.jsx("button", { onClick: () => setSelectedUrl(element.url), children: jsxRuntime.jsx(Item.Item, { StartIcon: element.icon, heading: element.content, url: element.url }) }, i)) : undefined) }), isCustodialServiceWallet && (jsxRuntime.jsxs("div", { className: 'walletlist-help-content__custodial-wallet-area', children: [jsxRuntime.jsx(Typography.Typography, { className: 'walletlist-help-content__custodial-wallet-area--title', as: 'p', color: 'secondary', variant: 'body_normal', weight: 'regular', children: "If you don't want to install a wallet, then use:" }), jsxRuntime.jsx(NewToWeb3WalletItem.NewToWeb3WalletItem, { wallet: newToWeb3Wallet })] })), jsxRuntime.jsx(WalletExtensionOrAppContinueButton.WalletExtensionOrAppContinueButton, { selectedUrl: selectedUrl, wallet: newToWeb3Wallet })] }) }));
|
package/src/lib/layout/DynamicAuthLayout/HelpContent/WalletListHelpContent/WalletListHelpContent.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { AppleIcon, AndroidIcon } from '@dynamic-labs/iconic';
|
|
5
|
-
import { useWalletBookContext, WalletIcon } from '@dynamic-labs/wallet-book';
|
|
5
|
+
import { useWalletBookContext, isWalletBookPopulated, WalletIcon } from '@dynamic-labs/wallet-book';
|
|
6
6
|
import { isMobile } from '@dynamic-labs/utils';
|
|
7
7
|
import { getWalletLinks } from '@dynamic-labs/wallet-connector-core';
|
|
8
8
|
import '../../../../context/DynamicContext/DynamicContext.js';
|
|
@@ -91,7 +91,7 @@ import '../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
91
91
|
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
92
92
|
|
|
93
93
|
const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
|
|
94
|
-
var _a
|
|
94
|
+
var _a;
|
|
95
95
|
const { walletConnectorOptions } = useInternalDynamicContext();
|
|
96
96
|
const { walletBook } = useWalletBookContext();
|
|
97
97
|
const [selectedUrl, setSelectedUrl] = useState('');
|
|
@@ -122,7 +122,7 @@ const WalletListHelpContent = ({ chains, newToWeb3WalletChainMap, }) => {
|
|
|
122
122
|
url: links.android,
|
|
123
123
|
},
|
|
124
124
|
];
|
|
125
|
-
if (!
|
|
125
|
+
if (!isWalletBookPopulated(walletBook)) {
|
|
126
126
|
return jsx(Skeleton, { className: 'walletlist-footer-content__container' });
|
|
127
127
|
}
|
|
128
128
|
return (jsx("div", { className: 'walletlist-help-content__container', children: jsxs(EnterTileAnimation, { delay: '300ms', children: [jsx("div", { className: 'walletlist-help-content__icon', children: jsx(WalletIcon, { icon: metadata === null || metadata === void 0 ? void 0 : metadata.icon, walletKey: walletKey, style: { height: pixelToRem(56), width: pixelToRem(56) } }) }), jsxs("div", { className: 'walletlist-help-content__typography-wrapper', children: [jsxs(Typography, { as: 'p', variant: 'title', weight: 'medium', children: ["We recommend installing ", metadata === null || metadata === void 0 ? void 0 : metadata.name] }), jsx(Typography, { as: 'label', variant: 'body_normal', weight: 'regular', color: 'secondary', className: 'walletlist-help-content__typography--label', children: "Select your preferred option below:" })] }), jsx("div", { className: 'walletlist-help-content__buttons-wrapper', children: walletLinksElements.map((element, i) => element.isEnabled ? (jsx("button", { onClick: () => setSelectedUrl(element.url), children: jsx(Item, { StartIcon: element.icon, heading: element.content, url: element.url }) }, i)) : undefined) }), isCustodialServiceWallet && (jsxs("div", { className: 'walletlist-help-content__custodial-wallet-area', children: [jsx(Typography, { className: 'walletlist-help-content__custodial-wallet-area--title', as: 'p', color: 'secondary', variant: 'body_normal', weight: 'regular', children: "If you don't want to install a wallet, then use:" }), jsx(NewToWeb3WalletItem, { wallet: newToWeb3Wallet })] })), jsx(WalletExtensionOrAppContinueButton, { selectedUrl: selectedUrl, wallet: newToWeb3Wallet })] }) }));
|
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var React = require('react');
|
|
7
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
7
8
|
var loadingAndLifecycle = require('../../../../store/state/loadingAndLifecycle.cjs');
|
|
8
9
|
var logger = require('../../../logger.cjs');
|
|
9
10
|
var index = require('../../functions/lastAuthenticatedAccount/index.cjs');
|
|
10
11
|
|
|
11
|
-
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWalletId, primaryWallet, user, isLoadingUserFromCookie, walletBook, enableInstrumentation, appName, environmentId, }) => {
|
|
12
|
-
var _a
|
|
12
|
+
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWalletId, primaryWallet, user, isLoadingUserFromCookie, walletBook: walletBook$1, enableInstrumentation, appName, environmentId, }) => {
|
|
13
|
+
var _a;
|
|
13
14
|
// Once we declare the SDK as loaded, we do not ever want to flip back to false
|
|
14
15
|
const hasLoaded = React.useRef(false);
|
|
15
16
|
const loadingStart = React.useRef(new Date().getTime());
|
|
@@ -41,11 +42,11 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
|
|
|
41
42
|
};
|
|
42
43
|
if (hasLoaded.current)
|
|
43
44
|
return true;
|
|
44
|
-
const isWalletBookLoading = !
|
|
45
|
+
const isWalletBookLoading = !walletBook.isWalletBookPopulated(walletBook$1);
|
|
45
46
|
const isProjectSettingsLoading = !projectSettings;
|
|
46
47
|
const isUserLoading = isLoadingUserFromCookie;
|
|
47
48
|
const shouldHavePrimaryWallet = primaryWalletId ||
|
|
48
|
-
(user && ((
|
|
49
|
+
(user && ((_a = index.lastAuthenticatedAccount(user)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain');
|
|
49
50
|
const isPrimaryWalletLoading = Boolean(shouldHavePrimaryWallet && !primaryWallet);
|
|
50
51
|
const isConnectOnlyWalletsLoading = authMode === 'connect-only' &&
|
|
51
52
|
connectedInfo &&
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useRef } from 'react';
|
|
3
|
+
import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
|
|
3
4
|
import { useLoadingAndLifecycle } from '../../../../store/state/loadingAndLifecycle.js';
|
|
4
5
|
import { logger } from '../../../logger.js';
|
|
5
6
|
import { lastAuthenticatedAccount } from '../../functions/lastAuthenticatedAccount/index.js';
|
|
6
7
|
|
|
7
8
|
const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSettings, primaryWalletId, primaryWallet, user, isLoadingUserFromCookie, walletBook, enableInstrumentation, appName, environmentId, }) => {
|
|
8
|
-
var _a
|
|
9
|
+
var _a;
|
|
9
10
|
// Once we declare the SDK as loaded, we do not ever want to flip back to false
|
|
10
11
|
const hasLoaded = useRef(false);
|
|
11
12
|
const loadingStart = useRef(new Date().getTime());
|
|
@@ -37,11 +38,11 @@ const useGlobalLoading = ({ authMode, connectedInfo, connectedWallets, projectSe
|
|
|
37
38
|
};
|
|
38
39
|
if (hasLoaded.current)
|
|
39
40
|
return true;
|
|
40
|
-
const isWalletBookLoading = !
|
|
41
|
+
const isWalletBookLoading = !isWalletBookPopulated(walletBook);
|
|
41
42
|
const isProjectSettingsLoading = !projectSettings;
|
|
42
43
|
const isUserLoading = isLoadingUserFromCookie;
|
|
43
44
|
const shouldHavePrimaryWallet = primaryWalletId ||
|
|
44
|
-
(user && ((
|
|
45
|
+
(user && ((_a = lastAuthenticatedAccount(user)) === null || _a === void 0 ? void 0 : _a.format) === 'blockchain');
|
|
45
46
|
const isPrimaryWalletLoading = Boolean(shouldHavePrimaryWallet && !primaryWallet);
|
|
46
47
|
const isConnectOnlyWalletsLoading = authMode === 'connect-only' &&
|
|
47
48
|
connectedInfo &&
|
package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.cjs
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var walletBook = require('@dynamic-labs/wallet-book');
|
|
8
9
|
var data = require('../../../views/WalletList/data.cjs');
|
|
9
10
|
require('@dynamic-labs/sdk-api-core');
|
|
10
11
|
require('../../constants/values.cjs');
|
|
@@ -17,7 +18,6 @@ require('@dynamic-labs/iconic');
|
|
|
17
18
|
require('@dynamic-labs/wallet-connector-core');
|
|
18
19
|
require('react/jsx-runtime');
|
|
19
20
|
require('../../../context/ViewContext/ViewContext.cjs');
|
|
20
|
-
require('@dynamic-labs/wallet-book');
|
|
21
21
|
require('../../../store/state/loadingAndLifecycle.cjs');
|
|
22
22
|
require('../../../shared/consts/index.cjs');
|
|
23
23
|
require('../../../config/ApiEndpoint.cjs');
|
|
@@ -29,14 +29,14 @@ var walletConnectorOptions = require('../../../store/state/walletConnectorOption
|
|
|
29
29
|
var verifyRequiredConnectorsAreSetup = require('./utils/verifyRequiredConnectorsAreSetup/verifyRequiredConnectorsAreSetup.cjs');
|
|
30
30
|
|
|
31
31
|
const useCreateWalletConnectorOptions = (_a) => {
|
|
32
|
-
var { projectSettings, networkConfigurations, walletBook, walletConnectorsProp, walletConnectorExtensions } = _a, props = _tslib.__rest(_a, ["projectSettings", "networkConfigurations", "walletBook", "walletConnectorsProp", "walletConnectorExtensions"]);
|
|
32
|
+
var { projectSettings, networkConfigurations, walletBook: walletBook$1, walletConnectorsProp, walletConnectorExtensions } = _a, props = _tslib.__rest(_a, ["projectSettings", "networkConfigurations", "walletBook", "walletConnectorsProp", "walletConnectorExtensions"]);
|
|
33
33
|
const walletConnectorsKey = React.useMemo(() => { var _a; return (_a = serializeWalletConnectors.serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
|
|
34
|
-
const
|
|
34
|
+
const isWalletBookLoaded = React.useMemo(() => walletBook.isWalletBookPopulated(walletBook$1), [walletBook$1]);
|
|
35
35
|
const walletConnectorOptions$1 = React.useMemo(() => {
|
|
36
|
-
if (!projectSettings || !
|
|
36
|
+
if (!projectSettings || !isWalletBookLoaded || !networkConfigurations)
|
|
37
37
|
return [];
|
|
38
38
|
return data.getWallets({
|
|
39
|
-
getSupportedWalletOpts: Object.assign({ networkConfigurations, settings: projectSettings, skipMemo: true, walletBook, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
|
|
39
|
+
getSupportedWalletOpts: Object.assign({ networkConfigurations, settings: projectSettings, skipMemo: true, walletBook: walletBook$1, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
|
|
40
40
|
walletConnectorExtensions,
|
|
41
41
|
});
|
|
42
42
|
// Cannot include walletUiUtils in the dependency array because it will cause an infinite loop
|
|
@@ -44,7 +44,7 @@ const useCreateWalletConnectorOptions = (_a) => {
|
|
|
44
44
|
}, [
|
|
45
45
|
projectSettings,
|
|
46
46
|
walletConnectorsKey,
|
|
47
|
-
|
|
47
|
+
isWalletBookLoaded,
|
|
48
48
|
networkConfigurations,
|
|
49
49
|
]);
|
|
50
50
|
React.useEffect(() => {
|
package/src/lib/utils/hooks/useCreateWalletConnectorOptions/useCreateWalletConnectorOptions.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __rest } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { useMemo, useEffect } from 'react';
|
|
4
|
+
import { isWalletBookPopulated } from '@dynamic-labs/wallet-book';
|
|
4
5
|
import { getWallets } from '../../../views/WalletList/data.js';
|
|
5
6
|
import '@dynamic-labs/sdk-api-core';
|
|
6
7
|
import '../../constants/values.js';
|
|
@@ -13,7 +14,6 @@ import '@dynamic-labs/iconic';
|
|
|
13
14
|
import '@dynamic-labs/wallet-connector-core';
|
|
14
15
|
import 'react/jsx-runtime';
|
|
15
16
|
import '../../../context/ViewContext/ViewContext.js';
|
|
16
|
-
import '@dynamic-labs/wallet-book';
|
|
17
17
|
import '../../../store/state/loadingAndLifecycle.js';
|
|
18
18
|
import '../../../shared/consts/index.js';
|
|
19
19
|
import '../../../config/ApiEndpoint.js';
|
|
@@ -27,9 +27,9 @@ import { verifyRequiredConnectorsAreSetup } from './utils/verifyRequiredConnecto
|
|
|
27
27
|
const useCreateWalletConnectorOptions = (_a) => {
|
|
28
28
|
var { projectSettings, networkConfigurations, walletBook, walletConnectorsProp, walletConnectorExtensions } = _a, props = __rest(_a, ["projectSettings", "networkConfigurations", "walletBook", "walletConnectorsProp", "walletConnectorExtensions"]);
|
|
29
29
|
const walletConnectorsKey = useMemo(() => { var _a; return (_a = serializeWalletConnectors(walletConnectorsProp)) === null || _a === void 0 ? void 0 : _a.join(','); }, [walletConnectorsProp]);
|
|
30
|
-
const
|
|
30
|
+
const isWalletBookLoaded = useMemo(() => isWalletBookPopulated(walletBook), [walletBook]);
|
|
31
31
|
const walletConnectorOptions = useMemo(() => {
|
|
32
|
-
if (!projectSettings || !
|
|
32
|
+
if (!projectSettings || !isWalletBookLoaded || !networkConfigurations)
|
|
33
33
|
return [];
|
|
34
34
|
return getWallets({
|
|
35
35
|
getSupportedWalletOpts: Object.assign({ networkConfigurations, settings: projectSettings, skipMemo: true, walletBook, walletConnectorsProp: walletConnectorsProp !== null && walletConnectorsProp !== void 0 ? walletConnectorsProp : [] }, props),
|
|
@@ -40,7 +40,7 @@ const useCreateWalletConnectorOptions = (_a) => {
|
|
|
40
40
|
}, [
|
|
41
41
|
projectSettings,
|
|
42
42
|
walletConnectorsKey,
|
|
43
|
-
|
|
43
|
+
isWalletBookLoaded,
|
|
44
44
|
networkConfigurations,
|
|
45
45
|
]);
|
|
46
46
|
useEffect(() => {
|
|
@@ -16,6 +16,7 @@ var createWallet = require('../../shared/utils/functions/wallet/createWallet.cjs
|
|
|
16
16
|
require('@dynamic-labs/utils');
|
|
17
17
|
require('../../utils/constants/colors.cjs');
|
|
18
18
|
require('../../utils/constants/values.cjs');
|
|
19
|
+
require('@dynamic-labs/wallet-book');
|
|
19
20
|
require('../../store/state/loadingAndLifecycle.cjs');
|
|
20
21
|
require('../../shared/consts/index.cjs');
|
|
21
22
|
|
|
@@ -12,6 +12,7 @@ import { createWallet } from '../../shared/utils/functions/wallet/createWallet.j
|
|
|
12
12
|
import '@dynamic-labs/utils';
|
|
13
13
|
import '../../utils/constants/colors.js';
|
|
14
14
|
import '../../utils/constants/values.js';
|
|
15
|
+
import '@dynamic-labs/wallet-book';
|
|
15
16
|
import '../../store/state/loadingAndLifecycle.js';
|
|
16
17
|
import '../../shared/consts/index.js';
|
|
17
18
|
|