@dynamic-labs/sdk-react-core 4.74.1 → 4.76.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 +21 -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/context/ErrorContext/hooks/useErrorText/useErrorText.cjs +1 -0
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.js +1 -0
- package/src/lib/data/api/email/email.cjs +3 -0
- package/src/lib/data/api/email/email.js +4 -1
- package/src/lib/data/api/oauth/oauth.cjs +6 -0
- package/src/lib/data/api/oauth/oauth.js +7 -1
- package/src/lib/data/api/sms/sms.cjs +6 -0
- package/src/lib/data/api/sms/sms.js +7 -1
- package/src/lib/data/api/wallets/wallets.cjs +6 -0
- package/src/lib/data/api/wallets/wallets.js +7 -1
- 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/utils/hooks/useTransition/useTransition.cjs +14 -3
- package/src/lib/utils/hooks/useTransition/useTransition.js +14 -3
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +4 -0
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +5 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +6 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +7 -1
- 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,25 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.76.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.75.0...v4.76.0) (2026-04-06)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* handle credential_not_enabled_for_sign_in error across all sign-in methods ([#10819](https://github.com/dynamic-labs/dynamic-auth/issues/10819)) ([f694b85](https://github.com/dynamic-labs/dynamic-auth/commit/f694b857eab9d377626078d290473ca369652331))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* modal transition race condition (opacity stuck at 0) ([#10857](https://github.com/dynamic-labs/dynamic-auth/issues/10857)) ([6e9ec68](https://github.com/dynamic-labs/dynamic-auth/commit/6e9ec68040776cc5be333ad20ad0096374947b74))
|
|
13
|
+
* **react-native:** ensure session is correctly mapped ([#10860](https://github.com/dynamic-labs/dynamic-auth/issues/10860)) ([117b013](https://github.com/dynamic-labs/dynamic-auth/commit/117b013faf9a0d4bc6b8429a36d8e88dba546889))
|
|
14
|
+
|
|
15
|
+
## [4.75.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.74.1...v4.75.0) (2026-04-03)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **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))
|
|
21
|
+
* **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))
|
|
22
|
+
|
|
2
23
|
### [4.74.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.74.0...v4.74.1) (2026-04-02)
|
|
3
24
|
|
|
4
25
|
This was a version bump only, there were no code changes.
|
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.76.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.76.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.76.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.76.0",
|
|
20
|
+
"@dynamic-labs/iconic": "4.76.0",
|
|
21
|
+
"@dynamic-labs/locale": "4.76.0",
|
|
22
|
+
"@dynamic-labs/logger": "4.76.0",
|
|
23
|
+
"@dynamic-labs/multi-wallet": "4.76.0",
|
|
24
|
+
"@dynamic-labs/rpc-providers": "4.76.0",
|
|
25
|
+
"@dynamic-labs/store": "4.76.0",
|
|
26
|
+
"@dynamic-labs/types": "4.76.0",
|
|
27
|
+
"@dynamic-labs/utils": "4.76.0",
|
|
28
|
+
"@dynamic-labs/wallet-book": "4.76.0",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "4.76.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
|
};
|