@dynamic-labs/sdk-react-core 1.0.0-alpha.3 → 1.0.0-alpha.5
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 +20 -0
- package/package.cjs +2 -2
- package/package.js +2 -2
- package/package.json +10 -10
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.cjs +1 -1
- package/src/lib/components/TransactionConfirmationPageLayout/TransactionConfirmationPageLayout.js +1 -1
- package/src/lib/styles/index.shadow.cjs +1 -1
- package/src/lib/styles/index.shadow.js +1 -1
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.cjs +2 -2
- package/src/lib/utils/hooks/useEmbeddedWallet/useEmbeddedWallet.js +2 -2
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.cjs +3 -1
- package/src/lib/utils/hooks/useTransactionEstimatedGas/useTransactionEstimatedGas.js +3 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +4 -3
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.d.ts +1 -1
- package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +4 -3
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.cjs +2 -2
- package/src/lib/views/Passkey/PasskeyIntroView/PasskeyIntroView.js +2 -2
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +10 -10
- package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +11 -11
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.cjs +1 -1
- package/src/lib/views/TransactionConfirmationView/helpers/transactionErrorMessage.js +1 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.cjs +14 -1
- package/src/lib/widgets/DynamicWidget/components/DynamicWidgetHeader/DynamicWidgetWalletHeader/DynamicWidgetWalletHeader.js +14 -1
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs +5 -1
- package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.js +5 -1
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.cjs +81 -0
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.d.ts +4 -0
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/UnknownWalletInformation.js +77 -0
- package/src/lib/widgets/DynamicWidget/components/UnknownWalletInformation/index.d.ts +1 -0
|
@@ -99,7 +99,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
99
99
|
},
|
|
100
100
|
});
|
|
101
101
|
const { mutate: send, isLoading, error: transactionError, } = useMutation.useMutation(() => {
|
|
102
|
-
if (
|
|
102
|
+
if (utils.TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
|
|
103
103
|
const { connector } = primaryWallet;
|
|
104
104
|
if (walletConnectorCore.isAccountAbstractionConnector(connector)) {
|
|
105
105
|
connector.disableGasSponsorshipOnce();
|
|
@@ -108,7 +108,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
108
108
|
return mutation();
|
|
109
109
|
}, {
|
|
110
110
|
onFailure: (error) => {
|
|
111
|
-
if (
|
|
111
|
+
if (utils.TransactionGasCannotBeSponsoredError.isInstance(error)) {
|
|
112
112
|
setIsGasSponsored(false);
|
|
113
113
|
}
|
|
114
114
|
onError === null || onError === void 0 ? void 0 : onError(error);
|
|
@@ -152,7 +152,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
152
152
|
return total > balance;
|
|
153
153
|
}, [balance, total]);
|
|
154
154
|
const alert = React.useMemo(() => {
|
|
155
|
-
if (
|
|
155
|
+
if (utils.TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
|
|
156
156
|
return (jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: t('dyn_send_transaction.error_message.gas_not_sponsored') }));
|
|
157
157
|
}
|
|
158
158
|
const showInsufficientFundsWarningMessage = hasInsufficientFunds && missingFunds;
|
|
@@ -165,13 +165,13 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
165
165
|
}) }));
|
|
166
166
|
}, [currencySymbol, hasInsufficientFunds, missingFunds, transactionError]);
|
|
167
167
|
return (jsxRuntime.jsxs(TransactionConfirmationPageLayout.TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, alert: alert, children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.from'), isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress.shortenWalletAddress(transactionFromAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.to'), isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
|
|
168
|
-
shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber.formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxRuntime.jsx(TransactionRow.TransactionRow, { label: isGasEstimated
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
168
|
+
shortenWalletAddress.shortenWalletAddress(transactionToAddress, 4, 4) }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber.formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber.formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(TransactionRow.TransactionRow, { label: isGasEstimated
|
|
169
|
+
? t('dyn_send_transaction.confirmation.data.gas_estimate')
|
|
170
|
+
: t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
171
|
+
? 'transaction-estimated-gas-fee'
|
|
172
|
+
: 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber.formatBigNumber(gasTotalPrice, 10) : '--' }), jsxRuntime.jsx(TransactionRow.TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber.formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
|
|
173
|
+
? formatBigNumber.formatBigNumber(total, 10)
|
|
174
|
+
: t('dyn_send_transaction.confirmation.not_applied') })] }))] }));
|
|
175
175
|
};
|
|
176
176
|
|
|
177
177
|
exports.TransactionConfirmationView = TransactionConfirmationView;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __awaiter } from '../../../../_virtual/_tslib.js';
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useMemo } from 'react';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
5
5
|
import { parseEther, isHex, hexToBigInt } from 'viem';
|
|
@@ -95,7 +95,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
95
95
|
},
|
|
96
96
|
});
|
|
97
97
|
const { mutate: send, isLoading, error: transactionError, } = useMutation(() => {
|
|
98
|
-
if (transactionError
|
|
98
|
+
if (TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
|
|
99
99
|
const { connector } = primaryWallet;
|
|
100
100
|
if (isAccountAbstractionConnector(connector)) {
|
|
101
101
|
connector.disableGasSponsorshipOnce();
|
|
@@ -104,7 +104,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
104
104
|
return mutation();
|
|
105
105
|
}, {
|
|
106
106
|
onFailure: (error) => {
|
|
107
|
-
if (error
|
|
107
|
+
if (TransactionGasCannotBeSponsoredError.isInstance(error)) {
|
|
108
108
|
setIsGasSponsored(false);
|
|
109
109
|
}
|
|
110
110
|
onError === null || onError === void 0 ? void 0 : onError(error);
|
|
@@ -148,7 +148,7 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
148
148
|
return total > balance;
|
|
149
149
|
}, [balance, total]);
|
|
150
150
|
const alert = useMemo(() => {
|
|
151
|
-
if (transactionError
|
|
151
|
+
if (TransactionGasCannotBeSponsoredError.isInstance(transactionError)) {
|
|
152
152
|
return (jsx(Alert, { icon: 'error', variant: 'error', children: t('dyn_send_transaction.error_message.gas_not_sponsored') }));
|
|
153
153
|
}
|
|
154
154
|
const showInsufficientFundsWarningMessage = hasInsufficientFunds && missingFunds;
|
|
@@ -161,13 +161,13 @@ const TransactionConfirmationView = ({ transaction, mutation, onError, onSuccess
|
|
|
161
161
|
}) }));
|
|
162
162
|
}, [currencySymbol, hasInsufficientFunds, missingFunds, transactionError]);
|
|
163
163
|
return (jsxs(TransactionConfirmationPageLayout, { onClickBack: onClickBack, onClickClose: onClickClose, title: title, appOrigin: appOrigin, appName: appName, appLogoUrl: appLogoUrl, isLoading: isLoading, onClickSend: () => send(), displayPoweredByDynamicFooter: displayPoweredByDynamicFooter, disableSendButton: isTransactionLoading || hasInsufficientFunds, error: errorMessage, alert: alert, children: [jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.from'), isLoading: isTransactionFromAddressLoading, title: transactionFromAddress, children: shortenWalletAddress(transactionFromAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.to'), isLoading: isTransactionToAddressLoading, title: transactionToAddress, children: transactionToAddress &&
|
|
164
|
-
shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsx(TransactionRow, { label: isGasEstimated
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
shortenWalletAddress(transactionToAddress, 4, 4) }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.amount'), isLoading: isTransactionValueLoading, isEmpty: !transactionValue, title: transactionValue ? formatBigNumber(transactionValue) : undefined, suffix: currencySymbol, icon: chainIcon, dataTestId: 'transaction-amount', children: transactionValue ? formatBigNumber(transactionValue, 10) : 0 }), !isGasSponsored && (jsxs(Fragment, { children: [jsx(TransactionRow, { label: isGasEstimated
|
|
165
|
+
? t('dyn_send_transaction.confirmation.data.gas_estimate')
|
|
166
|
+
: t('dyn_send_transaction.confirmation.data.gas'), isEmpty: !gasTotalPrice, isLoading: isGasPriceLoading || isGasSponsoredLoading, title: gasTotalPrice ? formatBigNumber(gasTotalPrice) : undefined, suffix: gasTotalPrice ? currencySymbol : undefined, icon: gasTotalPrice ? chainIcon : undefined, dataTestId: isGasEstimated
|
|
167
|
+
? 'transaction-estimated-gas-fee'
|
|
168
|
+
: 'transaction-gas-fee', children: gasTotalPrice ? formatBigNumber(gasTotalPrice, 10) : '--' }), jsx(TransactionRow, { label: t('dyn_send_transaction.confirmation.data.total'), isEmpty: !total, title: total ? formatBigNumber(total) : undefined, suffix: total ? currencySymbol : undefined, icon: total ? chainIcon : undefined, dataTestId: 'transaction-total', children: total
|
|
169
|
+
? formatBigNumber(total, 10)
|
|
170
|
+
: t('dyn_send_transaction.confirmation.not_applied') })] }))] }));
|
|
171
171
|
};
|
|
172
172
|
|
|
173
173
|
export { TransactionConfirmationView };
|
|
@@ -28,7 +28,7 @@ const errorReasonsMapping = {
|
|
|
28
28
|
const transactionErrorMessage = (error) => {
|
|
29
29
|
var _a;
|
|
30
30
|
logger.logger.debug('transaction error]:', error);
|
|
31
|
-
if (
|
|
31
|
+
if (utils.TransactionGasCannotBeSponsoredError.isInstance(error)) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
const { code } = error;
|
|
@@ -24,7 +24,7 @@ const errorReasonsMapping = {
|
|
|
24
24
|
const transactionErrorMessage = (error) => {
|
|
25
25
|
var _a;
|
|
26
26
|
logger.debug('transaction error]:', error);
|
|
27
|
-
if (error
|
|
27
|
+
if (TransactionGasCannotBeSponsoredError.isInstance(error)) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
30
|
const { code } = error;
|
|
@@ -66,6 +66,7 @@ require('react-focus-lock');
|
|
|
66
66
|
var FundingContext = require('../../../../../context/FundingContext/FundingContext.cjs');
|
|
67
67
|
var SendBalanceContext = require('../../../../../context/SendBalanceContext/SendBalanceContext.cjs');
|
|
68
68
|
var ActiveWalletInformation = require('../../ActiveWalletInformation/ActiveWalletInformation.cjs');
|
|
69
|
+
var UnknownWalletInformation = require('../../UnknownWalletInformation/UnknownWalletInformation.cjs');
|
|
69
70
|
var UserAvatar = require('../../../../../components/UserAvatar/UserAvatar.cjs');
|
|
70
71
|
|
|
71
72
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -99,8 +100,20 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
99
100
|
}
|
|
100
101
|
return shortenEmail.shortenEmail(user === null || user === void 0 ? void 0 : user.email);
|
|
101
102
|
};
|
|
103
|
+
const renderWalletHeader = () => {
|
|
104
|
+
const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
|
|
105
|
+
if (primaryWallet) {
|
|
106
|
+
return jsxRuntime.jsx(ActiveWalletInformation.ActiveWalletInformation, {});
|
|
107
|
+
}
|
|
108
|
+
else if (unknownWallet) {
|
|
109
|
+
return jsxRuntime.jsx(UnknownWalletInformation.UnknownWalletInformation, { address: unknownWallet.address });
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return (jsxRuntime.jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsxRuntime.jsx(UserAvatar.UserAvatar, { user: user }) }));
|
|
113
|
+
}
|
|
114
|
+
};
|
|
102
115
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
103
|
-
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [
|
|
116
|
+
return (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsxRuntime.jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxRuntime.jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
|
|
104
117
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
105
118
|
jsxRuntime.jsx(Icon.Icon, { size: 'small', color: 'text-secondary', children: jsxRuntime.jsx(add.ReactComponent, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsxRuntime.jsx(Button.Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
|
|
106
119
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
@@ -62,6 +62,7 @@ import 'react-focus-lock';
|
|
|
62
62
|
import { useFundingContext } from '../../../../../context/FundingContext/FundingContext.js';
|
|
63
63
|
import { useSendBalance } from '../../../../../context/SendBalanceContext/SendBalanceContext.js';
|
|
64
64
|
import { ActiveWalletInformation } from '../../ActiveWalletInformation/ActiveWalletInformation.js';
|
|
65
|
+
import { UnknownWalletInformation } from '../../UnknownWalletInformation/UnknownWalletInformation.js';
|
|
65
66
|
import { UserAvatar } from '../../../../../components/UserAvatar/UserAvatar.js';
|
|
66
67
|
|
|
67
68
|
const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
@@ -91,8 +92,20 @@ const DynamicWidgetWalletHeader = ({ variant, }) => {
|
|
|
91
92
|
}
|
|
92
93
|
return shortenEmail(user === null || user === void 0 ? void 0 : user.email);
|
|
93
94
|
};
|
|
95
|
+
const renderWalletHeader = () => {
|
|
96
|
+
const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
|
|
97
|
+
if (primaryWallet) {
|
|
98
|
+
return jsx(ActiveWalletInformation, {});
|
|
99
|
+
}
|
|
100
|
+
else if (unknownWallet) {
|
|
101
|
+
return jsx(UnknownWalletInformation, { address: unknownWallet.address });
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
return (jsx("div", { className: 'dynamic-widget-wallet-header__icon-container', children: jsx(UserAvatar, { user: user }) }));
|
|
105
|
+
}
|
|
106
|
+
};
|
|
94
107
|
const isActionsVisible = isSendBalanceEnabled || fundingEnabled;
|
|
95
|
-
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [
|
|
108
|
+
return (jsxs("div", { className: 'dynamic-widget-wallet-header', "data-testid": 'dynamic-widget-wallet-header', children: [renderWalletHeader(), primaryWallet ? (jsx("div", { "data-testid": 'primaryWalletStatus', className: 'dynamic-widget-wallet-header__wallet-info', children: isActionsVisible && (jsxs("div", { className: 'dynamic-widget-wallet-header__wallet-actions', children: [fundingEnabled && (jsx(Button, { expanded: true, dataTestId: 'buy-crypto-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: () => setShowFunding(true), disabled: !supportsFunding, startSlot:
|
|
96
109
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
97
110
|
jsx(Icon, { size: 'small', color: 'text-secondary', children: jsx(SvgAdd, {}) }), children: "Buy" })), isSendBalanceEnabled && (jsx(Button, { expanded: true, dataTestId: 'send-balance-button', buttonPadding: 'small', buttonVariant: 'primary', onClick: handleOnClickSend, startSlot:
|
|
98
111
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
package/src/lib/widgets/DynamicWidget/components/SingleWalletButtons/SingleWalletButtons.cjs
CHANGED
|
@@ -61,10 +61,14 @@ require('react-focus-lock');
|
|
|
61
61
|
|
|
62
62
|
const SingleWalletButtons = () => {
|
|
63
63
|
const { primaryWallet, handleLogOut, user } = useInternalDynamicContext.useInternalDynamicContext();
|
|
64
|
+
const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
|
|
64
65
|
return (jsxRuntime.jsxs("div", { className: 'single-wallet-buttons', children: [jsxRuntime.jsx(Button.Button, { dataTestId: 'Copy address', expanded: true, buttonPadding: 'medium', typographyProps: {
|
|
65
66
|
className: 'single-wallet-buttons--center',
|
|
66
67
|
variant: 'button_primary',
|
|
67
|
-
}, onClick: () => helpers.copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ||
|
|
68
|
+
}, onClick: () => helpers.copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ||
|
|
69
|
+
(unknownWallet === null || unknownWallet === void 0 ? void 0 : unknownWallet.address) ||
|
|
70
|
+
(user === null || user === void 0 ? void 0 : user.email) ||
|
|
71
|
+
''), feedback:
|
|
68
72
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
69
73
|
jsxRuntime.jsxs("div", { className: 'single-wallet-buttons__copied', children: [jsxRuntime.jsx(checkCircle.ReactComponent, {}), " Copied!"] }), children: "Copy address" }), jsxRuntime.jsx(Button.Button, { dataTestId: 'Disconnect', expanded: true, buttonPadding: 'medium', typographyProps: {
|
|
70
74
|
className: 'single-wallet-buttons--center',
|
|
@@ -57,10 +57,14 @@ import 'react-focus-lock';
|
|
|
57
57
|
|
|
58
58
|
const SingleWalletButtons = () => {
|
|
59
59
|
const { primaryWallet, handleLogOut, user } = useInternalDynamicContext();
|
|
60
|
+
const unknownWallet = user === null || user === void 0 ? void 0 : user.verifiedCredentials.find((credential) => credential.walletName === 'unknown');
|
|
60
61
|
return (jsxs("div", { className: 'single-wallet-buttons', children: [jsx(Button, { dataTestId: 'Copy address', expanded: true, buttonPadding: 'medium', typographyProps: {
|
|
61
62
|
className: 'single-wallet-buttons--center',
|
|
62
63
|
variant: 'button_primary',
|
|
63
|
-
}, onClick: () => copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ||
|
|
64
|
+
}, onClick: () => copyToClipboard((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.address) ||
|
|
65
|
+
(unknownWallet === null || unknownWallet === void 0 ? void 0 : unknownWallet.address) ||
|
|
66
|
+
(user === null || user === void 0 ? void 0 : user.email) ||
|
|
67
|
+
''), feedback:
|
|
64
68
|
// eslint-disable-next-line react/jsx-wrap-multilines
|
|
65
69
|
jsxs("div", { className: 'single-wallet-buttons__copied', children: [jsx(SvgCheckCircle, {}), " Copied!"] }), children: "Copy address" }), jsx(Button, { dataTestId: 'Disconnect', expanded: true, buttonPadding: 'medium', typographyProps: {
|
|
66
70
|
className: 'single-wallet-buttons--center',
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
require('react');
|
|
7
|
+
require('@dynamic-labs/utils');
|
|
8
|
+
require('@dynamic-labs/sdk-api');
|
|
9
|
+
require('../../../../config/ApiEndpoint.cjs');
|
|
10
|
+
require('../../../../shared/logger.cjs');
|
|
11
|
+
require('@dynamic-labs/iconic');
|
|
12
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
13
|
+
require('../../../../context/ViewContext/ViewContext.cjs');
|
|
14
|
+
require('@dynamic-labs/wallet-book');
|
|
15
|
+
var shortenWalletAddress = require('../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.cjs');
|
|
16
|
+
require('../../../../utils/constants/colors.cjs');
|
|
17
|
+
require('../../../../shared/utils/classes/storage/localStorage.cjs');
|
|
18
|
+
require('viem');
|
|
19
|
+
require('../../../../shared/consts/index.cjs');
|
|
20
|
+
require('@dynamic-labs/multi-wallet');
|
|
21
|
+
require('@dynamic-labs/rpc-providers');
|
|
22
|
+
require('../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.cjs');
|
|
23
|
+
require('../../../../context/AccessDeniedContext/AccessDeniedContext.cjs');
|
|
24
|
+
require('../../../../context/AccountExistsContext/AccountExistsContext.cjs');
|
|
25
|
+
var useInternalDynamicContext = require('../../../../context/DynamicContext/useInternalDynamicContext.cjs');
|
|
26
|
+
require('../../../../context/ErrorContext/ErrorContext.cjs');
|
|
27
|
+
require('react-dom');
|
|
28
|
+
require('react-i18next');
|
|
29
|
+
require('../../../../components/Transition/ZoomTransition/ZoomTransition.cjs');
|
|
30
|
+
require('../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.cjs');
|
|
31
|
+
require('../../../../components/Transition/OpacityTransition/OpacityTransition.cjs');
|
|
32
|
+
require('../../../../components/ShadowDOM/ShadowDOM.cjs');
|
|
33
|
+
require('../../../../components/OverlayCard/OverlayCard.context.cjs');
|
|
34
|
+
require('../../../../context/FooterAnimationContext/index.cjs');
|
|
35
|
+
require('../../../../context/MockContext/MockContext.cjs');
|
|
36
|
+
require('../../../../context/QrCodeContext/QrCodeContext.cjs');
|
|
37
|
+
var Typography = require('../../../../components/Typography/Typography.cjs');
|
|
38
|
+
require('../../../../context/WalletGroupContext/WalletGroupContext.cjs');
|
|
39
|
+
require('../DynamicWidgetHeader/DynamicWidgetHeader.cjs');
|
|
40
|
+
require('../../../../context/ThemeContext/ThemeContext.cjs');
|
|
41
|
+
require('../../../../context/CaptchaContext/CaptchaContext.cjs');
|
|
42
|
+
require('../../../../context/EmailVerificationContext/EmailVerificationContext.cjs');
|
|
43
|
+
require('qrcode');
|
|
44
|
+
require('../../../../context/LoadingContext/LoadingContext.cjs');
|
|
45
|
+
require('i18next');
|
|
46
|
+
require('../../context/DynamicWidgetContext.cjs');
|
|
47
|
+
var DotsMenu = require('../DotsMenu/DotsMenu.cjs');
|
|
48
|
+
require('yup');
|
|
49
|
+
require('../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.cjs');
|
|
50
|
+
require('@dynamic-labs/types');
|
|
51
|
+
require('../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.cjs');
|
|
52
|
+
require('../../../../context/UserFieldEditorContext/UserFieldEditorContext.cjs');
|
|
53
|
+
require('formik');
|
|
54
|
+
require('../../../../components/IconButton/IconButton.cjs');
|
|
55
|
+
require('../../../../components/Alert/Alert.cjs');
|
|
56
|
+
require('../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.cjs');
|
|
57
|
+
require('../../../../components/InlineWidget/InlineWidget.cjs');
|
|
58
|
+
require('../../../../components/MenuList/Dropdown/Dropdown.cjs');
|
|
59
|
+
require('../../../../components/Popper/Popper/Popper.cjs');
|
|
60
|
+
require('../../../../components/Popper/PopperContext/PopperContext.cjs');
|
|
61
|
+
require('react-focus-lock');
|
|
62
|
+
|
|
63
|
+
const UnknownWalletInformation = ({ address, }) => {
|
|
64
|
+
const { handleLogOut } = useInternalDynamicContext.useInternalDynamicContext();
|
|
65
|
+
const options = [
|
|
66
|
+
{
|
|
67
|
+
Icon: null,
|
|
68
|
+
callback: () => address && navigator.clipboard.writeText(address),
|
|
69
|
+
hide: !address,
|
|
70
|
+
text: 'Copy wallet address',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
Icon: null,
|
|
74
|
+
callback: handleLogOut,
|
|
75
|
+
text: 'Disconnect',
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
return (jsxRuntime.jsx("div", { className: 'unknown-wallet-information-container', children: jsxRuntime.jsx("div", { className: 'unknown-wallet-information', children: jsxRuntime.jsx("div", { className: 'unknown-wallet-information__header', children: jsxRuntime.jsx("div", { className: 'unknown-wallet-information__details', children: jsxRuntime.jsxs("div", { className: 'unknown-wallet-information__actions-container', children: [jsxRuntime.jsx("div", { children: jsxRuntime.jsx(Typography.Typography, { className: 'unknown-wallet-information__address', weight: 'medium', variant: 'body_normal', color: 'primary', children: shortenWalletAddress.shortenWalletAddress(address, 4, 4) }) }), jsxRuntime.jsx(DotsMenu.DotsMenu, { options: options, buttonClassName: 'unknown-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'unknown-wallet-information__dots-menu' })] }) }) }) }) }));
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.UnknownWalletInformation = UnknownWalletInformation;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@dynamic-labs/utils';
|
|
4
|
+
import '@dynamic-labs/sdk-api';
|
|
5
|
+
import '../../../../config/ApiEndpoint.js';
|
|
6
|
+
import '../../../../shared/logger.js';
|
|
7
|
+
import '@dynamic-labs/iconic';
|
|
8
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
9
|
+
import '../../../../context/ViewContext/ViewContext.js';
|
|
10
|
+
import '@dynamic-labs/wallet-book';
|
|
11
|
+
import { shortenWalletAddress } from '../../../../shared/utils/functions/shortenWalletAddress/shortenWalletAddress.js';
|
|
12
|
+
import '../../../../utils/constants/colors.js';
|
|
13
|
+
import '../../../../shared/utils/classes/storage/localStorage.js';
|
|
14
|
+
import 'viem';
|
|
15
|
+
import '../../../../shared/consts/index.js';
|
|
16
|
+
import '@dynamic-labs/multi-wallet';
|
|
17
|
+
import '@dynamic-labs/rpc-providers';
|
|
18
|
+
import '../../../../utils/hooks/useWallets/utils/verifyMagicIsSetup/verifyMagicIsSetup.js';
|
|
19
|
+
import '../../../../context/AccessDeniedContext/AccessDeniedContext.js';
|
|
20
|
+
import '../../../../context/AccountExistsContext/AccountExistsContext.js';
|
|
21
|
+
import { useInternalDynamicContext } from '../../../../context/DynamicContext/useInternalDynamicContext.js';
|
|
22
|
+
import '../../../../context/ErrorContext/ErrorContext.js';
|
|
23
|
+
import 'react-dom';
|
|
24
|
+
import 'react-i18next';
|
|
25
|
+
import '../../../../components/Transition/ZoomTransition/ZoomTransition.js';
|
|
26
|
+
import '../../../../components/Transition/SlideInUpTransition/SlideInUpTransition.js';
|
|
27
|
+
import '../../../../components/Transition/OpacityTransition/OpacityTransition.js';
|
|
28
|
+
import '../../../../components/ShadowDOM/ShadowDOM.js';
|
|
29
|
+
import '../../../../components/OverlayCard/OverlayCard.context.js';
|
|
30
|
+
import '../../../../context/FooterAnimationContext/index.js';
|
|
31
|
+
import '../../../../context/MockContext/MockContext.js';
|
|
32
|
+
import '../../../../context/QrCodeContext/QrCodeContext.js';
|
|
33
|
+
import { Typography } from '../../../../components/Typography/Typography.js';
|
|
34
|
+
import '../../../../context/WalletGroupContext/WalletGroupContext.js';
|
|
35
|
+
import '../DynamicWidgetHeader/DynamicWidgetHeader.js';
|
|
36
|
+
import '../../../../context/ThemeContext/ThemeContext.js';
|
|
37
|
+
import '../../../../context/CaptchaContext/CaptchaContext.js';
|
|
38
|
+
import '../../../../context/EmailVerificationContext/EmailVerificationContext.js';
|
|
39
|
+
import 'qrcode';
|
|
40
|
+
import '../../../../context/LoadingContext/LoadingContext.js';
|
|
41
|
+
import 'i18next';
|
|
42
|
+
import '../../context/DynamicWidgetContext.js';
|
|
43
|
+
import { DotsMenu } from '../DotsMenu/DotsMenu.js';
|
|
44
|
+
import 'yup';
|
|
45
|
+
import '../../../../components/UserProfile/parts/UserProfileField/components/VerifiedEmailIcon/VerifiedEmailIcon.js';
|
|
46
|
+
import '@dynamic-labs/types';
|
|
47
|
+
import '../../../../utils/hooks/useUserUpdateRequest/useUpdateUser/useUpdateUser.js';
|
|
48
|
+
import '../../../../context/UserFieldEditorContext/UserFieldEditorContext.js';
|
|
49
|
+
import 'formik';
|
|
50
|
+
import '../../../../components/IconButton/IconButton.js';
|
|
51
|
+
import '../../../../components/Alert/Alert.js';
|
|
52
|
+
import '../../views/ManagePasskeysWidgetView/PasskeyCard/PasskeyCard.js';
|
|
53
|
+
import '../../../../components/InlineWidget/InlineWidget.js';
|
|
54
|
+
import '../../../../components/MenuList/Dropdown/Dropdown.js';
|
|
55
|
+
import '../../../../components/Popper/Popper/Popper.js';
|
|
56
|
+
import '../../../../components/Popper/PopperContext/PopperContext.js';
|
|
57
|
+
import 'react-focus-lock';
|
|
58
|
+
|
|
59
|
+
const UnknownWalletInformation = ({ address, }) => {
|
|
60
|
+
const { handleLogOut } = useInternalDynamicContext();
|
|
61
|
+
const options = [
|
|
62
|
+
{
|
|
63
|
+
Icon: null,
|
|
64
|
+
callback: () => address && navigator.clipboard.writeText(address),
|
|
65
|
+
hide: !address,
|
|
66
|
+
text: 'Copy wallet address',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
Icon: null,
|
|
70
|
+
callback: handleLogOut,
|
|
71
|
+
text: 'Disconnect',
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
return (jsx("div", { className: 'unknown-wallet-information-container', children: jsx("div", { className: 'unknown-wallet-information', children: jsx("div", { className: 'unknown-wallet-information__header', children: jsx("div", { className: 'unknown-wallet-information__details', children: jsxs("div", { className: 'unknown-wallet-information__actions-container', children: [jsx("div", { children: jsx(Typography, { className: 'unknown-wallet-information__address', weight: 'medium', variant: 'body_normal', color: 'primary', children: shortenWalletAddress(address, 4, 4) }) }), jsx(DotsMenu, { options: options, buttonClassName: 'unknown-wallet-information__dots-menu', buttonClassNameWithOpenMenu: 'unknown-wallet-information__dots-menu' })] }) }) }) }) }));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export { UnknownWalletInformation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UnknownWalletInformation } from './UnknownWalletInformation';
|