@dynamic-labs/sdk-react-core 5.7.0 → 5.8.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 +21 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +13 -13
- package/src/index.d.ts +3 -1
- package/src/lib/components/TransactionCard/TransactionCard.cjs +47 -25
- package/src/lib/components/TransactionCard/TransactionCard.js +47 -25
- package/src/lib/components/TransactionCard/getTransactionAssetTransfers.cjs +83 -0
- package/src/lib/components/TransactionCard/getTransactionAssetTransfers.d.ts +26 -0
- package/src/lib/components/TransactionCard/getTransactionAssetTransfers.js +79 -0
- package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -0
- package/src/lib/context/DynamicContext/DynamicContext.js +3 -0
- package/src/lib/context/ViewContext/types/index.d.ts +1 -1
- package/src/lib/data/api/wallets/wallets.cjs +4 -4
- package/src/lib/data/api/wallets/wallets.js +5 -5
- package/src/lib/utils/constants/authViewLayoutChecks.cjs +2 -2
- package/src/lib/utils/constants/authViewLayoutChecks.js +2 -2
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.cjs +4 -4
- package/src/lib/utils/hooks/useDynamicLayoutData/useDynamicLayoutData.js +4 -4
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +2 -2
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +3 -3
- package/src/lib/views/NoAccess/useNoAccessText.cjs +19 -19
- package/src/lib/views/NoAccess/useNoAccessText.d.ts +8 -8
- package/src/lib/views/NoAccess/useNoAccessText.js +19 -19
- package/src/lib/views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs +1 -1
- package/src/lib/views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js +1 -1
- package/src/lib/views/viewToComponentMap.cjs +1 -1
- package/src/lib/views/viewToComponentMap.d.ts +1 -1
- package/src/lib/views/viewToComponentMap.js +1 -1
- package/src/version.cjs +2 -0
- package/src/version.d.ts +1 -0
- package/src/version.js +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
### [5.8.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.8.0...v5.8.1) (2026-09-15)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* **wallet-connect:** fix Rabby WalletConnect connection ([#12385](https://github.com/dynamic-labs/dynamic-auth/issues/12385)) ([df2a93c](https://github.com/dynamic-labs/dynamic-auth/commit/df2a93cd95b75b74dd47468faedad88c463b14de))
|
|
8
|
+
|
|
9
|
+
## [5.8.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.7.0...v5.8.0) (2026-09-09)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **solana-core:** standalone sponsored ATA creation ([#12365](https://github.com/dynamic-labs/dynamic-auth/issues/12365)) ([ac2e776](https://github.com/dynamic-labs/dynamic-auth/commit/ac2e7769fcf91c868e961a227b8acb6347bf3f13))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* do not report wallets installed from a provider selection router ([#12340](https://github.com/dynamic-labs/dynamic-auth/issues/12340)) ([dac5546](https://github.com/dynamic-labs/dynamic-auth/commit/dac5546edf6004c37bd84dd2089d94952949230b))
|
|
20
|
+
* **screening:** soften the blocked-wallet copy to be provider-neutral ([#12358](https://github.com/dynamic-labs/dynamic-auth/issues/12358)) ([b4854d8](https://github.com/dynamic-labs/dynamic-auth/commit/b4854d88fa67f684be0e133edd5fd4a4bf5c7f37))
|
|
21
|
+
* show transaction amount when simulation returns no transfers ([#12355](https://github.com/dynamic-labs/dynamic-auth/issues/12355)) ([bfaf337](https://github.com/dynamic-labs/dynamic-auth/commit/bfaf337e5350970f71255baff065e0cdbccdc7ca))
|
|
22
|
+
|
|
2
23
|
## [5.7.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.6.1...v5.7.0) (2026-09-08)
|
|
3
24
|
|
|
4
25
|
|
package/package.cjs
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
var version = "5.
|
|
6
|
+
var version = "5.8.1";
|
|
7
7
|
var dependencies = {
|
|
8
8
|
"@dynamic-labs/sdk-api-core": "0.32.0",
|
|
9
|
-
"@dynamic-labs-sdk/client": "1.31.
|
|
9
|
+
"@dynamic-labs-sdk/client": "1.31.2",
|
|
10
10
|
"@dynamic-labs-wallet/browser-wallet-client": "1.0.118",
|
|
11
11
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
12
12
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
package/package.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
var version = "5.
|
|
2
|
+
var version = "5.8.1";
|
|
3
3
|
var dependencies = {
|
|
4
4
|
"@dynamic-labs/sdk-api-core": "0.32.0",
|
|
5
|
-
"@dynamic-labs-sdk/client": "1.31.
|
|
5
|
+
"@dynamic-labs-sdk/client": "1.31.2",
|
|
6
6
|
"@dynamic-labs-wallet/browser-wallet-client": "1.0.118",
|
|
7
7
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
8
8
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.8.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.32.0",
|
|
6
|
-
"@dynamic-labs-sdk/client": "1.31.
|
|
6
|
+
"@dynamic-labs-sdk/client": "1.31.2",
|
|
7
7
|
"@dynamic-labs-wallet/browser-wallet-client": "1.0.118",
|
|
8
8
|
"@dynamic-labs-wallet/forward-mpc-client": "1.0.2",
|
|
9
9
|
"@hcaptcha/react-hcaptcha": "1.4.4",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
"react-i18next": "13.5.0",
|
|
19
19
|
"react-international-phone": "4.5.0",
|
|
20
20
|
"yup": "0.32.11",
|
|
21
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
22
|
-
"@dynamic-labs/iconic": "5.
|
|
23
|
-
"@dynamic-labs/locale": "5.
|
|
24
|
-
"@dynamic-labs/logger": "5.
|
|
25
|
-
"@dynamic-labs/multi-wallet": "5.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
27
|
-
"@dynamic-labs/store": "5.
|
|
28
|
-
"@dynamic-labs/types": "5.
|
|
29
|
-
"@dynamic-labs/utils": "5.
|
|
30
|
-
"@dynamic-labs/wallet-book": "5.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
21
|
+
"@dynamic-labs/assert-package-version": "5.8.1",
|
|
22
|
+
"@dynamic-labs/iconic": "5.8.1",
|
|
23
|
+
"@dynamic-labs/locale": "5.8.1",
|
|
24
|
+
"@dynamic-labs/logger": "5.8.1",
|
|
25
|
+
"@dynamic-labs/multi-wallet": "5.8.1",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "5.8.1",
|
|
27
|
+
"@dynamic-labs/store": "5.8.1",
|
|
28
|
+
"@dynamic-labs/types": "5.8.1",
|
|
29
|
+
"@dynamic-labs/utils": "5.8.1",
|
|
30
|
+
"@dynamic-labs/wallet-book": "5.8.1",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "5.8.1",
|
|
32
32
|
"eventemitter3": "5.0.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
package/src/index.d.ts
CHANGED
|
@@ -104,7 +104,9 @@ export { getDefaultColor, getThemeConfig, themesData, } from './lib/context/Them
|
|
|
104
104
|
export type {
|
|
105
105
|
/** @deprecated */
|
|
106
106
|
ViewType, } from './lib/context/ViewContext';
|
|
107
|
-
export type { NotSupportedError, SandboxMaximumThresholdReachedError, NoAccessError,
|
|
107
|
+
export type { NotSupportedError, SandboxMaximumThresholdReachedError, NoAccessError,
|
|
108
|
+
/** @deprecated use WalletScreeningBlockedError */
|
|
109
|
+
ChainalysisError, WalletScreeningBlockedError, EmailAlreadyExistsError, UsernameAlreadyExistsError, SocialAccountAlreadyExistsError, WalletNotDeployedError, WalletUsedError, EmailVerificationError, AccountExistsError, InvalidPhoneNumberError, PhoneNumberAlreadyLinkedError, RateLimitError, } from '@dynamic-labs/utils';
|
|
108
110
|
export type { WalletConnector, Chain, } from '@dynamic-labs/wallet-connector-core';
|
|
109
111
|
export type { EvmNetwork, PhoneData, OtpDestination, UserProfile,
|
|
110
112
|
/** @deprecated use AuthOptions instead */
|
|
@@ -105,6 +105,7 @@ require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
|
105
105
|
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
106
106
|
require('../../utils/hooks/useWalletDelegation/DelegationError.cjs');
|
|
107
107
|
require('../../store/state/sendBalances.cjs');
|
|
108
|
+
var getTransactionAssetTransfers = require('./getTransactionAssetTransfers.cjs');
|
|
108
109
|
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
109
110
|
require('../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
110
111
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -127,7 +128,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
127
128
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
128
129
|
|
|
129
130
|
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, walletConnector, }) => {
|
|
130
|
-
var _a, _b, _c, _d, _e, _f;
|
|
131
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
131
132
|
const { t } = reactI18next.useTranslation();
|
|
132
133
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
133
134
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
@@ -157,27 +158,6 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
157
158
|
return undefined;
|
|
158
159
|
return feeInUsd < 0.01 ? '<$0.01' : `~$${feeInUsd.toFixed(2)}`;
|
|
159
160
|
};
|
|
160
|
-
const totalAmountInUsd = React.useMemo(() => {
|
|
161
|
-
var _a;
|
|
162
|
-
const outgoingAssetsTotal = ((_a = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets) === null || _a === void 0 ? void 0 : _a.reduce((acc, transfer) => {
|
|
163
|
-
var _a;
|
|
164
|
-
const transferOutTotal = ((_a = transfer.transferOut) === null || _a === void 0 ? void 0 : _a.reduce((sum, t) => sum + Number((t === null || t === void 0 ? void 0 : t.usdPrice) || 0), 0)) || 0;
|
|
165
|
-
return acc + transferOutTotal;
|
|
166
|
-
}, 0)) || 0;
|
|
167
|
-
if (blockaidOn && isAATransaction) {
|
|
168
|
-
return outgoingAssetsTotal;
|
|
169
|
-
}
|
|
170
|
-
// for solana, the fee is included in the outgoing assets already
|
|
171
|
-
return (outgoingAssetsTotal +
|
|
172
|
-
(nativeCurrencySymbol === 'SOL' || isGasSponsored ? 0 : feeInUsd || 0));
|
|
173
|
-
}, [
|
|
174
|
-
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
175
|
-
nativeCurrencySymbol,
|
|
176
|
-
feeInUsd,
|
|
177
|
-
blockaidOn,
|
|
178
|
-
isAATransaction,
|
|
179
|
-
isGasSponsored,
|
|
180
|
-
]);
|
|
181
161
|
const getTotalAmountInUsdDisplay = (totalAmountInUsd) => {
|
|
182
162
|
if (!totalAmountInUsd)
|
|
183
163
|
return undefined;
|
|
@@ -187,7 +167,8 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
187
167
|
};
|
|
188
168
|
const renderAssetTransfer = (transfer, index, array) => {
|
|
189
169
|
var _a, _b;
|
|
190
|
-
if (
|
|
170
|
+
if (transfer.isSimulated &&
|
|
171
|
+
['NATIVE', 'SOL', 'ETH'].includes(transfer.asset.type) &&
|
|
191
172
|
(activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain) === 'SOL' &&
|
|
192
173
|
transaction.fee.gas) {
|
|
193
174
|
transfer.amount = (Number(transfer.amount) -
|
|
@@ -219,6 +200,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
219
200
|
amount: (_a = inTransfer === null || inTransfer === void 0 ? void 0 : inTransfer.value) !== null && _a !== void 0 ? _a : '',
|
|
220
201
|
asset: assetDiff.asset,
|
|
221
202
|
direction: 'in',
|
|
203
|
+
isSimulated: true,
|
|
222
204
|
usdPrice: (_b = inTransfer === null || inTransfer === void 0 ? void 0 : inTransfer.usdPrice) !== null && _b !== void 0 ? _b : '',
|
|
223
205
|
});
|
|
224
206
|
})) || [];
|
|
@@ -231,6 +213,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
231
213
|
amount: (_a = outTransfer === null || outTransfer === void 0 ? void 0 : outTransfer.value) !== null && _a !== void 0 ? _a : '',
|
|
232
214
|
asset: assetDiff.asset,
|
|
233
215
|
direction: 'out',
|
|
216
|
+
isSimulated: true,
|
|
234
217
|
usdPrice: (_b = outTransfer === null || outTransfer === void 0 ? void 0 : outTransfer.usdPrice) !== null && _b !== void 0 ? _b : '',
|
|
235
218
|
});
|
|
236
219
|
})) || [];
|
|
@@ -245,7 +228,46 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
245
228
|
const outAssetsWithoutFeeEvm = outAssetsWithoutFee.filter((asset) => !(asset.asset.type === 'NATIVE' &&
|
|
246
229
|
transaction.chain === 'EVM' &&
|
|
247
230
|
!transaction.value));
|
|
248
|
-
const
|
|
231
|
+
const simulatedAssets = [...outAssetsWithoutFeeEvm, ...inAssets];
|
|
232
|
+
// assets removed by the fee filters are intentionally hidden, so the
|
|
233
|
+
// transaction fallback applies only when the simulation reported no transfer
|
|
234
|
+
const hasSimulatedTransfers = outAssets.length > 0 || inAssets.length > 0;
|
|
235
|
+
const transactionAssetTransfers = hasSimulatedTransfers
|
|
236
|
+
? []
|
|
237
|
+
: getTransactionAssetTransfers.getTransactionAssetTransfers({
|
|
238
|
+
nativeTokenUsdPrice: (_d = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.priceData) === null || _d === void 0 ? void 0 : _d.nativeTokenUsdPrice,
|
|
239
|
+
networkInfoEntry,
|
|
240
|
+
transaction,
|
|
241
|
+
});
|
|
242
|
+
const allAssets = hasSimulatedTransfers
|
|
243
|
+
? simulatedAssets
|
|
244
|
+
: transactionAssetTransfers;
|
|
245
|
+
const transactionAssetsUsdTotal = transactionAssetTransfers.reduce((acc, transfer) => acc + Number(transfer.usdPrice || 0), 0);
|
|
246
|
+
const totalAmountInUsd = React.useMemo(() => {
|
|
247
|
+
var _a;
|
|
248
|
+
const simulatedOutgoingTotal = ((_a = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets) === null || _a === void 0 ? void 0 : _a.reduce((acc, transfer) => {
|
|
249
|
+
var _a;
|
|
250
|
+
const transferOutTotal = ((_a = transfer.transferOut) === null || _a === void 0 ? void 0 : _a.reduce((sum, t) => sum + Number((t === null || t === void 0 ? void 0 : t.usdPrice) || 0), 0)) || 0;
|
|
251
|
+
return acc + transferOutTotal;
|
|
252
|
+
}, 0)) || 0;
|
|
253
|
+
const outgoingAssetsTotal = simulatedOutgoingTotal + transactionAssetsUsdTotal;
|
|
254
|
+
if (blockaidOn && isAATransaction) {
|
|
255
|
+
return outgoingAssetsTotal;
|
|
256
|
+
}
|
|
257
|
+
// for solana, the simulated outgoing assets already include the fee
|
|
258
|
+
const feeIsAlreadyCounted = nativeCurrencySymbol === 'SOL' && hasSimulatedTransfers;
|
|
259
|
+
return (outgoingAssetsTotal +
|
|
260
|
+
(feeIsAlreadyCounted || isGasSponsored ? 0 : feeInUsd || 0));
|
|
261
|
+
}, [
|
|
262
|
+
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
263
|
+
transactionAssetsUsdTotal,
|
|
264
|
+
hasSimulatedTransfers,
|
|
265
|
+
nativeCurrencySymbol,
|
|
266
|
+
feeInUsd,
|
|
267
|
+
blockaidOn,
|
|
268
|
+
isAATransaction,
|
|
269
|
+
isGasSponsored,
|
|
270
|
+
]);
|
|
249
271
|
const getGasFeeDisplay = () => {
|
|
250
272
|
if (feeInUsd) {
|
|
251
273
|
return getFeeInUsdDisplay(feeInUsd);
|
|
@@ -258,7 +280,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
258
280
|
return `-- ${nativeCurrencySymbol}`;
|
|
259
281
|
};
|
|
260
282
|
return (jsxRuntime.jsxs("div", { className: 'transaction-card-container', children: [allAssets.length > 0 && (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsx("div", { className: 'transaction-card__assets-container', children: allAssets.map((asset, index, array) => (jsxRuntime.jsx(React__default["default"].Fragment, { children: renderAssetTransfer(asset, index, array) }, `asset-${index}`))) }) })), jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsxs("div", { className: 'transaction-card__details', children: [recipient && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: 'transaction-card__row', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.recipient', children: t('dyn_send_transaction.confirmation.data.recipient') }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-recipient', children: shortenWalletAddress.shortenWalletAddress(recipient) })] }), jsxRuntime.jsx("div", { className: 'transaction-card__divider' })] })), !recipient &&
|
|
261
|
-
(transaction.to || ((
|
|
283
|
+
(transaction.to || ((_e = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _e === void 0 ? void 0 : _e[0])) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { 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((_f = transaction.to) !== null && _f !== void 0 ? _f : (_g = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _g === void 0 ? void 0 : _g[0]) })] }), 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.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) || 'Ethereum' }), jsxRuntime.jsx("img", { src: networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.iconUrls[0], alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Network icon', width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), !isGasSponsored && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [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.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: t('dyn_send_transaction.confirmation.data.gas_estimate') }), jsxRuntime.jsx(Tooltip.Tooltip, { content: '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: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: getGasFeeDisplay() }) })] })] })), blockaidOn &&
|
|
262
284
|
totalAmountInUsd !== undefined &&
|
|
263
285
|
totalAmountInUsd > 0 &&
|
|
264
286
|
!(isAATransaction && !isGasSponsored) && (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', weight: 'bold', copykey: 'dyn_send_transaction.confirmation.data.total', children: t('dyn_send_transaction.confirmation.data.total') }), jsxRuntime.jsx("div", { className: 'transaction-card__total-amount', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-total', children: getTotalAmountInUsdDisplay(totalAmountInUsd) }) })] })] }))] }) })] }));
|
|
@@ -101,6 +101,7 @@ import '../../context/PasskeyContext/PasskeyContext.js';
|
|
|
101
101
|
import '../../context/OnrampContext/OnrampContext.js';
|
|
102
102
|
import '../../utils/hooks/useWalletDelegation/DelegationError.js';
|
|
103
103
|
import '../../store/state/sendBalances.js';
|
|
104
|
+
import { getTransactionAssetTransfers } from './getTransactionAssetTransfers.js';
|
|
104
105
|
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
105
106
|
import '../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
106
107
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -119,7 +120,7 @@ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
119
120
|
import '@dynamic-labs-sdk/client/waas';
|
|
120
121
|
|
|
121
122
|
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, walletConnector, }) => {
|
|
122
|
-
var _a, _b, _c, _d, _e, _f;
|
|
123
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
123
124
|
const { t } = useTranslation();
|
|
124
125
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
125
126
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
@@ -149,27 +150,6 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
149
150
|
return undefined;
|
|
150
151
|
return feeInUsd < 0.01 ? '<$0.01' : `~$${feeInUsd.toFixed(2)}`;
|
|
151
152
|
};
|
|
152
|
-
const totalAmountInUsd = useMemo(() => {
|
|
153
|
-
var _a;
|
|
154
|
-
const outgoingAssetsTotal = ((_a = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets) === null || _a === void 0 ? void 0 : _a.reduce((acc, transfer) => {
|
|
155
|
-
var _a;
|
|
156
|
-
const transferOutTotal = ((_a = transfer.transferOut) === null || _a === void 0 ? void 0 : _a.reduce((sum, t) => sum + Number((t === null || t === void 0 ? void 0 : t.usdPrice) || 0), 0)) || 0;
|
|
157
|
-
return acc + transferOutTotal;
|
|
158
|
-
}, 0)) || 0;
|
|
159
|
-
if (blockaidOn && isAATransaction) {
|
|
160
|
-
return outgoingAssetsTotal;
|
|
161
|
-
}
|
|
162
|
-
// for solana, the fee is included in the outgoing assets already
|
|
163
|
-
return (outgoingAssetsTotal +
|
|
164
|
-
(nativeCurrencySymbol === 'SOL' || isGasSponsored ? 0 : feeInUsd || 0));
|
|
165
|
-
}, [
|
|
166
|
-
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
167
|
-
nativeCurrencySymbol,
|
|
168
|
-
feeInUsd,
|
|
169
|
-
blockaidOn,
|
|
170
|
-
isAATransaction,
|
|
171
|
-
isGasSponsored,
|
|
172
|
-
]);
|
|
173
153
|
const getTotalAmountInUsdDisplay = (totalAmountInUsd) => {
|
|
174
154
|
if (!totalAmountInUsd)
|
|
175
155
|
return undefined;
|
|
@@ -179,7 +159,8 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
179
159
|
};
|
|
180
160
|
const renderAssetTransfer = (transfer, index, array) => {
|
|
181
161
|
var _a, _b;
|
|
182
|
-
if (
|
|
162
|
+
if (transfer.isSimulated &&
|
|
163
|
+
['NATIVE', 'SOL', 'ETH'].includes(transfer.asset.type) &&
|
|
183
164
|
(activeConnector === null || activeConnector === void 0 ? void 0 : activeConnector.connectedChain) === 'SOL' &&
|
|
184
165
|
transaction.fee.gas) {
|
|
185
166
|
transfer.amount = (Number(transfer.amount) -
|
|
@@ -211,6 +192,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
211
192
|
amount: (_a = inTransfer === null || inTransfer === void 0 ? void 0 : inTransfer.value) !== null && _a !== void 0 ? _a : '',
|
|
212
193
|
asset: assetDiff.asset,
|
|
213
194
|
direction: 'in',
|
|
195
|
+
isSimulated: true,
|
|
214
196
|
usdPrice: (_b = inTransfer === null || inTransfer === void 0 ? void 0 : inTransfer.usdPrice) !== null && _b !== void 0 ? _b : '',
|
|
215
197
|
});
|
|
216
198
|
})) || [];
|
|
@@ -223,6 +205,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
223
205
|
amount: (_a = outTransfer === null || outTransfer === void 0 ? void 0 : outTransfer.value) !== null && _a !== void 0 ? _a : '',
|
|
224
206
|
asset: assetDiff.asset,
|
|
225
207
|
direction: 'out',
|
|
208
|
+
isSimulated: true,
|
|
226
209
|
usdPrice: (_b = outTransfer === null || outTransfer === void 0 ? void 0 : outTransfer.usdPrice) !== null && _b !== void 0 ? _b : '',
|
|
227
210
|
});
|
|
228
211
|
})) || [];
|
|
@@ -237,7 +220,46 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
237
220
|
const outAssetsWithoutFeeEvm = outAssetsWithoutFee.filter((asset) => !(asset.asset.type === 'NATIVE' &&
|
|
238
221
|
transaction.chain === 'EVM' &&
|
|
239
222
|
!transaction.value));
|
|
240
|
-
const
|
|
223
|
+
const simulatedAssets = [...outAssetsWithoutFeeEvm, ...inAssets];
|
|
224
|
+
// assets removed by the fee filters are intentionally hidden, so the
|
|
225
|
+
// transaction fallback applies only when the simulation reported no transfer
|
|
226
|
+
const hasSimulatedTransfers = outAssets.length > 0 || inAssets.length > 0;
|
|
227
|
+
const transactionAssetTransfers = hasSimulatedTransfers
|
|
228
|
+
? []
|
|
229
|
+
: getTransactionAssetTransfers({
|
|
230
|
+
nativeTokenUsdPrice: (_d = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.priceData) === null || _d === void 0 ? void 0 : _d.nativeTokenUsdPrice,
|
|
231
|
+
networkInfoEntry,
|
|
232
|
+
transaction,
|
|
233
|
+
});
|
|
234
|
+
const allAssets = hasSimulatedTransfers
|
|
235
|
+
? simulatedAssets
|
|
236
|
+
: transactionAssetTransfers;
|
|
237
|
+
const transactionAssetsUsdTotal = transactionAssetTransfers.reduce((acc, transfer) => acc + Number(transfer.usdPrice || 0), 0);
|
|
238
|
+
const totalAmountInUsd = useMemo(() => {
|
|
239
|
+
var _a;
|
|
240
|
+
const simulatedOutgoingTotal = ((_a = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets) === null || _a === void 0 ? void 0 : _a.reduce((acc, transfer) => {
|
|
241
|
+
var _a;
|
|
242
|
+
const transferOutTotal = ((_a = transfer.transferOut) === null || _a === void 0 ? void 0 : _a.reduce((sum, t) => sum + Number((t === null || t === void 0 ? void 0 : t.usdPrice) || 0), 0)) || 0;
|
|
243
|
+
return acc + transferOutTotal;
|
|
244
|
+
}, 0)) || 0;
|
|
245
|
+
const outgoingAssetsTotal = simulatedOutgoingTotal + transactionAssetsUsdTotal;
|
|
246
|
+
if (blockaidOn && isAATransaction) {
|
|
247
|
+
return outgoingAssetsTotal;
|
|
248
|
+
}
|
|
249
|
+
// for solana, the simulated outgoing assets already include the fee
|
|
250
|
+
const feeIsAlreadyCounted = nativeCurrencySymbol === 'SOL' && hasSimulatedTransfers;
|
|
251
|
+
return (outgoingAssetsTotal +
|
|
252
|
+
(feeIsAlreadyCounted || isGasSponsored ? 0 : feeInUsd || 0));
|
|
253
|
+
}, [
|
|
254
|
+
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
255
|
+
transactionAssetsUsdTotal,
|
|
256
|
+
hasSimulatedTransfers,
|
|
257
|
+
nativeCurrencySymbol,
|
|
258
|
+
feeInUsd,
|
|
259
|
+
blockaidOn,
|
|
260
|
+
isAATransaction,
|
|
261
|
+
isGasSponsored,
|
|
262
|
+
]);
|
|
241
263
|
const getGasFeeDisplay = () => {
|
|
242
264
|
if (feeInUsd) {
|
|
243
265
|
return getFeeInUsdDisplay(feeInUsd);
|
|
@@ -250,7 +272,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
250
272
|
return `-- ${nativeCurrencySymbol}`;
|
|
251
273
|
};
|
|
252
274
|
return (jsxs("div", { className: 'transaction-card-container', children: [allAssets.length > 0 && (jsx("div", { className: 'transaction-card', children: jsx("div", { className: 'transaction-card__assets-container', children: allAssets.map((asset, index, array) => (jsx(React__default.Fragment, { children: renderAssetTransfer(asset, index, array) }, `asset-${index}`))) }) })), jsx("div", { className: 'transaction-card', children: jsxs("div", { className: 'transaction-card__details', children: [recipient && (jsxs(Fragment, { children: [jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.recipient', children: t('dyn_send_transaction.confirmation.data.recipient') }), jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-recipient', children: shortenWalletAddress(recipient) })] }), jsx("div", { className: 'transaction-card__divider' })] })), !recipient &&
|
|
253
|
-
(transaction.to || ((
|
|
275
|
+
(transaction.to || ((_e = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _e === void 0 ? void 0 : _e[0])) && (jsxs(Fragment, { 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((_f = transaction.to) !== null && _f !== void 0 ? _f : (_g = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _g === void 0 ? void 0 : _g[0]) })] }), 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.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) || 'Ethereum' }), jsx("img", { src: networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.iconUrls[0], alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Network icon', width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), !isGasSponsored && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: t('dyn_send_transaction.confirmation.data.gas_estimate') }), jsx(Tooltip, { content: '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: jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: getGasFeeDisplay() }) })] })] })), blockaidOn &&
|
|
254
276
|
totalAmountInUsd !== undefined &&
|
|
255
277
|
totalAmountInUsd > 0 &&
|
|
256
278
|
!(isAATransaction && !isGasSponsored) && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', weight: 'bold', copykey: 'dyn_send_transaction.confirmation.data.total', children: t('dyn_send_transaction.confirmation.data.total') }), jsx("div", { className: 'transaction-card__total-amount', children: jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-total', children: getTotalAmountInUsdDisplay(totalAmountInUsd) }) })] })] }))] }) })] }));
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
const NATIVE_ASSET_TYPE = 'NATIVE';
|
|
7
|
+
const TOKEN_ASSET_TYPE = 'TOKEN';
|
|
8
|
+
const AMOUNT_PRECISION = 8;
|
|
9
|
+
/** Label of a token whose transaction carries no symbol. */
|
|
10
|
+
const TOKEN_ASSET_SYMBOL = 'Token';
|
|
11
|
+
const getNativeTransfer = ({ transaction, networkInfoEntry, nativeTokenUsdPrice, }) => {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
if (!transaction.value)
|
|
14
|
+
return undefined;
|
|
15
|
+
const { symbol, decimals, iconUrl } = (_a = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency) !== null && _a !== void 0 ? _a : {};
|
|
16
|
+
const amount = transaction.format(transaction.value, {
|
|
17
|
+
precision: AMOUNT_PRECISION,
|
|
18
|
+
});
|
|
19
|
+
const usdPrice = nativeTokenUsdPrice
|
|
20
|
+
? String(Number(amount) * Number(nativeTokenUsdPrice))
|
|
21
|
+
: '';
|
|
22
|
+
return {
|
|
23
|
+
amount,
|
|
24
|
+
asset: {
|
|
25
|
+
address: null,
|
|
26
|
+
chainName: (_b = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) !== null && _b !== void 0 ? _b : '',
|
|
27
|
+
decimals: decimals !== null && decimals !== void 0 ? decimals : 0,
|
|
28
|
+
logoUrl: iconUrl !== null && iconUrl !== void 0 ? iconUrl : '',
|
|
29
|
+
name: symbol !== null && symbol !== void 0 ? symbol : '',
|
|
30
|
+
symbol: symbol !== null && symbol !== void 0 ? symbol : '',
|
|
31
|
+
type: NATIVE_ASSET_TYPE,
|
|
32
|
+
},
|
|
33
|
+
direction: 'out',
|
|
34
|
+
isSimulated: false,
|
|
35
|
+
usdPrice,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Builds the transfer of the token a transaction sends.
|
|
40
|
+
*
|
|
41
|
+
* The decimals of the token scale its raw amount and vary per token, so a
|
|
42
|
+
* transaction that omits them carries no displayable amount.
|
|
43
|
+
*/
|
|
44
|
+
const getNonNativeTransfer = ({ transaction, networkInfoEntry, }) => {
|
|
45
|
+
var _a;
|
|
46
|
+
const { nonNativeValue, nonNativeAddress, nonNativeDecimal } = transaction;
|
|
47
|
+
if (!nonNativeValue ||
|
|
48
|
+
nonNativeDecimal === undefined ||
|
|
49
|
+
!transaction.formatNonNativeToken) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
amount: transaction.formatNonNativeToken(nonNativeValue, nonNativeDecimal),
|
|
54
|
+
asset: {
|
|
55
|
+
address: nonNativeAddress !== null && nonNativeAddress !== void 0 ? nonNativeAddress : null,
|
|
56
|
+
chainName: (_a = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) !== null && _a !== void 0 ? _a : '',
|
|
57
|
+
decimals: nonNativeDecimal,
|
|
58
|
+
logoUrl: '',
|
|
59
|
+
name: TOKEN_ASSET_SYMBOL,
|
|
60
|
+
symbol: TOKEN_ASSET_SYMBOL,
|
|
61
|
+
type: TOKEN_ASSET_TYPE,
|
|
62
|
+
},
|
|
63
|
+
direction: 'out',
|
|
64
|
+
isSimulated: false,
|
|
65
|
+
usdPrice: '',
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Builds the outgoing transfers of a transaction, for chains and transactions
|
|
70
|
+
* where no simulated transfer is available.
|
|
71
|
+
*
|
|
72
|
+
* A token transfer carries the amount being sent in `nonNativeValue`, while its
|
|
73
|
+
* `value` is native currency attached to the message to pay for its execution
|
|
74
|
+
* (TON jettons), so the token transfer is the only one reported for it.
|
|
75
|
+
*/
|
|
76
|
+
const getTransactionAssetTransfers = (props) => {
|
|
77
|
+
const transfer = props.transaction.nonNativeValue
|
|
78
|
+
? getNonNativeTransfer(props)
|
|
79
|
+
: getNativeTransfer(props);
|
|
80
|
+
return transfer ? [transfer] : [];
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
exports.getTransactionAssetTransfers = getTransactionAssetTransfers;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Asset } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
import { IUITransaction } from '@dynamic-labs/types';
|
|
3
|
+
import { NetworkInfoEntry } from '../../utils/functions/networksAndChains';
|
|
4
|
+
export type AssetTransfer = {
|
|
5
|
+
asset: Asset;
|
|
6
|
+
amount: string;
|
|
7
|
+
direction: 'in' | 'out';
|
|
8
|
+
usdPrice: string;
|
|
9
|
+
/** Transfers derived from the transaction itself are not simulated. */
|
|
10
|
+
isSimulated: boolean;
|
|
11
|
+
};
|
|
12
|
+
type GetTransactionAssetTransfersProps = {
|
|
13
|
+
transaction: IUITransaction;
|
|
14
|
+
networkInfoEntry: NetworkInfoEntry | undefined;
|
|
15
|
+
nativeTokenUsdPrice: number | string | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Builds the outgoing transfers of a transaction, for chains and transactions
|
|
19
|
+
* where no simulated transfer is available.
|
|
20
|
+
*
|
|
21
|
+
* A token transfer carries the amount being sent in `nonNativeValue`, while its
|
|
22
|
+
* `value` is native currency attached to the message to pay for its execution
|
|
23
|
+
* (TON jettons), so the token transfer is the only one reported for it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const getTransactionAssetTransfers: (props: GetTransactionAssetTransfersProps) => AssetTransfer[];
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
const NATIVE_ASSET_TYPE = 'NATIVE';
|
|
3
|
+
const TOKEN_ASSET_TYPE = 'TOKEN';
|
|
4
|
+
const AMOUNT_PRECISION = 8;
|
|
5
|
+
/** Label of a token whose transaction carries no symbol. */
|
|
6
|
+
const TOKEN_ASSET_SYMBOL = 'Token';
|
|
7
|
+
const getNativeTransfer = ({ transaction, networkInfoEntry, nativeTokenUsdPrice, }) => {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
if (!transaction.value)
|
|
10
|
+
return undefined;
|
|
11
|
+
const { symbol, decimals, iconUrl } = (_a = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency) !== null && _a !== void 0 ? _a : {};
|
|
12
|
+
const amount = transaction.format(transaction.value, {
|
|
13
|
+
precision: AMOUNT_PRECISION,
|
|
14
|
+
});
|
|
15
|
+
const usdPrice = nativeTokenUsdPrice
|
|
16
|
+
? String(Number(amount) * Number(nativeTokenUsdPrice))
|
|
17
|
+
: '';
|
|
18
|
+
return {
|
|
19
|
+
amount,
|
|
20
|
+
asset: {
|
|
21
|
+
address: null,
|
|
22
|
+
chainName: (_b = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) !== null && _b !== void 0 ? _b : '',
|
|
23
|
+
decimals: decimals !== null && decimals !== void 0 ? decimals : 0,
|
|
24
|
+
logoUrl: iconUrl !== null && iconUrl !== void 0 ? iconUrl : '',
|
|
25
|
+
name: symbol !== null && symbol !== void 0 ? symbol : '',
|
|
26
|
+
symbol: symbol !== null && symbol !== void 0 ? symbol : '',
|
|
27
|
+
type: NATIVE_ASSET_TYPE,
|
|
28
|
+
},
|
|
29
|
+
direction: 'out',
|
|
30
|
+
isSimulated: false,
|
|
31
|
+
usdPrice,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Builds the transfer of the token a transaction sends.
|
|
36
|
+
*
|
|
37
|
+
* The decimals of the token scale its raw amount and vary per token, so a
|
|
38
|
+
* transaction that omits them carries no displayable amount.
|
|
39
|
+
*/
|
|
40
|
+
const getNonNativeTransfer = ({ transaction, networkInfoEntry, }) => {
|
|
41
|
+
var _a;
|
|
42
|
+
const { nonNativeValue, nonNativeAddress, nonNativeDecimal } = transaction;
|
|
43
|
+
if (!nonNativeValue ||
|
|
44
|
+
nonNativeDecimal === undefined ||
|
|
45
|
+
!transaction.formatNonNativeToken) {
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
amount: transaction.formatNonNativeToken(nonNativeValue, nonNativeDecimal),
|
|
50
|
+
asset: {
|
|
51
|
+
address: nonNativeAddress !== null && nonNativeAddress !== void 0 ? nonNativeAddress : null,
|
|
52
|
+
chainName: (_a = networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) !== null && _a !== void 0 ? _a : '',
|
|
53
|
+
decimals: nonNativeDecimal,
|
|
54
|
+
logoUrl: '',
|
|
55
|
+
name: TOKEN_ASSET_SYMBOL,
|
|
56
|
+
symbol: TOKEN_ASSET_SYMBOL,
|
|
57
|
+
type: TOKEN_ASSET_TYPE,
|
|
58
|
+
},
|
|
59
|
+
direction: 'out',
|
|
60
|
+
isSimulated: false,
|
|
61
|
+
usdPrice: '',
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Builds the outgoing transfers of a transaction, for chains and transactions
|
|
66
|
+
* where no simulated transfer is available.
|
|
67
|
+
*
|
|
68
|
+
* A token transfer carries the amount being sent in `nonNativeValue`, while its
|
|
69
|
+
* `value` is native currency attached to the message to pay for its execution
|
|
70
|
+
* (TON jettons), so the token transfer is the only one reported for it.
|
|
71
|
+
*/
|
|
72
|
+
const getTransactionAssetTransfers = (props) => {
|
|
73
|
+
const transfer = props.transaction.nonNativeValue
|
|
74
|
+
? getNonNativeTransfer(props)
|
|
75
|
+
: getNativeTransfer(props);
|
|
76
|
+
return transfer ? [transfer] : [];
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export { getTransactionAssetTransfers };
|
|
@@ -20,6 +20,7 @@ require('@dynamic-labs/sdk-api-core');
|
|
|
20
20
|
require('eventemitter3');
|
|
21
21
|
require('@dynamic-labs-sdk/client');
|
|
22
22
|
var useInitializeSdkClient = require('../../client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.cjs');
|
|
23
|
+
var version = require('../../../version.cjs');
|
|
23
24
|
var values = require('../../utils/constants/values.cjs');
|
|
24
25
|
require('@dynamic-labs/multi-wallet');
|
|
25
26
|
var logger$1 = require('../../shared/logger.cjs');
|
|
@@ -775,6 +776,8 @@ const DynamicContextProvider = (props) => {
|
|
|
775
776
|
useInitializeSdkClient.useInitializeSdkClient(props, reinitializeState.key);
|
|
776
777
|
logger.Logger.setEnvironmentId(props.settings.environmentId);
|
|
777
778
|
logger.Logger.setEmitErrors(props.emitErrors);
|
|
779
|
+
logger.Logger.globalMetaData.set('sdkReactCoreVersion', version.VERSION);
|
|
780
|
+
logger.Logger.globalMetaData.set('sdkVersion', version.CLIENT_VERSION);
|
|
778
781
|
useParentDynamicContextGuard.useParentDynamicContextGuard();
|
|
779
782
|
return (jsxRuntime.jsx(ReinitializeContextProvider.ReinitializeContextProvider, { reinitializeState: reinitializeState, onReinitialize: onReinitialize.onReinitialize, children: jsxRuntime.jsx(ErrorBoundary.ErrorBoundary, { children: jsxRuntime.jsx(ErrorContext.ErrorContextProvider, { children: jsxRuntime.jsx(UserWalletsContext.UserWalletsProvider, { children: jsxRuntime.jsx(FieldsStateContext.FieldsStateProvider, { children: jsxRuntime.jsx(IpConfigurationContext.IpConfigurationContextProvider, { children: jsxRuntime.jsx(WidgetRegistryContextProvider.WidgetRegistryContextProvider, { children: jsxRuntime.jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }) }) }) }) }) }));
|
|
780
783
|
};
|
|
@@ -16,6 +16,7 @@ import '@dynamic-labs/sdk-api-core';
|
|
|
16
16
|
import 'eventemitter3';
|
|
17
17
|
import '@dynamic-labs-sdk/client';
|
|
18
18
|
import { useInitializeSdkClient } from '../../client/extension/hooks/useInitializeSdkClient/useInitializeSdkClient.js';
|
|
19
|
+
import { VERSION, CLIENT_VERSION } from '../../../version.js';
|
|
19
20
|
import { DEFAULT_NUMBER_OF_WALLETS_TO_SHOW } from '../../utils/constants/values.js';
|
|
20
21
|
import '@dynamic-labs/multi-wallet';
|
|
21
22
|
import { logger } from '../../shared/logger.js';
|
|
@@ -771,6 +772,8 @@ const DynamicContextProvider = (props) => {
|
|
|
771
772
|
useInitializeSdkClient(props, reinitializeState.key);
|
|
772
773
|
Logger.setEnvironmentId(props.settings.environmentId);
|
|
773
774
|
Logger.setEmitErrors(props.emitErrors);
|
|
775
|
+
Logger.globalMetaData.set('sdkReactCoreVersion', VERSION);
|
|
776
|
+
Logger.globalMetaData.set('sdkVersion', CLIENT_VERSION);
|
|
774
777
|
useParentDynamicContextGuard();
|
|
775
778
|
return (jsx(ReinitializeContextProvider, { reinitializeState: reinitializeState, onReinitialize: onReinitialize, children: jsx(ErrorBoundary, { children: jsx(ErrorContextProvider, { children: jsx(UserWalletsProvider, { children: jsx(FieldsStateProvider, { children: jsx(IpConfigurationContextProvider, { children: jsx(WidgetRegistryContextProvider, { children: jsx(InnerDynamicContextProvider, Object.assign({}, props)) }) }) }) }) }) }) }));
|
|
776
779
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, FC } from 'react';
|
|
2
2
|
import type { viewToComponentMap } from '../../../views/viewToComponentMap';
|
|
3
|
-
export type ViewType = 'auth-loading' | 'access-blocked' | 'backup-unsuccessful' | 'select-hardware-wallet' | 'captcha' | '
|
|
3
|
+
export type ViewType = 'auth-loading' | 'access-blocked' | 'backup-unsuccessful' | 'select-hardware-wallet' | 'captcha' | 'collect-user-data' | 'collect-user-data-login-no-wallet' | 'device-registration' | 'login-with-email-or-wallet-full-wallet-list' | 'login-with-email-or-wallet' | 'login-with-wallet-only' | 'login-with-email-verification' | 'login-with-sms-verification' | 'network-not-supported' | 'network-not-supported-manual' | 'no-access' | 'no-qr-not-installed' | 'pending-connect' | 'pending-signature-without-back-button' | 'pending-signature' | 'qr-code' | 'verify-email' | 'verify-sms' | 'wallet-connect-mobile-wallets-list' | 'wallet-list' | 'unified-wallet-exchange-list' | 'external-funding-exchange-list' | 'external-funding-wallet-list' | 'mfa-exchange-view' | 'exchange-whitelist-warning' | 'sandbox-maximum-threshold-reached' | 'multi-wallet-wallet-list' | 'duplicate-wallet' | 'wallet-screening-blocked' | 'wallet-sign' | 'wallet-used' | 'wallet-group' | 'select-wallet-in-wallet-group' | 'wait-for-email-confirmation-view' | 'email-wallet-otp-verification-view' | 'social-redirect-view' | 'wallet-locked-view' | 'social-wrong-account' | 'gate-blocked-wallet' | 'bridge-welcome' | 'bridge-summary' | 'bridge-next-wallet-connection' | 'account-exists' | 'merge-user-accounts' | 'merge-user-accounts-conflicts' | 'merge-user-accounts-with-same-email' | 'mfa-choose-device' | 'mfa-recovery' | 'mfa-secure-device' | 'mfa-secure-device-help' | 'mfa-verification' | 'mfa-display-backup-codes' | 'wallet-cannot-be-transferred' | 'global-wallet-confirm' | 'global-wallet-malicious' | 'global-wallet-info' | 'passkey-setup' | 'passkey-confirm' | 'embedded-reveal-view' | 'export-shares-view' | 'embedded-reveal-account-view' | 'rename-passkey' | 'wallet-redirect-view' | 'mobile-wallet-redirect-view' | 'farcaster-connect-view' | 'embedded-wallet-exists' | 'user-delete-account' | 'wallet-delegation-view' | 'waas-backup-view' | 'waas-backup-info-view' | 'waas-backup-cloud-provider-view' | 'waas-backup-download-view' | 'waas-backup-grant-access-view' | 'waas-backup-progress-view' | 'waas-backup-success-view' | 'setup-password-terms' | 'setup-password-for-wallet-creation' | 'reset-password-flow' | 'unlock-wallet' | 'step-up-reauth-choose' | 'step-up-reauth-otp' | 'step-up-reauth-social' | 'step-up-reauth-wallet';
|
|
4
4
|
export type ViewMapConstraint = Record<ViewType, FC<any>>;
|
|
5
5
|
export type ViewMap = typeof viewToComponentMap;
|
|
6
6
|
export type ViewState<T extends ViewType> = {
|
|
@@ -179,8 +179,8 @@ const verifyWallet = (environmentId_3, _f) => _tslib.__awaiter(void 0, [environm
|
|
|
179
179
|
if (data.code === utils$1.SdkErrorCode.WALLET_NOT_DEPLOYED) {
|
|
180
180
|
throw new utils$1.WalletNotDeployedError();
|
|
181
181
|
}
|
|
182
|
-
if (((_g = data.error) === null || _g === void 0 ? void 0 : _g.code)
|
|
183
|
-
throw new utils$1.
|
|
182
|
+
if (utils$1.SCREENING_BLOCKED_WALLET_ERROR_CODES.includes((_g = data.error) === null || _g === void 0 ? void 0 : _g.code)) {
|
|
183
|
+
throw new utils$1.WalletScreeningBlockedError(data.payload.walletPublicKey, data.error.code);
|
|
184
184
|
}
|
|
185
185
|
if (((_h = data.error) === null || _h === void 0 ? void 0 : _h.code) === 'gate_blocked') {
|
|
186
186
|
throw new utils$1.GateBlockedError(data.payload.walletPublicKey);
|
|
@@ -231,8 +231,8 @@ const walletsVerify = (environmentId_4, _l) => _tslib.__awaiter(void 0, [environ
|
|
|
231
231
|
if (data.code === utils$1.SdkErrorCode.WALLET_NOT_DEPLOYED) {
|
|
232
232
|
throw new utils$1.WalletNotDeployedError();
|
|
233
233
|
}
|
|
234
|
-
if (((_m = data.error) === null || _m === void 0 ? void 0 : _m.code)
|
|
235
|
-
throw new utils$1.
|
|
234
|
+
if (utils$1.SCREENING_BLOCKED_WALLET_ERROR_CODES.includes((_m = data.error) === null || _m === void 0 ? void 0 : _m.code)) {
|
|
235
|
+
throw new utils$1.WalletScreeningBlockedError(data.payload.walletPublicKey, data.error.code);
|
|
236
236
|
}
|
|
237
237
|
if (((_o = data.error) === null || _o === void 0 ? void 0 : _o.code) === 'gate_blocked') {
|
|
238
238
|
throw new utils$1.GateBlockedError(data.payload.walletPublicKey);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
4
|
import { TokenScope, VerifyRequestFromJSON } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { DynamicError, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, SdkErrorCode, WalletNotDeployedError,
|
|
5
|
+
import { DynamicError, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, SdkErrorCode, WalletNotDeployedError, SCREENING_BLOCKED_WALLET_ERROR_CODES, WalletScreeningBlockedError, GateBlockedError, NoAccessError, ErrorCode, AccountExistsError } from '@dynamic-labs/utils';
|
|
6
6
|
import '@dynamic-labs-sdk/client/core';
|
|
7
7
|
import 'react';
|
|
8
8
|
import 'eventemitter3';
|
|
@@ -175,8 +175,8 @@ const verifyWallet = (environmentId_3, _f) => __awaiter(void 0, [environmentId_3
|
|
|
175
175
|
if (data.code === SdkErrorCode.WALLET_NOT_DEPLOYED) {
|
|
176
176
|
throw new WalletNotDeployedError();
|
|
177
177
|
}
|
|
178
|
-
if (((_g = data.error) === null || _g === void 0 ? void 0 : _g.code)
|
|
179
|
-
throw new
|
|
178
|
+
if (SCREENING_BLOCKED_WALLET_ERROR_CODES.includes((_g = data.error) === null || _g === void 0 ? void 0 : _g.code)) {
|
|
179
|
+
throw new WalletScreeningBlockedError(data.payload.walletPublicKey, data.error.code);
|
|
180
180
|
}
|
|
181
181
|
if (((_h = data.error) === null || _h === void 0 ? void 0 : _h.code) === 'gate_blocked') {
|
|
182
182
|
throw new GateBlockedError(data.payload.walletPublicKey);
|
|
@@ -227,8 +227,8 @@ const walletsVerify = (environmentId_4, _l) => __awaiter(void 0, [environmentId_
|
|
|
227
227
|
if (data.code === SdkErrorCode.WALLET_NOT_DEPLOYED) {
|
|
228
228
|
throw new WalletNotDeployedError();
|
|
229
229
|
}
|
|
230
|
-
if (((_m = data.error) === null || _m === void 0 ? void 0 : _m.code)
|
|
231
|
-
throw new
|
|
230
|
+
if (SCREENING_BLOCKED_WALLET_ERROR_CODES.includes((_m = data.error) === null || _m === void 0 ? void 0 : _m.code)) {
|
|
231
|
+
throw new WalletScreeningBlockedError(data.payload.walletPublicKey, data.error.code);
|
|
232
232
|
}
|
|
233
233
|
if (((_o = data.error) === null || _o === void 0 ? void 0 : _o.code) === 'gate_blocked') {
|
|
234
234
|
throw new GateBlockedError(data.payload.walletPublicKey);
|
|
@@ -19,14 +19,14 @@ const viewsThatHideHelpContent = [
|
|
|
19
19
|
'qr-code',
|
|
20
20
|
'no-qr-not-installed',
|
|
21
21
|
'wallet-used',
|
|
22
|
-
'
|
|
22
|
+
'wallet-screening-blocked',
|
|
23
23
|
'wallet-sign',
|
|
24
24
|
'collect-user-data',
|
|
25
25
|
];
|
|
26
26
|
const viewsThatHideHeader = [
|
|
27
27
|
'collect-user-data',
|
|
28
28
|
'no-access',
|
|
29
|
-
'
|
|
29
|
+
'wallet-screening-blocked',
|
|
30
30
|
'wallet-locked-view',
|
|
31
31
|
'gate-blocked-wallet',
|
|
32
32
|
'email-wallet-otp-verification-view',
|
|
@@ -15,14 +15,14 @@ const viewsThatHideHelpContent = [
|
|
|
15
15
|
'qr-code',
|
|
16
16
|
'no-qr-not-installed',
|
|
17
17
|
'wallet-used',
|
|
18
|
-
'
|
|
18
|
+
'wallet-screening-blocked',
|
|
19
19
|
'wallet-sign',
|
|
20
20
|
'collect-user-data',
|
|
21
21
|
];
|
|
22
22
|
const viewsThatHideHeader = [
|
|
23
23
|
'collect-user-data',
|
|
24
24
|
'no-access',
|
|
25
|
-
'
|
|
25
|
+
'wallet-screening-blocked',
|
|
26
26
|
'wallet-locked-view',
|
|
27
27
|
'gate-blocked-wallet',
|
|
28
28
|
'email-wallet-otp-verification-view',
|
|
@@ -60,10 +60,6 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
60
60
|
copykey: 'dyn_waas.backup_unsuccessful.title',
|
|
61
61
|
heading: t('dyn_waas.backup_unsuccessful.title'),
|
|
62
62
|
},
|
|
63
|
-
'chainalysis-blocked-wallet': {
|
|
64
|
-
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
65
|
-
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
66
|
-
},
|
|
67
63
|
'confirm-exchange-transfer': {
|
|
68
64
|
copykey: 'dyn_exchange_transfer_confirmation.title',
|
|
69
65
|
heading: t('dyn_exchange_transfer_confirmation.title'),
|
|
@@ -212,6 +208,10 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
212
208
|
copykey: 'dyn_wallet_list.title.select',
|
|
213
209
|
heading: t('dyn_wallet_list.title.select'),
|
|
214
210
|
},
|
|
211
|
+
'wallet-screening-blocked': {
|
|
212
|
+
copykey: 'dyn_screening_blocked_wallet.title',
|
|
213
|
+
heading: t('dyn_screening_blocked_wallet.title'),
|
|
214
|
+
},
|
|
215
215
|
'wallet-sign': {
|
|
216
216
|
copykey: 'dyn_wallet_transfer.sign.title',
|
|
217
217
|
heading: t('dyn_wallet_transfer.sign.title'),
|
|
@@ -56,10 +56,6 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
56
56
|
copykey: 'dyn_waas.backup_unsuccessful.title',
|
|
57
57
|
heading: t('dyn_waas.backup_unsuccessful.title'),
|
|
58
58
|
},
|
|
59
|
-
'chainalysis-blocked-wallet': {
|
|
60
|
-
copykey: 'dyn_chainalysis_blocked_wallet.title',
|
|
61
|
-
heading: t('dyn_chainalysis_blocked_wallet.title'),
|
|
62
|
-
},
|
|
63
59
|
'confirm-exchange-transfer': {
|
|
64
60
|
copykey: 'dyn_exchange_transfer_confirmation.title',
|
|
65
61
|
heading: t('dyn_exchange_transfer_confirmation.title'),
|
|
@@ -208,6 +204,10 @@ const useDynamicLayoutData = ({ view }) => {
|
|
|
208
204
|
copykey: 'dyn_wallet_list.title.select',
|
|
209
205
|
heading: t('dyn_wallet_list.title.select'),
|
|
210
206
|
},
|
|
207
|
+
'wallet-screening-blocked': {
|
|
208
|
+
copykey: 'dyn_screening_blocked_wallet.title',
|
|
209
|
+
heading: t('dyn_screening_blocked_wallet.title'),
|
|
210
|
+
},
|
|
211
211
|
'wallet-sign': {
|
|
212
212
|
copykey: 'dyn_wallet_transfer.sign.title',
|
|
213
213
|
heading: t('dyn_wallet_transfer.sign.title'),
|
|
@@ -240,10 +240,10 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
240
240
|
setShowAuthFlow(true);
|
|
241
241
|
return;
|
|
242
242
|
}
|
|
243
|
-
if (e instanceof utils.
|
|
243
|
+
if (e instanceof utils.WalletScreeningBlockedError) {
|
|
244
244
|
handleDisconnectWallet({ walletConnector });
|
|
245
245
|
setDeniedAddress(address);
|
|
246
|
-
pushView('
|
|
246
|
+
pushView('wallet-screening-blocked');
|
|
247
247
|
return;
|
|
248
248
|
}
|
|
249
249
|
if (e instanceof utils.GateBlockedError) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
|
-
import { DynamicError, StorageService, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError,
|
|
3
|
+
import { DynamicError, StorageService, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, WalletScreeningBlockedError, GateBlockedError, SandboxMaximumThresholdReachedError, NoAccessError, AccountExistsError, ErrorCode } from '@dynamic-labs/utils';
|
|
4
4
|
import { getWalletProvider, isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import 'react';
|
|
6
6
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
@@ -236,10 +236,10 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
|
|
|
236
236
|
setShowAuthFlow(true);
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
if (e instanceof
|
|
239
|
+
if (e instanceof WalletScreeningBlockedError) {
|
|
240
240
|
handleDisconnectWallet({ walletConnector });
|
|
241
241
|
setDeniedAddress(address);
|
|
242
|
-
pushView('
|
|
242
|
+
pushView('wallet-screening-blocked');
|
|
243
243
|
return;
|
|
244
244
|
}
|
|
245
245
|
if (e instanceof GateBlockedError) {
|
|
@@ -12,12 +12,12 @@ const useNoAccessText = () => {
|
|
|
12
12
|
const { socialMediaLinkText, socialMediaUrl, accessDeniedMessagePrimary, accessDeniedMessageSecondary, } = useInternalDynamicContext.useInternalDynamicContext();
|
|
13
13
|
const { view } = ViewContext.useViewContext();
|
|
14
14
|
const { t } = reactI18next.useTranslation();
|
|
15
|
-
const
|
|
15
|
+
const isScreeningBlockedView = view.type === 'wallet-screening-blocked';
|
|
16
16
|
const isGateBlockedView = view.type === 'gate-blocked-wallet';
|
|
17
17
|
const isAccessListView = view.type === 'no-access';
|
|
18
18
|
const getSocialMediaLinkText = () => {
|
|
19
|
-
if (
|
|
20
|
-
return t(textData.
|
|
19
|
+
if (isScreeningBlockedView) {
|
|
20
|
+
return t(textData.screening._socialMediaLinkText);
|
|
21
21
|
}
|
|
22
22
|
if (isGateBlockedView) {
|
|
23
23
|
return undefined;
|
|
@@ -25,8 +25,8 @@ const useNoAccessText = () => {
|
|
|
25
25
|
return socialMediaLinkText;
|
|
26
26
|
};
|
|
27
27
|
const getSocialMediaUrl = () => {
|
|
28
|
-
if (
|
|
29
|
-
return t(textData.
|
|
28
|
+
if (isScreeningBlockedView) {
|
|
29
|
+
return t(textData.screening._socialMediaUrl);
|
|
30
30
|
}
|
|
31
31
|
if (isGateBlockedView) {
|
|
32
32
|
return undefined;
|
|
@@ -34,8 +34,8 @@ const useNoAccessText = () => {
|
|
|
34
34
|
return socialMediaUrl;
|
|
35
35
|
};
|
|
36
36
|
const getTitle = () => {
|
|
37
|
-
if (
|
|
38
|
-
return t(textData.
|
|
37
|
+
if (isScreeningBlockedView) {
|
|
38
|
+
return t(textData.screening.title);
|
|
39
39
|
}
|
|
40
40
|
if (isGateBlockedView) {
|
|
41
41
|
return t(textData.gate.title);
|
|
@@ -43,8 +43,8 @@ const useNoAccessText = () => {
|
|
|
43
43
|
return accessDeniedMessagePrimary || t(textData.default.title);
|
|
44
44
|
};
|
|
45
45
|
const getSubtitle = () => {
|
|
46
|
-
if (
|
|
47
|
-
return t(textData.
|
|
46
|
+
if (isScreeningBlockedView) {
|
|
47
|
+
return t(textData.screening.subtitle);
|
|
48
48
|
}
|
|
49
49
|
if (isGateBlockedView) {
|
|
50
50
|
return t(textData.gate.subtitle);
|
|
@@ -52,8 +52,8 @@ const useNoAccessText = () => {
|
|
|
52
52
|
return accessDeniedMessageSecondary || t(textData.default.subtitle);
|
|
53
53
|
};
|
|
54
54
|
const getButtonTitle = () => {
|
|
55
|
-
if (
|
|
56
|
-
return t(textData.
|
|
55
|
+
if (isScreeningBlockedView) {
|
|
56
|
+
return t(textData.screening.buttonTitle);
|
|
57
57
|
}
|
|
58
58
|
if (isGateBlockedView) {
|
|
59
59
|
return t(textData.gate.buttonTitle);
|
|
@@ -65,20 +65,13 @@ const useNoAccessText = () => {
|
|
|
65
65
|
_socialMediaUrl: getSocialMediaUrl(),
|
|
66
66
|
buttonTitle: getButtonTitle(),
|
|
67
67
|
isAccessListView,
|
|
68
|
-
isChainalysisView,
|
|
69
68
|
isGateBlockedView,
|
|
69
|
+
isScreeningBlockedView,
|
|
70
70
|
subtitle: getSubtitle(),
|
|
71
71
|
title: getTitle(),
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
const textData = {
|
|
75
|
-
chainalysis: {
|
|
76
|
-
_socialMediaLinkText: 'dyn_no_access.chainalysis.social_media_link_text',
|
|
77
|
-
_socialMediaUrl: 'dyn_no_access.chainalysis.social_media_link_url',
|
|
78
|
-
buttonTitle: 'dyn_no_access.chainalysis.button_text',
|
|
79
|
-
subtitle: 'dyn_no_access.chainalysis.description',
|
|
80
|
-
title: 'dyn_no_access.chainalysis.title',
|
|
81
|
-
},
|
|
82
75
|
default: {
|
|
83
76
|
buttonTitle: 'dyn_no_access.default.button_text',
|
|
84
77
|
subtitle: 'dyn_no_access.default.description',
|
|
@@ -91,6 +84,13 @@ const textData = {
|
|
|
91
84
|
subtitle: 'dyn_no_access.gate.description',
|
|
92
85
|
title: 'dyn_no_access.gate.title',
|
|
93
86
|
},
|
|
87
|
+
screening: {
|
|
88
|
+
_socialMediaLinkText: 'dyn_no_access.screening.social_media_link_text',
|
|
89
|
+
_socialMediaUrl: 'dyn_no_access.screening.social_media_link_url',
|
|
90
|
+
buttonTitle: 'dyn_no_access.screening.button_text',
|
|
91
|
+
subtitle: 'dyn_no_access.screening.description',
|
|
92
|
+
title: 'dyn_no_access.screening.title',
|
|
93
|
+
},
|
|
94
94
|
};
|
|
95
95
|
|
|
96
96
|
exports.textData = textData;
|
|
@@ -3,19 +3,12 @@ export declare const useNoAccessText: () => {
|
|
|
3
3
|
_socialMediaUrl: string | undefined;
|
|
4
4
|
buttonTitle: string;
|
|
5
5
|
isAccessListView: boolean;
|
|
6
|
-
isChainalysisView: boolean;
|
|
7
6
|
isGateBlockedView: boolean;
|
|
7
|
+
isScreeningBlockedView: boolean;
|
|
8
8
|
subtitle: string;
|
|
9
9
|
title: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const textData: {
|
|
12
|
-
chainalysis: {
|
|
13
|
-
_socialMediaLinkText: string;
|
|
14
|
-
_socialMediaUrl: string;
|
|
15
|
-
buttonTitle: string;
|
|
16
|
-
subtitle: string;
|
|
17
|
-
title: string;
|
|
18
|
-
};
|
|
19
12
|
default: {
|
|
20
13
|
buttonTitle: string;
|
|
21
14
|
subtitle: string;
|
|
@@ -28,4 +21,11 @@ export declare const textData: {
|
|
|
28
21
|
subtitle: string;
|
|
29
22
|
title: string;
|
|
30
23
|
};
|
|
24
|
+
screening: {
|
|
25
|
+
_socialMediaLinkText: string;
|
|
26
|
+
_socialMediaUrl: string;
|
|
27
|
+
buttonTitle: string;
|
|
28
|
+
subtitle: string;
|
|
29
|
+
title: string;
|
|
30
|
+
};
|
|
31
31
|
};
|
|
@@ -8,12 +8,12 @@ const useNoAccessText = () => {
|
|
|
8
8
|
const { socialMediaLinkText, socialMediaUrl, accessDeniedMessagePrimary, accessDeniedMessageSecondary, } = useInternalDynamicContext();
|
|
9
9
|
const { view } = useViewContext();
|
|
10
10
|
const { t } = useTranslation();
|
|
11
|
-
const
|
|
11
|
+
const isScreeningBlockedView = view.type === 'wallet-screening-blocked';
|
|
12
12
|
const isGateBlockedView = view.type === 'gate-blocked-wallet';
|
|
13
13
|
const isAccessListView = view.type === 'no-access';
|
|
14
14
|
const getSocialMediaLinkText = () => {
|
|
15
|
-
if (
|
|
16
|
-
return t(textData.
|
|
15
|
+
if (isScreeningBlockedView) {
|
|
16
|
+
return t(textData.screening._socialMediaLinkText);
|
|
17
17
|
}
|
|
18
18
|
if (isGateBlockedView) {
|
|
19
19
|
return undefined;
|
|
@@ -21,8 +21,8 @@ const useNoAccessText = () => {
|
|
|
21
21
|
return socialMediaLinkText;
|
|
22
22
|
};
|
|
23
23
|
const getSocialMediaUrl = () => {
|
|
24
|
-
if (
|
|
25
|
-
return t(textData.
|
|
24
|
+
if (isScreeningBlockedView) {
|
|
25
|
+
return t(textData.screening._socialMediaUrl);
|
|
26
26
|
}
|
|
27
27
|
if (isGateBlockedView) {
|
|
28
28
|
return undefined;
|
|
@@ -30,8 +30,8 @@ const useNoAccessText = () => {
|
|
|
30
30
|
return socialMediaUrl;
|
|
31
31
|
};
|
|
32
32
|
const getTitle = () => {
|
|
33
|
-
if (
|
|
34
|
-
return t(textData.
|
|
33
|
+
if (isScreeningBlockedView) {
|
|
34
|
+
return t(textData.screening.title);
|
|
35
35
|
}
|
|
36
36
|
if (isGateBlockedView) {
|
|
37
37
|
return t(textData.gate.title);
|
|
@@ -39,8 +39,8 @@ const useNoAccessText = () => {
|
|
|
39
39
|
return accessDeniedMessagePrimary || t(textData.default.title);
|
|
40
40
|
};
|
|
41
41
|
const getSubtitle = () => {
|
|
42
|
-
if (
|
|
43
|
-
return t(textData.
|
|
42
|
+
if (isScreeningBlockedView) {
|
|
43
|
+
return t(textData.screening.subtitle);
|
|
44
44
|
}
|
|
45
45
|
if (isGateBlockedView) {
|
|
46
46
|
return t(textData.gate.subtitle);
|
|
@@ -48,8 +48,8 @@ const useNoAccessText = () => {
|
|
|
48
48
|
return accessDeniedMessageSecondary || t(textData.default.subtitle);
|
|
49
49
|
};
|
|
50
50
|
const getButtonTitle = () => {
|
|
51
|
-
if (
|
|
52
|
-
return t(textData.
|
|
51
|
+
if (isScreeningBlockedView) {
|
|
52
|
+
return t(textData.screening.buttonTitle);
|
|
53
53
|
}
|
|
54
54
|
if (isGateBlockedView) {
|
|
55
55
|
return t(textData.gate.buttonTitle);
|
|
@@ -61,20 +61,13 @@ const useNoAccessText = () => {
|
|
|
61
61
|
_socialMediaUrl: getSocialMediaUrl(),
|
|
62
62
|
buttonTitle: getButtonTitle(),
|
|
63
63
|
isAccessListView,
|
|
64
|
-
isChainalysisView,
|
|
65
64
|
isGateBlockedView,
|
|
65
|
+
isScreeningBlockedView,
|
|
66
66
|
subtitle: getSubtitle(),
|
|
67
67
|
title: getTitle(),
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
70
|
const textData = {
|
|
71
|
-
chainalysis: {
|
|
72
|
-
_socialMediaLinkText: 'dyn_no_access.chainalysis.social_media_link_text',
|
|
73
|
-
_socialMediaUrl: 'dyn_no_access.chainalysis.social_media_link_url',
|
|
74
|
-
buttonTitle: 'dyn_no_access.chainalysis.button_text',
|
|
75
|
-
subtitle: 'dyn_no_access.chainalysis.description',
|
|
76
|
-
title: 'dyn_no_access.chainalysis.title',
|
|
77
|
-
},
|
|
78
71
|
default: {
|
|
79
72
|
buttonTitle: 'dyn_no_access.default.button_text',
|
|
80
73
|
subtitle: 'dyn_no_access.default.description',
|
|
@@ -87,6 +80,13 @@ const textData = {
|
|
|
87
80
|
subtitle: 'dyn_no_access.gate.description',
|
|
88
81
|
title: 'dyn_no_access.gate.title',
|
|
89
82
|
},
|
|
83
|
+
screening: {
|
|
84
|
+
_socialMediaLinkText: 'dyn_no_access.screening.social_media_link_text',
|
|
85
|
+
_socialMediaUrl: 'dyn_no_access.screening.social_media_link_url',
|
|
86
|
+
buttonTitle: 'dyn_no_access.screening.button_text',
|
|
87
|
+
subtitle: 'dyn_no_access.screening.description',
|
|
88
|
+
title: 'dyn_no_access.screening.title',
|
|
89
|
+
},
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
export { textData, useNoAccessText };
|
|
@@ -20,7 +20,7 @@ const findPrimaryEmbeddedChain = (projectSettings) => {
|
|
|
20
20
|
return primaryChainName;
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
logger.
|
|
23
|
+
logger.warn('Unsupported primary chain', { primaryChainName });
|
|
24
24
|
}
|
|
25
25
|
return sdkApiCore.ChainEnum.Evm;
|
|
26
26
|
};
|
|
@@ -16,7 +16,7 @@ const findPrimaryEmbeddedChain = (projectSettings) => {
|
|
|
16
16
|
return primaryChainName;
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
-
logger.
|
|
19
|
+
logger.warn('Unsupported primary chain', { primaryChainName });
|
|
20
20
|
}
|
|
21
21
|
return ChainEnum.Evm;
|
|
22
22
|
};
|
|
@@ -95,7 +95,6 @@ const viewToComponentMap = {
|
|
|
95
95
|
'bridge-summary': BridgeSummaryView.BridgeSummaryView,
|
|
96
96
|
'bridge-welcome': BridgeWelcomeView.BridgeWelcomeView,
|
|
97
97
|
captcha: CaptchaVerifyUser.CaptchaVerifyUser,
|
|
98
|
-
'chainalysis-blocked-wallet': NoAccess.NoAccess,
|
|
99
98
|
'collect-user-data': CollectUserDataView.CollectUserDataView,
|
|
100
99
|
'collect-user-data-login-no-wallet': CollectUserDataViewNoWallet.CollectUserDataViewNoWallet,
|
|
101
100
|
'device-registration': DeviceRegistrationView.DeviceRegistrationView,
|
|
@@ -173,6 +172,7 @@ const viewToComponentMap = {
|
|
|
173
172
|
'wallet-list': WalletListForDefaultConnection.WalletListForDefaultConnection,
|
|
174
173
|
'wallet-locked-view': WalletLockedView.WalletLockedView,
|
|
175
174
|
'wallet-redirect-view': WalletRedirectView.WalletRedirectView,
|
|
175
|
+
'wallet-screening-blocked': NoAccess.NoAccess,
|
|
176
176
|
'wallet-sign': WalletSignSpinnerView.WalletSignSpinnerView,
|
|
177
177
|
'wallet-used': WalletUsedView.WalletUsedView,
|
|
178
178
|
};
|
|
@@ -8,7 +8,6 @@ export declare const viewToComponentMap: {
|
|
|
8
8
|
'bridge-summary': () => JSX.Element;
|
|
9
9
|
'bridge-welcome': () => JSX.Element;
|
|
10
10
|
captcha: () => JSX.Element;
|
|
11
|
-
'chainalysis-blocked-wallet': () => JSX.Element;
|
|
12
11
|
'collect-user-data': () => JSX.Element | null;
|
|
13
12
|
'collect-user-data-login-no-wallet': import("react").FC<{
|
|
14
13
|
userIdentification: "environmentId" | keyof import("@dynamic-labs/sdk-api-core").UserFields | "lastVerifiedCredentialId" | "lists" | "newUser" | "sessionId" | "userId" | "verifiedCredentials" | "scope" | "missingFields";
|
|
@@ -127,6 +126,7 @@ export declare const viewToComponentMap: {
|
|
|
127
126
|
}>;
|
|
128
127
|
'wallet-locked-view': () => JSX.Element | null;
|
|
129
128
|
'wallet-redirect-view': () => JSX.Element;
|
|
129
|
+
'wallet-screening-blocked': () => JSX.Element;
|
|
130
130
|
'wallet-sign': () => JSX.Element | null;
|
|
131
131
|
'wallet-used': () => JSX.Element;
|
|
132
132
|
};
|
|
@@ -91,7 +91,6 @@ const viewToComponentMap = {
|
|
|
91
91
|
'bridge-summary': BridgeSummaryView,
|
|
92
92
|
'bridge-welcome': BridgeWelcomeView,
|
|
93
93
|
captcha: CaptchaVerifyUser,
|
|
94
|
-
'chainalysis-blocked-wallet': NoAccess,
|
|
95
94
|
'collect-user-data': CollectUserDataView,
|
|
96
95
|
'collect-user-data-login-no-wallet': CollectUserDataViewNoWallet,
|
|
97
96
|
'device-registration': DeviceRegistrationView,
|
|
@@ -169,6 +168,7 @@ const viewToComponentMap = {
|
|
|
169
168
|
'wallet-list': WalletListForDefaultConnection,
|
|
170
169
|
'wallet-locked-view': WalletLockedView,
|
|
171
170
|
'wallet-redirect-view': WalletRedirectView,
|
|
171
|
+
'wallet-screening-blocked': NoAccess,
|
|
172
172
|
'wallet-sign': WalletSignSpinnerView,
|
|
173
173
|
'wallet-used': WalletUsedView,
|
|
174
174
|
};
|
package/src/version.cjs
CHANGED
|
@@ -7,6 +7,8 @@ var _package = require('../package.cjs');
|
|
|
7
7
|
|
|
8
8
|
const VERSION = _package.version;
|
|
9
9
|
const API_VERSION = _package.dependencies['@dynamic-labs/sdk-api-core'];
|
|
10
|
+
const CLIENT_VERSION = _package.dependencies['@dynamic-labs-sdk/client'];
|
|
10
11
|
|
|
11
12
|
exports.API_VERSION = API_VERSION;
|
|
13
|
+
exports.CLIENT_VERSION = CLIENT_VERSION;
|
|
12
14
|
exports.VERSION = VERSION;
|
package/src/version.d.ts
CHANGED
package/src/version.js
CHANGED
|
@@ -3,5 +3,6 @@ import { version, dependencies } from '../package.js';
|
|
|
3
3
|
|
|
4
4
|
const VERSION = version;
|
|
5
5
|
const API_VERSION = dependencies['@dynamic-labs/sdk-api-core'];
|
|
6
|
+
const CLIENT_VERSION = dependencies['@dynamic-labs-sdk/client'];
|
|
6
7
|
|
|
7
|
-
export { API_VERSION, VERSION };
|
|
8
|
+
export { API_VERSION, CLIENT_VERSION, VERSION };
|