@dynamic-labs/sdk-react-core 4.74.0 → 4.75.0
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 +12 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/FeeTokenSelector.cjs +165 -0
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/FeeTokenSelector.d.ts +11 -0
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/FeeTokenSelector.js +161 -0
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/index.d.ts +1 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +5 -13
- package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +1 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +5 -13
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +10 -13
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +10 -13
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +6 -7
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +6 -7
- package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +3 -0
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +3 -0
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +8 -8
- package/src/lib/views/SendBalanceView/SendBalanceView.js +9 -9
- package/src/lib/views/WalletList/data.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +6 -7
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +6 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.75.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.74.1...v4.75.0) (2026-04-03)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **midnight:** add midnight base package scaffolding ([#10850](https://github.com/dynamic-labs/dynamic-auth/issues/10850)) ([5844849](https://github.com/dynamic-labs/dynamic-auth/commit/584484916cf49d7ec46ec5cf862e2e6b8308d90f))
|
|
8
|
+
* **tempo:** add FeeTokenSelector component for fee token selection ([#10842](https://github.com/dynamic-labs/dynamic-auth/issues/10842)) ([18bc637](https://github.com/dynamic-labs/dynamic-auth/commit/18bc6374bea6eeff6656edaa725b0620bc8b36dd))
|
|
9
|
+
|
|
10
|
+
### [4.74.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.74.0...v4.74.1) (2026-04-02)
|
|
11
|
+
|
|
12
|
+
This was a version bump only, there were no code changes.
|
|
13
|
+
|
|
2
14
|
## [4.74.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.73.2...v4.74.0) (2026-04-02)
|
|
3
15
|
|
|
4
16
|
|
package/package.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "4.
|
|
6
|
+
var version = "4.75.0";
|
|
7
7
|
var dependencies = {
|
|
8
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
9
|
-
"@dynamic-labs-sdk/client": "0.
|
|
8
|
+
"@dynamic-labs/sdk-api-core": "0.0.923",
|
|
9
|
+
"@dynamic-labs-sdk/client": "0.23.2",
|
|
10
10
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.314",
|
|
11
11
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
12
12
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "4.
|
|
2
|
+
var version = "4.75.0";
|
|
3
3
|
var dependencies = {
|
|
4
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
5
|
-
"@dynamic-labs-sdk/client": "0.
|
|
4
|
+
"@dynamic-labs/sdk-api-core": "0.0.923",
|
|
5
|
+
"@dynamic-labs-sdk/client": "0.23.2",
|
|
6
6
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.314",
|
|
7
7
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
8
8
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.75.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
6
|
-
"@dynamic-labs-sdk/client": "0.
|
|
5
|
+
"@dynamic-labs/sdk-api-core": "0.0.923",
|
|
6
|
+
"@dynamic-labs-sdk/client": "0.23.2",
|
|
7
7
|
"@dynamic-labs-wallet/browser-wallet-client": "0.0.314",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
9
9
|
"@thumbmarkjs/thumbmarkjs": "0.16.0",
|
|
@@ -16,17 +16,17 @@
|
|
|
16
16
|
"yup": "0.32.11",
|
|
17
17
|
"react-international-phone": "4.5.0",
|
|
18
18
|
"bs58": "5.0.0",
|
|
19
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
20
|
-
"@dynamic-labs/iconic": "4.
|
|
21
|
-
"@dynamic-labs/locale": "4.
|
|
22
|
-
"@dynamic-labs/logger": "4.
|
|
23
|
-
"@dynamic-labs/multi-wallet": "4.
|
|
24
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
25
|
-
"@dynamic-labs/store": "4.
|
|
26
|
-
"@dynamic-labs/types": "4.
|
|
27
|
-
"@dynamic-labs/utils": "4.
|
|
28
|
-
"@dynamic-labs/wallet-book": "4.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
19
|
+
"@dynamic-labs/assert-package-version": "4.75.0",
|
|
20
|
+
"@dynamic-labs/iconic": "4.75.0",
|
|
21
|
+
"@dynamic-labs/locale": "4.75.0",
|
|
22
|
+
"@dynamic-labs/logger": "4.75.0",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.75.0",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.75.0",
|
|
25
|
+
"@dynamic-labs/store": "4.75.0",
|
|
26
|
+
"@dynamic-labs/types": "4.75.0",
|
|
27
|
+
"@dynamic-labs/utils": "4.75.0",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.75.0",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.75.0",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactI18next = require('react-i18next');
|
|
9
|
+
require('../../Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
10
|
+
var stroke = require('../../../shared/assets/stroke.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('../../../context/ViewContext/ViewContext.cjs');
|
|
13
|
+
require('../../../../../_virtual/_tslib.cjs');
|
|
14
|
+
var classNames = require('../../../utils/functions/classNames/classNames.cjs');
|
|
15
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
16
|
+
require('../../../shared/logger.cjs');
|
|
17
|
+
require('@dynamic-labs/wallet-book');
|
|
18
|
+
require('@dynamic-labs/utils');
|
|
19
|
+
require('../../../utils/constants/colors.cjs');
|
|
20
|
+
require('../../../utils/constants/values.cjs');
|
|
21
|
+
require('@dynamic-labs/sdk-api-core');
|
|
22
|
+
require('../../../shared/consts/index.cjs');
|
|
23
|
+
require('../../Alert/Alert.cjs');
|
|
24
|
+
require('../../../events/dynamicEvents.cjs');
|
|
25
|
+
require('../../../context/DynamicContext/DynamicContext.cjs');
|
|
26
|
+
require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
27
|
+
require('../../../store/state/authMode/authMode.cjs');
|
|
28
|
+
require('../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
29
|
+
require('../../../context/ErrorContext/ErrorContext.cjs');
|
|
30
|
+
require('@dynamic-labs/multi-wallet');
|
|
31
|
+
require('react-international-phone');
|
|
32
|
+
require('../../../store/state/nonce/nonce.cjs');
|
|
33
|
+
require('@dynamic-labs-sdk/client/core');
|
|
34
|
+
require('../../../client/client.cjs');
|
|
35
|
+
require('@dynamic-labs-sdk/client');
|
|
36
|
+
require('../../../config/ApiEndpoint.cjs');
|
|
37
|
+
require('@dynamic-labs/locale');
|
|
38
|
+
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
39
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
40
|
+
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
41
|
+
require('../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.cjs');
|
|
42
|
+
require('../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
43
|
+
require('../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
44
|
+
require('../../../context/UserWalletsContext/UserWalletsContext.cjs');
|
|
45
|
+
require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
46
|
+
require('react-dom');
|
|
47
|
+
require('../../../utils/functions/compareChains/compareChains.cjs');
|
|
48
|
+
require('../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
49
|
+
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
50
|
+
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
51
|
+
require('bs58');
|
|
52
|
+
require('@dynamic-labs/types');
|
|
53
|
+
require('../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
54
|
+
require('../../../context/LoadingContext/LoadingContext.cjs');
|
|
55
|
+
require('../../../context/WalletContext/WalletContext.cjs');
|
|
56
|
+
require('../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.cjs');
|
|
57
|
+
require('yup');
|
|
58
|
+
require('../../../context/MockContext/MockContext.cjs');
|
|
59
|
+
require('../../../views/CollectUserDataView/useFields.cjs');
|
|
60
|
+
require('../../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
61
|
+
require('../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
62
|
+
require('@dynamic-labs/rpc-providers');
|
|
63
|
+
require('../../../store/state/walletOptions/walletOptions.cjs');
|
|
64
|
+
var Typography = require('../../Typography/Typography.cjs');
|
|
65
|
+
require('../../../context/FooterAnimationContext/index.cjs');
|
|
66
|
+
require('../../ShadowDOM/ShadowDOM.cjs');
|
|
67
|
+
require('../../Transition/ZoomTransition/ZoomTransition.cjs');
|
|
68
|
+
require('../../Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
69
|
+
require('../../Transition/OpacityTransition/OpacityTransition.cjs');
|
|
70
|
+
require('../../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
71
|
+
require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
72
|
+
require('../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
73
|
+
require('react-focus-lock');
|
|
74
|
+
var Icon = require('../../Icon/Icon.cjs');
|
|
75
|
+
require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
|
|
76
|
+
require('../../IconButton/IconButton.cjs');
|
|
77
|
+
require('../../../utils/hooks/useGetMfaToken/useGetMfaToken.cjs');
|
|
78
|
+
require('../../MenuList/Dropdown/Dropdown.cjs');
|
|
79
|
+
var Image = require('../../Image/Image.cjs');
|
|
80
|
+
require('formik');
|
|
81
|
+
require('../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
82
|
+
require('../../../store/state/sendBalances.cjs');
|
|
83
|
+
require('../../Input/Input.cjs');
|
|
84
|
+
var MenuList = require('../../MenuList/MenuList/MenuList.cjs');
|
|
85
|
+
require('../../../views/TransactionConfirmationView/TransactionConfirmationView.cjs');
|
|
86
|
+
require('../../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.cjs');
|
|
87
|
+
require('../../../context/PasskeyContext/PasskeyContext.cjs');
|
|
88
|
+
require('../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.cjs');
|
|
89
|
+
require('../../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
90
|
+
require('../../../utils/hooks/useWalletBackup/types.cjs');
|
|
91
|
+
require('../../../utils/hooks/useWalletBackup/cloudProviders.cjs');
|
|
92
|
+
require('../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.cjs');
|
|
93
|
+
require('../../../context/OnrampContext/OnrampContext.cjs');
|
|
94
|
+
require('../../../../index.cjs');
|
|
95
|
+
require('../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs');
|
|
96
|
+
require('qrcode');
|
|
97
|
+
require('../../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.cjs');
|
|
98
|
+
require('../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.cjs');
|
|
99
|
+
require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
|
|
100
|
+
require('../../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
101
|
+
require('../../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
102
|
+
require('../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
103
|
+
require('@hcaptcha/react-hcaptcha');
|
|
104
|
+
require('../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs');
|
|
105
|
+
require('../../../context/ErrorContext/hooks/useErrorText/useErrorText.cjs');
|
|
106
|
+
require('../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.cjs');
|
|
107
|
+
require('../../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
108
|
+
require('../../../store/state/tokenBalances.cjs');
|
|
109
|
+
require('../../../store/state/multichainBalances.cjs');
|
|
110
|
+
require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
111
|
+
require('../../InlineWidget/InlineWidget.cjs');
|
|
112
|
+
require('../../IsBrowser/IsBrowser.cjs');
|
|
113
|
+
require('../../OverlayCard/OverlayCard.cjs');
|
|
114
|
+
require('../../Popper/Popper/Popper.cjs');
|
|
115
|
+
require('../../Popper/PopperContext/PopperContext.cjs');
|
|
116
|
+
|
|
117
|
+
const FeeTokenSelector = ({ feeTokenOptions, currentFeeToken, setCurrentFeeToken, label, }) => {
|
|
118
|
+
const { t } = reactI18next.useTranslation();
|
|
119
|
+
const [isDropdownOpen, setIsDropdownOpen] = React.useState(false);
|
|
120
|
+
const anchorRef = React.useRef(null);
|
|
121
|
+
const handleTokenClick = (selectedToken) => {
|
|
122
|
+
setCurrentFeeToken(selectedToken);
|
|
123
|
+
setIsDropdownOpen(false);
|
|
124
|
+
};
|
|
125
|
+
return (jsxRuntime.jsxs("div", { className: 'fee-token-selector', children: [label && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'regular', color: 'secondary', className: 'fee-token-selector__label', children: label })), jsxRuntime.jsxs("div", { className: 'fee-token-selector__dropdown', ref: anchorRef, onClick: () => setIsDropdownOpen(!isDropdownOpen), "data-testid": 'fee-token-selector', style: {
|
|
126
|
+
alignItems: 'center',
|
|
127
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
128
|
+
border: '1px solid var(--dynamic-base-4)',
|
|
129
|
+
borderRadius: 'calc(var(--dynamic-border-radius) / 2)',
|
|
130
|
+
cursor: 'pointer',
|
|
131
|
+
display: 'flex',
|
|
132
|
+
gap: '8px',
|
|
133
|
+
padding: '14px 12px',
|
|
134
|
+
}, children: [jsxRuntime.jsx(Image.Image, { src: currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.logoURI, alt: currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.symbol, className: 'token-balance-item__icon', dataTestId: 'fee-token-icon', fallback: jsxRuntime.jsx("div", { className: 'token-balance-item__skeleton-icon' }) }), jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_normal', color: 'primary', children: (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.name) || (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.symbol) }), jsxRuntime.jsx("div", { style: { marginLeft: 'auto' }, children: jsxRuntime.jsx(Icon.Icon, { color: 'text-tertiary', size: 'small', children: jsxRuntime.jsx(stroke.ReactComponent, {}) }) })] }), jsxRuntime.jsx(MenuList.MenuList, { className: 'fee-token-selector__menu-list', isOpen: isDropdownOpen, onClickClose: () => setIsDropdownOpen(false), popperProps: {
|
|
135
|
+
anchorOrigin: 'bottom-left',
|
|
136
|
+
anchorRef,
|
|
137
|
+
}, mobileTitle: t('dyn_send_transaction.data.fee_token_label'), style: { minWidth: '310px', padding: '8px 16px' }, children: feeTokenOptions.map((token) => {
|
|
138
|
+
var _a;
|
|
139
|
+
return (jsxRuntime.jsxs("button", { className: classNames.classNames('fee-token-selector__menu-item', {
|
|
140
|
+
'fee-token-selector__menu-item--selected': token.address === (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address),
|
|
141
|
+
}), onClick: () => handleTokenClick(token), type: 'button', style: {
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
background: 'transparent',
|
|
144
|
+
border: 'none',
|
|
145
|
+
cursor: 'pointer',
|
|
146
|
+
display: 'flex',
|
|
147
|
+
gap: '10px',
|
|
148
|
+
justifyContent: 'space-between',
|
|
149
|
+
padding: '8px 0',
|
|
150
|
+
textAlign: 'left',
|
|
151
|
+
width: '100%',
|
|
152
|
+
}, children: [jsxRuntime.jsxs("div", { style: {
|
|
153
|
+
alignItems: 'center',
|
|
154
|
+
display: 'flex',
|
|
155
|
+
gap: '5px',
|
|
156
|
+
minWidth: '150px',
|
|
157
|
+
}, children: [jsxRuntime.jsx(Image.Image, { src: token.logoURI, alt: token.symbol, className: 'token-balance-item__icon', fallback: jsxRuntime.jsx("div", { className: 'token-balance-item__skeleton-icon' }) }), jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_small', color: 'primary', children: token.name || token.symbol })] }), jsxRuntime.jsxs("div", { style: {
|
|
158
|
+
alignItems: 'flex-end',
|
|
159
|
+
display: 'flex',
|
|
160
|
+
flexDirection: 'column',
|
|
161
|
+
}, children: [jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_small', color: 'secondary', children: token.symbol }), jsxRuntime.jsx(Typography.Typography, { as: 'span', variant: 'body_small', color: 'primary', children: ((_a = token.balance) === null || _a === void 0 ? void 0 : _a.toLocaleString()) || 0 })] })] }, token.address));
|
|
162
|
+
}) })] }));
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
exports.FeeTokenSelector = FeeTokenSelector;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dispatch, FC, SetStateAction } from 'react';
|
|
2
|
+
import { TokenBalance } from '@dynamic-labs/sdk-api-core';
|
|
3
|
+
import './FeeTokenSelector.scss';
|
|
4
|
+
type FeeTokenSelectorProps = {
|
|
5
|
+
feeTokenOptions: TokenBalance[];
|
|
6
|
+
currentFeeToken: TokenBalance | undefined;
|
|
7
|
+
setCurrentFeeToken: Dispatch<SetStateAction<TokenBalance | undefined>>;
|
|
8
|
+
label?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const FeeTokenSelector: FC<FeeTokenSelectorProps>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef } from 'react';
|
|
4
|
+
import { useTranslation } from 'react-i18next';
|
|
5
|
+
import '../../Accordion/components/AccordionItem/AccordionItem.js';
|
|
6
|
+
import { ReactComponent as SvgStroke } from '../../../shared/assets/stroke.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import '../../../context/ViewContext/ViewContext.js';
|
|
9
|
+
import '../../../../../_virtual/_tslib.js';
|
|
10
|
+
import { classNames } from '../../../utils/functions/classNames/classNames.js';
|
|
11
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
12
|
+
import '../../../shared/logger.js';
|
|
13
|
+
import '@dynamic-labs/wallet-book';
|
|
14
|
+
import '@dynamic-labs/utils';
|
|
15
|
+
import '../../../utils/constants/colors.js';
|
|
16
|
+
import '../../../utils/constants/values.js';
|
|
17
|
+
import '@dynamic-labs/sdk-api-core';
|
|
18
|
+
import '../../../shared/consts/index.js';
|
|
19
|
+
import '../../Alert/Alert.js';
|
|
20
|
+
import '../../../events/dynamicEvents.js';
|
|
21
|
+
import '../../../context/DynamicContext/DynamicContext.js';
|
|
22
|
+
import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
23
|
+
import '../../../store/state/authMode/authMode.js';
|
|
24
|
+
import '../../../context/CaptchaContext/CaptchaContext.js';
|
|
25
|
+
import '../../../context/ErrorContext/ErrorContext.js';
|
|
26
|
+
import '@dynamic-labs/multi-wallet';
|
|
27
|
+
import 'react-international-phone';
|
|
28
|
+
import '../../../store/state/nonce/nonce.js';
|
|
29
|
+
import '@dynamic-labs-sdk/client/core';
|
|
30
|
+
import '../../../client/client.js';
|
|
31
|
+
import '@dynamic-labs-sdk/client';
|
|
32
|
+
import '../../../config/ApiEndpoint.js';
|
|
33
|
+
import '@dynamic-labs/locale';
|
|
34
|
+
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
35
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
36
|
+
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
37
|
+
import '../../../utils/functions/getWaasAddressTypeLabel/getWaasAddressTypeLabel.js';
|
|
38
|
+
import '../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
39
|
+
import '../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
40
|
+
import '../../../context/UserWalletsContext/UserWalletsContext.js';
|
|
41
|
+
import '../../../context/VerificationContext/VerificationContext.js';
|
|
42
|
+
import 'react-dom';
|
|
43
|
+
import '../../../utils/functions/compareChains/compareChains.js';
|
|
44
|
+
import '../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
45
|
+
import '../../../context/ThemeContext/ThemeContext.js';
|
|
46
|
+
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
47
|
+
import 'bs58';
|
|
48
|
+
import '@dynamic-labs/types';
|
|
49
|
+
import '../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
50
|
+
import '../../../context/LoadingContext/LoadingContext.js';
|
|
51
|
+
import '../../../context/WalletContext/WalletContext.js';
|
|
52
|
+
import '../../../utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/constants.js';
|
|
53
|
+
import 'yup';
|
|
54
|
+
import '../../../context/MockContext/MockContext.js';
|
|
55
|
+
import '../../../views/CollectUserDataView/useFields.js';
|
|
56
|
+
import '../../../context/FieldsStateContext/FieldsStateContext.js';
|
|
57
|
+
import '../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
58
|
+
import '@dynamic-labs/rpc-providers';
|
|
59
|
+
import '../../../store/state/walletOptions/walletOptions.js';
|
|
60
|
+
import { Typography } from '../../Typography/Typography.js';
|
|
61
|
+
import '../../../context/FooterAnimationContext/index.js';
|
|
62
|
+
import '../../ShadowDOM/ShadowDOM.js';
|
|
63
|
+
import '../../Transition/ZoomTransition/ZoomTransition.js';
|
|
64
|
+
import '../../Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
65
|
+
import '../../Transition/OpacityTransition/OpacityTransition.js';
|
|
66
|
+
import '../../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
67
|
+
import '../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
68
|
+
import '../../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
69
|
+
import 'react-focus-lock';
|
|
70
|
+
import { Icon } from '../../Icon/Icon.js';
|
|
71
|
+
import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
|
|
72
|
+
import '../../IconButton/IconButton.js';
|
|
73
|
+
import '../../../utils/hooks/useGetMfaToken/useGetMfaToken.js';
|
|
74
|
+
import '../../MenuList/Dropdown/Dropdown.js';
|
|
75
|
+
import { Image } from '../../Image/Image.js';
|
|
76
|
+
import 'formik';
|
|
77
|
+
import '../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
78
|
+
import '../../../store/state/sendBalances.js';
|
|
79
|
+
import '../../Input/Input.js';
|
|
80
|
+
import { MenuList } from '../../MenuList/MenuList/MenuList.js';
|
|
81
|
+
import '../../../views/TransactionConfirmationView/TransactionConfirmationView.js';
|
|
82
|
+
import '../../PasskeyCreatedSuccessBanner/PasskeyCreatedSuccessBanner.js';
|
|
83
|
+
import '../../../context/PasskeyContext/PasskeyContext.js';
|
|
84
|
+
import '../../../widgets/DynamicWidget/components/PasskeyCard/PasskeyCard.js';
|
|
85
|
+
import '../../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
86
|
+
import '../../../utils/hooks/useWalletBackup/types.js';
|
|
87
|
+
import '../../../utils/hooks/useWalletBackup/cloudProviders.js';
|
|
88
|
+
import '../../../widgets/DynamicWidget/views/CryptoComOnramp/CryptoComOnramp.js';
|
|
89
|
+
import '../../../context/OnrampContext/OnrampContext.js';
|
|
90
|
+
import '../../../../index.js';
|
|
91
|
+
import '../../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
92
|
+
import 'qrcode';
|
|
93
|
+
import '../../../widgets/DynamicWidget/views/ManagePasskeysMfaWidgetView/ManagePasskeysMfaWidgetView.js';
|
|
94
|
+
import '../../../widgets/DynamicWidget/views/ManageTotpMfaWidgetView/ManageTotpMfaWidgetView.js';
|
|
95
|
+
import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
|
|
96
|
+
import '../../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
97
|
+
import '../../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
98
|
+
import '../../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
99
|
+
import '@hcaptcha/react-hcaptcha';
|
|
100
|
+
import '../../../views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js';
|
|
101
|
+
import '../../../context/ErrorContext/hooks/useErrorText/useErrorText.js';
|
|
102
|
+
import '../../../views/MfaChooseDeviceView/useGetMfaOptions/useGetMfaOptions.js';
|
|
103
|
+
import '../../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
104
|
+
import '../../../store/state/tokenBalances.js';
|
|
105
|
+
import '../../../store/state/multichainBalances.js';
|
|
106
|
+
import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
107
|
+
import '../../InlineWidget/InlineWidget.js';
|
|
108
|
+
import '../../IsBrowser/IsBrowser.js';
|
|
109
|
+
import '../../OverlayCard/OverlayCard.js';
|
|
110
|
+
import '../../Popper/Popper/Popper.js';
|
|
111
|
+
import '../../Popper/PopperContext/PopperContext.js';
|
|
112
|
+
|
|
113
|
+
const FeeTokenSelector = ({ feeTokenOptions, currentFeeToken, setCurrentFeeToken, label, }) => {
|
|
114
|
+
const { t } = useTranslation();
|
|
115
|
+
const [isDropdownOpen, setIsDropdownOpen] = useState(false);
|
|
116
|
+
const anchorRef = useRef(null);
|
|
117
|
+
const handleTokenClick = (selectedToken) => {
|
|
118
|
+
setCurrentFeeToken(selectedToken);
|
|
119
|
+
setIsDropdownOpen(false);
|
|
120
|
+
};
|
|
121
|
+
return (jsxs("div", { className: 'fee-token-selector', children: [label && (jsx(Typography, { variant: 'body_small', weight: 'regular', color: 'secondary', className: 'fee-token-selector__label', children: label })), jsxs("div", { className: 'fee-token-selector__dropdown', ref: anchorRef, onClick: () => setIsDropdownOpen(!isDropdownOpen), "data-testid": 'fee-token-selector', style: {
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
backgroundColor: 'var(--dynamic-base-2)',
|
|
124
|
+
border: '1px solid var(--dynamic-base-4)',
|
|
125
|
+
borderRadius: 'calc(var(--dynamic-border-radius) / 2)',
|
|
126
|
+
cursor: 'pointer',
|
|
127
|
+
display: 'flex',
|
|
128
|
+
gap: '8px',
|
|
129
|
+
padding: '14px 12px',
|
|
130
|
+
}, children: [jsx(Image, { src: currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.logoURI, alt: currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.symbol, className: 'token-balance-item__icon', dataTestId: 'fee-token-icon', fallback: jsx("div", { className: 'token-balance-item__skeleton-icon' }) }), jsx(Typography, { as: 'span', variant: 'body_normal', color: 'primary', children: (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.name) || (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.symbol) }), jsx("div", { style: { marginLeft: 'auto' }, children: jsx(Icon, { color: 'text-tertiary', size: 'small', children: jsx(SvgStroke, {}) }) })] }), jsx(MenuList, { className: 'fee-token-selector__menu-list', isOpen: isDropdownOpen, onClickClose: () => setIsDropdownOpen(false), popperProps: {
|
|
131
|
+
anchorOrigin: 'bottom-left',
|
|
132
|
+
anchorRef,
|
|
133
|
+
}, mobileTitle: t('dyn_send_transaction.data.fee_token_label'), style: { minWidth: '310px', padding: '8px 16px' }, children: feeTokenOptions.map((token) => {
|
|
134
|
+
var _a;
|
|
135
|
+
return (jsxs("button", { className: classNames('fee-token-selector__menu-item', {
|
|
136
|
+
'fee-token-selector__menu-item--selected': token.address === (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address),
|
|
137
|
+
}), onClick: () => handleTokenClick(token), type: 'button', style: {
|
|
138
|
+
alignItems: 'center',
|
|
139
|
+
background: 'transparent',
|
|
140
|
+
border: 'none',
|
|
141
|
+
cursor: 'pointer',
|
|
142
|
+
display: 'flex',
|
|
143
|
+
gap: '10px',
|
|
144
|
+
justifyContent: 'space-between',
|
|
145
|
+
padding: '8px 0',
|
|
146
|
+
textAlign: 'left',
|
|
147
|
+
width: '100%',
|
|
148
|
+
}, children: [jsxs("div", { style: {
|
|
149
|
+
alignItems: 'center',
|
|
150
|
+
display: 'flex',
|
|
151
|
+
gap: '5px',
|
|
152
|
+
minWidth: '150px',
|
|
153
|
+
}, children: [jsx(Image, { src: token.logoURI, alt: token.symbol, className: 'token-balance-item__icon', fallback: jsx("div", { className: 'token-balance-item__skeleton-icon' }) }), jsx(Typography, { as: 'span', variant: 'body_small', color: 'primary', children: token.name || token.symbol })] }), jsxs("div", { style: {
|
|
154
|
+
alignItems: 'flex-end',
|
|
155
|
+
display: 'flex',
|
|
156
|
+
flexDirection: 'column',
|
|
157
|
+
}, children: [jsx(Typography, { as: 'span', variant: 'body_small', color: 'secondary', children: token.symbol }), jsx(Typography, { as: 'span', variant: 'body_small', color: 'primary', children: ((_a = token.balance) === null || _a === void 0 ? void 0 : _a.toLocaleString()) || 0 })] })] }, token.address));
|
|
158
|
+
}) })] }));
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export { FeeTokenSelector };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FeeTokenSelector } from './FeeTokenSelector';
|
|
@@ -100,6 +100,7 @@ require('../../context/OnrampContext/OnrampContext.cjs');
|
|
|
100
100
|
var sendBalances = require('../../store/state/sendBalances.cjs');
|
|
101
101
|
var TokensBalanceDropdown = require('../SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.cjs');
|
|
102
102
|
var utils = require('../TransactionConfirmationPageLayout/utils.cjs');
|
|
103
|
+
var FeeTokenSelector = require('./FeeTokenSelector/FeeTokenSelector.cjs');
|
|
103
104
|
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
104
105
|
require('../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
105
106
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -139,9 +140,7 @@ const getDisplayErrorMessage = (errors, t, field, decimals) => {
|
|
|
139
140
|
}
|
|
140
141
|
return '';
|
|
141
142
|
};
|
|
142
|
-
const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddress = () => true, validateAmount = () => true, currentToken, transaction, tokenBalances, setCurrentToken, isLoading,
|
|
143
|
-
// Tempo-specific props
|
|
144
|
-
isTempo = false, feeTokenOptions, currentFeeToken, setCurrentFeeToken, }) => {
|
|
143
|
+
const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddress = () => true, validateAmount = () => true, currentToken, transaction, tokenBalances, setCurrentToken, isLoading, supportsFeeTokenSelection = false, feeTokenOptions, currentFeeToken, setCurrentFeeToken, }) => {
|
|
145
144
|
const { t } = reactI18next.useTranslation();
|
|
146
145
|
const { showFiat } = useInternalDynamicContext.useInternalDynamicContext();
|
|
147
146
|
const floatingValueRef = React.useRef(null);
|
|
@@ -196,18 +195,11 @@ isTempo = false, feeTokenOptions, currentFeeToken, setCurrentFeeToken, }) => {
|
|
|
196
195
|
paddingLeft: `${leftSymbolPadding}px`,
|
|
197
196
|
} }), jsxRuntime.jsx("div", { className: 'send-balance-form__amount-container__floating_value', ref: floatingValueRef, children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', weight: 'regular', color: 'secondary', children: currentToken === null || currentToken === void 0 ? void 0 : currentToken.symbol }) }), jsxRuntime.jsx("div", { className: 'send-balance-form__amount-container__balance', children: showFiat && !Number.isNaN(amount) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_mini', weight: 'bold', color: 'secondary', children: "$" }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_mini', weight: 'regular', color: 'secondary', children: utils.getDisplayFiatPrice(amount, currentToken) })] })) })] }), jsxRuntime.jsx(Typography.Typography, { className: 'send-balance-form__amount_available', variant: 'body_small', weight: 'regular', color: 'secondary', as: 'div', children: jsxRuntime.jsxs("div", { style: { display: 'flex', gap: '0.225rem' }, children: [jsxRuntime.jsx(Typography.Typography, { className: 'send-balance-form__amount_available__line', variant: 'body_small', weight: 'bold', color: 'primary', as: 'div', children: (_a = currentToken === null || currentToken === void 0 ? void 0 : currentToken.balance) !== null && _a !== void 0 ? _a : 0 }), t('dyn_send_transaction.data.symbol_available', {
|
|
198
197
|
symbol: currentToken === null || currentToken === void 0 ? void 0 : currentToken.symbol,
|
|
199
|
-
})] }) }),
|
|
198
|
+
})] }) }), supportsFeeTokenSelection &&
|
|
200
199
|
feeTokenOptions &&
|
|
201
200
|
feeTokenOptions.length > 0 &&
|
|
202
|
-
setCurrentFeeToken &&
|
|
203
|
-
|
|
204
|
-
if (selected) {
|
|
205
|
-
setCurrentFeeToken(selected);
|
|
206
|
-
}
|
|
207
|
-
}, children: feeTokenOptions.map((token) => {
|
|
208
|
-
var _a;
|
|
209
|
-
return (jsxRuntime.jsxs("option", { value: token.address, children: [token.symbol, " (", ((_a = token.balance) === null || _a === void 0 ? void 0 : _a.toLocaleString()) || 0, ' ', "available)"] }, token.address));
|
|
210
|
-
}) })] })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'regular', color: 'secondary', copykey: 'dyn_send_transaction.data.recipient.label', children: "Recipient Address" }), jsxRuntime.jsx(formik.Field, { className: 'send-balance-form__field', placeholder: t('dyn_send_transaction.data.recipient.placeholder'), label: t('dyn_send_transaction.data.recipient.label'), id: 'recipient', name: 'recipient', as: Input.Input, error: errors['recipient'], copykey: 'dyn_send_transaction.data.recipient.label', message: touched['recipient'] &&
|
|
201
|
+
setCurrentFeeToken &&
|
|
202
|
+
currentFeeToken && (jsxRuntime.jsx(FeeTokenSelector.FeeTokenSelector, { feeTokenOptions: feeTokenOptions, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, label: t('dyn_send_transaction.data.fee_token_label') })), jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', weight: 'regular', color: 'secondary', copykey: 'dyn_send_transaction.data.recipient.label', children: "Recipient Address" }), jsxRuntime.jsx(formik.Field, { className: 'send-balance-form__field', placeholder: t('dyn_send_transaction.data.recipient.placeholder'), label: t('dyn_send_transaction.data.recipient.label'), id: 'recipient', name: 'recipient', as: Input.Input, error: errors['recipient'], copykey: 'dyn_send_transaction.data.recipient.label', message: touched['recipient'] &&
|
|
211
203
|
getDisplayErrorMessage(errors, t, 'recipient') }), jsxRuntime.jsx(TypographyButton.TypographyButton, { dataTestId: 'sendBalanceFormSubmitButton', expanded: true, type: 'submit', buttonVariant: 'primary', buttonPadding: 'small', buttonClassName: 'send-balance-form__button', copykey: 'dyn_send_transaction.preview_transaction', children: t('dyn_send_transaction.preview_transaction') })] }));
|
|
212
204
|
} }));
|
|
213
205
|
};
|
|
@@ -16,7 +16,7 @@ export type Props = {
|
|
|
16
16
|
setCurrentToken: Dispatch<SetStateAction<TokenBalance | undefined>>;
|
|
17
17
|
isLoading?: boolean;
|
|
18
18
|
transaction: IUITransaction;
|
|
19
|
-
|
|
19
|
+
supportsFeeTokenSelection?: boolean;
|
|
20
20
|
feeTokenOptions?: TokenBalance[];
|
|
21
21
|
currentFeeToken?: TokenBalance;
|
|
22
22
|
setCurrentFeeToken?: Dispatch<SetStateAction<TokenBalance | undefined>>;
|
|
@@ -96,6 +96,7 @@ import '../../context/OnrampContext/OnrampContext.js';
|
|
|
96
96
|
import { useSendBalanceState, setSendBalanceVariable } from '../../store/state/sendBalances.js';
|
|
97
97
|
import { TokensBalanceDropdown } from '../SendBalancePageLayout/components/TokensBalanceDropdown/TokensBalanceDropdown.js';
|
|
98
98
|
import { getDisplayFiatPrice } from '../TransactionConfirmationPageLayout/utils.js';
|
|
99
|
+
import { FeeTokenSelector } from './FeeTokenSelector/FeeTokenSelector.js';
|
|
99
100
|
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
100
101
|
import '../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
101
102
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -135,9 +136,7 @@ const getDisplayErrorMessage = (errors, t, field, decimals) => {
|
|
|
135
136
|
}
|
|
136
137
|
return '';
|
|
137
138
|
};
|
|
138
|
-
const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddress = () => true, validateAmount = () => true, currentToken, transaction, tokenBalances, setCurrentToken, isLoading,
|
|
139
|
-
// Tempo-specific props
|
|
140
|
-
isTempo = false, feeTokenOptions, currentFeeToken, setCurrentFeeToken, }) => {
|
|
139
|
+
const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddress = () => true, validateAmount = () => true, currentToken, transaction, tokenBalances, setCurrentToken, isLoading, supportsFeeTokenSelection = false, feeTokenOptions, currentFeeToken, setCurrentFeeToken, }) => {
|
|
141
140
|
const { t } = useTranslation();
|
|
142
141
|
const { showFiat } = useInternalDynamicContext();
|
|
143
142
|
const floatingValueRef = useRef(null);
|
|
@@ -192,18 +191,11 @@ isTempo = false, feeTokenOptions, currentFeeToken, setCurrentFeeToken, }) => {
|
|
|
192
191
|
paddingLeft: `${leftSymbolPadding}px`,
|
|
193
192
|
} }), jsx("div", { className: 'send-balance-form__amount-container__floating_value', ref: floatingValueRef, children: jsx(Typography, { variant: 'title', weight: 'regular', color: 'secondary', children: currentToken === null || currentToken === void 0 ? void 0 : currentToken.symbol }) }), jsx("div", { className: 'send-balance-form__amount-container__balance', children: showFiat && !Number.isNaN(amount) && (jsxs(Fragment, { children: [jsx(Typography, { variant: 'body_mini', weight: 'bold', color: 'secondary', children: "$" }), jsx(Typography, { variant: 'body_mini', weight: 'regular', color: 'secondary', children: getDisplayFiatPrice(amount, currentToken) })] })) })] }), jsx(Typography, { className: 'send-balance-form__amount_available', variant: 'body_small', weight: 'regular', color: 'secondary', as: 'div', children: jsxs("div", { style: { display: 'flex', gap: '0.225rem' }, children: [jsx(Typography, { className: 'send-balance-form__amount_available__line', variant: 'body_small', weight: 'bold', color: 'primary', as: 'div', children: (_a = currentToken === null || currentToken === void 0 ? void 0 : currentToken.balance) !== null && _a !== void 0 ? _a : 0 }), t('dyn_send_transaction.data.symbol_available', {
|
|
194
193
|
symbol: currentToken === null || currentToken === void 0 ? void 0 : currentToken.symbol,
|
|
195
|
-
})] }) }),
|
|
194
|
+
})] }) }), supportsFeeTokenSelection &&
|
|
196
195
|
feeTokenOptions &&
|
|
197
196
|
feeTokenOptions.length > 0 &&
|
|
198
|
-
setCurrentFeeToken &&
|
|
199
|
-
|
|
200
|
-
if (selected) {
|
|
201
|
-
setCurrentFeeToken(selected);
|
|
202
|
-
}
|
|
203
|
-
}, children: feeTokenOptions.map((token) => {
|
|
204
|
-
var _a;
|
|
205
|
-
return (jsxs("option", { value: token.address, children: [token.symbol, " (", ((_a = token.balance) === null || _a === void 0 ? void 0 : _a.toLocaleString()) || 0, ' ', "available)"] }, token.address));
|
|
206
|
-
}) })] })), jsx(Typography, { variant: 'body_small', weight: 'regular', color: 'secondary', copykey: 'dyn_send_transaction.data.recipient.label', children: "Recipient Address" }), jsx(Field, { className: 'send-balance-form__field', placeholder: t('dyn_send_transaction.data.recipient.placeholder'), label: t('dyn_send_transaction.data.recipient.label'), id: 'recipient', name: 'recipient', as: Input, error: errors['recipient'], copykey: 'dyn_send_transaction.data.recipient.label', message: touched['recipient'] &&
|
|
197
|
+
setCurrentFeeToken &&
|
|
198
|
+
currentFeeToken && (jsx(FeeTokenSelector, { feeTokenOptions: feeTokenOptions, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, label: t('dyn_send_transaction.data.fee_token_label') })), jsx(Typography, { variant: 'body_small', weight: 'regular', color: 'secondary', copykey: 'dyn_send_transaction.data.recipient.label', children: "Recipient Address" }), jsx(Field, { className: 'send-balance-form__field', placeholder: t('dyn_send_transaction.data.recipient.placeholder'), label: t('dyn_send_transaction.data.recipient.label'), id: 'recipient', name: 'recipient', as: Input, error: errors['recipient'], copykey: 'dyn_send_transaction.data.recipient.label', message: touched['recipient'] &&
|
|
207
199
|
getDisplayErrorMessage(errors, t, 'recipient') }), jsx(TypographyButton, { dataTestId: 'sendBalanceFormSubmitButton', expanded: true, type: 'submit', buttonVariant: 'primary', buttonPadding: 'small', buttonClassName: 'send-balance-form__button', copykey: 'dyn_send_transaction.preview_transaction', children: t('dyn_send_transaction.preview_transaction') })] }));
|
|
208
200
|
} }));
|
|
209
201
|
};
|
|
@@ -123,7 +123,7 @@ require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
123
123
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
124
124
|
|
|
125
125
|
const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, displayPoweredByDynamicFooter = false, transaction, networkCurrencyDecimals, tokenBalances, currentToken, setCurrentToken, isLoading, isNativeToken, }) => {
|
|
126
|
-
var _a, _b;
|
|
126
|
+
var _a, _b, _c;
|
|
127
127
|
const { t } = reactI18next.useTranslation();
|
|
128
128
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
129
129
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
@@ -132,13 +132,13 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
132
132
|
});
|
|
133
133
|
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
134
134
|
const { chain } = useFetchChain.useFetchChain(walletConnector);
|
|
135
|
-
|
|
136
|
-
const isTempo = ((_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.connectedChain) === 'TEMPO';
|
|
135
|
+
const supportsFeeTokenSelection = (_b = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false;
|
|
137
136
|
const [currentFeeToken, setCurrentFeeToken] = React.useState(undefined);
|
|
138
|
-
// Initialize fee token
|
|
139
|
-
// Also reset if current token is no longer in the list (stale after refresh)
|
|
137
|
+
// Initialize fee token when connector supports fee token selection
|
|
140
138
|
React.useEffect(() => {
|
|
141
|
-
if (
|
|
139
|
+
if (supportsFeeTokenSelection &&
|
|
140
|
+
tokenBalances &&
|
|
141
|
+
tokenBalances.length > 0) {
|
|
142
142
|
const currentTokenStillExists = currentFeeToken
|
|
143
143
|
? tokenBalances.some((token) => token.address === currentFeeToken.address)
|
|
144
144
|
: false;
|
|
@@ -146,7 +146,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
146
146
|
setCurrentFeeToken(tokenBalances[0]);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
}, [
|
|
149
|
+
}, [supportsFeeTokenSelection, tokenBalances, currentFeeToken]);
|
|
150
150
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
151
151
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
152
152
|
const { data: balance } = usePromise.usePromise(() => transaction.getBalance(), {
|
|
@@ -206,9 +206,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
206
206
|
? transaction.formatNonNativeToken(transaction.nonNativeValue, transaction.nonNativeDecimal)
|
|
207
207
|
: '';
|
|
208
208
|
};
|
|
209
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__body', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading,
|
|
210
|
-
// Tempo-specific props
|
|
211
|
-
isTempo: isTempo, feeTokenOptions: isTempo ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
209
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__body', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading, supportsFeeTokenSelection: supportsFeeTokenSelection, feeTokenOptions: supportsFeeTokenSelection ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
212
210
|
if (isNativeToken) {
|
|
213
211
|
transaction.value = transaction.parse(amount);
|
|
214
212
|
}
|
|
@@ -219,15 +217,14 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
219
217
|
transaction.nonNativeDecimal = currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals;
|
|
220
218
|
}
|
|
221
219
|
transaction.to = recipient;
|
|
222
|
-
|
|
223
|
-
if (isTempo && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
220
|
+
if (supportsFeeTokenSelection && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
224
221
|
transaction.feeTokenAddress = currentFeeToken.address;
|
|
225
222
|
transaction.feeTokenSymbol = currentFeeToken.symbol;
|
|
226
223
|
}
|
|
227
224
|
onSubmit();
|
|
228
225
|
}, initialValues: {
|
|
229
226
|
amount: getAmount(),
|
|
230
|
-
recipient: (
|
|
227
|
+
recipient: (_c = transaction.to) !== null && _c !== void 0 ? _c : '',
|
|
231
228
|
}, decimals: isNativeToken ? networkCurrencyDecimals : currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals, validateAddress: (value) => {
|
|
232
229
|
if (!value)
|
|
233
230
|
return true;
|
|
@@ -119,7 +119,7 @@ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
119
119
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
120
120
|
|
|
121
121
|
const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, displayPoweredByDynamicFooter = false, transaction, networkCurrencyDecimals, tokenBalances, currentToken, setCurrentToken, isLoading, isNativeToken, }) => {
|
|
122
|
-
var _a, _b;
|
|
122
|
+
var _a, _b, _c;
|
|
123
123
|
const { t } = useTranslation();
|
|
124
124
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
125
125
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
@@ -128,13 +128,13 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
128
128
|
});
|
|
129
129
|
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
130
130
|
const { chain } = useFetchChain(walletConnector);
|
|
131
|
-
|
|
132
|
-
const isTempo = ((_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.connectedChain) === 'TEMPO';
|
|
131
|
+
const supportsFeeTokenSelection = (_b = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false;
|
|
133
132
|
const [currentFeeToken, setCurrentFeeToken] = useState(undefined);
|
|
134
|
-
// Initialize fee token
|
|
135
|
-
// Also reset if current token is no longer in the list (stale after refresh)
|
|
133
|
+
// Initialize fee token when connector supports fee token selection
|
|
136
134
|
useEffect(() => {
|
|
137
|
-
if (
|
|
135
|
+
if (supportsFeeTokenSelection &&
|
|
136
|
+
tokenBalances &&
|
|
137
|
+
tokenBalances.length > 0) {
|
|
138
138
|
const currentTokenStillExists = currentFeeToken
|
|
139
139
|
? tokenBalances.some((token) => token.address === currentFeeToken.address)
|
|
140
140
|
: false;
|
|
@@ -142,7 +142,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
142
142
|
setCurrentFeeToken(tokenBalances[0]);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
}, [
|
|
145
|
+
}, [supportsFeeTokenSelection, tokenBalances, currentFeeToken]);
|
|
146
146
|
const closeButton = onClickClose && (jsx(IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
|
|
147
147
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }));
|
|
148
148
|
const { data: balance } = usePromise(() => transaction.getBalance(), {
|
|
@@ -202,9 +202,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
202
202
|
? transaction.formatNonNativeToken(transaction.nonNativeValue, transaction.nonNativeDecimal)
|
|
203
203
|
: '';
|
|
204
204
|
};
|
|
205
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxs("div", { className: 'send-balance-page-layout__body', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'send-balance-page-layout__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsx(SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading,
|
|
206
|
-
// Tempo-specific props
|
|
207
|
-
isTempo: isTempo, feeTokenOptions: isTempo ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
205
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxs("div", { className: 'send-balance-page-layout__body', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'send-balance-page-layout__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsx(SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading, supportsFeeTokenSelection: supportsFeeTokenSelection, feeTokenOptions: supportsFeeTokenSelection ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
208
206
|
if (isNativeToken) {
|
|
209
207
|
transaction.value = transaction.parse(amount);
|
|
210
208
|
}
|
|
@@ -215,15 +213,14 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
215
213
|
transaction.nonNativeDecimal = currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals;
|
|
216
214
|
}
|
|
217
215
|
transaction.to = recipient;
|
|
218
|
-
|
|
219
|
-
if (isTempo && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
216
|
+
if (supportsFeeTokenSelection && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
220
217
|
transaction.feeTokenAddress = currentFeeToken.address;
|
|
221
218
|
transaction.feeTokenSymbol = currentFeeToken.symbol;
|
|
222
219
|
}
|
|
223
220
|
onSubmit();
|
|
224
221
|
}, initialValues: {
|
|
225
222
|
amount: getAmount(),
|
|
226
|
-
recipient: (
|
|
223
|
+
recipient: (_c = transaction.to) !== null && _c !== void 0 ? _c : '',
|
|
227
224
|
}, decimals: isNativeToken ? networkCurrencyDecimals : currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals, validateAddress: (value) => {
|
|
228
225
|
if (!value)
|
|
229
226
|
return true;
|
|
@@ -120,7 +120,7 @@ require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
120
120
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
121
121
|
|
|
122
122
|
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, t, onFeeUpdate, }) => {
|
|
123
|
-
var _a, _b
|
|
123
|
+
var _a, _b;
|
|
124
124
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
125
125
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
126
126
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
@@ -136,17 +136,16 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
136
136
|
const isBitcoinTransaction = transaction.chain === 'BTC' ||
|
|
137
137
|
((_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _b === void 0 ? void 0 : _b.connectedChain) === 'BTC' ||
|
|
138
138
|
((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) && walletConnectorCore.isBitcoinConnector(primaryWallet.connector));
|
|
139
|
-
|
|
140
|
-
const isTempoTransaction = ((_c = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _c === void 0 ? void 0 : _c.connectedChain) === 'TEMPO';
|
|
139
|
+
const hasFeeToken = Boolean(transaction.feeTokenSymbol);
|
|
141
140
|
const bitcoinTransaction = transaction;
|
|
142
141
|
const [feePriority, setFeePriority] = React.useState((bitcoinTransaction === null || bitcoinTransaction === void 0 ? void 0 : bitcoinTransaction.feePriority) || 'medium');
|
|
143
142
|
const handleFeePriorityChange = React.useCallback((newPriority) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
var
|
|
143
|
+
var _c;
|
|
145
144
|
if (!isBitcoinTransaction || feePriority === newPriority) {
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
147
|
setFeePriority(newPriority);
|
|
149
|
-
yield ((
|
|
148
|
+
yield ((_c = bitcoinTransaction.updateFeePriority) === null || _c === void 0 ? void 0 : _c.call(bitcoinTransaction, newPriority));
|
|
150
149
|
onFeeUpdate === null || onFeeUpdate === void 0 ? void 0 : onFeeUpdate();
|
|
151
150
|
}), [isBitcoinTransaction, feePriority, bitcoinTransaction, onFeeUpdate]);
|
|
152
151
|
const renderTransferDetails = () => (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsx("div", { className: 'transaction-card__assets-container', children: jsxRuntime.jsx("div", { className: 'transaction-card__out', children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: t('dyn_send_transaction.confirmation.data.transfer.send') }), jsxRuntime.jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-info', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-row', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'error-1', "data-testid": 'transaction-transfer-amount', children: ["-", valueRounded ||
|
|
@@ -156,7 +155,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
156
155
|
})
|
|
157
156
|
: '')] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: currencySymbol })] }), transactionValue && (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'error-1', "data-testid": 'transaction-transfer-amount-fiat', children: ["$", utils.getDisplayFiatPrice(Number(transactionValue) || Number(valueRounded) || 0, currentToken)] }))] }), jsxRuntime.jsx("div", { className: 'transaction-card__icon', children: jsxRuntime.jsx("div", { className: 'transaction-card__icon__container', children: jsxRuntime.jsx("img", { src: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.logoURI) ||
|
|
158
157
|
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: currencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }) }) }));
|
|
159
|
-
const renderTransactionDetails = () => (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsxs("div", { className: 'transaction-card__details', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.destination', children: t('dyn_send_transaction.confirmation.data.destination') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-destination', children: shortenWalletAddress.shortenWalletAddress(transaction.to) })] }), (!isGasSponsored ||
|
|
158
|
+
const renderTransactionDetails = () => (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsxs("div", { className: 'transaction-card__details', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.destination', children: t('dyn_send_transaction.confirmation.data.destination') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-destination', children: shortenWalletAddress.shortenWalletAddress(transaction.to) })] }), (!isGasSponsored || hasFeeToken) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-card__divider' }), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', "data-testid": 'transaction-network', copykey: 'dyn_send_transaction.confirmation.data.network', children: t('dyn_send_transaction.confirmation.data.network') }), jsxRuntime.jsxs("div", { className: 'transaction-card__network-info', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) ||
|
|
160
159
|
(isBitcoinTransaction ? 'Bitcoin' : 'Ethereum') }), jsxRuntime.jsx("img", { src: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.iconUrls[0]) || (chain === null || chain === void 0 ? void 0 : chain.icon), alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) ||
|
|
161
160
|
(isBitcoinTransaction ? 'Bitcoin' : 'Network icon'), width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), isBitcoinTransaction && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-card__divider' }), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.fee_priority', children: "Fee Priority" }), jsxRuntime.jsxs("div", { className: 'transaction-card__value', style: {
|
|
162
161
|
alignItems: 'center',
|
|
@@ -182,7 +181,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
182
181
|
pointerEvents: 'none',
|
|
183
182
|
position: 'absolute',
|
|
184
183
|
right: 0,
|
|
185
|
-
}, children: jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) }) })] })] })] })), jsxRuntime.jsx("div", { className: 'transaction-card__divider' }), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'),
|
|
184
|
+
}, children: jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) }) })] })] })] })), jsxRuntime.jsx("div", { className: 'transaction-card__divider' }), jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'), hasFeeToken && (jsxRuntime.jsxs("span", { style: { fontWeight: 'normal' }, children: [' ', "(in ", transaction.feeTokenSymbol, ")"] }))] }), jsxRuntime.jsx(Tooltip.Tooltip, { content: hasFeeToken
|
|
186
185
|
? `Network fees paid in ${transaction.feeTokenSymbol}`
|
|
187
186
|
: 'Network fees are paid to process your transaction', className: 'transaction-confirmation', children: jsxRuntime.jsx(Icon.Icon, { size: 'small', className: 'fee-tooltip', children: jsxRuntime.jsx(tooltip.ReactComponent, {}) }) })] }), jsxRuntime.jsx("div", { className: 'transaction-card__value', children: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) ? (jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: Number(gasFiatValue) <= 0.01
|
|
188
187
|
? '<$0.01'
|
|
@@ -116,7 +116,7 @@ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
116
116
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
117
117
|
|
|
118
118
|
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, t, onFeeUpdate, }) => {
|
|
119
|
-
var _a, _b
|
|
119
|
+
var _a, _b;
|
|
120
120
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
121
121
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
122
122
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
@@ -132,17 +132,16 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
132
132
|
const isBitcoinTransaction = transaction.chain === 'BTC' ||
|
|
133
133
|
((_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _b === void 0 ? void 0 : _b.connectedChain) === 'BTC' ||
|
|
134
134
|
((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) && isBitcoinConnector(primaryWallet.connector));
|
|
135
|
-
|
|
136
|
-
const isTempoTransaction = ((_c = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _c === void 0 ? void 0 : _c.connectedChain) === 'TEMPO';
|
|
135
|
+
const hasFeeToken = Boolean(transaction.feeTokenSymbol);
|
|
137
136
|
const bitcoinTransaction = transaction;
|
|
138
137
|
const [feePriority, setFeePriority] = useState((bitcoinTransaction === null || bitcoinTransaction === void 0 ? void 0 : bitcoinTransaction.feePriority) || 'medium');
|
|
139
138
|
const handleFeePriorityChange = useCallback((newPriority) => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
-
var
|
|
139
|
+
var _c;
|
|
141
140
|
if (!isBitcoinTransaction || feePriority === newPriority) {
|
|
142
141
|
return;
|
|
143
142
|
}
|
|
144
143
|
setFeePriority(newPriority);
|
|
145
|
-
yield ((
|
|
144
|
+
yield ((_c = bitcoinTransaction.updateFeePriority) === null || _c === void 0 ? void 0 : _c.call(bitcoinTransaction, newPriority));
|
|
146
145
|
onFeeUpdate === null || onFeeUpdate === void 0 ? void 0 : onFeeUpdate();
|
|
147
146
|
}), [isBitcoinTransaction, feePriority, bitcoinTransaction, onFeeUpdate]);
|
|
148
147
|
const renderTransferDetails = () => (jsx("div", { className: 'transaction-card', children: jsx("div", { className: 'transaction-card__assets-container', children: jsx("div", { className: 'transaction-card__out', children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', children: t('dyn_send_transaction.confirmation.data.transfer.send') }), jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxs("div", { className: 'transaction-card__token-info', children: [jsxs("div", { className: 'transaction-card__token-row', children: [jsxs(Typography, { variant: 'body_normal', color: 'error-1', "data-testid": 'transaction-transfer-amount', children: ["-", valueRounded ||
|
|
@@ -152,7 +151,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
152
151
|
})
|
|
153
152
|
: '')] }), jsx(Typography, { variant: 'body_normal', color: 'secondary', children: currencySymbol })] }), transactionValue && (jsxs(Typography, { variant: 'body_small', color: 'error-1', "data-testid": 'transaction-transfer-amount-fiat', children: ["$", getDisplayFiatPrice(Number(transactionValue) || Number(valueRounded) || 0, currentToken)] }))] }), jsx("div", { className: 'transaction-card__icon', children: jsx("div", { className: 'transaction-card__icon__container', children: jsx("img", { src: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.logoURI) ||
|
|
154
153
|
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: currencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }) }) }));
|
|
155
|
-
const renderTransactionDetails = () => (jsx("div", { className: 'transaction-card', children: jsxs("div", { className: 'transaction-card__details', children: [jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.destination', children: t('dyn_send_transaction.confirmation.data.destination') }), jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-destination', children: shortenWalletAddress(transaction.to) })] }), (!isGasSponsored ||
|
|
154
|
+
const renderTransactionDetails = () => (jsx("div", { className: 'transaction-card', children: jsxs("div", { className: 'transaction-card__details', children: [jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.destination', children: t('dyn_send_transaction.confirmation.data.destination') }), jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-destination', children: shortenWalletAddress(transaction.to) })] }), (!isGasSponsored || hasFeeToken) && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', "data-testid": 'transaction-network', copykey: 'dyn_send_transaction.confirmation.data.network', children: t('dyn_send_transaction.confirmation.data.network') }), jsxs("div", { className: 'transaction-card__network-info', children: [jsx(Typography, { variant: 'body_normal', color: 'primary', children: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) ||
|
|
156
155
|
(isBitcoinTransaction ? 'Bitcoin' : 'Ethereum') }), jsx("img", { src: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.iconUrls[0]) || (chain === null || chain === void 0 ? void 0 : chain.icon), alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) ||
|
|
157
156
|
(isBitcoinTransaction ? 'Bitcoin' : 'Network icon'), width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), isBitcoinTransaction && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.fee_priority', children: "Fee Priority" }), jsxs("div", { className: 'transaction-card__value', style: {
|
|
158
157
|
alignItems: 'center',
|
|
@@ -178,7 +177,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
178
177
|
pointerEvents: 'none',
|
|
179
178
|
position: 'absolute',
|
|
180
179
|
right: 0,
|
|
181
|
-
}, children: jsx(Icon, { size: 'small', children: jsx(SvgChevronDown, {}) }) })] })] })] })), jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxs(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'),
|
|
180
|
+
}, children: jsx(Icon, { size: 'small', children: jsx(SvgChevronDown, {}) }) })] })] })] })), jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxs(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'), hasFeeToken && (jsxs("span", { style: { fontWeight: 'normal' }, children: [' ', "(in ", transaction.feeTokenSymbol, ")"] }))] }), jsx(Tooltip, { content: hasFeeToken
|
|
182
181
|
? `Network fees paid in ${transaction.feeTokenSymbol}`
|
|
183
182
|
: 'Network fees are paid to process your transaction', className: 'transaction-confirmation', children: jsx(Icon, { size: 'small', className: 'fee-tooltip', children: jsx(SvgTooltip, {}) }) })] }), jsx("div", { className: 'transaction-card__value', children: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) ? (jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: Number(gasFiatValue) <= 0.01
|
|
184
183
|
? '<$0.01'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { AleoIcon, AlgorandIcon, AptosIcon, BitcoinIcon, CosmosIcon, EclipseIcon, EthereumIcon, FlowIcon, SolanaIcon, SparkIcon, StarknetIcon, StellarIcon, SuiIcon, TempoIcon, TonIcon, TronIcon } from '@dynamic-labs/iconic';
|
|
2
|
+
import { AleoIcon, AlgorandIcon, AptosIcon, BitcoinIcon, CosmosIcon, EclipseIcon, EthereumIcon, FlowIcon, MidnightIcon, SolanaIcon, SparkIcon, StarknetIcon, StellarIcon, SuiIcon, TempoIcon, TonIcon, TronIcon } from '@dynamic-labs/iconic';
|
|
3
3
|
import { getChainInfo } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import 'react';
|
|
5
5
|
import { ReactComponent as SvgError } from '../../../assets/error.js';
|
|
@@ -15,6 +15,7 @@ const chainIconMap = {
|
|
|
15
15
|
eclipse: EclipseIcon,
|
|
16
16
|
evm: EthereumIcon,
|
|
17
17
|
flow: FlowIcon,
|
|
18
|
+
midnight: MidnightIcon,
|
|
18
19
|
solana: SolanaIcon,
|
|
19
20
|
spark: SparkIcon,
|
|
20
21
|
starknet: StarknetIcon,
|
|
@@ -84,12 +84,14 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, aleoNetw
|
|
|
84
84
|
bitcoinNetworksOverrides,
|
|
85
85
|
]);
|
|
86
86
|
const createNetwork = (network, parser = (input) => input) => {
|
|
87
|
+
var _a, _b;
|
|
87
88
|
const result = {
|
|
88
89
|
bech32Prefix: network.bech32Prefix,
|
|
89
90
|
blockExplorerUrls: network.blockExplorerUrls,
|
|
90
91
|
chainId: parser(network.chainId),
|
|
91
92
|
cluster: network.cluster,
|
|
92
93
|
genesisHash: network.genesisHash,
|
|
94
|
+
hasNativeToken: (_a = network.hasNativeToken) !== null && _a !== void 0 ? _a : true,
|
|
93
95
|
iconUrls: network.iconUrls,
|
|
94
96
|
isTestnet: network.isTestnet,
|
|
95
97
|
key: network.key,
|
|
@@ -99,6 +101,7 @@ const createNetwork = (network, parser = (input) => input) => {
|
|
|
99
101
|
networkId: parser(network.networkId),
|
|
100
102
|
privateCustomerRpcUrls: network.privateCustomerRpcUrls,
|
|
101
103
|
rpcUrls: network.rpcUrls,
|
|
104
|
+
supportsFeeTokenSelection: (_b = network.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false,
|
|
102
105
|
vanityName: network.vanityName,
|
|
103
106
|
};
|
|
104
107
|
return result;
|
|
@@ -80,12 +80,14 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, aleoNetw
|
|
|
80
80
|
bitcoinNetworksOverrides,
|
|
81
81
|
]);
|
|
82
82
|
const createNetwork = (network, parser = (input) => input) => {
|
|
83
|
+
var _a, _b;
|
|
83
84
|
const result = {
|
|
84
85
|
bech32Prefix: network.bech32Prefix,
|
|
85
86
|
blockExplorerUrls: network.blockExplorerUrls,
|
|
86
87
|
chainId: parser(network.chainId),
|
|
87
88
|
cluster: network.cluster,
|
|
88
89
|
genesisHash: network.genesisHash,
|
|
90
|
+
hasNativeToken: (_a = network.hasNativeToken) !== null && _a !== void 0 ? _a : true,
|
|
89
91
|
iconUrls: network.iconUrls,
|
|
90
92
|
isTestnet: network.isTestnet,
|
|
91
93
|
key: network.key,
|
|
@@ -95,6 +97,7 @@ const createNetwork = (network, parser = (input) => input) => {
|
|
|
95
97
|
networkId: parser(network.networkId),
|
|
96
98
|
privateCustomerRpcUrls: network.privateCustomerRpcUrls,
|
|
97
99
|
rpcUrls: network.rpcUrls,
|
|
100
|
+
supportsFeeTokenSelection: (_b = network.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false,
|
|
98
101
|
vanityName: network.vanityName,
|
|
99
102
|
};
|
|
100
103
|
return result;
|
|
@@ -89,6 +89,7 @@ require('../../utils/hooks/useGetMfaToken/useGetMfaToken.cjs');
|
|
|
89
89
|
require('../../utils/hooks/useWalletBackup/useWalletBackup.cjs');
|
|
90
90
|
require('../../utils/hooks/useWalletBackup/types.cjs');
|
|
91
91
|
require('../../utils/hooks/useWalletBackup/cloudProviders.cjs');
|
|
92
|
+
var useStepUpAuthentication = require('../../utils/hooks/useStepUpAuthentication/useStepUpAuthentication.cjs');
|
|
92
93
|
require('../../context/IpConfigurationContext/IpConfigurationContext.cjs');
|
|
93
94
|
require('../../context/ConnectWithOtpContext/ConnectWithOtpContext.cjs');
|
|
94
95
|
require('../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.cjs');
|
|
@@ -114,9 +115,7 @@ require('../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds
|
|
|
114
115
|
var useNetworkDataFromWallet = require('../../utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.cjs');
|
|
115
116
|
var useTokenBalances = require('../../utils/hooks/useTokenBalances/useTokenBalances.cjs');
|
|
116
117
|
require('../../store/state/multichainBalances.cjs');
|
|
117
|
-
var usePromptMfaAuth = require('../../utils/hooks/usePromptMfaAuth/usePromptMfaAuth.cjs');
|
|
118
118
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
119
|
-
var useIsMfaRequiredForAction = require('../../utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.cjs');
|
|
120
119
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
121
120
|
|
|
122
121
|
const usingNative = (token) => Boolean(token.isNative);
|
|
@@ -148,8 +147,7 @@ const getSupportedChainName = (connectedChain) => {
|
|
|
148
147
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
149
148
|
const [stage, setStage] = React.useState('form');
|
|
150
149
|
const { primaryWallet, walletUiUtils } = useInternalDynamicContext.useInternalDynamicContext();
|
|
151
|
-
const
|
|
152
|
-
const promptMfaAuth = usePromptMfaAuth.usePromptMfaAuth();
|
|
150
|
+
const { isStepUpRequired, promptStepUpAuth } = useStepUpAuthentication.useStepUpAuthentication();
|
|
153
151
|
const { t } = reactI18next.useTranslation();
|
|
154
152
|
const [isNativeToken, setIsNativeToken] = React.useState(false);
|
|
155
153
|
const [currentToken, setCurrentToken] = React.useState(undefined);
|
|
@@ -238,11 +236,13 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
238
236
|
: networkData.nativeCurrency.decimals, walletAddress: shortenWalletAddress.shortenWalletAddress(currentToken === null || currentToken === void 0 ? void 0 : currentToken.address), walletKey: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.key, onClickClose: onClickClose, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSubmit: () => setStage('confirmation'), tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, isNativeToken: isNativeToken }));
|
|
239
237
|
const buildTransactionStage = () => (jsxRuntime.jsx(TransactionConfirmationView.TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
240
238
|
if (primaryWallet.connector.key === 'dynamicwaas') {
|
|
241
|
-
const
|
|
242
|
-
|
|
239
|
+
const requiresStepUp = yield isStepUpRequired({
|
|
240
|
+
scope: sdkApiCore.TokenScope.Walletsign,
|
|
243
241
|
});
|
|
244
|
-
if (
|
|
245
|
-
yield
|
|
242
|
+
if (requiresStepUp) {
|
|
243
|
+
yield promptStepUpAuth({
|
|
244
|
+
requestedScopes: [sdkApiCore.TokenScope.Walletsign],
|
|
245
|
+
});
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
248
|
walletUiUtils.disabledConfirmationOnce();
|
|
@@ -3,7 +3,7 @@ import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
|
3
3
|
import { jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { useState, useEffect } from 'react';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
-
import { ChainEnum,
|
|
6
|
+
import { ChainEnum, TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
7
7
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
8
8
|
import { isSendBalanceWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
9
9
|
import { ChainIcon } from '../../components/ChainIcon/ChainIcon.js';
|
|
@@ -85,6 +85,7 @@ import '../../utils/hooks/useGetMfaToken/useGetMfaToken.js';
|
|
|
85
85
|
import '../../utils/hooks/useWalletBackup/useWalletBackup.js';
|
|
86
86
|
import '../../utils/hooks/useWalletBackup/types.js';
|
|
87
87
|
import '../../utils/hooks/useWalletBackup/cloudProviders.js';
|
|
88
|
+
import { useStepUpAuthentication } from '../../utils/hooks/useStepUpAuthentication/useStepUpAuthentication.js';
|
|
88
89
|
import '../../context/IpConfigurationContext/IpConfigurationContext.js';
|
|
89
90
|
import '../../context/ConnectWithOtpContext/ConnectWithOtpContext.js';
|
|
90
91
|
import '../../widgets/DynamicBridgeWidget/views/WalletsView/components/SecondaryWallets/SecondaryWallets.js';
|
|
@@ -110,9 +111,7 @@ import '../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.
|
|
|
110
111
|
import { useNetworkDataFromWallet } from '../../utils/hooks/useNetworkDataFromWallet/useNetworkDataFromWallet.js';
|
|
111
112
|
import { useTokenBalances } from '../../utils/hooks/useTokenBalances/useTokenBalances.js';
|
|
112
113
|
import '../../store/state/multichainBalances.js';
|
|
113
|
-
import { usePromptMfaAuth } from '../../utils/hooks/usePromptMfaAuth/usePromptMfaAuth.js';
|
|
114
114
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
115
|
-
import { useIsMfaRequiredForAction } from '../../utils/hooks/useIsMfaRequiredForAction/useIsMfaRequiredForAction.js';
|
|
116
115
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
117
116
|
|
|
118
117
|
const usingNative = (token) => Boolean(token.isNative);
|
|
@@ -144,8 +143,7 @@ const getSupportedChainName = (connectedChain) => {
|
|
|
144
143
|
const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBack, onClickClose, onError, onSuccess, onDone, displayPoweredByDynamicFooter = false, }) => {
|
|
145
144
|
const [stage, setStage] = useState('form');
|
|
146
145
|
const { primaryWallet, walletUiUtils } = useInternalDynamicContext();
|
|
147
|
-
const
|
|
148
|
-
const promptMfaAuth = usePromptMfaAuth();
|
|
146
|
+
const { isStepUpRequired, promptStepUpAuth } = useStepUpAuthentication();
|
|
149
147
|
const { t } = useTranslation();
|
|
150
148
|
const [isNativeToken, setIsNativeToken] = useState(false);
|
|
151
149
|
const [currentToken, setCurrentToken] = useState(undefined);
|
|
@@ -234,11 +232,13 @@ const SendBalanceView = ({ initialRecipientAddress = '', initialValue, onClickBa
|
|
|
234
232
|
: networkData.nativeCurrency.decimals, walletAddress: shortenWalletAddress(currentToken === null || currentToken === void 0 ? void 0 : currentToken.address), walletKey: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.key, onClickClose: onClickClose, displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, onSubmit: () => setStage('confirmation'), tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, isNativeToken: isNativeToken }));
|
|
235
233
|
const buildTransactionStage = () => (jsx(TransactionConfirmationView, { walletConnector: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector, transaction: transaction, mutation: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
236
234
|
if (primaryWallet.connector.key === 'dynamicwaas') {
|
|
237
|
-
const
|
|
238
|
-
|
|
235
|
+
const requiresStepUp = yield isStepUpRequired({
|
|
236
|
+
scope: TokenScope.Walletsign,
|
|
239
237
|
});
|
|
240
|
-
if (
|
|
241
|
-
yield
|
|
238
|
+
if (requiresStepUp) {
|
|
239
|
+
yield promptStepUpAuth({
|
|
240
|
+
requestedScopes: [TokenScope.Walletsign],
|
|
241
|
+
});
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
walletUiUtils.disabledConfirmationOnce();
|
|
@@ -4,7 +4,7 @@ interface IChain {
|
|
|
4
4
|
enabled: boolean;
|
|
5
5
|
name: string;
|
|
6
6
|
}
|
|
7
|
-
export declare const getEnabledChains: (chains: IChain[]) => ("ALEO" | "STARK" | "STELLAR" | "TEMPO" | "ALGO" | "APTOS" | "ATOM" | "BTC" | "COSMOS" | "ECLIPSE" | "ETH" | "EVM" | "FLOW" | "SOL" | "SPARK" | "SUI" | "TRON" | "TON")[];
|
|
7
|
+
export declare const getEnabledChains: (chains: IChain[]) => ("ALEO" | "STARK" | "STELLAR" | "TEMPO" | "ALGO" | "APTOS" | "ATOM" | "BTC" | "COSMOS" | "ECLIPSE" | "ETH" | "EVM" | "FLOW" | "MIDNIGHT" | "SOL" | "SPARK" | "SUI" | "TRON" | "TON")[];
|
|
8
8
|
type BaseGetSupportedWalletOpts = Omit<GetSupportedWalletsOpts, 'walletConnectProjectId' | 'chainRpcProviders'>;
|
|
9
9
|
export declare const getWallets: (props: {
|
|
10
10
|
getSupportedWalletOpts: BaseGetSupportedWalletOpts;
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs
CHANGED
|
@@ -120,7 +120,7 @@ var TokenBalanceList = require('./TokenBalanceList/TokenBalanceList.cjs');
|
|
|
120
120
|
|
|
121
121
|
/** Component to display token balances for the primary wallet */
|
|
122
122
|
const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
123
|
-
var _a;
|
|
123
|
+
var _a, _b, _c;
|
|
124
124
|
const { t } = reactI18next.useTranslation();
|
|
125
125
|
/** Controls for the multi asset balance accordion */
|
|
126
126
|
const [balanceIsExpanded, setBalanceIsExpanded] = React.useState(false);
|
|
@@ -132,14 +132,13 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
132
132
|
const successTimeoutRef = React.useRef(null);
|
|
133
133
|
const refreshTimeoutRef = React.useRef(null);
|
|
134
134
|
const { primaryWallet, network, showFiat, multiAsset } = useInternalDynamicContext.useInternalDynamicContext();
|
|
135
|
-
|
|
136
|
-
const isTempo = (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain) === 'TEMPO';
|
|
135
|
+
const hasNativeToken = (_b = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.hasNativeToken) !== null && _b !== void 0 ? _b : true;
|
|
137
136
|
const authMode$1 = authMode.useAuthMode();
|
|
138
137
|
const projectSettings = useProjectSettings.useProjectSettings();
|
|
139
138
|
const { data: testnet } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () { return Boolean(yield (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isTestnet())); }), { deps: [network], initialData: false });
|
|
140
139
|
const { isLoading: isLoadingTokenBalances, tokenBalances, error: errorTokenBalances, fetchAccountBalances, } = useTokenBalances.useTokenBalances({
|
|
141
140
|
chainName: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain,
|
|
142
|
-
includeFiat: showFiat ||
|
|
141
|
+
includeFiat: showFiat || !hasNativeToken,
|
|
143
142
|
includeNativeBalance: true,
|
|
144
143
|
});
|
|
145
144
|
const filteredTokenBalances = React.useMemo(() => (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [], [tokenBalances]);
|
|
@@ -152,7 +151,7 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
152
151
|
multiAsset;
|
|
153
152
|
}, [
|
|
154
153
|
authMode$1,
|
|
155
|
-
(
|
|
154
|
+
(_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.featureFlags) === null || _c === void 0 ? void 0 : _c.connectOnlyMultiAsset,
|
|
156
155
|
multiAsset,
|
|
157
156
|
]);
|
|
158
157
|
const isTooManyRequests = errorTokenBalances === 'Too many requests fetching balances';
|
|
@@ -202,8 +201,8 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
202
201
|
if (!primaryWallet || isLoadingTokenBalances || isLoading) {
|
|
203
202
|
return jsxRuntime.jsx(Skeleton.Skeleton, { className: 'balance-container__skeleton' });
|
|
204
203
|
}
|
|
205
|
-
//
|
|
206
|
-
if (
|
|
204
|
+
// Chain has no native token - show aggregated fiat token values
|
|
205
|
+
if (!hasNativeToken) {
|
|
207
206
|
return (jsxRuntime.jsx(Typography.Typography, { variant: 'numbers_display', color: 'primary', children: totalValue === 0 || totalValue >= 0.01
|
|
208
207
|
? currencyFormatter.format(parseFloat(totalValue.toFixed(2)))
|
|
209
208
|
: '<$0.01' }));
|
|
@@ -116,7 +116,7 @@ import { TokenBalanceList } from './TokenBalanceList/TokenBalanceList.js';
|
|
|
116
116
|
|
|
117
117
|
/** Component to display token balances for the primary wallet */
|
|
118
118
|
const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
119
|
-
var _a;
|
|
119
|
+
var _a, _b, _c;
|
|
120
120
|
const { t } = useTranslation();
|
|
121
121
|
/** Controls for the multi asset balance accordion */
|
|
122
122
|
const [balanceIsExpanded, setBalanceIsExpanded] = useState(false);
|
|
@@ -128,14 +128,13 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
128
128
|
const successTimeoutRef = useRef(null);
|
|
129
129
|
const refreshTimeoutRef = useRef(null);
|
|
130
130
|
const { primaryWallet, network, showFiat, multiAsset } = useInternalDynamicContext();
|
|
131
|
-
|
|
132
|
-
const isTempo = (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain) === 'TEMPO';
|
|
131
|
+
const hasNativeToken = (_b = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.hasNativeToken) !== null && _b !== void 0 ? _b : true;
|
|
133
132
|
const authMode = useAuthMode();
|
|
134
133
|
const projectSettings = useProjectSettings();
|
|
135
134
|
const { data: testnet } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () { return Boolean(yield (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isTestnet())); }), { deps: [network], initialData: false });
|
|
136
135
|
const { isLoading: isLoadingTokenBalances, tokenBalances, error: errorTokenBalances, fetchAccountBalances, } = useTokenBalances({
|
|
137
136
|
chainName: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain,
|
|
138
|
-
includeFiat: showFiat ||
|
|
137
|
+
includeFiat: showFiat || !hasNativeToken,
|
|
139
138
|
includeNativeBalance: true,
|
|
140
139
|
});
|
|
141
140
|
const filteredTokenBalances = useMemo(() => (tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.filter((token) => token.name)) || [], [tokenBalances]);
|
|
@@ -148,7 +147,7 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
148
147
|
multiAsset;
|
|
149
148
|
}, [
|
|
150
149
|
authMode,
|
|
151
|
-
(
|
|
150
|
+
(_c = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.featureFlags) === null || _c === void 0 ? void 0 : _c.connectOnlyMultiAsset,
|
|
152
151
|
multiAsset,
|
|
153
152
|
]);
|
|
154
153
|
const isTooManyRequests = errorTokenBalances === 'Too many requests fetching balances';
|
|
@@ -198,8 +197,8 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
198
197
|
if (!primaryWallet || isLoadingTokenBalances || isLoading) {
|
|
199
198
|
return jsx(Skeleton, { className: 'balance-container__skeleton' });
|
|
200
199
|
}
|
|
201
|
-
//
|
|
202
|
-
if (
|
|
200
|
+
// Chain has no native token - show aggregated fiat token values
|
|
201
|
+
if (!hasNativeToken) {
|
|
203
202
|
return (jsx(Typography, { variant: 'numbers_display', color: 'primary', children: totalValue === 0 || totalValue >= 0.01
|
|
204
203
|
? currencyFormatter.format(parseFloat(totalValue.toFixed(2)))
|
|
205
204
|
: '<$0.01' }));
|