@dynamic-labs/sdk-react-core 4.27.0 → 4.27.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +13 -11
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.d.ts +1 -2
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +13 -11
- package/src/lib/components/TransactionCard/TransactionCard.cjs +11 -8
- package/src/lib/components/TransactionCard/TransactionCard.js +11 -8
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.cjs +30 -0
- package/src/lib/utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.d.ts +7 -0
- package/src/lib/utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.js +26 -0
- package/src/lib/utils/functions/getTurnkeyWalletId/index.d.ts +1 -0
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.cjs +2 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useSecureEnclaveEmbeddedWallet/useSecureEnclaveEmbeddedWallet.js +2 -2
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.cjs +6 -9
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.d.ts +2 -1
- package/src/lib/utils/hooks/useEmbeddedWalletSessionKeys/useEmbeddedWalletSessionKeys.js +6 -9
- package/src/lib/views/EmbeddedDeleteView/EmbeddedDeleteView.cjs +2 -2
- package/src/lib/views/EmbeddedDeleteView/EmbeddedDeleteView.js +2 -2
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.cjs +2 -2
- package/src/lib/views/EmbeddedReveal/EmbeddedRevealView/EmbeddedRevealView.js +2 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +4 -2
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +4 -2
- package/src/lib/utils/functions/getPrimaryTurnkeyWalletId/getPrimaryTurnkeyWalletId.cjs +0 -30
- package/src/lib/utils/functions/getPrimaryTurnkeyWalletId/getPrimaryTurnkeyWalletId.d.ts +0 -7
- package/src/lib/utils/functions/getPrimaryTurnkeyWalletId/getPrimaryTurnkeyWalletId.js +0 -26
- package/src/lib/utils/functions/getPrimaryTurnkeyWalletId/index.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.27.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.27.0...v4.27.1) (2025-08-18)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
* apple icon black background ([#9363](https://github.com/dynamic-labs/dynamic-auth/issues/9363)) ([b8242e6](https://github.com/dynamic-labs/dynamic-auth/commit/b8242e699f457036f5dbe5e061617d966b6e639e))
|
|
8
|
+
* issue when signing pbst with embedded wallet ([#9356](https://github.com/dynamic-labs/dynamic-auth/issues/9356)) ([3abac9a](https://github.com/dynamic-labs/dynamic-auth/commit/3abac9a52f27a27a95f576e402163ea9d19f69a5))
|
|
9
|
+
* secondary embedded wallets can register session on transactions and signing ([#9030](https://github.com/dynamic-labs/dynamic-auth/issues/9030)) ([716bd95](https://github.com/dynamic-labs/dynamic-auth/commit/716bd9588ac0c435dd6e3e2f37e93f4c488aa0ae))
|
|
10
|
+
* show native balance when on testnet ([#9329](https://github.com/dynamic-labs/dynamic-auth/issues/9329)) ([d8cbe3b](https://github.com/dynamic-labs/dynamic-auth/commit/d8cbe3b319c2ab2f3579e3759ca45913c7434e44))
|
|
11
|
+
|
|
2
12
|
## [4.27.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.26.0...v4.27.0) (2025-08-16)
|
|
3
13
|
|
|
4
14
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/sdk-react-core",
|
|
3
|
-
"version": "4.27.
|
|
3
|
+
"version": "4.27.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@dynamic-labs/sdk-api-core": "0.0.753",
|
|
6
6
|
"@dynamic-labs-sdk/client": "0.0.1-alpha.24",
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
"yup": "0.32.11",
|
|
16
16
|
"react-international-phone": "4.5.0",
|
|
17
17
|
"bs58": "5.0.0",
|
|
18
|
-
"@dynamic-labs/assert-package-version": "4.27.
|
|
19
|
-
"@dynamic-labs/iconic": "4.27.
|
|
20
|
-
"@dynamic-labs/logger": "4.27.
|
|
21
|
-
"@dynamic-labs/multi-wallet": "4.27.
|
|
22
|
-
"@dynamic-labs/rpc-providers": "4.27.
|
|
23
|
-
"@dynamic-labs/store": "4.27.
|
|
24
|
-
"@dynamic-labs/types": "4.27.
|
|
25
|
-
"@dynamic-labs/utils": "4.27.
|
|
26
|
-
"@dynamic-labs/wallet-book": "4.27.
|
|
27
|
-
"@dynamic-labs/wallet-connector-core": "4.27.
|
|
18
|
+
"@dynamic-labs/assert-package-version": "4.27.1",
|
|
19
|
+
"@dynamic-labs/iconic": "4.27.1",
|
|
20
|
+
"@dynamic-labs/logger": "4.27.1",
|
|
21
|
+
"@dynamic-labs/multi-wallet": "4.27.1",
|
|
22
|
+
"@dynamic-labs/rpc-providers": "4.27.1",
|
|
23
|
+
"@dynamic-labs/store": "4.27.1",
|
|
24
|
+
"@dynamic-labs/types": "4.27.1",
|
|
25
|
+
"@dynamic-labs/utils": "4.27.1",
|
|
26
|
+
"@dynamic-labs/wallet-book": "4.27.1",
|
|
27
|
+
"@dynamic-labs/wallet-connector-core": "4.27.1",
|
|
28
28
|
"eventemitter3": "5.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
@@ -4,11 +4,14 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var reactI18next = require('react-i18next');
|
|
8
|
+
require('react');
|
|
9
|
+
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
10
|
+
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
7
11
|
require('@dynamic-labs/sdk-api-core');
|
|
8
12
|
require('../../shared/logger.cjs');
|
|
9
13
|
require('@dynamic-labs/iconic');
|
|
10
14
|
require('@dynamic-labs/wallet-connector-core');
|
|
11
|
-
require('react');
|
|
12
15
|
var tooltip = require('../../shared/assets/tooltip.cjs');
|
|
13
16
|
require('../../context/ViewContext/ViewContext.cjs');
|
|
14
17
|
require('@dynamic-labs/wallet-book');
|
|
@@ -17,12 +20,6 @@ require('@dynamic-labs/utils');
|
|
|
17
20
|
require('../../utils/constants/colors.cjs');
|
|
18
21
|
require('../../utils/constants/values.cjs');
|
|
19
22
|
require('../../shared/consts/index.cjs');
|
|
20
|
-
var networksAndChains = require('../../utils/functions/networksAndChains/networksAndChains.cjs');
|
|
21
|
-
var Icon = require('../Icon/Icon.cjs');
|
|
22
|
-
var utils = require('../TransactionConfirmationPageLayout/utils.cjs');
|
|
23
|
-
var Typography = require('../Typography/Typography.cjs');
|
|
24
|
-
require('../../context/DynamicContext/DynamicContext.cjs');
|
|
25
|
-
require('../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
|
|
26
23
|
require('../../events/dynamicEvents.cjs');
|
|
27
24
|
require('../../../../_virtual/_tslib.cjs');
|
|
28
25
|
require('../../context/CaptchaContext/CaptchaContext.cjs');
|
|
@@ -30,6 +27,7 @@ require('../../context/ErrorContext/ErrorContext.cjs');
|
|
|
30
27
|
require('@dynamic-labs/multi-wallet');
|
|
31
28
|
require('react-international-phone');
|
|
32
29
|
require('../../store/state/nonce/nonce.cjs');
|
|
30
|
+
var networksAndChains = require('../../utils/functions/networksAndChains/networksAndChains.cjs');
|
|
33
31
|
require('@dynamic-labs-sdk/client/core');
|
|
34
32
|
require('../../client/client.cjs');
|
|
35
33
|
require('@dynamic-labs-sdk/client');
|
|
@@ -62,9 +60,10 @@ require('../../context/FieldsStateContext/FieldsStateContext.cjs');
|
|
|
62
60
|
require('../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
63
61
|
require('@dynamic-labs/rpc-providers');
|
|
64
62
|
require('../../store/state/walletOptions/walletOptions.cjs');
|
|
65
|
-
require('react-i18next');
|
|
66
63
|
require('../Accordion/components/AccordionItem/AccordionItem.cjs');
|
|
67
64
|
require('../Alert/Alert.cjs');
|
|
65
|
+
var Typography = require('../Typography/Typography.cjs');
|
|
66
|
+
var Icon = require('../Icon/Icon.cjs');
|
|
68
67
|
var Tooltip = require('../Tooltip/Tooltip.cjs');
|
|
69
68
|
require('../IconButton/IconButton.cjs');
|
|
70
69
|
require('../InlineWidget/InlineWidget.cjs');
|
|
@@ -98,6 +97,7 @@ require('../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.cjs');
|
|
|
98
97
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
99
98
|
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
100
99
|
require('../../store/state/sendBalances.cjs');
|
|
100
|
+
var utils = require('../TransactionConfirmationPageLayout/utils.cjs');
|
|
101
101
|
var useNetworkConfigurationsFromProjectSettings = require('../../utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs');
|
|
102
102
|
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
103
103
|
require('../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
@@ -111,8 +111,9 @@ require('../../store/state/multichainBalances.cjs');
|
|
|
111
111
|
require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
112
112
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
113
113
|
|
|
114
|
-
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total,
|
|
114
|
+
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, }) => {
|
|
115
115
|
var _a;
|
|
116
|
+
const { t } = reactI18next.useTranslation();
|
|
116
117
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
117
118
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
118
119
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
@@ -124,13 +125,14 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
124
125
|
networkId: chain === null || chain === void 0 ? void 0 : chain.chainId,
|
|
125
126
|
networkInfo,
|
|
126
127
|
});
|
|
127
|
-
const renderTransferDetails = () => (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsx("div", { className: 'transaction-card__assets-container', children: jsxRuntime.jsx("div", { className: 'transaction-card__out', children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: t('dyn_send_transaction.confirmation.data.transfer.send') }), jsxRuntime.jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-info', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-row', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'error-1', "data-testid": 'transaction-transfer-amount', children: ["-", valueRounded ||
|
|
128
|
+
const renderTransferDetails = () => (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsx("div", { className: 'transaction-card__assets-container', children: jsxRuntime.jsx("div", { className: 'transaction-card__out', children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.transfer.send', children: t('dyn_send_transaction.confirmation.data.transfer.send') }), jsxRuntime.jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-info', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-row', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'error-1', "data-testid": 'transaction-transfer-amount', children: ["-", valueRounded ||
|
|
128
129
|
((transaction === null || transaction === void 0 ? void 0 : transaction.value)
|
|
129
130
|
? transaction.format(transaction.value, {
|
|
130
131
|
precision: 6,
|
|
131
132
|
})
|
|
132
133
|
: '')] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: currencySymbol })] }), transactionValue && (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_small', color: 'error-1', "data-testid": 'transaction-transfer-amount-fiat', children: ["$", utils.getDisplayFiatPrice(Number(transactionValue) || Number(valueRounded) || 0, currentToken)] }))] }), jsxRuntime.jsx("div", { className: 'transaction-card__icon', children: jsxRuntime.jsx("div", { className: 'transaction-card__icon__container', children: jsxRuntime.jsx("img", { src: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.logoURI) ||
|
|
133
|
-
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl)
|
|
134
|
+
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl) ||
|
|
135
|
+
(chain === null || chain === void 0 ? void 0 : chain.icon), alt: currencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }) }) }));
|
|
134
136
|
const renderTransactionDetails = () => (jsxRuntime.jsx("div", { className: 'transaction-card', children: jsxRuntime.jsxs("div", { className: 'transaction-card__details', 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(transaction.to, 4, 4) })] }), !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', "data-testid": 'transaction-network', 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]) || (chain === null || chain === void 0 ? void 0 : chain.icon), alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Network icon', width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), 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: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) ? (jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: Number(gasFiatValue) <= 0.01
|
|
135
137
|
? '<$0.01'
|
|
136
138
|
: `$${gasFiatValue}` })) : (jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: [transaction.fee.gas
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { TokenBalance } from '@dynamic-labs/sdk-api-core';
|
|
3
3
|
import { IUITransaction } from '@dynamic-labs/types';
|
|
4
|
-
export declare const SendBalanceTransactionCard: ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total,
|
|
4
|
+
export declare const SendBalanceTransactionCard: ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, }: {
|
|
5
5
|
transaction: IUITransaction;
|
|
6
6
|
currentToken: TokenBalance | undefined;
|
|
7
7
|
currencySymbol: string | undefined;
|
|
@@ -12,5 +12,4 @@ export declare const SendBalanceTransactionCard: ({ transaction, currentToken, c
|
|
|
12
12
|
totalGasFiatValue: string;
|
|
13
13
|
currency: string | undefined;
|
|
14
14
|
total: bigint | undefined;
|
|
15
|
-
t: any;
|
|
16
15
|
}) => JSX.Element;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import 'react';
|
|
5
|
+
import '../../context/DynamicContext/DynamicContext.js';
|
|
6
|
+
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
3
7
|
import '@dynamic-labs/sdk-api-core';
|
|
4
8
|
import '../../shared/logger.js';
|
|
5
9
|
import '@dynamic-labs/iconic';
|
|
6
10
|
import '@dynamic-labs/wallet-connector-core';
|
|
7
|
-
import 'react';
|
|
8
11
|
import { ReactComponent as SvgTooltip } from '../../shared/assets/tooltip.js';
|
|
9
12
|
import '../../context/ViewContext/ViewContext.js';
|
|
10
13
|
import '@dynamic-labs/wallet-book';
|
|
@@ -13,12 +16,6 @@ import '@dynamic-labs/utils';
|
|
|
13
16
|
import '../../utils/constants/colors.js';
|
|
14
17
|
import '../../utils/constants/values.js';
|
|
15
18
|
import '../../shared/consts/index.js';
|
|
16
|
-
import { getNetworkInfoEntry } from '../../utils/functions/networksAndChains/networksAndChains.js';
|
|
17
|
-
import { Icon } from '../Icon/Icon.js';
|
|
18
|
-
import { getDisplayFiatPrice } from '../TransactionConfirmationPageLayout/utils.js';
|
|
19
|
-
import { Typography } from '../Typography/Typography.js';
|
|
20
|
-
import '../../context/DynamicContext/DynamicContext.js';
|
|
21
|
-
import '../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
|
|
22
19
|
import '../../events/dynamicEvents.js';
|
|
23
20
|
import '../../../../_virtual/_tslib.js';
|
|
24
21
|
import '../../context/CaptchaContext/CaptchaContext.js';
|
|
@@ -26,6 +23,7 @@ import '../../context/ErrorContext/ErrorContext.js';
|
|
|
26
23
|
import '@dynamic-labs/multi-wallet';
|
|
27
24
|
import 'react-international-phone';
|
|
28
25
|
import '../../store/state/nonce/nonce.js';
|
|
26
|
+
import { getNetworkInfoEntry } from '../../utils/functions/networksAndChains/networksAndChains.js';
|
|
29
27
|
import '@dynamic-labs-sdk/client/core';
|
|
30
28
|
import '../../client/client.js';
|
|
31
29
|
import '@dynamic-labs-sdk/client';
|
|
@@ -58,9 +56,10 @@ import '../../context/FieldsStateContext/FieldsStateContext.js';
|
|
|
58
56
|
import '../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
59
57
|
import '@dynamic-labs/rpc-providers';
|
|
60
58
|
import '../../store/state/walletOptions/walletOptions.js';
|
|
61
|
-
import 'react-i18next';
|
|
62
59
|
import '../Accordion/components/AccordionItem/AccordionItem.js';
|
|
63
60
|
import '../Alert/Alert.js';
|
|
61
|
+
import { Typography } from '../Typography/Typography.js';
|
|
62
|
+
import { Icon } from '../Icon/Icon.js';
|
|
64
63
|
import { Tooltip } from '../Tooltip/Tooltip.js';
|
|
65
64
|
import '../IconButton/IconButton.js';
|
|
66
65
|
import '../InlineWidget/InlineWidget.js';
|
|
@@ -94,6 +93,7 @@ import '../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
|
|
|
94
93
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
95
94
|
import '../../context/OnrampContext/OnrampContext.js';
|
|
96
95
|
import '../../store/state/sendBalances.js';
|
|
96
|
+
import { getDisplayFiatPrice } from '../TransactionConfirmationPageLayout/utils.js';
|
|
97
97
|
import { useNetworkConfigurationsFromProjectSettings } from '../../utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js';
|
|
98
98
|
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
99
99
|
import '../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
@@ -107,8 +107,9 @@ import '../../store/state/multichainBalances.js';
|
|
|
107
107
|
import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
108
108
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
109
109
|
|
|
110
|
-
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total,
|
|
110
|
+
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, }) => {
|
|
111
111
|
var _a;
|
|
112
|
+
const { t } = useTranslation();
|
|
112
113
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
113
114
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
114
115
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
@@ -120,13 +121,14 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
120
121
|
networkId: chain === null || chain === void 0 ? void 0 : chain.chainId,
|
|
121
122
|
networkInfo,
|
|
122
123
|
});
|
|
123
|
-
const renderTransferDetails = () => (jsx("div", { className: 'transaction-card', children: jsx("div", { className: 'transaction-card__assets-container', children: jsx("div", { className: 'transaction-card__out', children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', children: t('dyn_send_transaction.confirmation.data.transfer.send') }), jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxs("div", { className: 'transaction-card__token-info', children: [jsxs("div", { className: 'transaction-card__token-row', children: [jsxs(Typography, { variant: 'body_normal', color: 'error-1', "data-testid": 'transaction-transfer-amount', children: ["-", valueRounded ||
|
|
124
|
+
const renderTransferDetails = () => (jsx("div", { className: 'transaction-card', children: jsx("div", { className: 'transaction-card__assets-container', children: jsx("div", { className: 'transaction-card__out', children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.transfer.send', children: t('dyn_send_transaction.confirmation.data.transfer.send') }), jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxs("div", { className: 'transaction-card__token-info', children: [jsxs("div", { className: 'transaction-card__token-row', children: [jsxs(Typography, { variant: 'body_normal', color: 'error-1', "data-testid": 'transaction-transfer-amount', children: ["-", valueRounded ||
|
|
124
125
|
((transaction === null || transaction === void 0 ? void 0 : transaction.value)
|
|
125
126
|
? transaction.format(transaction.value, {
|
|
126
127
|
precision: 6,
|
|
127
128
|
})
|
|
128
129
|
: '')] }), jsx(Typography, { variant: 'body_normal', color: 'secondary', children: currencySymbol })] }), transactionValue && (jsxs(Typography, { variant: 'body_small', color: 'error-1', "data-testid": 'transaction-transfer-amount-fiat', children: ["$", getDisplayFiatPrice(Number(transactionValue) || Number(valueRounded) || 0, currentToken)] }))] }), jsx("div", { className: 'transaction-card__icon', children: jsx("div", { className: 'transaction-card__icon__container', children: jsx("img", { src: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.logoURI) ||
|
|
129
|
-
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl)
|
|
130
|
+
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl) ||
|
|
131
|
+
(chain === null || chain === void 0 ? void 0 : chain.icon), alt: currencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }) }) }));
|
|
130
132
|
const renderTransactionDetails = () => (jsx("div", { className: 'transaction-card', children: jsxs("div", { className: 'transaction-card__details', 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(transaction.to, 4, 4) })] }), !isGasSponsored && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', "data-testid": 'transaction-network', 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]) || (chain === null || chain === void 0 ? void 0 : chain.icon), alt: (networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.name) || 'Network icon', width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), 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: (currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) ? (jsx(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: Number(gasFiatValue) <= 0.01
|
|
131
133
|
? '<$0.01'
|
|
132
134
|
: `$${gasFiatValue}` })) : (jsxs(Typography, { variant: 'body_normal', color: 'primary', "data-testid": 'transaction-estimated-gas-fee', children: [transaction.fee.gas
|
|
@@ -97,7 +97,6 @@ require('../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.cjs');
|
|
|
97
97
|
require('../../context/PasskeyContext/PasskeyContext.cjs');
|
|
98
98
|
require('../../context/OnrampContext/OnrampContext.cjs');
|
|
99
99
|
require('../../store/state/sendBalances.cjs');
|
|
100
|
-
var useNetworkConfigurationsFromProjectSettings = require('../../utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs');
|
|
101
100
|
require('../../store/state/connectorsInitializing/connectorsInitializing.cjs');
|
|
102
101
|
require('../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.cjs');
|
|
103
102
|
require('../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
@@ -117,11 +116,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
117
116
|
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, }) => {
|
|
118
117
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
119
118
|
const { t } = reactI18next.useTranslation();
|
|
120
|
-
const { primaryWallet
|
|
121
|
-
const networkInfo =
|
|
122
|
-
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
123
|
-
projectSettings,
|
|
124
|
-
});
|
|
119
|
+
const { primaryWallet } = useInternalDynamicContext.useInternalDynamicContext();
|
|
120
|
+
const networkInfo = {};
|
|
125
121
|
const { chain } = useFetchChain.useFetchChain(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
126
122
|
const networkInfoEntry = networksAndChains.getNetworkInfoEntry({
|
|
127
123
|
chain: (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.connectedChain,
|
|
@@ -157,7 +153,14 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
157
153
|
// for solana, the fee is included in the outgoing assets already
|
|
158
154
|
return (outgoingAssetsTotal +
|
|
159
155
|
(nativeCurrencySymbol === 'SOL' || isGasSponsored ? 0 : feeInUsd || 0));
|
|
160
|
-
}, [
|
|
156
|
+
}, [
|
|
157
|
+
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
158
|
+
nativeCurrencySymbol,
|
|
159
|
+
feeInUsd,
|
|
160
|
+
blockaidOn,
|
|
161
|
+
isAATransaction,
|
|
162
|
+
isGasSponsored,
|
|
163
|
+
]);
|
|
161
164
|
const getTotalAmountInUsdDisplay = (totalAmountInUsd) => {
|
|
162
165
|
if (!totalAmountInUsd)
|
|
163
166
|
return undefined;
|
|
@@ -188,7 +191,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
188
191
|
}
|
|
189
192
|
return `$${usdPrice.toFixed(2)}`;
|
|
190
193
|
};
|
|
191
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', children: transfer.direction === 'in' ? '
|
|
194
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxRuntime.jsxs("div", { className: 'transaction-card__info-container', children: [jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: `dyn_send_transaction.confirmation.data.transfer.${transfer.direction === 'in' ? 'receive' : 'send'}`, children: t(`dyn_send_transaction.confirmation.data.transfer.${transfer.direction === 'in' ? 'receive' : 'send'}`) }), jsxRuntime.jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-info', children: [jsxRuntime.jsxs("div", { className: 'transaction-card__token-row', children: [jsxRuntime.jsxs(Typography.Typography, { variant: 'body_normal', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: [transfer.direction === 'out' ? '-' : '+', getAmountDisplay()] }), jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', children: (_b = (transfer.asset.symbol || transfer.asset.name)) !== null && _b !== void 0 ? _b : nativeCurrencySymbol })] }), Number(transfer.usdPrice) > 0 && (jsxRuntime.jsx(Typography.Typography, { variant: 'body_small', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: getUsdPriceDisplay() }))] }), jsxRuntime.jsx("div", { className: 'transaction-card__icon', children: jsxRuntime.jsx("div", { className: 'transaction-card__icon__container', children: jsxRuntime.jsx("img", { src: transfer.asset.logoUrl ||
|
|
192
195
|
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: (_c = transfer.asset.symbol) !== null && _c !== void 0 ? _c : nativeCurrencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }), index < array.length - 1 && (jsxRuntime.jsx("div", { className: 'transaction-card__divider' }))] }));
|
|
193
196
|
};
|
|
194
197
|
const inAssets = ((_c = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.inAssets) === null || _c === void 0 ? void 0 : _c.flatMap((assetDiff) => {
|
|
@@ -93,7 +93,6 @@ import '../../views/MfaChooseDeviceView/getMfaOptions/getMfaOptions.js';
|
|
|
93
93
|
import '../../context/PasskeyContext/PasskeyContext.js';
|
|
94
94
|
import '../../context/OnrampContext/OnrampContext.js';
|
|
95
95
|
import '../../store/state/sendBalances.js';
|
|
96
|
-
import { useNetworkConfigurationsFromProjectSettings } from '../../utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js';
|
|
97
96
|
import '../../store/state/connectorsInitializing/connectorsInitializing.js';
|
|
98
97
|
import '../OverlayCardBase/OverlayCardTarget/OverlayCardTarget.js';
|
|
99
98
|
import '../../widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
@@ -109,11 +108,8 @@ import { useInternalDynamicContext } from '../../context/DynamicContext/useDynam
|
|
|
109
108
|
const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATransaction, recipient, }) => {
|
|
110
109
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
111
110
|
const { t } = useTranslation();
|
|
112
|
-
const { primaryWallet
|
|
113
|
-
const networkInfo =
|
|
114
|
-
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
115
|
-
projectSettings,
|
|
116
|
-
});
|
|
111
|
+
const { primaryWallet } = useInternalDynamicContext();
|
|
112
|
+
const networkInfo = {};
|
|
117
113
|
const { chain } = useFetchChain(primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector);
|
|
118
114
|
const networkInfoEntry = getNetworkInfoEntry({
|
|
119
115
|
chain: (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.connectedChain,
|
|
@@ -149,7 +145,14 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
149
145
|
// for solana, the fee is included in the outgoing assets already
|
|
150
146
|
return (outgoingAssetsTotal +
|
|
151
147
|
(nativeCurrencySymbol === 'SOL' || isGasSponsored ? 0 : feeInUsd || 0));
|
|
152
|
-
}, [
|
|
148
|
+
}, [
|
|
149
|
+
simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.outAssets,
|
|
150
|
+
nativeCurrencySymbol,
|
|
151
|
+
feeInUsd,
|
|
152
|
+
blockaidOn,
|
|
153
|
+
isAATransaction,
|
|
154
|
+
isGasSponsored,
|
|
155
|
+
]);
|
|
153
156
|
const getTotalAmountInUsdDisplay = (totalAmountInUsd) => {
|
|
154
157
|
if (!totalAmountInUsd)
|
|
155
158
|
return undefined;
|
|
@@ -180,7 +183,7 @@ const TransactionCard = ({ transaction, simulationResult, isGasSponsored, isAATr
|
|
|
180
183
|
}
|
|
181
184
|
return `$${usdPrice.toFixed(2)}`;
|
|
182
185
|
};
|
|
183
|
-
return (jsxs(Fragment, { children: [jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', children: transfer.direction === 'in' ? '
|
|
186
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: `transaction-card__${transfer.direction}`, children: jsxs("div", { className: 'transaction-card__info-container', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: `dyn_send_transaction.confirmation.data.transfer.${transfer.direction === 'in' ? 'receive' : 'send'}`, children: t(`dyn_send_transaction.confirmation.data.transfer.${transfer.direction === 'in' ? 'receive' : 'send'}`) }), jsxs("div", { className: 'transaction-card__amount-symbol', children: [jsxs("div", { className: 'transaction-card__token-info', children: [jsxs("div", { className: 'transaction-card__token-row', children: [jsxs(Typography, { variant: 'body_normal', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: [transfer.direction === 'out' ? '-' : '+', getAmountDisplay()] }), jsx(Typography, { variant: 'body_normal', color: 'primary', children: (_b = (transfer.asset.symbol || transfer.asset.name)) !== null && _b !== void 0 ? _b : nativeCurrencySymbol })] }), Number(transfer.usdPrice) > 0 && (jsx(Typography, { variant: 'body_small', color: transfer.direction === 'in' ? 'green-1' : 'error-1', children: getUsdPriceDisplay() }))] }), jsx("div", { className: 'transaction-card__icon', children: jsx("div", { className: 'transaction-card__icon__container', children: jsx("img", { src: transfer.asset.logoUrl ||
|
|
184
187
|
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: (_c = transfer.asset.symbol) !== null && _c !== void 0 ? _c : nativeCurrencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }), index < array.length - 1 && (jsx("div", { className: 'transaction-card__divider' }))] }));
|
|
185
188
|
};
|
|
186
189
|
const inAssets = ((_c = simulationResult === null || simulationResult === void 0 ? void 0 : simulationResult.inAssets) === null || _c === void 0 ? void 0 : _c.flatMap((assetDiff) => {
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs
CHANGED
|
@@ -142,7 +142,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
142
142
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
143
143
|
const gasFiatValue = fiatUtils.getGasFiatValue(currentToken, transaction, nativePrice);
|
|
144
144
|
const totalGasFiatValue = fiatUtils.getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
145
|
-
return hideModal ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__banner', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsxRuntime.jsx(TransactionCard.TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient })) : (jsxRuntime.jsx(SendBalanceTransactionCard.SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = utils.getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total
|
|
145
|
+
return hideModal ? null : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsxRuntime.jsx("div", { className: 'send-balance-page-layout__header-content', children: jsxRuntime.jsx(Typography.Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__banner', children: jsxRuntime.jsx(Typography.Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsxRuntime.jsx(PasskeyCreatedSuccessBanner.PasskeyCreatedSuccessBanner, {}), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__body', children: [jsxRuntime.jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsxRuntime.jsx(TransactionCard.TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient })) : (jsxRuntime.jsx(SendBalanceTransactionCard.SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = utils.getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total })), children && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__rows', children: children }))] }), jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: alert && (jsxRuntime.jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxRuntime.jsxs("div", { className: 'transaction-confirmation__actions', children: [(onClickBack || onClickClose) && (jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'primary', buttonPadding: 'medium', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsxRuntime.jsx(TypographyButton.TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'medium', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsxRuntime.jsx(NeedHelpSection.NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("div", { className: 'transaction-confirmation__divider' }), jsxRuntime.jsx(PoweredByDynamic.PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' })] }))] })] }));
|
|
146
146
|
};
|
|
147
147
|
|
|
148
148
|
exports.TransactionConfirmationPageLayout = TransactionConfirmationPageLayout;
|
package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js
CHANGED
|
@@ -138,7 +138,7 @@ const TransactionConfirmationPageLayout = ({ onClickClose, isLoading, onClickBac
|
|
|
138
138
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }));
|
|
139
139
|
const gasFiatValue = getGasFiatValue(currentToken, transaction, nativePrice);
|
|
140
140
|
const totalGasFiatValue = getTotalFiatCost(currentToken, transaction, nativePrice, transactionValue);
|
|
141
|
-
return hideModal ? null : (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsx("div", { className: 'transaction-confirmation__banner', children: jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsx(TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient })) : (jsx(SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total
|
|
141
|
+
return hideModal ? null : (jsxs(Fragment, { children: [jsx(ModalHeader, { trailing: closeButton, leading: backButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.confirmation_tx', children: t('dyn_send_transaction.data.confirmation_tx') }) }) }), !sendBalanceTransaction && (jsx("div", { className: 'transaction-confirmation__banner', children: jsx(Typography, { variant: 'body_normal', color: 'primary', copykey: 'dyn_send_transaction.data.banner', children: t('dyn_send_transaction.data.banner') }) })), jsx(PasskeyCreatedSuccessBanner, {}), jsxs("div", { className: 'transaction-confirmation__body', children: [jsxs("div", { className: 'transaction-confirmation__content', children: [!sendBalanceTransaction ? (jsx(TransactionCard, { transaction: transaction, isGasSponsored: isGasSponsored, isAATransaction: (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.key) === 'zerodev', simulationResult: simulationResult, recipient: recipient })) : (jsx(SendBalanceTransactionCard, { transaction: transaction, currentToken: currentToken, currencySymbol: currencySymbol, valueRounded: (_a = getValueRounded(Boolean(isNativeToken), transaction)) === null || _a === void 0 ? void 0 : _a.toString(), transactionValue: transactionValue, isGasSponsored: isGasSponsored, gasFiatValue: gasFiatValue || '0', totalGasFiatValue: totalGasFiatValue || '0', currency: currency === null || currency === void 0 ? void 0 : currency.symbol, total: total })), children && (jsx("div", { className: 'transaction-confirmation__rows', children: children }))] }), jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: alert && (jsx("div", { className: 'transaction-confirmation__warning', children: alert })) }), jsxs("div", { className: 'transaction-confirmation__actions', children: [(onClickBack || onClickClose) && (jsx(TypographyButton, { buttonVariant: 'primary', buttonPadding: 'medium', onClick: onClickBack || onClickClose, expanded: true, disabled: isLoading, copykey: 'dyn_send_transaction.confirmation.cancel_button', children: t('dyn_send_transaction.confirmation.cancel_button') })), jsx(TypographyButton, { buttonVariant: 'brand-primary', buttonPadding: 'medium', onClick: handleSubmitWithChecks, expanded: true, loading: isLoading, disabled: disableSendButton, copykey: 'dyn_send_transaction.confirmation.send', dataTestId: 'transaction-confirmation-send', children: t('dyn_send_transaction.confirmation.send') })] }), jsx(NeedHelpSection, {}), displayPoweredByDynamicFooter && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-confirmation__divider' }), jsx(PoweredByDynamic, { classNameRoot: 'transaction-confirmation__footer' })] }))] })] }));
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
export { TransactionConfirmationPageLayout };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* returns the id of the turnkey wallet
|
|
8
|
+
* if the wallet is a turnkey wallet, it returns the id of the wallet
|
|
9
|
+
* if the wallet is a zerodev wallet, it returns corresponding turnkey wallet id
|
|
10
|
+
*/
|
|
11
|
+
const getTurnkeyWalletId = (turnkeyWalletId, verifiedCredentials) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const turnkeyWallet = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ id }) => id === turnkeyWalletId);
|
|
14
|
+
if (!turnkeyWallet) {
|
|
15
|
+
throw new Error('Dynamic v2 wallet not found');
|
|
16
|
+
}
|
|
17
|
+
let walletId = undefined;
|
|
18
|
+
if ((_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('turnkey')) {
|
|
19
|
+
walletId = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.id;
|
|
20
|
+
}
|
|
21
|
+
else if (turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.signerRefId) {
|
|
22
|
+
walletId = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.signerRefId;
|
|
23
|
+
}
|
|
24
|
+
if (!walletId) {
|
|
25
|
+
throw new Error("Invalid wallet type: expecting 'turnkey' wallet, or a wallet with a 'signerRefId'");
|
|
26
|
+
}
|
|
27
|
+
return walletId;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.getTurnkeyWalletId = getTurnkeyWalletId;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
2
|
+
/**
|
|
3
|
+
* returns the id of the turnkey wallet
|
|
4
|
+
* if the wallet is a turnkey wallet, it returns the id of the wallet
|
|
5
|
+
* if the wallet is a zerodev wallet, it returns corresponding turnkey wallet id
|
|
6
|
+
*/
|
|
7
|
+
export declare const getTurnkeyWalletId: (turnkeyWalletId: string, verifiedCredentials: JwtVerifiedCredential[]) => string;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
/**
|
|
3
|
+
* returns the id of the turnkey wallet
|
|
4
|
+
* if the wallet is a turnkey wallet, it returns the id of the wallet
|
|
5
|
+
* if the wallet is a zerodev wallet, it returns corresponding turnkey wallet id
|
|
6
|
+
*/
|
|
7
|
+
const getTurnkeyWalletId = (turnkeyWalletId, verifiedCredentials) => {
|
|
8
|
+
var _a;
|
|
9
|
+
const turnkeyWallet = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ id }) => id === turnkeyWalletId);
|
|
10
|
+
if (!turnkeyWallet) {
|
|
11
|
+
throw new Error('Dynamic v2 wallet not found');
|
|
12
|
+
}
|
|
13
|
+
let walletId = undefined;
|
|
14
|
+
if ((_a = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('turnkey')) {
|
|
15
|
+
walletId = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.id;
|
|
16
|
+
}
|
|
17
|
+
else if (turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.signerRefId) {
|
|
18
|
+
walletId = turnkeyWallet === null || turnkeyWallet === void 0 ? void 0 : turnkeyWallet.signerRefId;
|
|
19
|
+
}
|
|
20
|
+
if (!walletId) {
|
|
21
|
+
throw new Error("Invalid wallet type: expecting 'turnkey' wallet, or a wallet with a 'signerRefId'");
|
|
22
|
+
}
|
|
23
|
+
return walletId;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export { getTurnkeyWalletId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './getTurnkeyWalletId';
|
|
@@ -54,7 +54,7 @@ require('react-dom');
|
|
|
54
54
|
var useElementById = require('../../useElementById/useElementById.cjs');
|
|
55
55
|
require('../../../functions/compareChains/compareChains.cjs');
|
|
56
56
|
var findPrimaryEmbeddedChain = require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
57
|
-
var
|
|
57
|
+
var getTurnkeyWalletId = require('../../../functions/getTurnkeyWalletId/getTurnkeyWalletId.cjs');
|
|
58
58
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
59
59
|
var useSmartWallets = require('../../useSmartWallets/useSmartWallets.cjs');
|
|
60
60
|
require('../../useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
@@ -294,7 +294,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
294
294
|
if (!primaryWallet) {
|
|
295
295
|
throw new utils.DynamicError('No primary wallet found');
|
|
296
296
|
}
|
|
297
|
-
const primaryTurnkeyWalletId =
|
|
297
|
+
const primaryTurnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(primaryWallet.id, (user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) || []);
|
|
298
298
|
const organizationId = (_r = (_q = (_p = user$1 === null || user$1 === void 0 ? void 0 : user$1.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
|
|
299
299
|
yield turnkeyRecoveryHandler.verifyRecoveryCode(options.oneTimeCode, organizationId);
|
|
300
300
|
const sessionSettings = {
|
|
@@ -50,7 +50,7 @@ import 'react-dom';
|
|
|
50
50
|
import { useElementById } from '../../useElementById/useElementById.js';
|
|
51
51
|
import '../../../functions/compareChains/compareChains.js';
|
|
52
52
|
import { findPrimaryEmbeddedChain } from '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
53
|
-
import {
|
|
53
|
+
import { getTurnkeyWalletId } from '../../../functions/getTurnkeyWalletId/getTurnkeyWalletId.js';
|
|
54
54
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
55
55
|
import { useSmartWallets } from '../../useSmartWallets/useSmartWallets.js';
|
|
56
56
|
import '../../useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
@@ -290,7 +290,7 @@ const useSecureEnclaveEmbeddedWallet = () => {
|
|
|
290
290
|
if (!primaryWallet) {
|
|
291
291
|
throw new DynamicError('No primary wallet found');
|
|
292
292
|
}
|
|
293
|
-
const primaryTurnkeyWalletId =
|
|
293
|
+
const primaryTurnkeyWalletId = getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
294
294
|
const organizationId = (_r = (_q = (_p = user === null || user === void 0 ? void 0 : user.verifiedCredentials) === null || _p === void 0 ? void 0 : _p.find(({ walletName, id }) => (walletName === null || walletName === void 0 ? void 0 : walletName.startsWith('turnkey')) && id === primaryTurnkeyWalletId)) === null || _q === void 0 ? void 0 : _q.walletProperties) === null || _r === void 0 ? void 0 : _r.turnkeySubOrganizationId;
|
|
295
295
|
yield turnkeyRecoveryHandler.verifyRecoveryCode(options.oneTimeCode, organizationId);
|
|
296
296
|
const sessionSettings = {
|
|
@@ -28,12 +28,12 @@ require('../../../store/state/projectSettings/projectSettings.cjs');
|
|
|
28
28
|
var embeddedWallets = require('../../../data/api/embeddedWallets/embeddedWallets.cjs');
|
|
29
29
|
require('../../../locale/locale.cjs');
|
|
30
30
|
require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
|
|
31
|
-
|
|
31
|
+
require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
|
|
32
32
|
require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
|
|
33
33
|
var keyService = require('../../functions/keyService/keyService.cjs');
|
|
34
34
|
var dynamicEvents = require('../../../events/dynamicEvents.cjs');
|
|
35
35
|
var useOnboardingCompleteUser = require('../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.cjs');
|
|
36
|
-
var
|
|
36
|
+
var getTurnkeyWalletId = require('../../functions/getTurnkeyWalletId/getTurnkeyWalletId.cjs');
|
|
37
37
|
var embeddedWalletSessionKeysUtils = require('../../functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.cjs');
|
|
38
38
|
|
|
39
39
|
const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
@@ -47,7 +47,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
47
47
|
* @param ignoreRestore - if true, will not use the session keys if they are found in storage and didn't expire
|
|
48
48
|
* @returns - the session key
|
|
49
49
|
*/
|
|
50
|
-
const registerEmbeddedWalletSessionKey = (
|
|
50
|
+
const registerEmbeddedWalletSessionKey = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ ignoreRestore = false, walletId, }) {
|
|
51
51
|
if (!user) {
|
|
52
52
|
throw new Error('User not found');
|
|
53
53
|
}
|
|
@@ -107,6 +107,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
107
107
|
privateKeyJwk,
|
|
108
108
|
publicKey,
|
|
109
109
|
user,
|
|
110
|
+
walletId,
|
|
110
111
|
});
|
|
111
112
|
});
|
|
112
113
|
const getSessionPublicKey = () => {
|
|
@@ -143,13 +144,9 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
143
144
|
/////////////////////
|
|
144
145
|
// Helper Methods ///
|
|
145
146
|
/////////////////////
|
|
146
|
-
const registerHelper = (
|
|
147
|
+
const registerHelper = (_b) => _tslib.__awaiter(void 0, [_b], void 0, function* ({ walletId, environmentId, privateKey, privateKeyJwk, publicKey, prevSessionKeySignature, user, }) {
|
|
147
148
|
let resp;
|
|
148
|
-
const
|
|
149
|
-
if (!primaryWalletId$1) {
|
|
150
|
-
throw new Error('Primary wallet ID not found');
|
|
151
|
-
}
|
|
152
|
-
const turnkeyWalletId = getPrimaryTurnkeyWalletId.getPrimaryTurnkeyWalletId(primaryWalletId$1, user.verifiedCredentials);
|
|
149
|
+
const turnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(walletId, user.verifiedCredentials);
|
|
153
150
|
try {
|
|
154
151
|
resp = yield embeddedWallets.registerSessionKey({
|
|
155
152
|
environmentId,
|
|
@@ -7,8 +7,9 @@ export declare const useEmbeddedWalletSessionKeys: ({ environmentId, projectSett
|
|
|
7
7
|
generateSessionKey: () => Promise<SessionKey>;
|
|
8
8
|
getSessionPublicKey: () => string;
|
|
9
9
|
getSignedSessionId: () => Promise<string>;
|
|
10
|
-
registerEmbeddedWalletSessionKey: ({ ignoreRestore, }
|
|
10
|
+
registerEmbeddedWalletSessionKey: ({ ignoreRestore, walletId, }: {
|
|
11
11
|
ignoreRestore?: boolean;
|
|
12
|
+
walletId: string;
|
|
12
13
|
}) => Promise<SessionKey | {
|
|
13
14
|
expirationDate: Date;
|
|
14
15
|
privateKey: string;
|
|
@@ -24,12 +24,12 @@ import '../../../store/state/projectSettings/projectSettings.js';
|
|
|
24
24
|
import { registerSessionKey } from '../../../data/api/embeddedWallets/embeddedWallets.js';
|
|
25
25
|
import '../../../locale/locale.js';
|
|
26
26
|
import '../../../store/state/dynamicContextProps/dynamicContextProps.js';
|
|
27
|
-
import
|
|
27
|
+
import '../../../store/state/primaryWalletId/primaryWalletId.js';
|
|
28
28
|
import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
|
|
29
29
|
import { p256Sign, toEncodedFormat } from '../../functions/keyService/keyService.js';
|
|
30
30
|
import { dynamicEvents } from '../../../events/dynamicEvents.js';
|
|
31
31
|
import { useOnboardingCompleteUserProfile } from '../../../client/extension/user/useOnboardingCompleteUser/useOnboardingCompleteUser.js';
|
|
32
|
-
import {
|
|
32
|
+
import { getTurnkeyWalletId } from '../../functions/getTurnkeyWalletId/getTurnkeyWalletId.js';
|
|
33
33
|
import { generateAndSaveSessionKey, generateSessionKey } from '../../functions/embeddedWalletSessionKeysUtils/embeddedWalletSessionKeysUtils.js';
|
|
34
34
|
|
|
35
35
|
const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
@@ -43,7 +43,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
43
43
|
* @param ignoreRestore - if true, will not use the session keys if they are found in storage and didn't expire
|
|
44
44
|
* @returns - the session key
|
|
45
45
|
*/
|
|
46
|
-
const registerEmbeddedWalletSessionKey = (
|
|
46
|
+
const registerEmbeddedWalletSessionKey = (_a) => __awaiter(void 0, [_a], void 0, function* ({ ignoreRestore = false, walletId, }) {
|
|
47
47
|
if (!user) {
|
|
48
48
|
throw new Error('User not found');
|
|
49
49
|
}
|
|
@@ -103,6 +103,7 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
103
103
|
privateKeyJwk,
|
|
104
104
|
publicKey,
|
|
105
105
|
user,
|
|
106
|
+
walletId,
|
|
106
107
|
});
|
|
107
108
|
});
|
|
108
109
|
const getSessionPublicKey = () => {
|
|
@@ -139,13 +140,9 @@ const useEmbeddedWalletSessionKeys = ({ environmentId, projectSettings, }) => {
|
|
|
139
140
|
/////////////////////
|
|
140
141
|
// Helper Methods ///
|
|
141
142
|
/////////////////////
|
|
142
|
-
const registerHelper = (
|
|
143
|
+
const registerHelper = (_b) => __awaiter(void 0, [_b], void 0, function* ({ walletId, environmentId, privateKey, privateKeyJwk, publicKey, prevSessionKeySignature, user, }) {
|
|
143
144
|
let resp;
|
|
144
|
-
const
|
|
145
|
-
if (!primaryWalletId) {
|
|
146
|
-
throw new Error('Primary wallet ID not found');
|
|
147
|
-
}
|
|
148
|
-
const turnkeyWalletId = getPrimaryTurnkeyWalletId(primaryWalletId, user.verifiedCredentials);
|
|
145
|
+
const turnkeyWalletId = getTurnkeyWalletId(walletId, user.verifiedCredentials);
|
|
149
146
|
try {
|
|
150
147
|
resp = yield registerSessionKey({
|
|
151
148
|
environmentId,
|
|
@@ -47,7 +47,7 @@ require('../../context/VerificationContext/VerificationContext.cjs');
|
|
|
47
47
|
require('react-dom');
|
|
48
48
|
require('../../utils/functions/compareChains/compareChains.cjs');
|
|
49
49
|
require('../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
50
|
-
var
|
|
50
|
+
var getTurnkeyWalletId = require('../../utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.cjs');
|
|
51
51
|
require('../../context/ThemeContext/ThemeContext.cjs');
|
|
52
52
|
var useSmartWallets = require('../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
53
53
|
require('../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
@@ -139,7 +139,7 @@ const EmbeddedDeleteView = () => {
|
|
|
139
139
|
}
|
|
140
140
|
setIsLoading(true);
|
|
141
141
|
try {
|
|
142
|
-
const primaryTurnkeyWalletId =
|
|
142
|
+
const primaryTurnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
143
143
|
const deleteEmbeddedWalletsRawPayload = yield embeddedWallets.getDeleteEmbeddedWalletsRequest({
|
|
144
144
|
environmentId,
|
|
145
145
|
walletId: primaryTurnkeyWalletId,
|
|
@@ -43,7 +43,7 @@ import '../../context/VerificationContext/VerificationContext.js';
|
|
|
43
43
|
import 'react-dom';
|
|
44
44
|
import '../../utils/functions/compareChains/compareChains.js';
|
|
45
45
|
import '../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
46
|
-
import {
|
|
46
|
+
import { getTurnkeyWalletId } from '../../utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.js';
|
|
47
47
|
import '../../context/ThemeContext/ThemeContext.js';
|
|
48
48
|
import { useSmartWallets } from '../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
49
49
|
import '../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
@@ -135,7 +135,7 @@ const EmbeddedDeleteView = () => {
|
|
|
135
135
|
}
|
|
136
136
|
setIsLoading(true);
|
|
137
137
|
try {
|
|
138
|
-
const primaryTurnkeyWalletId =
|
|
138
|
+
const primaryTurnkeyWalletId = getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
139
139
|
const deleteEmbeddedWalletsRawPayload = yield getDeleteEmbeddedWalletsRequest({
|
|
140
140
|
environmentId,
|
|
141
141
|
walletId: primaryTurnkeyWalletId,
|
|
@@ -51,7 +51,7 @@ require('../../../context/VerificationContext/VerificationContext.cjs');
|
|
|
51
51
|
require('react-dom');
|
|
52
52
|
require('../../../utils/functions/compareChains/compareChains.cjs');
|
|
53
53
|
require('../../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.cjs');
|
|
54
|
-
var
|
|
54
|
+
var getTurnkeyWalletId = require('../../../utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.cjs');
|
|
55
55
|
require('../../../context/ThemeContext/ThemeContext.cjs');
|
|
56
56
|
var useSmartWallets = require('../../../utils/hooks/useSmartWallets/useSmartWallets.cjs');
|
|
57
57
|
require('../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
@@ -143,7 +143,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
143
143
|
}
|
|
144
144
|
let primaryTurnkeyWalletId;
|
|
145
145
|
try {
|
|
146
|
-
primaryTurnkeyWalletId =
|
|
146
|
+
primaryTurnkeyWalletId = getTurnkeyWalletId.getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
147
147
|
}
|
|
148
148
|
catch (error) {
|
|
149
149
|
// waas wallet
|
|
@@ -47,7 +47,7 @@ import '../../../context/VerificationContext/VerificationContext.js';
|
|
|
47
47
|
import 'react-dom';
|
|
48
48
|
import '../../../utils/functions/compareChains/compareChains.js';
|
|
49
49
|
import '../../Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbeddedChain.js';
|
|
50
|
-
import {
|
|
50
|
+
import { getTurnkeyWalletId } from '../../../utils/functions/getTurnkeyWalletId/getTurnkeyWalletId.js';
|
|
51
51
|
import '../../../context/ThemeContext/ThemeContext.js';
|
|
52
52
|
import { useSmartWallets } from '../../../utils/hooks/useSmartWallets/useSmartWallets.js';
|
|
53
53
|
import '../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
@@ -139,7 +139,7 @@ const EmbeddedRevealView = ({ exportPrivateKey, isPromptForExport = false, }) =>
|
|
|
139
139
|
}
|
|
140
140
|
let primaryTurnkeyWalletId;
|
|
141
141
|
try {
|
|
142
|
-
primaryTurnkeyWalletId =
|
|
142
|
+
primaryTurnkeyWalletId = getTurnkeyWalletId(primaryWallet.id, (user === null || user === void 0 ? void 0 : user.verifiedCredentials) || []);
|
|
143
143
|
}
|
|
144
144
|
catch (error) {
|
|
145
145
|
// waas wallet
|
package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
+
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
6
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
8
|
var React = require('react');
|
|
8
9
|
var reactI18next = require('react-i18next');
|
|
@@ -20,7 +21,6 @@ require('../../../../utils/constants/colors.cjs');
|
|
|
20
21
|
require('../../../../utils/constants/values.cjs');
|
|
21
22
|
require('../../../../shared/consts/index.cjs');
|
|
22
23
|
require('../../../../events/dynamicEvents.cjs');
|
|
23
|
-
require('../../../../../../_virtual/_tslib.cjs');
|
|
24
24
|
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
25
25
|
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
26
26
|
require('@dynamic-labs/multi-wallet');
|
|
@@ -46,6 +46,7 @@ require('../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmb
|
|
|
46
46
|
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
47
47
|
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.cjs');
|
|
48
48
|
require('bs58');
|
|
49
|
+
var usePromise = require('../../../../utils/hooks/usePromise/usePromise.cjs');
|
|
49
50
|
require('@dynamic-labs/types');
|
|
50
51
|
require('../../../../context/SocialRedirectContext/SocialRedirectContext.cjs');
|
|
51
52
|
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
@@ -119,6 +120,7 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
119
120
|
const { primaryWallet, network, showFiat, multiAsset } = useInternalDynamicContext.useInternalDynamicContext();
|
|
120
121
|
const authMode$1 = authMode.useAuthMode();
|
|
121
122
|
const projectSettings$1 = projectSettings.useProjectSettings();
|
|
123
|
+
const { data: testnet } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () { return Boolean(yield (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isTestnet())); }), { deps: [network], initialData: false });
|
|
122
124
|
const { isLoading: isLoadingTokenBalances, tokenBalances, error: errorTokenBalances, } = useTokenBalances.useTokenBalances({
|
|
123
125
|
chainName: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain,
|
|
124
126
|
includeFiat: showFiat,
|
|
@@ -143,7 +145,7 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
143
145
|
currency: 'USD',
|
|
144
146
|
style: 'currency',
|
|
145
147
|
});
|
|
146
|
-
const canShowFiat = React.useMemo(() => showFiat && showMultiAsset && !errorTokenBalances, [showFiat, showMultiAsset, errorTokenBalances]);
|
|
148
|
+
const canShowFiat = React.useMemo(() => !testnet && showFiat && showMultiAsset && !errorTokenBalances, [testnet, showFiat, showMultiAsset, errorTokenBalances]);
|
|
147
149
|
const handleScroll = () => {
|
|
148
150
|
if (contentRef.current) {
|
|
149
151
|
setHasShadow(contentRef.current.scrollTop > 0);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
+
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
2
3
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
4
|
import { useState, useRef, useMemo, useCallback } from 'react';
|
|
4
5
|
import { useTranslation } from 'react-i18next';
|
|
@@ -16,7 +17,6 @@ import '../../../../utils/constants/colors.js';
|
|
|
16
17
|
import '../../../../utils/constants/values.js';
|
|
17
18
|
import '../../../../shared/consts/index.js';
|
|
18
19
|
import '../../../../events/dynamicEvents.js';
|
|
19
|
-
import '../../../../../../_virtual/_tslib.js';
|
|
20
20
|
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
21
21
|
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
22
22
|
import '@dynamic-labs/multi-wallet';
|
|
@@ -42,6 +42,7 @@ import '../../../../views/Passkey/utils/findPrimaryEmbeddedChain/findPrimaryEmbe
|
|
|
42
42
|
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
43
43
|
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/userFieldsSchema.js';
|
|
44
44
|
import 'bs58';
|
|
45
|
+
import { usePromise } from '../../../../utils/hooks/usePromise/usePromise.js';
|
|
45
46
|
import '@dynamic-labs/types';
|
|
46
47
|
import '../../../../context/SocialRedirectContext/SocialRedirectContext.js';
|
|
47
48
|
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
@@ -115,6 +116,7 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
115
116
|
const { primaryWallet, network, showFiat, multiAsset } = useInternalDynamicContext();
|
|
116
117
|
const authMode = useAuthMode();
|
|
117
118
|
const projectSettings = useProjectSettings();
|
|
119
|
+
const { data: testnet } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () { return Boolean(yield (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.isTestnet())); }), { deps: [network], initialData: false });
|
|
118
120
|
const { isLoading: isLoadingTokenBalances, tokenBalances, error: errorTokenBalances, } = useTokenBalances({
|
|
119
121
|
chainName: primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector.connectedChain,
|
|
120
122
|
includeFiat: showFiat,
|
|
@@ -139,7 +141,7 @@ const ActiveWalletBalance = ({ isLoading = false, }) => {
|
|
|
139
141
|
currency: 'USD',
|
|
140
142
|
style: 'currency',
|
|
141
143
|
});
|
|
142
|
-
const canShowFiat = useMemo(() => showFiat && showMultiAsset && !errorTokenBalances, [showFiat, showMultiAsset, errorTokenBalances]);
|
|
144
|
+
const canShowFiat = useMemo(() => !testnet && showFiat && showMultiAsset && !errorTokenBalances, [testnet, showFiat, showMultiAsset, errorTokenBalances]);
|
|
143
145
|
const handleScroll = () => {
|
|
144
146
|
if (contentRef.current) {
|
|
145
147
|
setHasShadow(contentRef.current.scrollTop > 0);
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* returns the id of the primary turnkey wallet
|
|
8
|
-
* if the primary wallet is a turnkey wallet, it returns the id of the primary wallet
|
|
9
|
-
* if the primary wallet is a zerodev wallet, it returns corresponding turnkey wallet id
|
|
10
|
-
*/
|
|
11
|
-
const getPrimaryTurnkeyWalletId = (primaryWalletId, verifiedCredentials) => {
|
|
12
|
-
var _a;
|
|
13
|
-
const primaryWallet = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ id }) => id === primaryWalletId);
|
|
14
|
-
if (!primaryWallet) {
|
|
15
|
-
throw new Error('Primary wallet not found');
|
|
16
|
-
}
|
|
17
|
-
let turnkeyWalletId = undefined;
|
|
18
|
-
if ((_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('turnkey')) {
|
|
19
|
-
turnkeyWalletId = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id;
|
|
20
|
-
}
|
|
21
|
-
else if (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.signerRefId) {
|
|
22
|
-
turnkeyWalletId = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.signerRefId;
|
|
23
|
-
}
|
|
24
|
-
if (!turnkeyWalletId) {
|
|
25
|
-
throw new Error("Invalid wallet type: expecting 'turnkey' wallet, or a wallet with a 'signerRefId'");
|
|
26
|
-
}
|
|
27
|
-
return turnkeyWalletId;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.getPrimaryTurnkeyWalletId = getPrimaryTurnkeyWalletId;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { JwtVerifiedCredential } from '@dynamic-labs/sdk-api-core';
|
|
2
|
-
/**
|
|
3
|
-
* returns the id of the primary turnkey wallet
|
|
4
|
-
* if the primary wallet is a turnkey wallet, it returns the id of the primary wallet
|
|
5
|
-
* if the primary wallet is a zerodev wallet, it returns corresponding turnkey wallet id
|
|
6
|
-
*/
|
|
7
|
-
export declare const getPrimaryTurnkeyWalletId: (primaryWalletId: string, verifiedCredentials: JwtVerifiedCredential[]) => string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
/**
|
|
3
|
-
* returns the id of the primary turnkey wallet
|
|
4
|
-
* if the primary wallet is a turnkey wallet, it returns the id of the primary wallet
|
|
5
|
-
* if the primary wallet is a zerodev wallet, it returns corresponding turnkey wallet id
|
|
6
|
-
*/
|
|
7
|
-
const getPrimaryTurnkeyWalletId = (primaryWalletId, verifiedCredentials) => {
|
|
8
|
-
var _a;
|
|
9
|
-
const primaryWallet = verifiedCredentials === null || verifiedCredentials === void 0 ? void 0 : verifiedCredentials.find(({ id }) => id === primaryWalletId);
|
|
10
|
-
if (!primaryWallet) {
|
|
11
|
-
throw new Error('Primary wallet not found');
|
|
12
|
-
}
|
|
13
|
-
let turnkeyWalletId = undefined;
|
|
14
|
-
if ((_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.walletName) === null || _a === void 0 ? void 0 : _a.startsWith('turnkey')) {
|
|
15
|
-
turnkeyWalletId = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.id;
|
|
16
|
-
}
|
|
17
|
-
else if (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.signerRefId) {
|
|
18
|
-
turnkeyWalletId = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.signerRefId;
|
|
19
|
-
}
|
|
20
|
-
if (!turnkeyWalletId) {
|
|
21
|
-
throw new Error("Invalid wallet type: expecting 'turnkey' wallet, or a wallet with a 'signerRefId'");
|
|
22
|
-
}
|
|
23
|
-
return turnkeyWalletId;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { getPrimaryTurnkeyWalletId };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './getPrimaryTurnkeyWalletId';
|