@dynamic-labs/sdk-react-core 1.1.0-alpha.15 → 1.1.0-alpha.17
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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +11 -11
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.cjs +9 -1
- package/src/lib/components/AuthProviderIcon/AuthProviderIcon.js +9 -1
- package/src/lib/data/api.cjs +3 -0
- package/src/lib/data/api.js +3 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +10 -5
- package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +10 -5
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +4 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +4 -2
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.cjs +34 -0
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.js +30 -0
- package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/index.d.ts +1 -0
package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js
CHANGED
|
@@ -79,6 +79,7 @@ import { ActiveWalletAddreess } from './ActiveWalletAddress/ActiveWalletAddress.
|
|
|
79
79
|
|
|
80
80
|
const ICON_SIZE = 28;
|
|
81
81
|
const ActiveWalletInformation = () => {
|
|
82
|
+
var _a, _b;
|
|
82
83
|
const { t } = useTranslation();
|
|
83
84
|
const [isNetworkPickerOpen, setIsNetworkPickerOpen] = useState(false);
|
|
84
85
|
const { primaryWallet, authToken, network, projectSettings, handleLogOut, user, } = useInternalDynamicContext();
|
|
@@ -92,6 +93,7 @@ const ActiveWalletInformation = () => {
|
|
|
92
93
|
? createOwnerWallet(primaryWallet, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || [])
|
|
93
94
|
: primaryWallet;
|
|
94
95
|
const isBitcoin = primaryWallet && isBitcoinConnector(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
96
|
+
const isEmbeddedWallet = Boolean(wallet && ((_b = (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.key) === null || _b === void 0 ? void 0 : _b.startsWith('turnkey')));
|
|
95
97
|
const options = [
|
|
96
98
|
{
|
|
97
99
|
Icon: null,
|
|
@@ -121,7 +123,7 @@ const ActiveWalletInformation = () => {
|
|
|
121
123
|
{
|
|
122
124
|
Icon: null,
|
|
123
125
|
callback: handleLogOut,
|
|
124
|
-
hide:
|
|
126
|
+
hide: isEmbeddedWallet,
|
|
125
127
|
text: 'Disconnect',
|
|
126
128
|
},
|
|
127
129
|
];
|
|
@@ -129,7 +131,7 @@ const ActiveWalletInformation = () => {
|
|
|
129
131
|
(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector).evmNetworks) ||
|
|
130
132
|
[];
|
|
131
133
|
const showTestnetAlert = testnet && !isTurnkeyWalletWithoutAuthenticator;
|
|
132
|
-
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [jsx("div", { className: 'active-wallet-information__avatar', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus:
|
|
134
|
+
return (jsxs("div", { className: 'active-wallet-information-container', "data-testid": 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information', children: [jsxs("div", { className: 'active-wallet-information__header', children: [jsx("div", { className: 'active-wallet-information__avatar', children: (nameService === null || nameService === void 0 ? void 0 : nameService.avatar) ? (jsx("div", { className: 'active-wallet-information__avatar', children: jsx("img", { src: nameService === null || nameService === void 0 ? void 0 : nameService.avatar, alt: '' }) })) : (jsx("div", { className: 'active-wallet-information__wallet-img', children: jsx(AuthProviderIcon, { jwt: authToken, iconSize: ICON_SIZE, showStatus: !isEmbeddedWallet }) })) }), jsxs("div", { className: 'active-wallet-information__details', children: [jsx("div", { className: classNames('active-wallet-information__addresses-container', {
|
|
133
135
|
'active-wallet-information__addresses-container--centered': !(nameService === null || nameService === void 0 ? void 0 : nameService.name),
|
|
134
136
|
}), children: isBitcoin ? (jsx(ActiveBitcoinWalletAddresses, { wallet: primaryWallet, menuOption: options })) : (jsx(ActiveWalletAddreess, { address: address, nameServiceName: nameService === null || nameService === void 0 ? void 0 : nameService.name, menuOption: options })) }), jsx(NetworkPicker, { currentNetwork: network, connector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, isNetworkPickerOpen: isNetworkPickerOpen, setIsNetworkPickerOpen: setIsNetworkPickerOpen, mainClassName: 'active-wallet-information__network-picker', buttonClassName: 'active-wallet-information__network-picker-button', evmNetworks: evmNetworks, showNetworkName: true })] })] }), showTestnetAlert && (jsx(Alert, { variant: 'warning', copykey: 'dyn_active_wallet_info.testnet_warning', children: t('dyn_active_wallet_info.testnet_warning') }))] }), jsxs("div", { className: 'balance-container', children: [jsx(Typography, { color: 'secondary', variant: 'body_small', children: "Balance" }), primaryWallet && (jsx(Balance, { className: 'balance-container__balance', connector: primaryWallet.connector, address: primaryWallet.address, network: network }))] })] }));
|
|
135
137
|
};
|
package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.cjs
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
7
|
+
require('@dynamic-labs/sdk-api');
|
|
8
|
+
require('../../../../shared/logger.cjs');
|
|
9
|
+
var getChainIcon = require('../../../../shared/utils/functions/chain/getChainIcon.cjs');
|
|
10
|
+
require('@dynamic-labs/wallet-book');
|
|
11
|
+
require('../../../../utils/constants/colors.cjs');
|
|
12
|
+
require('../../../../utils/constants/values.cjs');
|
|
13
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
14
|
+
require('viem');
|
|
15
|
+
require('react');
|
|
16
|
+
require('@dynamic-labs/utils');
|
|
17
|
+
require('@dynamic-labs/iconic');
|
|
18
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
19
|
+
require('../../../../shared/consts/index.cjs');
|
|
20
|
+
require('../../../../../../_virtual/_tslib.cjs');
|
|
21
|
+
require('@dynamic-labs/multi-wallet');
|
|
22
|
+
var pixelToRem = require('../../../../utils/functions/pixelToRem/pixelToRem.cjs');
|
|
23
|
+
require('viem/chains');
|
|
24
|
+
var classNames = require('../../../../utils/functions/classNames/classNames.cjs');
|
|
25
|
+
|
|
26
|
+
const WalletIconWithNetwork = ({ iconSize = 24, chainName, Icon, }) => {
|
|
27
|
+
const ChainIcon = chainName ? getChainIcon.getChainIcon(chainName) : undefined;
|
|
28
|
+
return (jsxRuntime.jsxs("div", { className: 'wallet-icon-with-network__container', children: [jsxRuntime.jsx(Icon, { style: {
|
|
29
|
+
height: pixelToRem.pixelToRem(iconSize),
|
|
30
|
+
width: pixelToRem.pixelToRem(iconSize),
|
|
31
|
+
} }), ChainIcon && (jsxRuntime.jsx("div", { "data-testid": 'network-container', className: classNames.classNames('wallet-icon-with-network__network-container'), children: jsxRuntime.jsx(ChainIcon, {}) }))] }));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.WalletIconWithNetwork = WalletIconWithNetwork;
|
package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Icon } from '../../../../shared';
|
|
3
|
+
type Props = {
|
|
4
|
+
iconSize?: number;
|
|
5
|
+
chainName: string;
|
|
6
|
+
Icon: Icon;
|
|
7
|
+
};
|
|
8
|
+
export declare const WalletIconWithNetwork: ({ iconSize, chainName, Icon, }: Props) => JSX.Element;
|
|
9
|
+
export {};
|
package/src/lib/widgets/DynamicWidget/components/WalletIconWithNetwork/WalletIconWithNetwork.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import '@dynamic-labs/sdk-api';
|
|
4
|
+
import '../../../../shared/logger.js';
|
|
5
|
+
import { getChainIcon } from '../../../../shared/utils/functions/chain/getChainIcon.js';
|
|
6
|
+
import '@dynamic-labs/wallet-book';
|
|
7
|
+
import '../../../../utils/constants/colors.js';
|
|
8
|
+
import '../../../../utils/constants/values.js';
|
|
9
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
10
|
+
import 'viem';
|
|
11
|
+
import 'react';
|
|
12
|
+
import '@dynamic-labs/utils';
|
|
13
|
+
import '@dynamic-labs/iconic';
|
|
14
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
15
|
+
import '../../../../shared/consts/index.js';
|
|
16
|
+
import '../../../../../../_virtual/_tslib.js';
|
|
17
|
+
import '@dynamic-labs/multi-wallet';
|
|
18
|
+
import { pixelToRem } from '../../../../utils/functions/pixelToRem/pixelToRem.js';
|
|
19
|
+
import 'viem/chains';
|
|
20
|
+
import { classNames } from '../../../../utils/functions/classNames/classNames.js';
|
|
21
|
+
|
|
22
|
+
const WalletIconWithNetwork = ({ iconSize = 24, chainName, Icon, }) => {
|
|
23
|
+
const ChainIcon = chainName ? getChainIcon(chainName) : undefined;
|
|
24
|
+
return (jsxs("div", { className: 'wallet-icon-with-network__container', children: [jsx(Icon, { style: {
|
|
25
|
+
height: pixelToRem(iconSize),
|
|
26
|
+
width: pixelToRem(iconSize),
|
|
27
|
+
} }), ChainIcon && (jsx("div", { "data-testid": 'network-container', className: classNames('wallet-icon-with-network__network-container'), children: jsx(ChainIcon, {}) }))] }));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { WalletIconWithNetwork };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WalletIconWithNetwork } from './WalletIconWithNetwork';
|