@dynamic-labs/sdk-react-core 4.98.0 → 4.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,30 @@
1
1
 
2
+ ## [4.100.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.99.0...v4.100.0) (2026-09-10)
3
+
4
+
5
+ ### Features
6
+
7
+ * **solana-extension:** expose createAssociatedTokenAccount ([#12377](https://github.com/dynamic-labs/dynamic-auth/issues/12377)) ([c127857](https://github.com/dynamic-labs/dynamic-auth/commit/c127857097069ef2fcf337b78971e678f0552277))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * show transaction amount when simulation returns no transfers (v4 backport) ([#12356](https://github.com/dynamic-labs/dynamic-auth/issues/12356)) ([36feb2d](https://github.com/dynamic-labs/dynamic-auth/commit/36feb2d24de3f78560112bdf86a258d0596c4470))
13
+
14
+ ## [4.99.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.98.0...v4.99.0) (2026-09-10)
15
+
16
+
17
+ ### Features
18
+
19
+ * **solana-core:** standalone sponsored ATA creation [v4 backport] ([#12366](https://github.com/dynamic-labs/dynamic-auth/issues/12366)) ([46d86c9](https://github.com/dynamic-labs/dynamic-auth/commit/46d86c9a1a04c45bf045acc5c6df792dcd4b3590))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * do not report wallets installed from a provider selection router (v4) ([#12341](https://github.com/dynamic-labs/dynamic-auth/issues/12341)) ([6b02087](https://github.com/dynamic-labs/dynamic-auth/commit/6b02087685545bb6f672eb9040316d01489c82f4))
25
+ * **screening:** soften the blocked-wallet copy to be provider-neutral (v4) ([#12359](https://github.com/dynamic-labs/dynamic-auth/issues/12359)) ([d6772df](https://github.com/dynamic-labs/dynamic-auth/commit/d6772dfc1419811bfbc1d9cb1db58fe12274d397))
26
+ * **waas:** detach the superseded WaaS client from the iframe reverse channel (v4) ([#12349](https://github.com/dynamic-labs/dynamic-auth/issues/12349)) ([393253d](https://github.com/dynamic-labs/dynamic-auth/commit/393253d9e5934e039e21b85ed6ceded760e0f225)), closes [#11766](https://github.com/dynamic-labs/dynamic-auth/issues/11766) [#12348](https://github.com/dynamic-labs/dynamic-auth/issues/12348)
27
+
2
28
  ## [4.98.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.97.0...v4.98.0) (2026-09-02)
3
29
 
4
30
 
package/package.cjs CHANGED
@@ -3,12 +3,12 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.98.0";
6
+ var version = "4.100.0";
7
7
  var dependencies = {
8
8
  "@dynamic-labs/sdk-api-core": "0.12.0",
9
9
  "@dynamic-labs-sdk/client": "1.27.1",
10
- "@dynamic-labs-wallet/browser-wallet-client": "1.1.2",
11
- "@dynamic-labs-wallet/forward-mpc-client": "2.0.1",
10
+ "@dynamic-labs-wallet/browser-wallet-client": "1.1.8",
11
+ "@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
12
12
  "@hcaptcha/react-hcaptcha": "1.4.4",
13
13
  "@marsidev/react-turnstile": "1.5.2",
14
14
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
package/package.js CHANGED
@@ -1,10 +1,10 @@
1
1
  'use client'
2
- var version = "4.98.0";
2
+ var version = "4.100.0";
3
3
  var dependencies = {
4
4
  "@dynamic-labs/sdk-api-core": "0.12.0",
5
5
  "@dynamic-labs-sdk/client": "1.27.1",
6
- "@dynamic-labs-wallet/browser-wallet-client": "1.1.2",
7
- "@dynamic-labs-wallet/forward-mpc-client": "2.0.1",
6
+ "@dynamic-labs-wallet/browser-wallet-client": "1.1.8",
7
+ "@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
8
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
9
9
  "@marsidev/react-turnstile": "1.5.2",
10
10
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.98.0",
3
+ "version": "4.100.0",
4
4
  "dependencies": {
5
5
  "@dynamic-labs/sdk-api-core": "0.12.0",
6
6
  "@dynamic-labs-sdk/client": "1.27.1",
7
- "@dynamic-labs-wallet/browser-wallet-client": "1.1.2",
8
- "@dynamic-labs-wallet/forward-mpc-client": "2.0.1",
7
+ "@dynamic-labs-wallet/browser-wallet-client": "1.1.8",
8
+ "@dynamic-labs-wallet/forward-mpc-client": "2.0.2",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
10
10
  "@marsidev/react-turnstile": "1.5.2",
11
11
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
@@ -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": "4.98.0",
22
- "@dynamic-labs/iconic": "4.98.0",
23
- "@dynamic-labs/locale": "4.98.0",
24
- "@dynamic-labs/logger": "4.98.0",
25
- "@dynamic-labs/multi-wallet": "4.98.0",
26
- "@dynamic-labs/rpc-providers": "4.98.0",
27
- "@dynamic-labs/store": "4.98.0",
28
- "@dynamic-labs/types": "4.98.0",
29
- "@dynamic-labs/utils": "4.98.0",
30
- "@dynamic-labs/wallet-book": "4.98.0",
31
- "@dynamic-labs/wallet-connector-core": "4.98.0",
21
+ "@dynamic-labs/assert-package-version": "4.100.0",
22
+ "@dynamic-labs/iconic": "4.100.0",
23
+ "@dynamic-labs/locale": "4.100.0",
24
+ "@dynamic-labs/logger": "4.100.0",
25
+ "@dynamic-labs/multi-wallet": "4.100.0",
26
+ "@dynamic-labs/rpc-providers": "4.100.0",
27
+ "@dynamic-labs/store": "4.100.0",
28
+ "@dynamic-labs/types": "4.100.0",
29
+ "@dynamic-labs/utils": "4.100.0",
30
+ "@dynamic-labs/wallet-book": "4.100.0",
31
+ "@dynamic-labs/wallet-connector-core": "4.100.0",
32
32
  "eventemitter3": "5.0.1"
33
33
  },
34
34
  "devDependencies": {
@@ -106,6 +106,7 @@ require('../../context/PasskeyContext/PasskeyContext.cjs');
106
106
  require('../../context/OnrampContext/OnrampContext.cjs');
107
107
  require('../../utils/hooks/useWalletDelegation/DelegationError.cjs');
108
108
  require('../../store/state/sendBalances.cjs');
109
+ var getTransactionAssetTransfers = require('./getTransactionAssetTransfers.cjs');
109
110
  require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
110
111
  require('../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
111
112
  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 (['NATIVE', 'SOL', 'ETH'].includes(transfer.asset.type) &&
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 allAssets = [...outAssetsWithoutFeeEvm, ...inAssets];
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 || ((_d = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _d === void 0 ? void 0 : _d[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((_e = transaction.to) !== null && _e !== void 0 ? _e : (_f = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _f === void 0 ? void 0 : _f[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 &&
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) }) })] })] }))] }) })] }));
@@ -102,6 +102,7 @@ import '../../context/PasskeyContext/PasskeyContext.js';
102
102
  import '../../context/OnrampContext/OnrampContext.js';
