@dynamic-labs/sdk-react-core 4.9.7 → 4.9.9
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 +19 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/ModalHeader/ModalHeader.cjs +5 -3
- package/src/lib/components/ModalHeader/ModalHeader.js +5 -3
- package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.cjs +1 -1
- package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.js +1 -1
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.cjs +11 -3
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.d.ts +4 -1
- package/src/lib/components/NetworkPicker/components/NonNetworkSwitchingSupportedControl/NonNetworkSwitchingSupportedControl.js +11 -3
- package/src/lib/data/api/wallets/wallets.cjs +3 -1
- package/src/lib/data/api/wallets/wallets.js +3 -1
- package/src/lib/shared/utils/functions/isGlobalWalletPopup/index.d.ts +1 -0
- package/src/lib/shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.cjs +8 -0
- package/src/lib/shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.d.ts +6 -0
- package/src/lib/shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.js +4 -0
- package/src/lib/store/state/dynamicContextProps/dynamicContextProps.cjs +2 -2
- package/src/lib/store/state/dynamicContextProps/dynamicContextProps.js +3 -3
- package/src/lib/utils/functions/generateMessages/index.cjs +3 -0
- package/src/lib/utils/functions/generateMessages/index.js +3 -0
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +8 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +8 -2
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +4 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +4 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +1 -5
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +1 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.9.9](https://github.com/dynamic-labs/dynamic-auth/compare/v4.9.8...v4.9.9) (2025-03-26)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **global-wallet-client:** properly clean up the popup state when popup is closed ([#8379](https://github.com/dynamic-labs/dynamic-auth/issues/8379)) ([782963f](https://github.com/dynamic-labs/dynamic-auth/commit/782963f87fcb2658b921ff6cc6f22c63be9714fb))
|
|
8
|
+
* hanging promises when a starknet wallet is connected but locked ([#8376](https://github.com/dynamic-labs/dynamic-auth/issues/8376)) ([a753939](https://github.com/dynamic-labs/dynamic-auth/commit/a7539395d4653be49f000ae51d15347a176b5b6c))
|
|
9
|
+
* token balance list should respect sort from backend ([#8383](https://github.com/dynamic-labs/dynamic-auth/issues/8383)) ([1c3bef4](https://github.com/dynamic-labs/dynamic-auth/commit/1c3bef47dbfd319e2444368a4a503b0839b5ad4b))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* add message auth code to global wallet ([#8354](https://github.com/dynamic-labs/dynamic-auth/issues/8354)) ([c847bf8](https://github.com/dynamic-labs/dynamic-auth/commit/c847bf8d66db54534348622255997f30f4309542))
|
|
13
|
+
|
|
14
|
+
### [4.9.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.9.7...v4.9.8) (2025-03-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* unlink wallets when using 7702 account ([#8367](https://github.com/dynamic-labs/dynamic-auth/issues/8367)) ([f5acf05](https://github.com/dynamic-labs/dynamic-auth/commit/f5acf05ef31b8f411f3b0cd0e90e919e71f4ad50))
|
|
20
|
+
|
|
2
21
|
### [4.9.7](https://github.com/dynamic-labs/dynamic-auth/compare/v4.9.6...v4.9.7) (2025-03-21)
|
|
3
22
|
|
|
4
23
|
|
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.9.
|
|
3
|
+
"version": "4.9.9",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.644",
|
|
6
6
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -14,16 +14,16 @@
|
|
|
14
14
|
"yup": "0.32.11",
|
|
15
15
|
"react-international-phone": "4.2.5",
|
|
16
16
|
"bs58": "5.0.0",
|
|
17
|
-
"@dynamic-labs/assert-package-version": "4.9.
|
|
18
|
-
"@dynamic-labs/iconic": "4.9.
|
|
19
|
-
"@dynamic-labs/logger": "4.9.
|
|
20
|
-
"@dynamic-labs/multi-wallet": "4.9.
|
|
21
|
-
"@dynamic-labs/rpc-providers": "4.9.
|
|
22
|
-
"@dynamic-labs/store": "4.9.
|
|
23
|
-
"@dynamic-labs/types": "4.9.
|
|
24
|
-
"@dynamic-labs/utils": "4.9.
|
|
25
|
-
"@dynamic-labs/wallet-book": "4.9.
|
|
26
|
-
"@dynamic-labs/wallet-connector-core": "4.9.
|
|
17
|
+
"@dynamic-labs/assert-package-version": "4.9.9",
|
|
18
|
+
"@dynamic-labs/iconic": "4.9.9",
|
|
19
|
+
"@dynamic-labs/logger": "4.9.9",
|
|
20
|
+
"@dynamic-labs/multi-wallet": "4.9.9",
|
|
21
|
+
"@dynamic-labs/rpc-providers": "4.9.9",
|
|
22
|
+
"@dynamic-labs/store": "4.9.9",
|
|
23
|
+
"@dynamic-labs/types": "4.9.9",
|
|
24
|
+
"@dynamic-labs/utils": "4.9.9",
|
|
25
|
+
"@dynamic-labs/wallet-book": "4.9.9",
|
|
26
|
+
"@dynamic-labs/wallet-connector-core": "4.9.9",
|
|
27
27
|
"eventemitter3": "5.0.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
@@ -6,19 +6,21 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var classNames = require('../../utils/functions/classNames/classNames.cjs');
|
|
9
|
+
var isGlobalWalletPopup = require('../../shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.cjs');
|
|
9
10
|
|
|
10
11
|
const ModalHeader = ({ alignContent, children, leading, displayLeading = true, trailing, displayTrailing = true, style, displayBorder, description, }) => {
|
|
11
12
|
const hasLeading = displayLeading && leading && React.Children.count(leading);
|
|
12
13
|
const hasTrailing = displayTrailing && trailing && React.Children.count(trailing);
|
|
14
|
+
const trailingClassName = classNames.classNames('modal-header__content__trailing', {
|
|
15
|
+
'modal-header__content__trailing--empty': !hasTrailing,
|
|
16
|
+
});
|
|
13
17
|
return (jsxRuntime.jsxs("div", { className: classNames.classNames('modal-header', {
|
|
14
18
|
'modal-header--border': displayBorder,
|
|
15
19
|
'modal-header--empty': !hasLeading && !children && !hasTrailing,
|
|
16
20
|
}), style: style, children: [jsxRuntime.jsxs("div", { className: classNames.classNames('modal-header__content', alignContent &&
|
|
17
21
|
`modal-header__content--align-content-${alignContent}`), children: [displayLeading && (jsxRuntime.jsx("div", { className: classNames.classNames('modal-header__content__leading', {
|
|
18
22
|
'modal-header__content__leading--empty': !hasLeading,
|
|
19
|
-
}), children: leading })), children,
|
|
20
|
-
'modal-header__content__trailing--empty': !hasTrailing,
|
|
21
|
-
}), children: trailing }))] }), description] }));
|
|
23
|
+
}), children: leading })), children, isGlobalWalletPopup.isGlobalWalletPopup() && (jsxRuntime.jsx("div", { id: 'modal-header-gw-menu', className: trailingClassName })), displayTrailing && !isGlobalWalletPopup.isGlobalWalletPopup() && (jsxRuntime.jsx("div", { className: trailingClassName, children: trailing }))] }), description] }));
|
|
22
24
|
};
|
|
23
25
|
|
|
24
26
|
exports.ModalHeader = ModalHeader;
|
|
@@ -2,19 +2,21 @@
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { Children } from 'react';
|
|
4
4
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
5
|
+
import { isGlobalWalletPopup } from '../../shared/utils/functions/isGlobalWalletPopup/isGlobalWalletPopup.js';
|
|
5
6
|
|
|
6
7
|
const ModalHeader = ({ alignContent, children, leading, displayLeading = true, trailing, displayTrailing = true, style, displayBorder, description, }) => {
|
|
7
8
|
const hasLeading = displayLeading && leading && Children.count(leading);
|
|
8
9
|
const hasTrailing = displayTrailing && trailing && Children.count(trailing);
|
|
10
|
+
const trailingClassName = classNames('modal-header__content__trailing', {
|
|
11
|
+
'modal-header__content__trailing--empty': !hasTrailing,
|
|
12
|
+
});
|
|
9
13
|
return (jsxs("div", { className: classNames('modal-header', {
|
|
10
14
|
'modal-header--border': displayBorder,
|
|
11
15
|
'modal-header--empty': !hasLeading && !children && !hasTrailing,
|
|
12
16
|
}), style: style, children: [jsxs("div", { className: classNames('modal-header__content', alignContent &&
|
|
13
17
|
`modal-header__content--align-content-${alignContent}`), children: [displayLeading && (jsx("div", { className: classNames('modal-header__content__leading', {
|
|
14
18
|
'modal-header__content__leading--empty': !hasLeading,
|
|
15
|
-
}), children: leading })), children,
|
|
16
|
-
'modal-header__content__trailing--empty': !hasTrailing,
|
|
17
|
-
}), children: trailing }))] }), description] }));
|
|
19
|
+
}), children: leading })), children, isGlobalWalletPopup() && (jsx("div", { id: 'modal-header-gw-menu', className: trailingClassName })), displayTrailing && !isGlobalWalletPopup() && (jsx("div", { className: trailingClassName, children: trailing }))] }), description] }));
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export { ModalHeader };
|
|
@@ -20,7 +20,7 @@ const NetworkControl = ({ loading, walletConnector, buttonClassName, network, ac
|
|
|
20
20
|
return jsxRuntime.jsx(NetworkControlSkeleton.NetworkControlSkeleton, { className: buttonClassName });
|
|
21
21
|
}
|
|
22
22
|
if (!walletConnector.supportsNetworkSwitching()) {
|
|
23
|
-
return (jsxRuntime.jsx(NonNetworkSwitchingSupportedControl.NonNetworkSwitchingSupportedControl, { className: buttonClassName, showNetworkName: showNetworkName, walletConnector: walletConnector }));
|
|
23
|
+
return (jsxRuntime.jsx(NonNetworkSwitchingSupportedControl.NonNetworkSwitchingSupportedControl, { className: buttonClassName, showNetworkName: showNetworkName, walletConnector: walletConnector, network: network, enabledNetworks: enabledNetworks }));
|
|
24
24
|
}
|
|
25
25
|
return (jsxRuntime.jsx(NetworkSwitchControl.NetworkSwitchControl, { showNetworkName: showNetworkName, enabledNetworks: enabledNetworks, activeClassName: activeClassName, className: buttonClassName, network: network, loading: loading, isOpen: isOpen, walletConnector: walletConnector, setIsOpen: setIsOpen }));
|
|
26
26
|
};
|
|
@@ -16,7 +16,7 @@ const NetworkControl = ({ loading, walletConnector, buttonClassName, network, ac
|
|
|
16
16
|
return jsx(NetworkControlSkeleton, { className: buttonClassName });
|
|
17
17
|
}
|
|
18
18
|
if (!walletConnector.supportsNetworkSwitching()) {
|
|
19
|
-
return (jsx(NonNetworkSwitchingSupportedControl, { className: buttonClassName, showNetworkName: showNetworkName, walletConnector: walletConnector }));
|
|
19
|
+
return (jsx(NonNetworkSwitchingSupportedControl, { className: buttonClassName, showNetworkName: showNetworkName, walletConnector: walletConnector, network: network, enabledNetworks: enabledNetworks }));
|
|
20
20
|
}
|
|
21
21
|
return (jsx(NetworkSwitchControl, { showNetworkName: showNetworkName, enabledNetworks: enabledNetworks, activeClassName: activeClassName, className: buttonClassName, network: network, loading: loading, isOpen: isOpen, walletConnector: walletConnector, setIsOpen: setIsOpen }));
|
|
22
22
|
};
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
7
8
|
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
8
9
|
require('../../../Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
9
10
|
require('../../../Alert/Alert.cjs');
|
|
10
|
-
require('react');
|
|
11
11
|
require('../../../../events/dynamicEvents.cjs');
|
|
12
12
|
require('../../../../../../_virtual/_tslib.cjs');
|
|
13
13
|
require('@dynamic-labs/utils');
|
|
@@ -101,14 +101,22 @@ require('../../../IsBrowser/IsBrowser.cjs');
|
|
|
101
101
|
require('../../../Popper/Popper/Popper.cjs');
|
|
102
102
|
require('../../../Popper/PopperContext/PopperContext.cjs');
|
|
103
103
|
|
|
104
|
-
const NonNetworkSwitchingSupportedControl = ({ walletConnector, className, showNetworkName = false, }) => {
|
|
104
|
+
const NonNetworkSwitchingSupportedControl = ({ walletConnector, className, showNetworkName = false, network, enabledNetworks, }) => {
|
|
105
105
|
const { chain, isLoading } = useFetchChain.useFetchChain(walletConnector);
|
|
106
106
|
const chainName = (chain === null || chain === void 0 ? void 0 : chain.name) || '';
|
|
107
107
|
const ChainIcon = getChainIcon.getChainIcon(walletConnector.connectedChain || '');
|
|
108
|
+
const currentNetwork = React.useMemo(() => {
|
|
109
|
+
var _a;
|
|
110
|
+
let networkName;
|
|
111
|
+
if (network && enabledNetworks) {
|
|
112
|
+
networkName = (_a = enabledNetworks.find((element) => element.chainId.toString() === network.toString())) === null || _a === void 0 ? void 0 : _a.name;
|
|
113
|
+
}
|
|
114
|
+
return capitalize.capitalize(networkName !== null && networkName !== void 0 ? networkName : chainName);
|
|
115
|
+
}, [enabledNetworks, network, chainName]);
|
|
108
116
|
if (isLoading) {
|
|
109
117
|
return jsxRuntime.jsx(NetworkControlSkeleton.NetworkControlSkeleton, { className: className });
|
|
110
118
|
}
|
|
111
|
-
return (jsxRuntime.jsxs("div", { "data-testid": 'NonNetworkSwitchingSupportedControl', className: classNames.classNames('non-network-switching-supported-control', className), children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', children: (chain === null || chain === void 0 ? void 0 : chain.icon) ? (jsxRuntime.jsx("img", { src: chain.icon, alt: `${chain.name} icon` })) : (jsxRuntime.jsx(ChainIcon, {})) }), showNetworkName && (jsxRuntime.jsx(Typography.Typography, { className: classNames.classNames('non-network-switching-supported-control__network-name'), as: 'span', variant: 'body_small', children:
|
|
119
|
+
return (jsxRuntime.jsxs("div", { "data-testid": 'NonNetworkSwitchingSupportedControl', className: classNames.classNames('non-network-switching-supported-control', className), children: [jsxRuntime.jsx(Icon.Icon, { size: 'small', children: (chain === null || chain === void 0 ? void 0 : chain.icon) ? (jsxRuntime.jsx("img", { src: chain.icon, alt: `${chain.name} icon` })) : (jsxRuntime.jsx(ChainIcon, {})) }), showNetworkName && (jsxRuntime.jsx(Typography.Typography, { className: classNames.classNames('non-network-switching-supported-control__network-name'), as: 'span', variant: 'body_small', children: currentNetwork }))] }));
|
|
112
120
|
};
|
|
113
121
|
|
|
114
122
|
exports.NonNetworkSwitchingSupportedControl = NonNetworkSwitchingSupportedControl;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { GenericNetwork } from '@dynamic-labs/types';
|
|
3
4
|
type Props = {
|
|
4
5
|
className?: string;
|
|
5
6
|
showNetworkName?: boolean;
|
|
6
7
|
walletConnector: WalletConnector;
|
|
8
|
+
network?: string | number;
|
|
9
|
+
enabledNetworks?: GenericNetwork[];
|
|
7
10
|
};
|
|
8
|
-
export declare const NonNetworkSwitchingSupportedControl: ({ walletConnector, className, showNetworkName, }: Props) => JSX.Element;
|
|
11
|
+
export declare const NonNetworkSwitchingSupportedControl: ({ walletConnector, className, showNetworkName, network, enabledNetworks, }: Props) => JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useMemo } from 'react';
|
|
3
4
|
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
4
5
|
import '../../../Accordion/components/AccordionItem/AccordionItem.js';
|
|
5
6
|
import '../../../Alert/Alert.js';
|
|
6
|
-
import 'react';
|
|
7
7
|
import '../../../../events/dynamicEvents.js';
|
|
8
8
|
import '../../../../../../_virtual/_tslib.js';
|
|
9
9
|
import '@dynamic-labs/utils';
|
|
@@ -97,14 +97,22 @@ import '../../../IsBrowser/IsBrowser.js';
|
|
|
97
97
|
import '../../../Popper/Popper/Popper.js';
|
|
98
98
|
import '../../../Popper/PopperContext/PopperContext.js';
|
|
99
99
|
|
|
100
|
-
const NonNetworkSwitchingSupportedControl = ({ walletConnector, className, showNetworkName = false, }) => {
|
|
100
|
+
const NonNetworkSwitchingSupportedControl = ({ walletConnector, className, showNetworkName = false, network, enabledNetworks, }) => {
|
|
101
101
|
const { chain, isLoading } = useFetchChain(walletConnector);
|
|
102
102
|
const chainName = (chain === null || chain === void 0 ? void 0 : chain.name) || '';
|
|
103
103
|
const ChainIcon = getChainIcon(walletConnector.connectedChain || '');
|
|
104
|
+
const currentNetwork = useMemo(() => {
|
|
105
|
+
var _a;
|
|
106
|
+
let networkName;
|
|
107
|
+
if (network && enabledNetworks) {
|
|
108
|
+
networkName = (_a = enabledNetworks.find((element) => element.chainId.toString() === network.toString())) === null || _a === void 0 ? void 0 : _a.name;
|
|
109
|
+
}
|
|
110
|
+
return capitalize(networkName !== null && networkName !== void 0 ? networkName : chainName);
|
|
111
|
+
}, [enabledNetworks, network, chainName]);
|
|
104
112
|
if (isLoading) {
|
|
105
113
|
return jsx(NetworkControlSkeleton, { className: className });
|
|
106
114
|
}
|
|
107
|
-
return (jsxs("div", { "data-testid": 'NonNetworkSwitchingSupportedControl', className: classNames('non-network-switching-supported-control', className), children: [jsx(Icon, { size: 'small', children: (chain === null || chain === void 0 ? void 0 : chain.icon) ? (jsx("img", { src: chain.icon, alt: `${chain.name} icon` })) : (jsx(ChainIcon, {})) }), showNetworkName && (jsx(Typography, { className: classNames('non-network-switching-supported-control__network-name'), as: 'span', variant: 'body_small', children:
|
|
115
|
+
return (jsxs("div", { "data-testid": 'NonNetworkSwitchingSupportedControl', className: classNames('non-network-switching-supported-control', className), children: [jsx(Icon, { size: 'small', children: (chain === null || chain === void 0 ? void 0 : chain.icon) ? (jsx("img", { src: chain.icon, alt: `${chain.name} icon` })) : (jsx(ChainIcon, {})) }), showNetworkName && (jsx(Typography, { className: classNames('non-network-switching-supported-control__network-name'), as: 'span', variant: 'body_small', children: currentNetwork }))] }));
|
|
108
116
|
};
|
|
109
117
|
|
|
110
118
|
export { NonNetworkSwitchingSupportedControl };
|
|
@@ -70,11 +70,13 @@ const linkWallet = (environmentId_1, _b) => _tslib.__awaiter(void 0, [environmen
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
const unlinkWallet = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function* ({ environmentId, primaryWalletId, walletId, onSuccess, }) {
|
|
73
|
+
// 7702 wallets have a -zerodev suffix because it's a credential created on the fly
|
|
74
|
+
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
73
75
|
try {
|
|
74
76
|
const response = yield api.sdkApi().verifyUnlink({
|
|
75
77
|
environmentId,
|
|
76
78
|
verifyUnlinkRequest: {
|
|
77
|
-
primaryWalletId,
|
|
79
|
+
primaryWalletId: normalizedPrimaryWalletId,
|
|
78
80
|
walletId,
|
|
79
81
|
},
|
|
80
82
|
});
|
|
@@ -66,11 +66,13 @@ const linkWallet = (environmentId_1, _b) => __awaiter(void 0, [environmentId_1,
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
const unlinkWallet = (_c) => __awaiter(void 0, [_c], void 0, function* ({ environmentId, primaryWalletId, walletId, onSuccess, }) {
|
|
69
|
+
// 7702 wallets have a -zerodev suffix because it's a credential created on the fly
|
|
70
|
+
const normalizedPrimaryWalletId = primaryWalletId === null || primaryWalletId === void 0 ? void 0 : primaryWalletId.replace('-zerodev', '');
|
|
69
71
|
try {
|
|
70
72
|
const response = yield sdkApi().verifyUnlink({
|
|
71
73
|
environmentId,
|
|
72
74
|
verifyUnlinkRequest: {
|
|
73
|
-
primaryWalletId,
|
|
75
|
+
primaryWalletId: normalizedPrimaryWalletId,
|
|
74
76
|
walletId,
|
|
75
77
|
},
|
|
76
78
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isGlobalWalletPopup } from './isGlobalWalletPopup';
|
|
@@ -41,7 +41,6 @@ const useSyncDynamicContextProps = ({ settings, emitErrors, enableInstrumentatio
|
|
|
41
41
|
// If it changes, the user should be logged out and we will detect that in useValidateSession.
|
|
42
42
|
settings.environmentId = environmentId;
|
|
43
43
|
React.useEffect(() => {
|
|
44
|
-
var _a;
|
|
45
44
|
if (environmentId === defaultDynamicSettings.PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID) {
|
|
46
45
|
logger.logger.warn(`WARNING: DYNAMIC is using a test environment ID ${environmentId}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`);
|
|
47
46
|
}
|
|
@@ -49,7 +48,8 @@ const useSyncDynamicContextProps = ({ settings, emitErrors, enableInstrumentatio
|
|
|
49
48
|
logger.logger.setLogLevel(settings.logLevel);
|
|
50
49
|
walletConnectorCore.logger.setLogLevel(settings.logLevel);
|
|
51
50
|
}
|
|
52
|
-
|
|
51
|
+
const apiBaseUrl = utils.getEnvVarWithFallback('DYNAMIC_API_BASE_URL', settings.apiBaseUrl || '');
|
|
52
|
+
ApiEndpoint.setBaseUrl(apiBaseUrl);
|
|
53
53
|
setDynamicContextProps({
|
|
54
54
|
emitErrors,
|
|
55
55
|
enableInstrumentation,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import { MissingEnvironmentIdError } from '@dynamic-labs/utils';
|
|
3
|
+
import { MissingEnvironmentIdError, getEnvVarWithFallback } from '@dynamic-labs/utils';
|
|
4
4
|
import { logger as logger$1 } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import ApiEndpoint from '../../../config/ApiEndpoint.js';
|
|
6
6
|
import { logger } from '../../../shared/logger.js';
|
|
@@ -37,7 +37,6 @@ const useSyncDynamicContextProps = ({ settings, emitErrors, enableInstrumentatio
|
|
|
37
37
|
// If it changes, the user should be logged out and we will detect that in useValidateSession.
|
|
38
38
|
settings.environmentId = environmentId;
|
|
39
39
|
useEffect(() => {
|
|
40
|
-
var _a;
|
|
41
40
|
if (environmentId === PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID) {
|
|
42
41
|
logger.warn(`WARNING: DYNAMIC is using a test environment ID ${environmentId}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`);
|
|
43
42
|
}
|
|
@@ -45,7 +44,8 @@ const useSyncDynamicContextProps = ({ settings, emitErrors, enableInstrumentatio
|
|
|
45
44
|
logger.setLogLevel(settings.logLevel);
|
|
46
45
|
logger$1.setLogLevel(settings.logLevel);
|
|
47
46
|
}
|
|
48
|
-
|
|
47
|
+
const apiBaseUrl = getEnvVarWithFallback('DYNAMIC_API_BASE_URL', settings.apiBaseUrl || '');
|
|
48
|
+
ApiEndpoint.setBaseUrl(apiBaseUrl);
|
|
49
49
|
setDynamicContextProps({
|
|
50
50
|
emitErrors,
|
|
51
51
|
enableInstrumentation,
|
|
@@ -13,6 +13,9 @@ const getChainIdForMessage = (walletConnector) => _tslib.__awaiter(void 0, void
|
|
|
13
13
|
if (walletConnector.connectedChain === 'SOL') {
|
|
14
14
|
return undefined;
|
|
15
15
|
}
|
|
16
|
+
if (walletConnector.connectedChain === 'SUI') {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
16
19
|
const chain = yield walletConnector.getNetwork(true);
|
|
17
20
|
if (chain) {
|
|
18
21
|
return chain;
|
|
@@ -9,6 +9,9 @@ const getChainIdForMessage = (walletConnector) => __awaiter(void 0, void 0, void
|
|
|
9
9
|
if (walletConnector.connectedChain === 'SOL') {
|
|
10
10
|
return undefined;
|
|
11
11
|
}
|
|
12
|
+
if (walletConnector.connectedChain === 'SUI') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
12
15
|
const chain = yield walletConnector.getNetwork(true);
|
|
13
16
|
if (chain) {
|
|
14
17
|
return chain;
|
|
@@ -182,10 +182,16 @@ const useDynamicWaas = () => {
|
|
|
182
182
|
}), [getWalletConnector, primaryChain, enabledChainNames, refresh]);
|
|
183
183
|
const shouldAutoCreateDynamicWaasWallet = React.useMemo(() => {
|
|
184
184
|
const hasDynamicWaasWallet = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((wallet) => { var _a; return (_a = wallet.walletName) === null || _a === void 0 ? void 0 : _a.includes('dynamicwaas'); });
|
|
185
|
+
const hasExistingV1orV2Wallet = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((wallet) => {
|
|
186
|
+
var _a, _b;
|
|
187
|
+
return ((_a = wallet.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === sdkApiCore.EmbeddedWalletVersionEnum.V1 || // V1 wallet
|
|
188
|
+
((_b = wallet.walletProperties) === null || _b === void 0 ? void 0 : _b.version) === sdkApiCore.EmbeddedWalletVersionEnum.V2;
|
|
189
|
+
});
|
|
185
190
|
if (!user$1 ||
|
|
186
|
-
hasDynamicWaasWallet || // already has a dynamic waas wallet
|
|
191
|
+
hasDynamicWaasWallet || // already has a dynamic waas wallet for all enabled chains
|
|
187
192
|
!dynamicWaasIsEnabled || // dynamic waas is not enabled
|
|
188
|
-
!automaticEmbeddedWalletCreationEnabled // automatic embedded wallet creation is not enabled
|
|
193
|
+
!automaticEmbeddedWalletCreationEnabled || // automatic embedded wallet creation is not enabled
|
|
194
|
+
hasExistingV1orV2Wallet // already has a v2 or v1 wallet
|
|
189
195
|
)
|
|
190
196
|
return false;
|
|
191
197
|
const hasExternalWallet = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials.some((vc) => vc.format === sdkApiCore.JwtVerifiedCredentialFormatEnum.Blockchain &&
|
|
@@ -178,10 +178,16 @@ const useDynamicWaas = () => {
|
|
|
178
178
|
}), [getWalletConnector, primaryChain, enabledChainNames, refresh]);
|
|
179
179
|
const shouldAutoCreateDynamicWaasWallet = useMemo(() => {
|
|
180
180
|
const hasDynamicWaasWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => { var _a; return (_a = wallet.walletName) === null || _a === void 0 ? void 0 : _a.includes('dynamicwaas'); });
|
|
181
|
+
const hasExistingV1orV2Wallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((wallet) => {
|
|
182
|
+
var _a, _b;
|
|
183
|
+
return ((_a = wallet.walletProperties) === null || _a === void 0 ? void 0 : _a.version) === EmbeddedWalletVersionEnum.V1 || // V1 wallet
|
|
184
|
+
((_b = wallet.walletProperties) === null || _b === void 0 ? void 0 : _b.version) === EmbeddedWalletVersionEnum.V2;
|
|
185
|
+
});
|
|
181
186
|
if (!user ||
|
|
182
|
-
hasDynamicWaasWallet || // already has a dynamic waas wallet
|
|
187
|
+
hasDynamicWaasWallet || // already has a dynamic waas wallet for all enabled chains
|
|
183
188
|
!dynamicWaasIsEnabled || // dynamic waas is not enabled
|
|
184
|
-
!automaticEmbeddedWalletCreationEnabled // automatic embedded wallet creation is not enabled
|
|
189
|
+
!automaticEmbeddedWalletCreationEnabled || // automatic embedded wallet creation is not enabled
|
|
190
|
+
hasExistingV1orV2Wallet // already has a v2 or v1 wallet
|
|
185
191
|
)
|
|
186
192
|
return false;
|
|
187
193
|
const hasExternalWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.some((vc) => vc.format === JwtVerifiedCredentialFormatEnum.Blockchain &&
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var React = require('react');
|
|
7
7
|
|
|
8
8
|
const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, }) => React.useMemo(() => {
|
|
9
|
-
var _a, _b, _c, _d, _e;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
10
|
const networks = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks;
|
|
11
11
|
if (!networks)
|
|
12
12
|
return {};
|
|
@@ -15,6 +15,7 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
15
15
|
const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
|
|
16
16
|
const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
|
|
17
17
|
const eclipse = networks.find((configurations) => configurations.chainName === 'eclipse');
|
|
18
|
+
const sui = networks.find((configurations) => configurations.chainName === 'sui');
|
|
18
19
|
let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, Number.parseInt));
|
|
19
20
|
cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
|
|
20
21
|
let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, Number.parseInt));
|
|
@@ -31,12 +32,14 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
31
32
|
evmNetworks = evmNetworksOverrides(evmNetworks !== null && evmNetworks !== void 0 ? evmNetworks : []);
|
|
32
33
|
}
|
|
33
34
|
}
|
|
35
|
+
const suiNetworks = (_f = sui === null || sui === void 0 ? void 0 : sui.networks) === null || _f === void 0 ? void 0 : _f.map((net) => createNetwork(net));
|
|
34
36
|
const networkConfigurations = {
|
|
35
37
|
cosmos: cosmosNetworks,
|
|
36
38
|
eclipse: eclipseNetworks,
|
|
37
39
|
evm: evmNetworks,
|
|
38
40
|
solana: solanaNetworks,
|
|
39
41
|
starknet: starknetNetworks,
|
|
42
|
+
sui: suiNetworks,
|
|
40
43
|
};
|
|
41
44
|
return networkConfigurations;
|
|
42
45
|
}, [
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
|
|
4
4
|
const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNetworkOverrides, evmNetworksOverrides, solanaNetworksOverrides, }) => useMemo(() => {
|
|
5
|
-
var _a, _b, _c, _d, _e;
|
|
5
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
6
|
const networks = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.networks;
|
|
7
7
|
if (!networks)
|
|
8
8
|
return {};
|
|
@@ -11,6 +11,7 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
11
11
|
const cosmos = networks.find((configurations) => configurations.chainName === 'cosmos');
|
|
12
12
|
const starknet = networks.find((configurations) => configurations.chainName === 'starknet');
|
|
13
13
|
const eclipse = networks.find((configurations) => configurations.chainName === 'eclipse');
|
|
14
|
+
const sui = networks.find((configurations) => configurations.chainName === 'sui');
|
|
14
15
|
let cosmosNetworks = (_a = cosmos === null || cosmos === void 0 ? void 0 : cosmos.networks) === null || _a === void 0 ? void 0 : _a.map((net) => createNetwork(net, Number.parseInt));
|
|
15
16
|
cosmosNetworks = overrideNetworks(cosmosNetworkOverrides, cosmosNetworks);
|
|
16
17
|
let evmNetworks = (_b = evm === null || evm === void 0 ? void 0 : evm.networks) === null || _b === void 0 ? void 0 : _b.map((net) => createNetwork(net, Number.parseInt));
|
|
@@ -27,12 +28,14 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, cosmosNe
|
|
|
27
28
|
evmNetworks = evmNetworksOverrides(evmNetworks !== null && evmNetworks !== void 0 ? evmNetworks : []);
|
|
28
29
|
}
|
|
29
30
|
}
|
|
31
|
+
const suiNetworks = (_f = sui === null || sui === void 0 ? void 0 : sui.networks) === null || _f === void 0 ? void 0 : _f.map((net) => createNetwork(net));
|
|
30
32
|
const networkConfigurations = {
|
|
31
33
|
cosmos: cosmosNetworks,
|
|
32
34
|
eclipse: eclipseNetworks,
|
|
33
35
|
evm: evmNetworks,
|
|
34
36
|
solana: solanaNetworks,
|
|
35
37
|
starknet: starknetNetworks,
|
|
38
|
+
sui: suiNetworks,
|
|
36
39
|
};
|
|
37
40
|
return networkConfigurations;
|
|
38
41
|
}, [
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs
CHANGED
|
@@ -118,11 +118,7 @@ const ActiveWalletBalance = () => {
|
|
|
118
118
|
includeNativeBalance: true,
|
|
119
119
|
});
|
|
120
120
|
const primaryConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
121
|
-
const filteredTokenBalances = React.useMemo(() =>
|
|
122
|
-
const balances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [];
|
|
123
|
-
balances.sort((a, b) => ((b === null || b === void 0 ? void 0 : b.marketValue) || 0) - ((a === null || a === void 0 ? void 0 : a.marketValue) || 0));
|
|
124
|
-
return balances;
|
|
125
|
-
}, [tokenBalances]);
|
|
121
|
+
const filteredTokenBalances = React.useMemo(() => (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [], [tokenBalances]);
|
|
126
122
|
const totalValue = React.useMemo(() => filteredTokenBalances.reduce((acc, token) => acc + ((token === null || token === void 0 ? void 0 : token.marketValue) || 0), 0), [filteredTokenBalances]);
|
|
127
123
|
const enableMultiAsset = (authMode === 'connect-and-sign' ||
|
|
128
124
|
(authMode === 'connect-only' &&
|
|
@@ -114,11 +114,7 @@ const ActiveWalletBalance = () => {
|
|
|
114
114
|
includeNativeBalance: true,
|
|
115
115
|
});
|
|
116
116
|
const primaryConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
117
|
-
const filteredTokenBalances = useMemo(() =>
|
|
118
|
-
const balances = (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [];
|
|
119
|
-
balances.sort((a, b) => ((b === null || b === void 0 ? void 0 : b.marketValue) || 0) - ((a === null || a === void 0 ? void 0 : a.marketValue) || 0));
|
|
120
|
-
return balances;
|
|
121
|
-
}, [tokenBalances]);
|
|
117
|
+
const filteredTokenBalances = useMemo(() => (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [], [tokenBalances]);
|
|
122
118
|
const totalValue = useMemo(() => filteredTokenBalances.reduce((acc, token) => acc + ((token === null || token === void 0 ? void 0 : token.marketValue) || 0), 0), [filteredTokenBalances]);
|
|
123
119
|
const enableMultiAsset = (authMode === 'connect-and-sign' ||
|
|
124
120
|
(authMode === 'connect-only' &&
|