@dynamic-labs/sdk-react-core 4.23.0 → 4.23.1
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 +2 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +13 -13
- package/src/lib/locale/en/translation.cjs +2 -0
- package/src/lib/locale/en/translation.d.ts +2 -0
- package/src/lib/locale/en/translation.js +2 -0
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useRegisterPasskey/useRegisterPasskey.d.ts +2 -2
- package/src/lib/utils/hooks/useSubmitExchangeFunding/useSubmitExchangeFunding.cjs +11 -2
- package/src/lib/utils/hooks/useSubmitExchangeFunding/useSubmitExchangeFunding.js +11 -2
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.cjs +17 -8
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.d.ts +1 -1
- package/src/lib/views/EmbeddedReveal/utils/turnkeyExport/turnkeyExport.js +17 -8
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.cjs +8 -2
- package/src/lib/views/EmbeddedReveal/utils/waasExport/waasExport.js +8 -2
- package/src/lib/views/ExchangeList/ExchangeList.cjs +4 -9
- package/src/lib/views/ExchangeList/ExchangeList.js +5 -10
- package/src/lib/widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs +0 -6
- package/src/lib/widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js +1 -6
- package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.cjs +2 -2
- package/src/lib/widgets/DynamicWidget/views/DepositedExchangeView/DepositedExchangeView.js +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VerifyResponse } from '@dynamic-labs/sdk-api-core';
|
|
2
2
|
/**
|
|
3
3
|
* Register passkey
|
|
4
4
|
*
|
|
@@ -18,4 +18,4 @@ import { UserPasskey } from '@dynamic-labs/sdk-api-core';
|
|
|
18
18
|
* );
|
|
19
19
|
* }
|
|
20
20
|
*/
|
|
21
|
-
export declare const useRegisterPasskey: () => (() => Promise<
|
|
21
|
+
export declare const useRegisterPasskey: () => (() => Promise<VerifyResponse>);
|
|
@@ -105,7 +105,7 @@ const useSubmitExchangeFunding = () => {
|
|
|
105
105
|
const { exchangeTransfer } = useExchangeAccounts.useExchangeAccounts();
|
|
106
106
|
const { setDynamicWidgetView, goToInitialDynamicWidgetView, setHeaderAlert } = DynamicWidgetContext.useWidgetContext();
|
|
107
107
|
const { clearStackAndPush } = ViewContext.useViewContext();
|
|
108
|
-
const {
|
|
108
|
+
const { setShowAuthFlow } = useInternalDynamicContext.useInternalDynamicContext();
|
|
109
109
|
const { t } = reactI18next.useTranslation();
|
|
110
110
|
const submit = React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ tokenAmount, exchange, tokenSymbol, mfaCode, toAddress, props, }) {
|
|
111
111
|
if (!tokenAmount)
|
|
@@ -161,6 +161,16 @@ const useSubmitExchangeFunding = () => {
|
|
|
161
161
|
showError = true;
|
|
162
162
|
errorMessage = t('dyn_exchange_transfer_errors.invalid_balance');
|
|
163
163
|
}
|
|
164
|
+
else if (error.code ===
|
|
165
|
+
sdkApiCore.UnprocessableEntityErrorCode.TransferAmountTooSmall) {
|
|
166
|
+
showError = true;
|
|
167
|
+
errorMessage = t('dyn_exchange_transfer_errors.amount_too_small');
|
|
168
|
+
}
|
|
169
|
+
else if (error.code ===
|
|
170
|
+
sdkApiCore.UnprocessableEntityErrorCode.TransferAddressNotWhitelisted) {
|
|
171
|
+
showError = true;
|
|
172
|
+
errorMessage = t('dyn_exchange_transfer_errors.address_not_whitelisted');
|
|
173
|
+
}
|
|
164
174
|
else {
|
|
165
175
|
showError = true;
|
|
166
176
|
errorMessage = t('dyn_exchange_transfer_errors.unknown');
|
|
@@ -179,7 +189,6 @@ const useSubmitExchangeFunding = () => {
|
|
|
179
189
|
clearStackAndPush,
|
|
180
190
|
exchangeTransfer,
|
|
181
191
|
goToInitialDynamicWidgetView,
|
|
182
|
-
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector,
|
|
183
192
|
setDynamicWidgetView,
|
|
184
193
|
setHeaderAlert,
|
|
185
194
|
setShowAuthFlow,
|
|
@@ -101,7 +101,7 @@ const useSubmitExchangeFunding = () => {
|
|
|
101
101
|
const { exchangeTransfer } = useExchangeAccounts();
|
|
102
102
|
const { setDynamicWidgetView, goToInitialDynamicWidgetView, setHeaderAlert } = useWidgetContext();
|
|
103
103
|
const { clearStackAndPush } = useViewContext();
|
|
104
|
-
const {
|
|
104
|
+
const { setShowAuthFlow } = useInternalDynamicContext();
|
|
105
105
|
const { t } = useTranslation();
|
|
106
106
|
const submit = useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ tokenAmount, exchange, tokenSymbol, mfaCode, toAddress, props, }) {
|
|
107
107
|
if (!tokenAmount)
|
|
@@ -157,6 +157,16 @@ const useSubmitExchangeFunding = () => {
|
|
|
157
157
|
showError = true;
|
|
158
158
|
errorMessage = t('dyn_exchange_transfer_errors.invalid_balance');
|
|
159
159
|
}
|
|
160
|
+
else if (error.code ===
|
|
161
|
+
UnprocessableEntityErrorCode.TransferAmountTooSmall) {
|
|
162
|
+
showError = true;
|
|
163
|
+
errorMessage = t('dyn_exchange_transfer_errors.amount_too_small');
|
|
164
|
+
}
|
|
165
|
+
else if (error.code ===
|
|
166
|
+
UnprocessableEntityErrorCode.TransferAddressNotWhitelisted) {
|
|
167
|
+
showError = true;
|
|
168
|
+
errorMessage = t('dyn_exchange_transfer_errors.address_not_whitelisted');
|
|
169
|
+
}
|
|
160
170
|
else {
|
|
161
171
|
showError = true;
|
|
162
172
|
errorMessage = t('dyn_exchange_transfer_errors.unknown');
|
|
@@ -175,7 +185,6 @@ const useSubmitExchangeFunding = () => {
|
|
|
175
185
|
clearStackAndPush,
|
|
176
186
|
exchangeTransfer,
|
|
177
187
|
goToInitialDynamicWidgetView,
|
|
178
|
-
primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector,
|
|
179
188
|
setDynamicWidgetView,
|
|
180
189
|
setHeaderAlert,
|
|
181
190
|
setShowAuthFlow,
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
|
-
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
9
|
require('@dynamic-labs/sdk-api-core');
|
|
10
10
|
require('@dynamic-labs-sdk/client/core');
|
|
11
11
|
require('react');
|
|
@@ -14,7 +14,7 @@ require('../../../../client/client.cjs');
|
|
|
14
14
|
require('../../../../utils/constants/values.cjs');
|
|
15
15
|
var errors = require('../../../../utils/constants/errors.cjs');
|
|
16
16
|
require('@dynamic-labs/multi-wallet');
|
|
17
|
-
require('../../../../shared/logger.cjs');
|
|
17
|
+
var logger = require('../../../../shared/logger.cjs');
|
|
18
18
|
require('../../../../utils/constants/colors.cjs');
|
|
19
19
|
require('react-international-phone');
|
|
20
20
|
require('@dynamic-labs/iconic');
|
|
@@ -33,13 +33,22 @@ var embeddedWallets = require('../../../../data/api/embeddedWallets/embeddedWall
|
|
|
33
33
|
require('../../../../locale/locale.cjs');
|
|
34
34
|
|
|
35
35
|
const initExport = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ iframeContainer, iframeElementId, wallet, }) {
|
|
36
|
-
var _b;
|
|
36
|
+
var _b, _c;
|
|
37
37
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
38
38
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
39
39
|
!walletConnectorCore.isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
40
|
+
logger.logger.error('Cannot initialize embedded wallet export', {
|
|
41
|
+
connector: (_b = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _b === void 0 ? void 0 : _b.name,
|
|
42
|
+
foo: (wallet === null || wallet === void 0 ? void 0 : wallet.connector)
|
|
43
|
+
? walletConnectorCore.isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)
|
|
44
|
+
: undefined,
|
|
45
|
+
version: 'v2',
|
|
46
|
+
wallet: Boolean(wallet),
|
|
47
|
+
walletId: wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
48
|
+
});
|
|
40
49
|
throw new utils.DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings', errors.INVALID_WALLET_DATA);
|
|
41
50
|
}
|
|
42
|
-
const turnkeyExportHandler = (
|
|
51
|
+
const turnkeyExportHandler = (_c = wallet.connector) === null || _c === void 0 ? void 0 : _c.getExportHandler();
|
|
43
52
|
const publicKey = yield turnkeyExportHandler.initExport(iframeContainer, iframeElementId);
|
|
44
53
|
if (!publicKey) {
|
|
45
54
|
throw new utils.DynamicError('Something went wrong', errors.ERROR_PROCESSING_REVEAL_REQUEST);
|
|
@@ -83,7 +92,7 @@ const extractExportBundle = ({ address, privateKeyId, activity, }) => {
|
|
|
83
92
|
: exportWalletResult;
|
|
84
93
|
return result === null || result === void 0 ? void 0 : result.exportBundle;
|
|
85
94
|
};
|
|
86
|
-
const exportCredential = (
|
|
95
|
+
const exportCredential = (_d) => _tslib.__awaiter(void 0, [_d], void 0, function* ({ user, wallet, environmentId, address, }) {
|
|
87
96
|
const { connector, turnkeyHDWalletId, privateKeyId, organizationId } = handleExportInitCheck({
|
|
88
97
|
user,
|
|
89
98
|
wallet,
|
|
@@ -141,11 +150,11 @@ const exportCredential = (_c) => _tslib.__awaiter(void 0, [_c], void 0, function
|
|
|
141
150
|
organizationId,
|
|
142
151
|
});
|
|
143
152
|
});
|
|
144
|
-
const cleanupExport = (
|
|
145
|
-
var
|
|
153
|
+
const cleanupExport = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ wallet }) {
|
|
154
|
+
var _f;
|
|
146
155
|
const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
|
|
147
156
|
// clear iframeStamper and its reference
|
|
148
|
-
(
|
|
157
|
+
(_f = connector === null || connector === void 0 ? void 0 : connector.getExportHandler()) === null || _f === void 0 ? void 0 : _f.clear();
|
|
149
158
|
});
|
|
150
159
|
|
|
151
160
|
exports.cleanupExport = cleanupExport;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Wallet } from '../../../../shared';
|
|
2
1
|
import { UserProfile } from '../../../../..';
|
|
2
|
+
import { Wallet } from '../../../../shared';
|
|
3
3
|
export declare const initExport: ({ iframeContainer, iframeElementId, wallet, }: {
|
|
4
4
|
iframeContainer: HTMLElement;
|
|
5
5
|
iframeElementId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { isPasskeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
4
3
|
import { DynamicError } from '@dynamic-labs/utils';
|
|
4
|
+
import { isPasskeyWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import '@dynamic-labs-sdk/client/core';
|
|
7
7
|
import 'react';
|
|
@@ -10,7 +10,7 @@ import '../../../../client/client.js';
|
|
|
10
10
|
import '../../../../utils/constants/values.js';
|
|
11
11
|
import { INVALID_WALLET_DATA, ERROR_PROCESSING_REVEAL_REQUEST, USER_NOT_LOGGED_IN } from '../../../../utils/constants/errors.js';
|
|
12
12
|
import '@dynamic-labs/multi-wallet';
|
|
13
|
-
import '../../../../shared/logger.js';
|
|
13
|
+
import { logger } from '../../../../shared/logger.js';
|
|
14
14
|
import '../../../../utils/constants/colors.js';
|
|
15
15
|
import 'react-international-phone';
|
|
16
16
|
import '@dynamic-labs/iconic';
|
|
@@ -29,13 +29,22 @@ import { exportEmbeddedWallet } from '../../../../data/api/embeddedWallets/embed
|
|
|
29
29
|
import '../../../../locale/locale.js';
|
|
30
30
|
|
|
31
31
|
const initExport = (_a) => __awaiter(void 0, [_a], void 0, function* ({ iframeContainer, iframeElementId, wallet, }) {
|
|
32
|
-
var _b;
|
|
32
|
+
var _b, _c;
|
|
33
33
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) ||
|
|
34
34
|
!(wallet === null || wallet === void 0 ? void 0 : wallet.id) ||
|
|
35
35
|
!isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)) {
|
|
36
|
+
logger.error('Cannot initialize embedded wallet export', {
|
|
37
|
+
connector: (_b = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _b === void 0 ? void 0 : _b.name,
|
|
38
|
+
foo: (wallet === null || wallet === void 0 ? void 0 : wallet.connector)
|
|
39
|
+
? isPasskeyWalletConnector(wallet === null || wallet === void 0 ? void 0 : wallet.connector)
|
|
40
|
+
: undefined,
|
|
41
|
+
version: 'v2',
|
|
42
|
+
wallet: Boolean(wallet),
|
|
43
|
+
walletId: wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
44
|
+
});
|
|
36
45
|
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings', INVALID_WALLET_DATA);
|
|
37
46
|
}
|
|
38
|
-
const turnkeyExportHandler = (
|
|
47
|
+
const turnkeyExportHandler = (_c = wallet.connector) === null || _c === void 0 ? void 0 : _c.getExportHandler();
|
|
39
48
|
const publicKey = yield turnkeyExportHandler.initExport(iframeContainer, iframeElementId);
|
|
40
49
|
if (!publicKey) {
|
|
41
50
|
throw new DynamicError('Something went wrong', ERROR_PROCESSING_REVEAL_REQUEST);
|
|
@@ -79,7 +88,7 @@ const extractExportBundle = ({ address, privateKeyId, activity, }) => {
|
|
|
79
88
|
: exportWalletResult;
|
|
80
89
|
return result === null || result === void 0 ? void 0 : result.exportBundle;
|
|
81
90
|
};
|
|
82
|
-
const exportCredential = (
|
|
91
|
+
const exportCredential = (_d) => __awaiter(void 0, [_d], void 0, function* ({ user, wallet, environmentId, address, }) {
|
|
83
92
|
const { connector, turnkeyHDWalletId, privateKeyId, organizationId } = handleExportInitCheck({
|
|
84
93
|
user,
|
|
85
94
|
wallet,
|
|
@@ -137,11 +146,11 @@ const exportCredential = (_c) => __awaiter(void 0, [_c], void 0, function* ({ us
|
|
|
137
146
|
organizationId,
|
|
138
147
|
});
|
|
139
148
|
});
|
|
140
|
-
const cleanupExport = (
|
|
141
|
-
var
|
|
149
|
+
const cleanupExport = (_e) => __awaiter(void 0, [_e], void 0, function* ({ wallet }) {
|
|
150
|
+
var _f;
|
|
142
151
|
const connector = wallet === null || wallet === void 0 ? void 0 : wallet.connector;
|
|
143
152
|
// clear iframeStamper and its reference
|
|
144
|
-
(
|
|
153
|
+
(_f = connector === null || connector === void 0 ? void 0 : connector.getExportHandler()) === null || _f === void 0 ? void 0 : _f.clear();
|
|
145
154
|
});
|
|
146
155
|
|
|
147
156
|
export { cleanupExport, exportCredential, extractExportBundle, initExport };
|
|
@@ -9,15 +9,21 @@ var logger = require('../../../../shared/logger.cjs');
|
|
|
9
9
|
var errors = require('../../../../utils/constants/errors.cjs');
|
|
10
10
|
|
|
11
11
|
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
12
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c;
|
|
13
13
|
if (!user) {
|
|
14
14
|
throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
|
|
15
15
|
}
|
|
16
16
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
|
|
17
|
+
logger.logger.error('Cannot initialize embedded wallet export', {
|
|
18
|
+
connector: (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.name,
|
|
19
|
+
version: 'v3',
|
|
20
|
+
wallet: Boolean(wallet),
|
|
21
|
+
walletId: wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
22
|
+
});
|
|
17
23
|
throw new utils.DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
18
24
|
}
|
|
19
25
|
const connector = wallet.connector;
|
|
20
|
-
const walletProperties = (
|
|
26
|
+
const walletProperties = (_c = (_b = user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('dynamicwaas'))) === null || _c === void 0 ? void 0 : _c.walletProperties;
|
|
21
27
|
if (!walletProperties) {
|
|
22
28
|
throw new utils.DynamicError('Invalid token!');
|
|
23
29
|
}
|
|
@@ -5,15 +5,21 @@ import { logger } from '../../../../shared/logger.js';
|
|
|
5
5
|
import { USER_NOT_LOGGED_IN } from '../../../../utils/constants/errors.js';
|
|
6
6
|
|
|
7
7
|
const handleExportInitCheck = ({ user, wallet, }) => {
|
|
8
|
-
var _a, _b;
|
|
8
|
+
var _a, _b, _c;
|
|
9
9
|
if (!user) {
|
|
10
10
|
throw new DynamicError(USER_NOT_LOGGED_IN);
|
|
11
11
|
}
|
|
12
12
|
if (!(wallet === null || wallet === void 0 ? void 0 : wallet.connector) || !(wallet === null || wallet === void 0 ? void 0 : wallet.id)) {
|
|
13
|
+
logger.error('Cannot initialize embedded wallet export', {
|
|
14
|
+
connector: (_a = wallet === null || wallet === void 0 ? void 0 : wallet.connector) === null || _a === void 0 ? void 0 : _a.name,
|
|
15
|
+
version: 'v3',
|
|
16
|
+
wallet: Boolean(wallet),
|
|
17
|
+
walletId: wallet === null || wallet === void 0 ? void 0 : wallet.id,
|
|
18
|
+
});
|
|
13
19
|
throw new DynamicError('Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings');
|
|
14
20
|
}
|
|
15
21
|
const connector = wallet.connector;
|
|
16
|
-
const walletProperties = (
|
|
22
|
+
const walletProperties = (_c = (_b = user.verifiedCredentials) === null || _b === void 0 ? void 0 : _b.find(({ walletName }) => walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('dynamicwaas'))) === null || _c === void 0 ? void 0 : _c.walletProperties;
|
|
17
23
|
if (!walletProperties) {
|
|
18
24
|
throw new DynamicError('Invalid token!');
|
|
19
25
|
}
|
|
@@ -33,20 +33,15 @@ const ExchangeList = ({ onSelectExchange, showDefaultFooter, scrollContainerClas
|
|
|
33
33
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
34
34
|
const [filterValue, setFilterValue] = React.useState((_a = utils.StorageService.getItem(localStorage.EXCHANGE_PICKER_SEARCH_KEY)) !== null && _a !== void 0 ? _a : '');
|
|
35
35
|
const exchangeNames = React.useMemo(() => {
|
|
36
|
-
if (!(projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.
|
|
36
|
+
if (!(projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.exchanges))
|
|
37
37
|
return [];
|
|
38
|
-
const names = projectSettings$1.
|
|
38
|
+
const names = projectSettings$1.exchanges.flatMap(({ exchange, enabledAt }) => {
|
|
39
39
|
if (!enabledAt)
|
|
40
40
|
return [];
|
|
41
|
-
|
|
42
|
-
return [provider];
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
41
|
+
return [convertExchangeKeyAndProviderEnum.convertExchangeKeytoProviderEnum(exchange)];
|
|
47
42
|
});
|
|
48
43
|
return [...new Set(names)];
|
|
49
|
-
}, [projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.
|
|
44
|
+
}, [projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.exchanges]);
|
|
50
45
|
const filteredExchangeNames = React.useMemo(() => {
|
|
51
46
|
const term = filterValue.trim().toLowerCase();
|
|
52
47
|
if (!term)
|
|
@@ -13,7 +13,7 @@ import { useProjectSettings } from '../../store/state/projectSettings/projectSet
|
|
|
13
13
|
import { EXCHANGE_PICKER_SEARCH_KEY } from '../../utils/constants/localStorage.js';
|
|
14
14
|
import { classNames } from '../../utils/functions/classNames/classNames.js';
|
|
15
15
|
import { useEffectOnce } from '../../utils/hooks/useEffectOnce/useEffectOnce.js';
|
|
16
|
-
import {
|
|
16
|
+
import { convertExchangeKeytoProviderEnum, convertProviderToExchangeKeyEnum } from '../../widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js';
|
|
17
17
|
import { SearchNotFoundMessage } from '../WalletList/SearchNotFoundMessage/SearchNotFoundMessage.js';
|
|
18
18
|
import { ExchangeListItem } from './ExchangeListItem/ExchangeListItem.js';
|
|
19
19
|
|
|
@@ -29,20 +29,15 @@ const ExchangeList = ({ onSelectExchange, showDefaultFooter, scrollContainerClas
|
|
|
29
29
|
const projectSettings = useProjectSettings();
|
|
30
30
|
const [filterValue, setFilterValue] = useState((_a = StorageService.getItem(EXCHANGE_PICKER_SEARCH_KEY)) !== null && _a !== void 0 ? _a : '');
|
|
31
31
|
const exchangeNames = useMemo(() => {
|
|
32
|
-
if (!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.
|
|
32
|
+
if (!(projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.exchanges))
|
|
33
33
|
return [];
|
|
34
|
-
const names = projectSettings.
|
|
34
|
+
const names = projectSettings.exchanges.flatMap(({ exchange, enabledAt }) => {
|
|
35
35
|
if (!enabledAt)
|
|
36
36
|
return [];
|
|
37
|
-
|
|
38
|
-
return [provider];
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
37
|
+
return [convertExchangeKeytoProviderEnum(exchange)];
|
|
43
38
|
});
|
|
44
39
|
return [...new Set(names)];
|
|
45
|
-
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.
|
|
40
|
+
}, [projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.exchanges]);
|
|
46
41
|
const filteredExchangeNames = useMemo(() => {
|
|
47
42
|
const term = filterValue.trim().toLowerCase();
|
|
48
43
|
if (!term)
|
|
@@ -31,12 +31,6 @@ const convertProviderToExchangeKeyEnum = (provider) => {
|
|
|
31
31
|
return exchange;
|
|
32
32
|
throw new Error(`convertProviderToExchangeKeyEnum: No ExchangeKeyEnum value found for ProviderEnum.${provider}`);
|
|
33
33
|
};
|
|
34
|
-
const isProviderExchange = (provider) => {
|
|
35
|
-
if (provider in PROVIDER_TO_EXCHANGE_OVERRIDES)
|
|
36
|
-
return true;
|
|
37
|
-
return Boolean(sdkApiCore.ExchangeKeyEnum[provider]);
|
|
38
|
-
};
|
|
39
34
|
|
|
40
35
|
exports.convertExchangeKeytoProviderEnum = convertExchangeKeytoProviderEnum;
|
|
41
36
|
exports.convertProviderToExchangeKeyEnum = convertProviderToExchangeKeyEnum;
|
|
42
|
-
exports.isProviderExchange = isProviderExchange;
|
|
@@ -27,10 +27,5 @@ const convertProviderToExchangeKeyEnum = (provider) => {
|
|
|
27
27
|
return exchange;
|
|
28
28
|
throw new Error(`convertProviderToExchangeKeyEnum: No ExchangeKeyEnum value found for ProviderEnum.${provider}`);
|
|
29
29
|
};
|
|
30
|
-
const isProviderExchange = (provider) => {
|
|
31
|
-
if (provider in PROVIDER_TO_EXCHANGE_OVERRIDES)
|
|
32
|
-
return true;
|
|
33
|
-
return Boolean(ExchangeKeyEnum[provider]);
|
|
34
|
-
};
|
|
35
30
|
|
|
36
|
-
export { convertExchangeKeytoProviderEnum, convertProviderToExchangeKeyEnum
|
|
31
|
+
export { convertExchangeKeytoProviderEnum, convertProviderToExchangeKeyEnum };
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var reactI18next = require('react-i18next');
|
|
8
|
-
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
9
|
-
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
10
8
|
require('@dynamic-labs/utils');
|
|
11
9
|
require('../../../../components/Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
12
10
|
require('react');
|
|
@@ -75,9 +73,11 @@ require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
|
75
73
|
require('../../components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
76
74
|
require('react-focus-lock');
|
|
77
75
|
var Icon = require('../../../../components/Icon/Icon.cjs');
|
|
76
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
78
77
|
require('../../context/DynamicWidgetContext.cjs');
|
|
79
78
|
var IconButton = require('../../../../components/IconButton/IconButton.cjs');
|
|
80
79
|
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
80
|
+
var TypographyButton = require('../../../../components/TypographyButton/TypographyButton.cjs');
|
|
81
81
|
require('formik');
|
|
82
82
|
require('../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.cjs');
|
|
83
83
|
var ModalHeader = require('../../../../components/ModalHeader/ModalHeader.cjs');
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
|
-
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
5
|
-
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
6
4
|
import '@dynamic-labs/utils';
|
|
7
5
|
import '../../../../components/Accordion/components/AccordionItem/AccordionItem.js';
|
|
8
6
|
import 'react';
|
|
@@ -71,9 +69,11 @@ import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
|
71
69
|
import '../../components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
72
70
|
import 'react-focus-lock';
|
|
73
71
|
import { Icon } from '../../../../components/Icon/Icon.js';
|
|
72
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
74
73
|
import '../../context/DynamicWidgetContext.js';
|
|
75
74
|
import { IconButton } from '../../../../components/IconButton/IconButton.js';
|
|
76
75
|
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
76
|
+
import { TypographyButton } from '../../../../components/TypographyButton/TypographyButton.js';
|
|
77
77
|
import 'formik';
|
|
78
78
|
import '../../../../utils/hooks/useSubdomainCheck/useSubdomainCheck.js';
|
|
79
79
|
import { ModalHeader } from '../../../../components/ModalHeader/ModalHeader.js';
|