103
103
  import '../../utils/hooks/useWalletDelegation/DelegationError.js';
104
104
  import '../../store/state/sendBalances.js';
105
+ import { getTransactionAssetTransfers } from './getTransactionAssetTransfers.js';
105
106
  import '../../store/state/connectorsInitializing/connectorsInitializing.js';
106
107
  import '../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
107
108
  import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
@@ -119,7 +120,7 @@ import '@dynamic-labs/store';
119
120
  import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
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 (['NATIVE', 'SOL', 'ETH'].includes(transfer.asset.type) &&
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 allAssets = [...outAssetsWithoutFeeEvm, ...inAssets];
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 || ((_d = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _d === void 0 ? void 0 : _d[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((_e = transaction.to) !== null && _e !== void 0 ? _e : (_f = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.counterparties) === null || _f === void 0 ? void 0 : _f[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 &&
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 };
@@ -268,12 +268,20 @@ const useDynamicWaas = () => {
268
268
  return true;
269
269
  }
270
270
  catch (error) {
271
- walletConnectorCore.logger.error('Error initializing waas wallet client', {
271
+ const failureDetails = {
272
272
  chain,
273
273
  error,
274
274
  sessionId: user.sessionId,
275
275
  userId: user.id,
276
- });
276
+ };
277
+ // A pending auth scope means the token has not upgraded yet, so
278
+ // initialization is retried once it does.
279
+ if (utils.isWaasAuthScopePendingError(error)) {
280
+ walletConnectorCore.logger.debug('Waas wallet client not initialized yet', failureDetails);
281
+ }
282
+ else {
283
+ walletConnectorCore.logger.error('Error initializing waas wallet client', failureDetails);
284
+ }
277
285
  return false;
278
286
  }
279
287
  })));
@@ -2,7 +2,7 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useMemo, useRef, useState, useCallback } from 'react';
4
4
  import { EmbeddedWalletVersionEnum, JwtVerifiedCredentialFormatEnum, WalletProviderEnum, ChainEnum } from '@dynamic-labs/sdk-api-core';
