@dynamic-labs/sdk-react-core 5.6.1 → 5.8.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 +28 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +23 -13
- package/src/components.cjs +184 -0
- package/src/components.js +88 -0
- package/src/icons.cjs +298 -0
- package/src/icons.d.ts +1 -0
- package/src/icons.js +146 -0
- package/src/lib/components/DynamicSpinner/DynamicSpinner.cjs +15 -0
- package/src/lib/components/DynamicSpinner/DynamicSpinner.js +11 -0
- package/src/lib/components/Separator/Separator.cjs +11 -0
- package/src/lib/components/Separator/Separator.js +7 -0
- package/src/lib/components/Switch/Switch.cjs +11 -0
- package/src/lib/components/Switch/Switch.js +7 -0
- 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/types/IDynamicContext.d.ts +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.cjs +2 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.d.ts +1 -1
- package/src/lib/context/DynamicContext/useDynamicContext/useDynamicContext.js +2 -1
- package/src/lib/shared/assets/add-wallet.cjs +59 -0
- package/src/lib/shared/assets/add-wallet.js +35 -0
- package/src/lib/shared/assets/alt-embedded-wallet.cjs +55 -0
- package/src/lib/shared/assets/alt-embedded-wallet.js +31 -0
- package/src/lib/shared/assets/alt-key.cjs +55 -0
- package/src/lib/shared/assets/alt-key.js +31 -0
- package/src/lib/shared/assets/android-face-id.cjs +62 -0
- package/src/lib/shared/assets/android-face-id.js +38 -0
- package/src/lib/shared/assets/android-touch-id.cjs +52 -0
- package/src/lib/shared/assets/android-touch-id.js +28 -0
- package/src/lib/shared/assets/circle-locker.cjs +54 -0
- package/src/lib/shared/assets/circle-locker.js +30 -0
- package/src/lib/shared/assets/currency.cjs +70 -0
- package/src/lib/shared/assets/currency.js +46 -0
- package/src/lib/shared/assets/default-wallet.cjs +54 -0
- package/src/lib/shared/assets/default-wallet.js +30 -0
- package/src/lib/shared/assets/domain-blocked.cjs +73 -0
- package/src/lib/shared/assets/domain-blocked.js +49 -0
- package/src/lib/shared/assets/domain.cjs +54 -0
- package/src/lib/shared/assets/domain.js +30 -0
- package/src/lib/shared/assets/dynamic-logo.cjs +52 -0
- package/src/lib/shared/assets/dynamic-logo.js +28 -0
- package/src/lib/shared/assets/dynamic-round-logo.cjs +54 -0
- package/src/lib/shared/assets/dynamic-round-logo.js +30 -0
- package/src/lib/shared/assets/gear.cjs +54 -0
- package/src/lib/shared/assets/gear.js +30 -0
- package/src/lib/shared/assets/global-wallet-icon.cjs +64 -0
- package/src/lib/shared/assets/global-wallet-icon.js +40 -0
- package/src/lib/shared/assets/multiple-account-security.cjs +107 -0
- package/src/lib/shared/assets/multiple-account-security.js +83 -0
- package/src/lib/shared/assets/passkey-account-security.cjs +93 -0
- package/src/lib/shared/assets/passkey-account-security.js +69 -0
- package/src/lib/shared/assets/passkey-intro-icon.cjs +98 -0
- package/src/lib/shared/assets/passkey-intro-icon.js +74 -0
- package/src/lib/shared/assets/passkey-intro2.cjs +93 -0
- package/src/lib/shared/assets/passkey-intro2.js +69 -0
- package/src/lib/shared/assets/passkey-success-icon.cjs +95 -0
- package/src/lib/shared/assets/passkey-success-icon.js +71 -0
- package/src/lib/shared/assets/profile.cjs +65 -0
- package/src/lib/shared/assets/profile.js +41 -0
- package/src/lib/shared/assets/prompt-account-switch.cjs +64 -0
- package/src/lib/shared/assets/prompt-account-switch.js +40 -0
- package/src/lib/shared/assets/save-password-hero.cjs +128 -0
- package/src/lib/shared/assets/save-password-hero.js +104 -0
- package/src/lib/shared/assets/settings.cjs +54 -0
- package/src/lib/shared/assets/settings.js +30 -0
- package/src/lib/shared/assets/shield.cjs +59 -0
- package/src/lib/shared/assets/shield.js +35 -0
- package/src/lib/shared/assets/sparkles.cjs +54 -0
- package/src/lib/shared/assets/sparkles.js +30 -0
- package/src/lib/shared/assets/upgrade.cjs +93 -0
- package/src/lib/shared/assets/upgrade.js +69 -0
- package/src/lib/shared/assets/user-account-2.cjs +54 -0
- package/src/lib/shared/assets/user-account-2.js +30 -0
- package/src/lib/shared/assets/wallet-claim-hero.cjs +128 -0
- package/src/lib/shared/assets/wallet-claim-hero.js +104 -0
- package/src/lib/shared/assets/wallet.cjs +52 -0
- package/src/lib/shared/assets/wallet.js +28 -0
- package/src/lib/shared/assets/wallets/PhantomLedgerIcon/PhantomLedgerIcon.cjs +26 -0
- package/src/lib/shared/assets/wallets/PhantomLedgerIcon/PhantomLedgerIcon.js +22 -0
- package/src/lib/store/state/nonce/nonce.cjs +5 -5
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +10 -2
- package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +11 -3
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.cjs +17 -1
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.d.ts +11 -0
- package/src/lib/utils/hooks/useSendDynamicProps/useSendDynamicProps.js +17 -2
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +1 -0
- package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +1 -0
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.cjs +2 -3
- package/src/lib/utils/hooks/useWalletConnectors/utils/createLinkedWalletsFromWalletOptions/createLinkedWalletsFromWalletOptions.js +3 -4
- package/src/lib/views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.cjs +1 -0
- package/src/lib/views/ExchangeWhitelistWarning/ExchangeWhitelistWarning.js +1 -0
- package/src/lib/widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.cjs +1 -0
- package/src/lib/widgets/DynamicWidget/helpers/convertExchangeKeyAndProviderEnum.js +1 -0
- package/src/lib/widgets/DynamicWidget/views/MoonPayOnramp/useMoonPayOnramp.js +1 -1
|
@@ -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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
|
2
|
-
import { changeLanguage } from 'i18next';
|
|
2
|
+
import { changeLanguage, i18n as I18nInstance } from 'i18next';
|
|
3
3
|
import { CountryIso2 } from 'react-international-phone';
|
|
4
4
|
import { NameServiceData, ProjectSettings } from '@dynamic-labs/sdk-api-core';
|
|
5
5
|
import { MobileExperience, NetworkConfigurationMap, SocialProviderFilter, UserProfile, WalletUiUtils } from '@dynamic-labs/types';
|
|
@@ -68,6 +68,7 @@ export interface IDynamicContext {
|
|
|
68
68
|
handleLogOutWithReason: (reason: SdkLogoutReason) => Promise<void>;
|
|
69
69
|
removeWallet: (walletId: string, clearStackAndPushInitialView?: () => void) => Promise<void>;
|
|
70
70
|
handlers?: DynamicHandlers;
|
|
71
|
+
i18nSDKInstance: I18nInstance;
|
|
71
72
|
isBridgeFlow: boolean;
|
|
72
73
|
/** Whether there is an instance of DynamicEmbeddedAuthFlow being rendered */
|
|
73
74
|
isRenderingEmbeddedAuthFlow: boolean;
|
|
@@ -35,7 +35,7 @@ const useDynamicContextValue = () => {
|
|
|
35
35
|
// This is external context hook which is exposed to customers
|
|
36
36
|
const useDynamicContext = () => {
|
|
37
37
|
const context = useDynamicContextValue();
|
|
38
|
-
const { accountSwitchState, awaitingSignatureState, getNameService, handleLogOut, removeWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, refetchProjectSettings, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, // NOSONAR — deprecated property re-exposed via public API
|
|
38
|
+
const { accountSwitchState, awaitingSignatureState, getNameService, handleLogOut, removeWallet, i18nSDKInstance, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, refetchProjectSettings, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, // NOSONAR — deprecated property re-exposed via public API
|
|
39
39
|
showAuthFlow, showQrcodeModal, user, // NOSONAR — deprecated property re-exposed via public API
|
|
40
40
|
userWithMissingInfo, bridgeChains, // NOSONAR — deprecated property re-exposed via public API
|
|
41
41
|
bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
@@ -64,6 +64,7 @@ const useDynamicContext = () => {
|
|
|
64
64
|
bridgeChainsToConnect,
|
|
65
65
|
getNameService,
|
|
66
66
|
handleLogOut,
|
|
67
|
+
i18nSDKInstance,
|
|
67
68
|
loadingNetwork,
|
|
68
69
|
locale,
|
|
69
70
|
loginWithEmail,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { AuthMode } from '@dynamic-labs/types';
|
|
3
3
|
import { IDynamicContext } from '../types';
|
|
4
|
-
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'removeWallet' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'refetchProjectSettings' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'selectedTabIndex' | 'setSelectedTabIndex'> & {
|
|
4
|
+
export type UseDynamicContext = Pick<IDynamicContext, 'accountSwitchState' | 'awaitingSignatureState' | 'getNameService' | 'handleLogOut' | 'removeWallet' | 'i18nSDKInstance' | 'loadingNetwork' | 'locale' | 'loginWithEmail' | 'multiWalletWidgetState' | 'network' | 'networkConfigurations' | 'primaryWallet' | 'qrcodeUri' | 'refetchProjectSettings' | 'sdkHasLoaded' | 'setLogInWithEmail' | 'setMultiWalletWidgetState' | 'setShowDynamicUserProfile' | 'setShowQrcodeModal' | 'shadowDOMEnabled' | 'showAuthFlow' | 'showQrcodeModal' | 'user' | 'userWithMissingInfo' | 'bridgeChains' | 'bridgeChainsToConnect' | 'setShowBridgeWidget' | 'sendWagmiSettings' | 'showDynamicUserProfile' | 'selectedTabIndex' | 'setSelectedTabIndex'> & {
|
|
5
5
|
setShowAuthFlow: Dispatch<SetStateAction<boolean>>;
|
|
6
6
|
setAuthMode: (value: AuthMode) => void;
|
|
7
7
|
authMode: AuthMode;
|
|
@@ -31,7 +31,7 @@ const useDynamicContextValue = () => {
|
|
|
31
31
|
// This is external context hook which is exposed to customers
|
|
32
32
|
const useDynamicContext = () => {
|
|
33
33
|
const context = useDynamicContextValue();
|
|
34
|
-
const { accountSwitchState, awaitingSignatureState, getNameService, handleLogOut, removeWallet, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, refetchProjectSettings, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, // NOSONAR — deprecated property re-exposed via public API
|
|
34
|
+
const { accountSwitchState, awaitingSignatureState, getNameService, handleLogOut, removeWallet, i18nSDKInstance, loadingNetwork, locale, loginWithEmail, multiWalletWidgetState, network, networkConfigurations, qrcodeUri, refetchProjectSettings, sdkHasLoaded, setLogInWithEmail, setMultiWalletWidgetState, setShowAuthFlow, setShowDynamicUserProfile, setShowQrcodeModal, shadowDOMEnabled, // NOSONAR — deprecated property re-exposed via public API
|
|
35
35
|
showAuthFlow, showQrcodeModal, user, // NOSONAR — deprecated property re-exposed via public API
|
|
36
36
|
userWithMissingInfo, bridgeChains, // NOSONAR — deprecated property re-exposed via public API
|
|
37
37
|
bridgeChainsToConnect, primaryWallet, setShowBridgeWidget, sendWagmiSettings, showDynamicUserProfile, selectedTabIndex, setSelectedTabIndex, } = context;
|
|
@@ -60,6 +60,7 @@ const useDynamicContext = () => {
|
|
|
60
60
|
bridgeChainsToConnect,
|
|
61
61
|
getNameService,
|
|
62
62
|
handleLogOut,
|
|
63
|
+
i18nSDKInstance,
|
|
63
64
|
loadingNetwork,
|
|
64
65
|
locale,
|
|
65
66
|
loginWithEmail,
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var React = require('react');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n["default"] = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
var _path, _path2, _path3;
|
|
29
|
+
var _excluded = ["title", "titleId"];
|
|
30
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
31
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
32
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
33
|
+
var SvgAddWallet = function SvgAddWallet(_ref) {
|
|
34
|
+
var title = _ref.title,
|
|
35
|
+
titleId = _ref.titleId,
|
|
36
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
37
|
+
return /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
38
|
+
width: 24,
|
|
39
|
+
height: 24,
|
|
40
|
+
viewBox: "0 0 24 24",
|
|
41
|
+
fill: "none",
|
|
42
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
43
|
+
"aria-labelledby": titleId
|
|
44
|
+
}, props), title ? /*#__PURE__*/React__namespace.createElement("title", {
|
|
45
|
+
id: titleId
|
|
46
|
+
}, title) : null, _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
47
|
+
d: "M17.75 7.05C17.51 7.01 17.26 7 17 7H7c-.28 0-.55.02-.81.06.14-.28.34-.54.58-.78l3.25-3.26a3.525 3.525 0 0 1 4.96 0l1.75 1.77c.64.63.98 1.43 1.02 2.26ZM5 15c-2.21 0-4 1.79-4 4 0 .75.21 1.46.58 2.06A3.97 3.97 0 0 0 5 23c1.46 0 2.73-.78 3.42-1.94.37-.6.58-1.31.58-2.06 0-2.21-1.79-4-4-4Zm1.49 4.73h-.74v.78c0 .41-.34.75-.75.75s-.75-.34-.75-.75v-.78h-.74c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h.74v-.71c0-.41.34-.75.75-.75s.75.34.75.75v.71h.74a.749.749 0 1 1 0 1.5Z",
|
|
48
|
+
fill: "currentColor"
|
|
49
|
+
})), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
50
|
+
opacity: 0.4,
|
|
51
|
+
d: "M22 12v5c0 3-2 5-5 5H7.63c.31-.26.58-.58.79-.94.37-.6.58-1.31.58-2.06 0-2.21-1.79-4-4-4-1.2 0-2.27.53-3 1.36V12c0-2.72 1.64-4.62 4.19-4.94.26-.04.53-.06.81-.06h10c.26 0 .51.01.75.05C20.33 7.35 22 9.26 22 12Z",
|
|
52
|
+
fill: "currentColor"
|
|
53
|
+
})), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
54
|
+
d: "M22 12.5h-3c-1.1 0-2 .9-2 2s.9 2 2 2h3",
|
|
55
|
+
fill: "currentColor"
|
|
56
|
+
})));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.ReactComponent = SvgAddWallet;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
var _path, _path2, _path3;
|
|
5
|
+
var _excluded = ["title", "titleId"];
|
|
6
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
7
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
|
|
9
|
+
var SvgAddWallet = function SvgAddWallet(_ref) {
|
|
10
|
+
var title = _ref.title,
|
|
11
|
+
titleId = _ref.titleId,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
14
|
+
width: 24,
|
|
15
|
+
height: 24,
|
|
16
|
+
viewBox: "0 0 24 24",
|
|
17
|
+
fill: "none",
|
|
18
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
19
|
+
"aria-labelledby": titleId
|
|
20
|
+
}, props), title ? /*#__PURE__*/React.createElement("title", {
|
|
21
|
+
id: titleId
|
|
22
|
+
}, title) : null, _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
d: "M17.75 7.05C17.51 7.01 17.26 7 17 7H7c-.28 0-.55.02-.81.06.14-.28.34-.54.58-.78l3.25-3.26a3.525 3.525 0 0 1 4.96 0l1.75 1.77c.64.63.98 1.43 1.02 2.26ZM5 15c-2.21 0-4 1.79-4 4 0 .75.21 1.46.58 2.06A3.97 3.97 0 0 0 5 23c1.46 0 2.73-.78 3.42-1.94.37-.6.58-1.31.58-2.06 0-2.21-1.79-4-4-4Zm1.49 4.73h-.74v.78c0 .41-.34.75-.75.75s-.75-.34-.75-.75v-.78h-.74c-.41 0-.75-.34-.75-.75s.34-.75.75-.75h.74v-.71c0-.41.34-.75.75-.75s.75.34.75.75v.71h.74a.749.749 0 1 1 0 1.5Z",
|
|
24
|
+
fill: "currentColor"
|
|
25
|
+
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
26
|
+
opacity: 0.4,
|
|
27
|
+
d: "M22 12v5c0 3-2 5-5 5H7.63c.31-.26.58-.58.79-.94.37-.6.58-1.31.58-2.06 0-2.21-1.79-4-4-4-1.2 0-2.27.53-3 1.36V12c0-2.72 1.64-4.62 4.19-4.94.26-.04.53-.06.81-.06h10c.26 0 .51.01.75.05C20.33 7.35 22 9.26 22 12Z",
|
|
28
|
+
fill: "currentColor"
|
|
29
|
+
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
30
|
+
d: "M22 12.5h-3c-1.1 0-2 .9-2 2s.9 2 2 2h3",
|
|
31
|
+
fill: "currentColor"
|
|
32
|
+
})));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { SvgAddWallet as ReactComponent };
|