@dynamic-labs/sdk-react-core 4.5.1 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +12 -12
- package/src/lib/components/NetworkPicker/NetworkPicker.cjs +11 -40
- package/src/lib/components/NetworkPicker/NetworkPicker.d.ts +2 -6
- package/src/lib/components/NetworkPicker/NetworkPicker.js +12 -41
- package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.cjs +6 -8
- package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.d.ts +2 -4
- package/src/lib/components/NetworkPicker/components/NetworkControl/NetworkControl.js +6 -8
- package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.cjs +67 -0
- package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.d.ts +14 -0
- package/src/lib/components/NetworkPicker/components/NetworkDropdown/NetworkDropdown.js +63 -0
- package/src/lib/components/NetworkPicker/components/NetworkDropdown/index.d.ts +1 -0
- package/src/lib/components/NetworkPicker/components/{EvmNetworkControl/EvmNetworkControl.cjs → NetworkSwitchControl/NetworkSwitchControl.cjs} +27 -36
- package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/NetworkSwitchControl.d.ts +16 -0
- package/src/lib/components/NetworkPicker/components/{EvmNetworkControl/EvmNetworkControl.js → NetworkSwitchControl/NetworkSwitchControl.js} +27 -35
- package/src/lib/components/NetworkPicker/components/NetworkSwitchControl/index.d.ts +1 -0
- package/src/lib/components/Portal/Portal.cjs +3 -2
- package/src/lib/components/Portal/Portal.js +3 -2
- package/src/lib/locale/en/translation.cjs +13 -29
- package/src/lib/locale/en/translation.d.ts +11 -27
- package/src/lib/locale/en/translation.js +13 -29
- package/src/lib/shared/assets/index.d.ts +1 -0
- package/src/lib/shared/assets/{currency.cjs → wallet-with-sunglasses.cjs} +14 -26
- package/src/lib/shared/assets/wallet-with-sunglasses.js +34 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.cjs +2 -4
- package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.d.ts +2 -2
- package/src/lib/utils/functions/isNetworkUnsupported/isNetworkUnsupported.js +2 -4
- package/src/lib/views/CollectUserDataView/CollectUserDataView.cjs +2 -4
- package/src/lib/views/CollectUserDataView/CollectUserDataView.js +2 -4
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.cjs +3 -4
- package/src/lib/views/NetworkNotSupported/NetworkNotSupported.js +3 -4
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.cjs +6 -9
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletInformation/ActiveWalletInformation.js +7 -10
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.cjs +2 -6
- package/src/lib/widgets/DynamicWidget/components/DynamicNav/DynamicNav.js +2 -6
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs +98 -49
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js +94 -45
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.cjs +21 -10
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenOption/TokenOption.js +21 -10
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.cjs +3 -3
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/TokenSelectScreen/TokenSelectScreen.js +3 -3
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/types.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.cjs +27 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/calculateFiatBalance.js +23 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/calculateFiatBalance/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/convert/convert.cjs +4 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/convert/convert.js +4 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.cjs +33 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.d.ts +8 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/convertScientificToDecimal.js +29 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/convertScientificToDecimal/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.cjs +26 -27
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.d.ts +6 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/formatValue/formatValue.js +26 -27
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.cjs +2 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/isFiatToken/isFiatToken.js +2 -1
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.cjs +32 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.d.ts +9 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useExchangeRatesForFunding/useExchangeRatesForFunding.js +28 -0
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useTokensForFunding/useTokensForFunding.cjs +27 -15
- package/src/lib/widgets/DynamicWidget/views/ReceiveExternalWalletFunds/utils/useTokensForFunding/useTokensForFunding.js +27 -15
- package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.cjs +20 -0
- package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.d.ts +2 -0
- package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/EmptyScreen.js +16 -0
- package/src/lib/widgets/DynamicWidget/views/SettingsView/EmptyScreen/index.d.ts +1 -0
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.cjs +3 -6
- package/src/lib/widgets/DynamicWidget/views/SettingsView/SettingsView.js +3 -6
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.d.ts +0 -23
- package/src/lib/components/NetworkPicker/components/EvmNetworkControl/index.d.ts +0 -1
- package/src/lib/shared/assets/currency.js +0 -46
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FundingTokenData } from '../../types';
|
|
2
|
+
type UseExchangeRatesForFundingProps = {
|
|
3
|
+
onFetch: (exchangeRates: Record<string, number>) => void;
|
|
4
|
+
tokenBalances: FundingTokenData[];
|
|
5
|
+
};
|
|
6
|
+
export declare const useExchangeRatesForFunding: ({ onFetch, tokenBalances, }: UseExchangeRatesForFundingProps) => {
|
|
7
|
+
[x: string]: number;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { getExchangeRates } from '../../../../../../data/api/exchangeRates/exchangeRates.js';
|
|
4
|
+
import { usePromise } from '../../../../../../utils/hooks/usePromise/usePromise.js';
|
|
5
|
+
|
|
6
|
+
const overrideBalances = (exchangeRates, tokenBalances) => {
|
|
7
|
+
const updatedExchangeRates = Object.assign({}, exchangeRates);
|
|
8
|
+
if (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length) {
|
|
9
|
+
tokenBalances.forEach(({ symbol, price }) => {
|
|
10
|
+
if (price) {
|
|
11
|
+
updatedExchangeRates[symbol] = price;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
// Fix stablecoin exchange rates for better UX
|
|
16
|
+
updatedExchangeRates['USDC'] = 1;
|
|
17
|
+
updatedExchangeRates['USDT'] = 1;
|
|
18
|
+
return updatedExchangeRates;
|
|
19
|
+
};
|
|
20
|
+
const useExchangeRatesForFunding = ({ onFetch, tokenBalances, }) => {
|
|
21
|
+
const { data: exchangeRates } = usePromise(getExchangeRates, {
|
|
22
|
+
initialData: {},
|
|
23
|
+
onResolve: (rates) => onFetch(overrideBalances(rates, tokenBalances)),
|
|
24
|
+
});
|
|
25
|
+
return useMemo(() => overrideBalances(exchangeRates, tokenBalances), [tokenBalances, exchangeRates]);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { useExchangeRatesForFunding };
|
|
@@ -93,9 +93,10 @@ require('../../../../../../../index.cjs');
|
|
|
93
93
|
var useTokenBalances = require('../../../../../../utils/hooks/useTokenBalances/useTokenBalances.cjs');
|
|
94
94
|
require('../../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
95
95
|
var useInternalDynamicContext = require('../../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.cjs');
|
|
96
|
+
var isFiatToken = require('../isFiatToken/isFiatToken.cjs');
|
|
96
97
|
|
|
97
98
|
const useTokensForFunding = ({ wallet, }) => {
|
|
98
|
-
var _a, _b
|
|
99
|
+
var _a, _b;
|
|
99
100
|
const { network } = useInternalDynamicContext.useInternalDynamicContext();
|
|
100
101
|
const { tokenBalances, isLoading: tokenBalancesLoading } = useTokenBalances.useTokenBalances({
|
|
101
102
|
accountAddress: wallet.address,
|
|
@@ -115,23 +116,33 @@ const useTokensForFunding = ({ wallet, }) => {
|
|
|
115
116
|
tokens: [],
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
const
|
|
119
|
-
const solNetworks = (_b = wallet.connector.solNetworks) !== null && _b !== void 0 ? _b : [];
|
|
119
|
+
const enabledNetworks = wallet.connector.getEnabledNetworks();
|
|
120
120
|
let parsedTokens = [];
|
|
121
121
|
if (!tokenBalancesLoading) {
|
|
122
122
|
parsedTokens = tokenBalances
|
|
123
123
|
// Contrary to what the type says, symbol and name may be undefined
|
|
124
124
|
.filter(({ symbol, balance, address }) => symbol && balance && address)
|
|
125
|
-
.map(({ symbol, balance, name, logoURI, address, decimals }) =>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
125
|
+
.map(({ symbol, balance, name, logoURI, address, decimals, price, marketValue, }) => {
|
|
126
|
+
const parsedBalance = parseFloat(balance.toString());
|
|
127
|
+
// We use token balance for stablecoins to improve readability (user expectation is to be 1:1)
|
|
128
|
+
let fiatBalance = isFiatToken.isFiatOrStablecoin(symbol)
|
|
129
|
+
? parsedBalance
|
|
130
|
+
: marketValue;
|
|
131
|
+
if (fiatBalance === undefined && price)
|
|
132
|
+
fiatBalance = price * parsedBalance;
|
|
133
|
+
return {
|
|
134
|
+
balance: parsedBalance,
|
|
135
|
+
fiatBalance,
|
|
136
|
+
logoURI,
|
|
137
|
+
name: name !== null && name !== void 0 ? name : symbol,
|
|
138
|
+
price,
|
|
139
|
+
symbol,
|
|
140
|
+
token: {
|
|
141
|
+
address,
|
|
142
|
+
decimals,
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
});
|
|
135
146
|
}
|
|
136
147
|
if ((currency === null || currency === void 0 ? void 0 : currency.symbol) && parseFloat(balance !== null && balance !== void 0 ? balance : '0')) {
|
|
137
148
|
const nativeToken = parsedTokens.find((token) => token.symbol === currency.symbol);
|
|
@@ -142,11 +153,12 @@ const useTokensForFunding = ({ wallet, }) => {
|
|
|
142
153
|
tokens: parsedTokens,
|
|
143
154
|
};
|
|
144
155
|
}
|
|
145
|
-
const logoURI = (
|
|
156
|
+
const logoURI = (_a = enabledNetworks.find(({ chainId }) => chainId === network)) === null || _a === void 0 ? void 0 : _a.iconUrls[0];
|
|
146
157
|
const fetchedToken = {
|
|
147
158
|
balance: parseFloat(balance !== null && balance !== void 0 ? balance : '0'),
|
|
159
|
+
fiatBalance: undefined,
|
|
148
160
|
logoURI,
|
|
149
|
-
name: (
|
|
161
|
+
name: (_b = currency.name) !== null && _b !== void 0 ? _b : currency.symbol,
|
|
150
162
|
symbol: currency.symbol,
|
|
151
163
|
token: 'native',
|
|
152
164
|
};
|
|
@@ -89,9 +89,10 @@ import '../../../../../../../index.js';
|
|
|
89
89
|
import { useTokenBalances } from '../../../../../../utils/hooks/useTokenBalances/useTokenBalances.js';
|
|
90
90
|
import '../../../../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
91
91
|
import { useInternalDynamicContext } from '../../../../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext.js';
|
|
92
|
+
import { isFiatOrStablecoin } from '../isFiatToken/isFiatToken.js';
|
|
92
93
|
|
|
93
94
|
const useTokensForFunding = ({ wallet, }) => {
|
|
94
|
-
var _a, _b
|
|
95
|
+
var _a, _b;
|
|
95
96
|
const { network } = useInternalDynamicContext();
|
|
96
97
|
const { tokenBalances, isLoading: tokenBalancesLoading } = useTokenBalances({
|
|
97
98
|
accountAddress: wallet.address,
|
|
@@ -111,23 +112,33 @@ const useTokensForFunding = ({ wallet, }) => {
|
|
|
111
112
|
tokens: [],
|
|
112
113
|
};
|
|
113
114
|
}
|
|
114
|
-
const
|
|
115
|
-
const solNetworks = (_b = wallet.connector.solNetworks) !== null && _b !== void 0 ? _b : [];
|
|
115
|
+
const enabledNetworks = wallet.connector.getEnabledNetworks();
|
|
116
116
|
let parsedTokens = [];
|
|
117
117
|
if (!tokenBalancesLoading) {
|
|
118
118
|
parsedTokens = tokenBalances
|
|
119
119
|
// Contrary to what the type says, symbol and name may be undefined
|
|
120
120
|
.filter(({ symbol, balance, address }) => symbol && balance && address)
|
|
121
|
-
.map(({ symbol, balance, name, logoURI, address, decimals }) =>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
.map(({ symbol, balance, name, logoURI, address, decimals, price, marketValue, }) => {
|
|
122
|
+
const parsedBalance = parseFloat(balance.toString());
|
|
123
|
+
// We use token balance for stablecoins to improve readability (user expectation is to be 1:1)
|
|
124
|
+
let fiatBalance = isFiatOrStablecoin(symbol)
|
|
125
|
+
? parsedBalance
|
|
126
|
+
: marketValue;
|
|
127
|
+
if (fiatBalance === undefined && price)
|
|
128
|
+
fiatBalance = price * parsedBalance;
|
|
129
|
+
return {
|
|
130
|
+
balance: parsedBalance,
|
|
131
|
+
fiatBalance,
|
|
132
|
+
logoURI,
|
|
133
|
+
name: name !== null && name !== void 0 ? name : symbol,
|
|
134
|
+
price,
|
|
135
|
+
symbol,
|
|
136
|
+
token: {
|
|
137
|
+
address,
|
|
138
|
+
decimals,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
});
|
|
131
142
|
}
|
|
132
143
|
if ((currency === null || currency === void 0 ? void 0 : currency.symbol) && parseFloat(balance !== null && balance !== void 0 ? balance : '0')) {
|
|
133
144
|
const nativeToken = parsedTokens.find((token) => token.symbol === currency.symbol);
|
|
@@ -138,11 +149,12 @@ const useTokensForFunding = ({ wallet, }) => {
|
|
|
138
149
|
tokens: parsedTokens,
|
|
139
150
|
};
|
|
140
151
|
}
|
|
141
|
-
const logoURI = (
|
|
152
|
+
const logoURI = (_a = enabledNetworks.find(({ chainId }) => chainId === network)) === null || _a === void 0 ? void 0 : _a.iconUrls[0];
|
|
142
153
|
const fetchedToken = {
|
|
143
154
|
balance: parseFloat(balance !== null && balance !== void 0 ? balance : '0'),
|
|
155
|
+
fiatBalance: undefined,
|
|
144
156
|
logoURI,
|
|
145
|
-
name: (
|
|
157
|
+
name: (_b = currency.name) !== null && _b !== void 0 ? _b : currency.symbol,
|
|
146
158
|
symbol: currency.symbol,
|
|
147
159
|
token: 'native',
|
|
148
160
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
var LinearGradientFrame = require('../../../../../components/LinearGradientFrame/LinearGradientFrame.cjs');
|
|
9
|
+
require('react');
|
|
10
|
+
var walletWithSunglasses = require('../../../../../shared/assets/wallet-with-sunglasses.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('../../../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
var Typography = require('../../../../../components/Typography/Typography.cjs');
|
|
14
|
+
|
|
15
|
+
const EmptyScreen = () => {
|
|
16
|
+
const { t } = reactI18next.useTranslation();
|
|
17
|
+
return (jsxRuntime.jsxs("div", { className: 'empty-screen', children: [jsxRuntime.jsx(LinearGradientFrame.LinearGradientFrame, { Icon: jsxRuntime.jsx(walletWithSunglasses.ReactComponent, {}) }), jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'secondary', className: 'empty-screen__title', children: t('dyn_settings.empty_screen.title') })] }));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
exports.EmptyScreen = EmptyScreen;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { LinearGradientFrame } from '../../../../../components/LinearGradientFrame/LinearGradientFrame.js';
|
|
5
|
+
import 'react';
|
|
6
|
+
import { ReactComponent as SvgWalletWithSunglasses } from '../../../../../shared/assets/wallet-with-sunglasses.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import '../../../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import { Typography } from '../../../../../components/Typography/Typography.js';
|
|
10
|
+
|
|
11
|
+
const EmptyScreen = () => {
|
|
12
|
+
const { t } = useTranslation();
|
|
13
|
+
return (jsxs("div", { className: 'empty-screen', children: [jsx(LinearGradientFrame, { Icon: jsx(SvgWalletWithSunglasses, {}) }), jsx(Typography, { variant: 'title', color: 'secondary', className: 'empty-screen__title', children: t('dyn_settings.empty_screen.title') })] }));
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { EmptyScreen };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './EmptyScreen';
|
|
@@ -22,11 +22,9 @@ var androidTouchId = require('../../../../shared/assets/android-touch-id.cjs');
|
|
|
22
22
|
var checkCircle = require('../../../../shared/assets/check-circle.cjs');
|
|
23
23
|
var chevronLeft = require('../../../../shared/assets/chevron-left.cjs');
|
|
24
24
|
var connectedApps = require('../../../../shared/assets/connected-apps.cjs');
|
|
25
|
-
var currency = require('../../../../shared/assets/currency.cjs');
|
|
26
25
|
var exportPrivateKey = require('../../../../shared/assets/export-private-key.cjs');
|
|
27
26
|
var exportRecoveryPhrase = require('../../../../shared/assets/export-recovery-phrase.cjs');
|
|
28
27
|
var footerInfoIcon = require('../../../../shared/assets/footer-info-icon.cjs');
|
|
29
|
-
var logout = require('../../../../shared/assets/logout.cjs');
|
|
30
28
|
var shield = require('../../../../shared/assets/shield.cjs');
|
|
31
29
|
var signInWithEmail = require('../../../../shared/assets/sign-in-with-email.cjs');
|
|
32
30
|
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
@@ -109,6 +107,7 @@ require('../../../../views/TransactionConfirmationView/TransactionConfirmationVi
|
|
|
109
107
|
require('../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
110
108
|
var useEmbeddedReveal = require('../../../../utils/hooks/useEmbeddedReveal/useEmbeddedReveal.cjs');
|
|
111
109
|
var useEmbeddedWalletAuthenticator = require('../../../../utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.cjs');
|
|
110
|
+
var EmptyScreen = require('./EmptyScreen/EmptyScreen.cjs');
|
|
112
111
|
require('../../../../context/OnrampContext/OnrampContext.cjs');
|
|
113
112
|
require('../ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.cjs');
|
|
114
113
|
require('../../../../../index.cjs');
|
|
@@ -182,9 +181,7 @@ const SettingsView = () => {
|
|
|
182
181
|
const isMfaEnabled = Boolean((_l = (_k = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _k === void 0 ? void 0 : _k.mfa) === null || _l === void 0 ? void 0 : _l.enabled);
|
|
183
182
|
const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
|
|
184
183
|
const shouldShowSecuritySection = isMfaEnabled || shouldShowPasskeyMFA;
|
|
185
|
-
return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.
|
|
186
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
187
|
-
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(currency.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_section.currency.badge', children: t('dyn_settings.global_section.currency.title') }), jsxRuntime.jsx(Badge.Badge, { text: t('dyn_settings.global_section.currency.badge'), copykey: 'dyn_settings.global_section.currency.badge', variant: 'secondary' })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: true, showInternalLoading: false })] }), globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleConnectedAppsClick(), dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
184
|
+
return (jsxRuntime.jsxs("div", { className: 'settings-view', children: [jsxRuntime.jsxs("div", { className: 'settings-view__body', children: [globalWallet && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { onClick: () => handleConnectedAppsClick(), dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
188
185
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
189
186
|
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(connectedApps.ReactComponent, { className: 'settings-view__body__section__button__icon' }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), shouldShowSecuritySection && (jsxRuntime.jsxs("div", { className: 'settings-view__body__section', children: [jsxRuntime.jsx("div", { className: classNames.classNames('settings-view__body__section__title', {
|
|
190
187
|
'settings-view__body__section__title__info-icon': !isTurnkeyWalletWithAuthenticator,
|
|
@@ -202,7 +199,7 @@ const SettingsView = () => {
|
|
|
202
199
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
203
200
|
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportPrivateKey.ReactComponent, { className: `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.private_key_button', children: t('dyn_settings.export_section.private_key_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'embedded-reveal-button', onClick: () => handleExportClick(true), buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
204
201
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
205
|
-
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout',
|
|
202
|
+
jsxRuntime.jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsxRuntime.jsx(exportRecoveryPhrase.ReactComponent, { className: `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsxRuntime.jsx(Typography.Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsxRuntime.jsx(chevronLeft.ReactComponent, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] })), jsxRuntime.jsx(EmptyScreen.EmptyScreen, {})] }), jsxRuntime.jsx("div", { className: 'settings-view__logout-button-container', children: jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) })] }));
|
|
206
203
|
};
|
|
207
204
|
|
|
208
205
|
exports.SettingsView = SettingsView;
|
|
@@ -18,11 +18,9 @@ import { ReactComponent as SvgAndroidTouchId } from '../../../../shared/assets/a
|
|
|
18
18
|
import { ReactComponent as SvgCheckCircle } from '../../../../shared/assets/check-circle.js';
|
|
19
19
|
import { ReactComponent as SvgChevronLeft } from '../../../../shared/assets/chevron-left.js';
|
|
20
20
|
import { ReactComponent as SvgConnectedApps } from '../../../../shared/assets/connected-apps.js';
|
|
21
|
-
import { ReactComponent as SvgCurrency } from '../../../../shared/assets/currency.js';
|
|
22
21
|
import { ReactComponent as SvgExportPrivateKey } from '../../../../shared/assets/export-private-key.js';
|
|
23
22
|
import { ReactComponent as SvgExportRecoveryPhrase } from '../../../../shared/assets/export-recovery-phrase.js';
|
|
24
23
|
import { ReactComponent as SvgFooterInfoIcon } from '../../../../shared/assets/footer-info-icon.js';
|
|
25
|
-
import { ReactComponent as SvgLogout } from '../../../../shared/assets/logout.js';
|
|
26
24
|
import { ReactComponent as SvgShield } from '../../../../shared/assets/shield.js';
|
|
27
25
|
import { ReactComponent as SvgSignInWithEmail } from '../../../../shared/assets/sign-in-with-email.js';
|
|
28
26
|
import '../../../../context/ViewContext/ViewContext.js';
|
|
@@ -105,6 +103,7 @@ import '../../../../views/TransactionConfirmationView/TransactionConfirmationVie
|
|
|
105
103
|
import '../ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
106
104
|
import { useEmbeddedReveal } from '../../../../utils/hooks/useEmbeddedReveal/useEmbeddedReveal.js';
|
|
107
105
|
import { useEmbeddedWalletAuthenticator } from '../../../../utils/hooks/useEmbeddedWalletAuthenticator/useEmbeddedWalletAuthenticator.js';
|
|
106
|
+
import { EmptyScreen } from './EmptyScreen/EmptyScreen.js';
|
|
108
107
|
import '../../../../context/OnrampContext/OnrampContext.js';
|
|
109
108
|
import '../ReceiveExternalWalletFunds/ReceiveExternalWalletFunds.js';
|
|
110
109
|
import '../../../../../index.js';
|
|
@@ -178,9 +177,7 @@ const SettingsView = () => {
|
|
|
178
177
|
const isMfaEnabled = Boolean((_l = (_k = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.security) === null || _k === void 0 ? void 0 : _k.mfa) === null || _l === void 0 ? void 0 : _l.enabled);
|
|
179
178
|
const shouldShowPasskeyMFA = isPasskeyEnabled && isTurnkeyWallet && !isSessionKeyCompatible;
|
|
180
179
|
const shouldShowSecuritySection = isMfaEnabled || shouldShowPasskeyMFA;
|
|
181
|
-
return (jsxs("div", { className: 'settings-view', children: [jsxs("div", { className: 'settings-view__body', children: [jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.
|
|
182
|
-
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
183
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgCurrency, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_section.currency.badge', children: t('dyn_settings.global_section.currency.title') }), jsx(Badge, { text: t('dyn_settings.global_section.currency.badge'), copykey: 'dyn_settings.global_section.currency.badge', variant: 'secondary' })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), disabled: true, showInternalLoading: false })] }), globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsx(TypographyButton, { onClick: () => handleConnectedAppsClick(), dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
180
|
+
return (jsxs("div", { className: 'settings-view', children: [jsxs("div", { className: 'settings-view__body', children: [globalWallet && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: 'settings-view__body__section__title', children: t('dyn_settings.global_connectivity_section.title') }), jsx(TypographyButton, { onClick: () => handleConnectedAppsClick(), dataTestId: 'connected-apps-button', buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
184
181
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
185
182
|
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgConnectedApps, { className: 'settings-view__body__section__button__icon' }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.global_connectivity_section.connected_apps_button', children: t('dyn_settings.global_connectivity_section.connected_apps_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false })] })), shouldShowSecuritySection && (jsxs("div", { className: 'settings-view__body__section', children: [jsx("div", { className: classNames('settings-view__body__section__title', {
|
|
186
183
|
'settings-view__body__section__title__info-icon': !isTurnkeyWalletWithAuthenticator,
|
|
@@ -198,7 +195,7 @@ const SettingsView = () => {
|
|
|
198
195
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
199
196
|
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportPrivateKey, { className: `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.private_key_button', children: t('dyn_settings.export_section.private_key_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }), isTurnkeyHDWallet && (jsx(TypographyButton, { dataTestId: 'embedded-reveal-button', onClick: () => handleExportClick(true), buttonClassName: 'settings-view__body__section__button', startSlot:
|
|
200
197
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
201
|
-
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] }))] }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout',
|
|
198
|
+
jsxs("div", { className: 'settings-view__body__section__button__start-slot', children: [jsx(SvgExportRecoveryPhrase, { className: `settings-view__body__section__button__icon${theme.theme.name === 'dark' ? '__stroke' : ''}` }), jsx(Typography, { color: 'primary', weight: 'medium', copykey: 'dyn_settings.export_section.srp_button', children: t('dyn_settings.export_section.srp_button') })] }), endSlot: jsx(SvgChevronLeft, { className: 'settings-view__body__section__button__icon-secondary--rotate' }), showInternalLoading: false }))] })] })), jsx(EmptyScreen, {})] }), jsx("div", { className: 'settings-view__logout-button-container', children: jsx(TypographyButton, { buttonClassName: 'settings-view__logout-button-container__button', onClick: handleLogOut, dataTestId: 'logout-button', copykey: 'dyn_settings.buttonLogout', children: t('dyn_settings.button_logout') }) })] }));
|
|
202
199
|
};
|
|
203
200
|
|
|
204
201
|
export { SettingsView };
|
package/src/lib/components/NetworkPicker/components/EvmNetworkControl/EvmNetworkControl.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
|
2
|
-
import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
-
import { EvmNetwork } from '@dynamic-labs/types';
|
|
4
|
-
type Props = {
|
|
5
|
-
activeClassName?: string;
|
|
6
|
-
className?: string;
|
|
7
|
-
evmNetworks?: EvmNetwork[];
|
|
8
|
-
isOpen: boolean;
|
|
9
|
-
loading: boolean;
|
|
10
|
-
network: number | string | undefined;
|
|
11
|
-
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
12
|
-
showNetworkName?: boolean;
|
|
13
|
-
walletConnector: WalletConnector | undefined;
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Icon and name to use when network is undefined and connector is unavailable
|
|
17
|
-
*/
|
|
18
|
-
export declare const fallbackChainData: {
|
|
19
|
-
iconUrl: string;
|
|
20
|
-
name: string;
|
|
21
|
-
};
|
|
22
|
-
export declare const EvmNetworkControl: ({ evmNetworks, className, activeClassName, network, walletConnector, isOpen, setIsOpen, showNetworkName, }: Props) => JSX.Element;
|
|
23
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { EvmNetworkControl } from './EvmNetworkControl';
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
|
|
4
|
-
var _rect, _path, _path2, _ellipse;
|
|
5
|
-
var _excluded = ["title", "titleId"];
|
|
6
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
7
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) { o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
8
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } } return t; }
|
|
9
|
-
var SvgCurrency = function SvgCurrency(_ref) {
|
|
10
|
-
var title = _ref.title,
|
|
11
|
-
titleId = _ref.titleId,
|
|
12
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
-
width: 28,
|
|
15
|
-
height: 28,
|
|
16
|
-
viewBox: "0 0 28 28",
|
|
17
|
-
fill: "none",
|
|
18
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
-
"aria-labelledby": titleId
|
|
20
|
-
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
21
|
-
id: titleId
|
|
22
|
-
}, title) : null, _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
|
|
23
|
-
width: 28,
|
|
24
|
-
height: 28,
|
|
25
|
-
rx: 14,
|
|
26
|
-
fill: "#4779FF"
|
|
27
|
-
})), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
28
|
-
fillRule: "evenodd",
|
|
29
|
-
clipRule: "evenodd",
|
|
30
|
-
d: "M20.252 17.036C18.976 18.398 16.654 19.31 14 19.31c-2.65 0-4.97-.909-6.246-2.268-.004.646-.004 1.406-.004 2.293 0 1.726 2.798 3.125 6.25 3.125s6.25-1.399 6.25-3.125c0-.192.002-.406.004-.637.005-.496.01-1.069-.002-1.662Z",
|
|
31
|
-
fill: "#fff"
|
|
32
|
-
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
33
|
-
fillRule: "evenodd",
|
|
34
|
-
clipRule: "evenodd",
|
|
35
|
-
d: "M20.23 11.85c-1.28 1.35-3.591 2.252-6.23 2.252-2.65 0-4.969-.909-6.245-2.267-.005.64-.005 1.398-.005 2.292 0 1.726 2.798 3.125 6.25 3.125s6.25-1.399 6.25-3.125c0-.959 0-1.703-.02-2.276Z",
|
|
36
|
-
fill: "#fff"
|
|
37
|
-
})), _ellipse || (_ellipse = /*#__PURE__*/React.createElement("ellipse", {
|
|
38
|
-
cx: 14,
|
|
39
|
-
cy: 8.893,
|
|
40
|
-
rx: 6.25,
|
|
41
|
-
ry: 3.125,
|
|
42
|
-
fill: "#fff"
|
|
43
|
-
})));
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export { SvgCurrency as ReactComponent };
|