5
- import { DynamicError } from '@dynamic-labs/utils';
5
+ import { DynamicError, isWaasAuthScopePendingError } from '@dynamic-labs/utils';
6
6
  import { logger } from '@dynamic-labs/wallet-connector-core';
7
7
  import { dynamicEvents } from '../../../events/dynamicEvents.js';
8
8
  import '@dynamic-labs-sdk/client/core';
@@ -264,12 +264,20 @@ const useDynamicWaas = () => {
264
264
  return true;
265
265
  }
266
266
  catch (error) {
267
- logger.error('Error initializing waas wallet client', {
267
+ const failureDetails = {
268
268
  chain,
269
269
  error,
270
270
  sessionId: user.sessionId,
271
271
  userId: user.id,
272
- });
272
+ };
273
+ // A pending auth scope means the token has not upgraded yet, so
274
+ // initialization is retried once it does.
275
+ if (isWaasAuthScopePendingError(error)) {
276
+ logger.debug('Waas wallet client not initialized yet', failureDetails);
277
+ }
278
+ else {
279
+ logger.error('Error initializing waas wallet client', failureDetails);
280
+ }
273
281
  return false;
274
282
  }
275
283
  })));
@@ -67,15 +67,14 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
67
67
  // common pre-MFA case, but as defense in depth swallow the WaaS
68
68
  // "scope still pending" error specifically (recognizable via its
69
69
  // stable code) so a late token regression doesn't spam the console.
70
- // Anything else is surfaced as before.
70
+ // Anything else is surfaced as an error.
71
71
  void smartWallet.initializeSmartWallet({
72
72
  account,
73
73
  primaryWalletId,
74
74
  verifiedCredentials: user.verifiedCredentials,
75
75
  walletConnectorOptions,
76
76
  }).catch((error) => {
77
- if (error instanceof Error &&
78
- error.code === utils.WAAS_AUTH_SCOPE_PENDING_CODE) {
77
+ if (utils.isWaasAuthScopePendingError(error)) {
79
78
  logger.logger.debug('[createLinkedWalletsFromWalletOptions] Swallowed WaaS scope-pending error during smart-wallet init');
80
79
  return;
81
80
  }
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { HardwareWalletEnum, WalletProviderEnum } from '@dynamic-labs/sdk-api-core';
3
- import { WAAS_AUTH_SCOPE_PENDING_CODE } from '@dynamic-labs/utils';
3
+ import { isWaasAuthScopePendingError } from '@dynamic-labs/utils';
4
4
  import { isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
5
5
  import '@dynamic-labs/iconic';
6
6
  import 'react';
@@ -63,15 +63,14 @@ const createLinkedWalletsFromWalletOptions = ({ user, walletConnectorOptions, pr
63
63
  // common pre-MFA case, but as defense in depth swallow the WaaS
64
64
  // "scope still pending" error specifically (recognizable via its
65
65
  // stable code) so a late token regression doesn't spam the console.
66
- // Anything else is surfaced as before.
66
+ // Anything else is surfaced as an error.
67
67
  void initializeSmartWallet({
68
68
  account,
69
69
  primaryWalletId,
70
70
  verifiedCredentials: user.verifiedCredentials,
71
71
  walletConnectorOptions,
72
72
  }).catch((error) => {
73
- if (error instanceof Error &&
74
- error.code === WAAS_AUTH_SCOPE_PENDING_CODE) {
73
+ if (isWaasAuthScopePendingError(error)) {
75
74
  logger.debug('[createLinkedWalletsFromWalletOptions] Swallowed WaaS scope-pending error during smart-wallet init');
76
75
  return;
77
76
  }