@dynamic-labs/sdk-react-core 4.74.1 → 4.76.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/package.cjs +3 -3
- package/package.js +3 -3
- package/package.json +14 -14
- package/src/lib/client/extension/deprecated/mfa/verifyTotpMfaDevice/verifyTotpMfaDevice.d.ts +1 -1
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/FeeTokenSelector.cjs +165 -0
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/FeeTokenSelector.d.ts +11 -0
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/FeeTokenSelector.js +161 -0
- package/src/lib/components/SendBalanceForm/FeeTokenSelector/index.d.ts +1 -0
- package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +5 -13
- package/src/lib/components/SendBalanceForm/SendBalanceForm.d.ts +1 -1
- package/src/lib/components/SendBalanceForm/SendBalanceForm.js +5 -13
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.cjs +10 -13
- package/src/lib/components/SendBalancePageLayout/SendBalancePageLayout.js +10 -13
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.cjs +6 -7
- package/src/lib/components/TransactionCard/SendBalanceTransactionCard.js +6 -7
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.cjs +1 -0
- package/src/lib/context/ErrorContext/hooks/useErrorText/useErrorText.js +1 -0
- package/src/lib/data/api/email/email.cjs +3 -0
- package/src/lib/data/api/email/email.js +4 -1
- package/src/lib/data/api/oauth/oauth.cjs +6 -0
- package/src/lib/data/api/oauth/oauth.js +7 -1
- package/src/lib/data/api/sms/sms.cjs +6 -0
- package/src/lib/data/api/sms/sms.js +7 -1
- package/src/lib/data/api/wallets/wallets.cjs +6 -0
- package/src/lib/data/api/wallets/wallets.js +7 -1
- package/src/lib/shared/utils/functions/chain/getChainIcon.cjs +1 -0
- package/src/lib/shared/utils/functions/chain/getChainIcon.js +2 -1
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +3 -0
- package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +3 -0
- package/src/lib/utils/hooks/useTransition/useTransition.cjs +14 -3
- package/src/lib/utils/hooks/useTransition/useTransition.js +14 -3
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.cjs +4 -0
- package/src/lib/utils/hooks/useUserAuth/useUserAuth.js +5 -1
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +6 -0
- package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +7 -1
- package/src/lib/views/SendBalanceView/SendBalanceView.cjs +8 -8
- package/src/lib/views/SendBalanceView/SendBalanceView.js +9 -9
- package/src/lib/views/WalletList/data.d.ts +1 -1
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.cjs +6 -7
- package/src/lib/widgets/DynamicWidget/components/ActiveWalletBalance/ActiveWalletBalance.js +6 -7
|
@@ -123,7 +123,7 @@ require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
123
123
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
124
124
|
|
|
125
125
|
const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, displayPoweredByDynamicFooter = false, transaction, networkCurrencyDecimals, tokenBalances, currentToken, setCurrentToken, isLoading, isNativeToken, }) => {
|
|
126
|
-
var _a, _b;
|
|
126
|
+
var _a, _b, _c;
|
|
127
127
|
const { t } = reactI18next.useTranslation();
|
|
128
128
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
129
129
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
@@ -132,13 +132,13 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
132
132
|
});
|
|
133
133
|
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
134
134
|
const { chain } = useFetchChain.useFetchChain(walletConnector);
|
|
135
|
-
|
|
136
|
-
const isTempo = ((_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.connectedChain) === 'TEMPO';
|
|
135
|
+
const supportsFeeTokenSelection = (_b = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false;
|
|
137
136
|
const [currentFeeToken, setCurrentFeeToken] = React.useState(undefined);
|
|
138
|
-
// Initialize fee token
|
|
139
|
-
// Also reset if current token is no longer in the list (stale after refresh)
|
|
137
|
+
// Initialize fee token when connector supports fee token selection
|
|
140
138
|
React.useEffect(() => {
|
|
141
|
-
if (
|
|
139
|
+
if (supportsFeeTokenSelection &&
|
|
140
|
+
tokenBalances &&
|
|
141
|
+
tokenBalances.length > 0) {
|
|
142
142
|
const currentTokenStillExists = currentFeeToken
|
|
143
143
|
? tokenBalances.some((token) => token.address === currentFeeToken.address)
|
|
144
144
|
: false;
|
|
@@ -146,7 +146,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
146
146
|
setCurrentFeeToken(tokenBalances[0]);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
}, [
|
|
149
|
+
}, [supportsFeeTokenSelection, tokenBalances, currentFeeToken]);
|
|
150
150
|
const closeButton = onClickClose && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close-button', children: jsxRuntime.jsx(close.ReactComponent, {}) }));
|
|
151
151
|
const backButton = onClickBack && (jsxRuntime.jsx(IconButton.IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsxRuntime.jsx(arrowLeft.ReactComponent, {}) }));
|
|
152
152
|
const { data: balance } = usePromise.usePromise(() => transaction.getBalance(), {
|
|
@@ -206,9 +206,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
206
206
|
? transaction.formatNonNativeToken(transaction.nonNativeValue, transaction.nonNativeDecimal)
|
|
207
207
|
: '';
|
|
208
208
|
};
|
|
209
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, 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.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__body', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading,
|
|
210
|
-
// Tempo-specific props
|
|
211
|
-
isTempo: isTempo, feeTokenOptions: isTempo ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
209
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ModalHeader.ModalHeader, { leading: backButton, trailing: closeButton, 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.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__body', children: [jsxRuntime.jsx(AnimatePresence.AnimatePresence, { animationComponent: jsxRuntime.jsx(VerticalDrawerTransition.VerticalDrawerTransition, {}), children: error && (jsxRuntime.jsx("div", { className: 'send-balance-page-layout__error', children: jsxRuntime.jsx(Alert.Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsxRuntime.jsx(SendBalanceForm.SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading, supportsFeeTokenSelection: supportsFeeTokenSelection, feeTokenOptions: supportsFeeTokenSelection ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
212
210
|
if (isNativeToken) {
|
|
213
211
|
transaction.value = transaction.parse(amount);
|
|
214
212
|
}
|
|
@@ -219,15 +217,14 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
219
217
|
transaction.nonNativeDecimal = currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals;
|
|
220
218
|
}
|
|
221
219
|
transaction.to = recipient;
|
|
222
|
-
|
|
223
|
-
if (isTempo && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
220
|
+
if (supportsFeeTokenSelection && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
224
221
|
transaction.feeTokenAddress = currentFeeToken.address;
|
|
225
222
|
transaction.feeTokenSymbol = currentFeeToken.symbol;
|
|
226
223
|
}
|
|
227
224
|
onSubmit();
|
|
228
225
|
}, initialValues: {
|
|
229
226
|
amount: getAmount(),
|
|
230
|
-
recipient: (
|
|
227
|
+
recipient: (_c = transaction.to) !== null && _c !== void 0 ? _c : '',
|
|
231
228
|
}, decimals: isNativeToken ? networkCurrencyDecimals : currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals, validateAddress: (value) => {
|
|
232
229
|
if (!value)
|
|
233
230
|
return true;
|
|
@@ -119,7 +119,7 @@ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
119
119
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
120
120
|
|
|
121
121
|
const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, displayPoweredByDynamicFooter = false, transaction, networkCurrencyDecimals, tokenBalances, currentToken, setCurrentToken, isLoading, isNativeToken, }) => {
|
|
122
|
-
var _a, _b;
|
|
122
|
+
var _a, _b, _c;
|
|
123
123
|
const { t } = useTranslation();
|
|
124
124
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
125
125
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
@@ -128,13 +128,13 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
128
128
|
});
|
|
129
129
|
const walletConnector = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector;
|
|
130
130
|
const { chain } = useFetchChain(walletConnector);
|
|
131
|
-
|
|
132
|
-
const isTempo = ((_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.connectedChain) === 'TEMPO';
|
|
131
|
+
const supportsFeeTokenSelection = (_b = (_a = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _a === void 0 ? void 0 : _a.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false;
|
|
133
132
|
const [currentFeeToken, setCurrentFeeToken] = useState(undefined);
|
|
134
|
-
// Initialize fee token
|
|
135
|
-
// Also reset if current token is no longer in the list (stale after refresh)
|
|
133
|
+
// Initialize fee token when connector supports fee token selection
|
|
136
134
|
useEffect(() => {
|
|
137
|
-
if (
|
|
135
|
+
if (supportsFeeTokenSelection &&
|
|
136
|
+
tokenBalances &&
|
|
137
|
+
tokenBalances.length > 0) {
|
|
138
138
|
const currentTokenStillExists = currentFeeToken
|
|
139
139
|
? tokenBalances.some((token) => token.address === currentFeeToken.address)
|
|
140
140
|
: false;
|
|
@@ -142,7 +142,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
142
142
|
setCurrentFeeToken(tokenBalances[0]);
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
|
-
}, [
|
|
145
|
+
}, [supportsFeeTokenSelection, tokenBalances, currentFeeToken]);
|
|
146
146
|
const closeButton = onClickClose && (jsx(IconButton, { type: 'button', onClick: onClickClose, "data-testid": 'close-button', children: jsx(SvgClose, {}) }));
|
|
147
147
|
const backButton = onClickBack && (jsx(IconButton, { type: 'button', onClick: onClickBack, "data-testid": 'back-button', children: jsx(SvgArrowLeft, {}) }));
|
|
148
148
|
const { data: balance } = usePromise(() => transaction.getBalance(), {
|
|
@@ -202,9 +202,7 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
202
202
|
? transaction.formatNonNativeToken(transaction.nonNativeValue, transaction.nonNativeDecimal)
|
|
203
203
|
: '';
|
|
204
204
|
};
|
|
205
|
-
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxs("div", { className: 'send-balance-page-layout__body', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'send-balance-page-layout__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsx(SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading,
|
|
206
|
-
// Tempo-specific props
|
|
207
|
-
isTempo: isTempo, feeTokenOptions: isTempo ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
205
|
+
return (jsxs(Fragment, { children: [jsx(ModalHeader, { leading: backButton, trailing: closeButton, alignContent: 'bottom', children: jsx("div", { className: 'send-balance-page-layout__header-content', children: jsx(Typography, { variant: 'title', color: 'primary', copykey: 'dyn_send_transaction.data.send', children: t('dyn_send_transaction.data.send') }) }) }), jsxs("div", { className: 'send-balance-page-layout__body', children: [jsx(AnimatePresence, { animationComponent: jsx(VerticalDrawerTransition, {}), children: error && (jsx("div", { className: 'send-balance-page-layout__error', children: jsx(Alert, { icon: 'error', variant: 'error', children: error }) })) }), jsx(SendBalanceForm, { tokenBalances: tokenBalances, setCurrentToken: setCurrentToken, isLoading: isLoading, supportsFeeTokenSelection: supportsFeeTokenSelection, feeTokenOptions: supportsFeeTokenSelection ? tokenBalances : undefined, currentFeeToken: currentFeeToken, setCurrentFeeToken: setCurrentFeeToken, onSubmit: ({ amount, recipient }) => {
|
|
208
206
|
if (isNativeToken) {
|
|
209
207
|
transaction.value = transaction.parse(amount);
|
|
210
208
|
}
|
|
@@ -215,15 +213,14 @@ const SendBalancePageLayout = ({ error, onClickClose, onClickBack, onSubmit, dis
|
|
|
215
213
|
transaction.nonNativeDecimal = currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals;
|
|
216
214
|
}
|
|
217
215
|
transaction.to = recipient;
|
|
218
|
-
|
|
219
|
-
if (isTempo && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
216
|
+
if (supportsFeeTokenSelection && (currentFeeToken === null || currentFeeToken === void 0 ? void 0 : currentFeeToken.address)) {
|
|
220
217
|
transaction.feeTokenAddress = currentFeeToken.address;
|
|
221
218
|
transaction.feeTokenSymbol = currentFeeToken.symbol;
|
|
222
219
|
}
|
|
223
220
|
onSubmit();
|
|
224
221
|
}, initialValues: {
|
|
225
222
|
amount: getAmount(),
|
|
226
|
-
recipient: (
|
|
223
|
+
recipient: (_c = transaction.to) !== null && _c !== void 0 ? _c : '',
|
|
227
224
|
}, decimals: isNativeToken ? networkCurrencyDecimals : currentToken === null || currentToken === void 0 ? void 0 : currentToken.decimals, validateAddress: (value) => {
|
|
228
225
|
if (!value)
|
|
229
226
|
return true;
|
|
@@ -120,7 +120,7 @@ require('../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
|
|
|
120
120
|
var useInternalDynamicContext = require('../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
|
|
121
121
|
|
|
122
122
|
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, t, onFeeUpdate, }) => {
|
|
123
|
-
var _a, _b
|
|
123
|
+
var _a, _b;
|
|
124
124
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext.useInternalDynamicContext();
|
|
125
125
|
const networkInfo = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
|
|
126
126
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
@@ -136,17 +136,16 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
136
136
|
const isBitcoinTransaction = transaction.chain === 'BTC' ||
|
|
137
137
|
((_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _b === void 0 ? void 0 : _b.connectedChain) === 'BTC' ||
|
|
138
138
|
((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) && walletConnectorCore.isBitcoinConnector(primaryWallet.connector));
|
|
139
|
-
|
|
140
|
-
const isTempoTransaction = ((_c = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _c === void 0 ? void 0 : _c.connectedChain) === 'TEMPO';
|
|
139
|
+
const hasFeeToken = Boolean(transaction.feeTokenSymbol);
|
|
141
140
|
const bitcoinTransaction = transaction;
|
|
142
141
|
const [feePriority, setFeePriority] = React.useState((bitcoinTransaction === null || bitcoinTransaction === void 0 ? void 0 : bitcoinTransaction.feePriority) || 'medium');
|
|
143
142
|
const handleFeePriorityChange = React.useCallback((newPriority) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
-
var
|
|
143
|
+
var _c;
|
|
145
144
|
if (!isBitcoinTransaction || feePriority === newPriority) {
|
|
146
145
|
return;
|
|
147
146
|
}
|
|
148
147
|
setFeePriority(newPriority);
|
|
149
|
-
yield ((
|
|
148
|
+
yield ((_c = bitcoinTransaction.updateFeePriority) === null || _c === void 0 ? void 0 : _c.call(bitcoinTransaction, newPriority));
|
|
150
149
|
onFeeUpdate === null || onFeeUpdate === void 0 ? void 0 : onFeeUpdate();
|
|
151
150
|
}), [isBitcoinTransaction, feePriority, bitcoinTransaction, onFeeUpdate]);
|
|
152
151
|
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 ||
|
|
@@ -156,7 +155,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
156
155
|
})
|
|
157
156
|
: '')] }), 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) ||
|
|
158
157
|
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: currencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }) }) }));
|
|
159
|
-
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) })] }), (!isGasSponsored ||
|
|
158
|
+
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) })] }), (!isGasSponsored || hasFeeToken) && (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) ||
|
|
160
159
|
(isBitcoinTransaction ? 'Bitcoin' : '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) ||
|
|
161
160
|
(isBitcoinTransaction ? 'Bitcoin' : 'Network icon'), width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), isBitcoinTransaction && (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', copykey: 'dyn_send_transaction.confirmation.data.fee_priority', children: "Fee Priority" }), jsxRuntime.jsxs("div", { className: 'transaction-card__value', style: {
|
|
162
161
|
alignItems: 'center',
|
|
@@ -182,7 +181,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
182
181
|
pointerEvents: 'none',
|
|
183
182
|
position: 'absolute',
|
|
184
183
|
right: 0,
|
|
185
|
-
}, children: jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) }) })] })] })] })), 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.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'),
|
|
184
|
+
}, children: jsxRuntime.jsx(Icon.Icon, { size: 'small', children: jsxRuntime.jsx(chevronDown.ReactComponent, {}) }) })] })] })] })), 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.jsxs(Typography.Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'), hasFeeToken && (jsxRuntime.jsxs("span", { style: { fontWeight: 'normal' }, children: [' ', "(in ", transaction.feeTokenSymbol, ")"] }))] }), jsxRuntime.jsx(Tooltip.Tooltip, { content: hasFeeToken
|
|
186
185
|
? `Network fees paid in ${transaction.feeTokenSymbol}`
|
|
187
186
|
: '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
|
|
188
187
|
? '<$0.01'
|
|
@@ -116,7 +116,7 @@ import '../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
|
|
|
116
116
|
import { useInternalDynamicContext } from '../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
|
|
117
117
|
|
|
118
118
|
const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol, valueRounded, transactionValue, isGasSponsored, gasFiatValue, totalGasFiatValue, currency, total, t, onFeeUpdate, }) => {
|
|
119
|
-
var _a, _b
|
|
119
|
+
var _a, _b;
|
|
120
120
|
const { primaryWallet, projectSettings, overrides } = useInternalDynamicContext();
|
|
121
121
|
const networkInfo = useNetworkConfigurationsFromProjectSettings({
|
|
122
122
|
evmNetworksOverrides: overrides === null || overrides === void 0 ? void 0 : overrides.evmNetworks,
|
|
@@ -132,17 +132,16 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
132
132
|
const isBitcoinTransaction = transaction.chain === 'BTC' ||
|
|
133
133
|
((_b = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _b === void 0 ? void 0 : _b.connectedChain) === 'BTC' ||
|
|
134
134
|
((primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) && isBitcoinConnector(primaryWallet.connector));
|
|
135
|
-
|
|
136
|
-
const isTempoTransaction = ((_c = primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.connector) === null || _c === void 0 ? void 0 : _c.connectedChain) === 'TEMPO';
|
|
135
|
+
const hasFeeToken = Boolean(transaction.feeTokenSymbol);
|
|
137
136
|
const bitcoinTransaction = transaction;
|
|
138
137
|
const [feePriority, setFeePriority] = useState((bitcoinTransaction === null || bitcoinTransaction === void 0 ? void 0 : bitcoinTransaction.feePriority) || 'medium');
|
|
139
138
|
const handleFeePriorityChange = useCallback((newPriority) => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
-
var
|
|
139
|
+
var _c;
|
|
141
140
|
if (!isBitcoinTransaction || feePriority === newPriority) {
|
|
142
141
|
return;
|
|
143
142
|
}
|
|
144
143
|
setFeePriority(newPriority);
|
|
145
|
-
yield ((
|
|
144
|
+
yield ((_c = bitcoinTransaction.updateFeePriority) === null || _c === void 0 ? void 0 : _c.call(bitcoinTransaction, newPriority));
|
|
146
145
|
onFeeUpdate === null || onFeeUpdate === void 0 ? void 0 : onFeeUpdate();
|
|
147
146
|
}), [isBitcoinTransaction, feePriority, bitcoinTransaction, onFeeUpdate]);
|
|
148
147
|
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 ||
|
|
@@ -152,7 +151,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
152
151
|
})
|
|
153
152
|
: '')] }), 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) ||
|
|
154
153
|
(networkInfoEntry === null || networkInfoEntry === void 0 ? void 0 : networkInfoEntry.nativeCurrency.iconUrl), alt: currencySymbol, width: 32, height: 32, className: 'transaction-card__icon__container__main' }) }) })] })] }) }) }) }));
|
|
155
|
-
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) })] }), (!isGasSponsored ||
|
|
154
|
+
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) })] }), (!isGasSponsored || hasFeeToken) && (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) ||
|
|
156
155
|
(isBitcoinTransaction ? 'Bitcoin' : '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) ||
|
|
157
156
|
(isBitcoinTransaction ? 'Bitcoin' : 'Network icon'), width: 16, height: 16, className: 'transaction-card__network-icon' })] })] }), isBitcoinTransaction && (jsxs(Fragment, { children: [jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsx(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.fee_priority', children: "Fee Priority" }), jsxs("div", { className: 'transaction-card__value', style: {
|
|
158
157
|
alignItems: 'center',
|
|
@@ -178,7 +177,7 @@ const SendBalanceTransactionCard = ({ transaction, currentToken, currencySymbol,
|
|
|
178
177
|
pointerEvents: 'none',
|
|
179
178
|
position: 'absolute',
|
|
180
179
|
right: 0,
|
|
181
|
-
}, children: jsx(Icon, { size: 'small', children: jsx(SvgChevronDown, {}) }) })] })] })] })), jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxs(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'),
|
|
180
|
+
}, children: jsx(Icon, { size: 'small', children: jsx(SvgChevronDown, {}) }) })] })] })] })), jsx("div", { className: 'transaction-card__divider' }), jsxs("div", { className: 'transaction-card__row', children: [jsxs("div", { className: 'transaction-card__label-with-tooltip', children: [jsxs(Typography, { variant: 'body_normal', color: 'secondary', copykey: 'dyn_send_transaction.confirmation.data.gas_estimate', children: [t('dyn_send_transaction.confirmation.data.gas_estimate'), hasFeeToken && (jsxs("span", { style: { fontWeight: 'normal' }, children: [' ', "(in ", transaction.feeTokenSymbol, ")"] }))] }), jsx(Tooltip, { content: hasFeeToken
|
|
182
181
|
? `Network fees paid in ${transaction.feeTokenSymbol}`
|
|
183
182
|
: '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
|
|
184
183
|
? '<$0.01'
|
|
@@ -20,6 +20,7 @@ const mapErrorCodeToTranslation = {
|
|
|
20
20
|
[utils.ErrorCode.CONNECTION_REJECTED]: 'dyn_error.connection_rejected',
|
|
21
21
|
[utils.ErrorCode.MISSING_PUBLIC_ADDRESS]: 'dyn_error.missing_public_address',
|
|
22
22
|
[utils.ErrorCode.CONNECTION_PROPOSAL_EXPIRED]: 'dyn_error.connection_proposal_expired',
|
|
23
|
+
[utils.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN]: 'dyn_error.credential_not_enabled_for_sign_in',
|
|
23
24
|
[utils.ErrorCode.SEI_NOT_ENABLED_IN_KEPLR_WALLET]: 'dyn_error.sei_not_enabled_in_keplr_wallet',
|
|
24
25
|
[utils.RATE_LIMIT_ERROR_CODE]: 'dyn_error.rate_limit_error',
|
|
25
26
|
};
|
|
@@ -16,6 +16,7 @@ const mapErrorCodeToTranslation = {
|
|
|
16
16
|
[ErrorCode.CONNECTION_REJECTED]: 'dyn_error.connection_rejected',
|
|
17
17
|
[ErrorCode.MISSING_PUBLIC_ADDRESS]: 'dyn_error.missing_public_address',
|
|
18
18
|
[ErrorCode.CONNECTION_PROPOSAL_EXPIRED]: 'dyn_error.connection_proposal_expired',
|
|
19
|
+
[ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN]: 'dyn_error.credential_not_enabled_for_sign_in',
|
|
19
20
|
[ErrorCode.SEI_NOT_ENABLED_IN_KEPLR_WALLET]: 'dyn_error.sei_not_enabled_in_keplr_wallet',
|
|
20
21
|
[RATE_LIMIT_ERROR_CODE]: 'dyn_error.rate_limit_error',
|
|
21
22
|
};
|
|
@@ -45,6 +45,9 @@ const signInWithEmailVerification = (_b) => _tslib.__awaiter(void 0, [_b], void
|
|
|
45
45
|
if (data.error.code === 'missing_from_list') {
|
|
46
46
|
throw new utils$1.NoAccessError({ email: data.payload.email });
|
|
47
47
|
}
|
|
48
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
49
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
50
|
+
}
|
|
48
51
|
if (data.code === 'email_associated_with_different_provider') {
|
|
49
52
|
throw new utils$1.AccountExistsError(data.error, data.payload);
|
|
50
53
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
|
-
import { NoAccessError, AccountExistsError, SandboxMaximumThresholdReachedError, EmailVerificationError, UserHasAccountWithEmailError } from '@dynamic-labs/utils';
|
|
4
|
+
import { NoAccessError, DynamicError, ErrorCode, AccountExistsError, SandboxMaximumThresholdReachedError, EmailVerificationError, UserHasAccountWithEmailError } from '@dynamic-labs/utils';
|
|
5
5
|
import { TokenScope, UnprocessableEntityErrorCode } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { sdkApi } from '../api.js';
|
|
7
7
|
import { ELEVATED_ACCESS_TOKEN_HEADER } from '../constants.js';
|
|
@@ -41,6 +41,9 @@ const signInWithEmailVerification = (_b) => __awaiter(void 0, [_b], void 0, func
|
|
|
41
41
|
if (data.error.code === 'missing_from_list') {
|
|
42
42
|
throw new NoAccessError({ email: data.payload.email });
|
|
43
43
|
}
|
|
44
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
45
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
46
|
+
}
|
|
44
47
|
if (data.code === 'email_associated_with_different_provider') {
|
|
45
48
|
throw new AccountExistsError(data.error, data.payload);
|
|
46
49
|
}
|
|
@@ -211,6 +211,9 @@ const telegramVerify = (environmentId, oauthResultRequest) => _tslib.__awaiter(v
|
|
|
211
211
|
});
|
|
212
212
|
const handleVerifyError = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
213
213
|
const data = yield utils.logResponseError(e, 'error verifying social');
|
|
214
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
215
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
216
|
+
}
|
|
214
217
|
if (data.code === 'social_account_already_exists') {
|
|
215
218
|
throw new utils$1.SocialAccountAlreadyExistsError();
|
|
216
219
|
}
|
|
@@ -222,6 +225,9 @@ const handleVerifyError = (e) => _tslib.__awaiter(void 0, void 0, void 0, functi
|
|
|
222
225
|
const handleSignInError = (e) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
223
226
|
var _f, _g, _h;
|
|
224
227
|
const data = yield utils.logResponseError(e, 'error signin social');
|
|
228
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
229
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
230
|
+
}
|
|
225
231
|
if (data.error.code === 'gate_blocked') {
|
|
226
232
|
throw new utils$1.GateBlockedError(data.payload.walletPublicKey);
|
|
227
233
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
4
|
import { TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { SocialAccountAlreadyExistsError, SandboxMaximumThresholdReachedError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
5
|
+
import { DynamicError, ErrorCode, SocialAccountAlreadyExistsError, SandboxMaximumThresholdReachedError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
6
6
|
import '@dynamic-labs-sdk/client/core';
|
|
7
7
|
import '../../../client/client.js';
|
|
8
8
|
import 'react';
|
|
@@ -207,6 +207,9 @@ const telegramVerify = (environmentId, oauthResultRequest) => __awaiter(void 0,
|
|
|
207
207
|
});
|
|
208
208
|
const handleVerifyError = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
209
209
|
const data = yield logResponseError(e, 'error verifying social');
|
|
210
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
211
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
212
|
+
}
|
|
210
213
|
if (data.code === 'social_account_already_exists') {
|
|
211
214
|
throw new SocialAccountAlreadyExistsError();
|
|
212
215
|
}
|
|
@@ -218,6 +221,9 @@ const handleVerifyError = (e) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
218
221
|
const handleSignInError = (e) => __awaiter(void 0, void 0, void 0, function* () {
|
|
219
222
|
var _f, _g, _h;
|
|
220
223
|
const data = yield logResponseError(e, 'error signin social');
|
|
224
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
225
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
226
|
+
}
|
|
221
227
|
if (data.error.code === 'gate_blocked') {
|
|
222
228
|
throw new GateBlockedError(data.payload.walletPublicKey);
|
|
223
229
|
}
|
|
@@ -54,6 +54,9 @@ const signInWithSmsVerification = (_b) => _tslib.__awaiter(void 0, [_b], void 0,
|
|
|
54
54
|
}
|
|
55
55
|
catch (e) {
|
|
56
56
|
const data = yield utils.logResponseError(e, 'Error signin phone number');
|
|
57
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
58
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
59
|
+
}
|
|
57
60
|
if (((_c = data.error) === null || _c === void 0 ? void 0 : _c.code) === 'missing_from_list') {
|
|
58
61
|
throw new utils$1.NoAccessError({ phoneNumber: data.payload.phoneNumber });
|
|
59
62
|
}
|
|
@@ -103,6 +106,9 @@ const verifySms = (_e) => _tslib.__awaiter(void 0, [_e], void 0, function* ({ ve
|
|
|
103
106
|
catch (e) {
|
|
104
107
|
const data = yield utils.logResponseError(e, 'Error verifying phone number');
|
|
105
108
|
logger.logger.error(data.error);
|
|
109
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
110
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
111
|
+
}
|
|
106
112
|
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
107
113
|
throw new utils$1.SandboxMaximumThresholdReachedError(data.error.message);
|
|
108
114
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
|
-
import { NoAccessError, SmsVerificationError, SandboxMaximumThresholdReachedError } from '@dynamic-labs/utils';
|
|
4
|
+
import { DynamicError, ErrorCode, NoAccessError, SmsVerificationError, SandboxMaximumThresholdReachedError } from '@dynamic-labs/utils';
|
|
5
5
|
import { TokenScope } from '@dynamic-labs/sdk-api-core';
|
|
6
6
|
import { Locale } from '@dynamic-labs/locale';
|
|
7
7
|
import '@dynamic-labs/iconic';
|
|
@@ -50,6 +50,9 @@ const signInWithSmsVerification = (_b) => __awaiter(void 0, [_b], void 0, functi
|
|
|
50
50
|
}
|
|
51
51
|
catch (e) {
|
|
52
52
|
const data = yield logResponseError(e, 'Error signin phone number');
|
|
53
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
54
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
55
|
+
}
|
|
53
56
|
if (((_c = data.error) === null || _c === void 0 ? void 0 : _c.code) === 'missing_from_list') {
|
|
54
57
|
throw new NoAccessError({ phoneNumber: data.payload.phoneNumber });
|
|
55
58
|
}
|
|
@@ -99,6 +102,9 @@ const verifySms = (_e) => __awaiter(void 0, [_e], void 0, function* ({ verificat
|
|
|
99
102
|
catch (e) {
|
|
100
103
|
const data = yield logResponseError(e, 'Error verifying phone number');
|
|
101
104
|
logger.error(data.error);
|
|
105
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
106
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
107
|
+
}
|
|
102
108
|
if (data.error.code === 'sandbox_maximum_threshold_reached') {
|
|
103
109
|
throw new SandboxMaximumThresholdReachedError(data.error.message);
|
|
104
110
|
}
|
|
@@ -189,6 +189,9 @@ const verifyWallet = (environmentId_3, _f) => _tslib.__awaiter(void 0, [environm
|
|
|
189
189
|
walletPublicKey: data.payload.walletPublicKey,
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
193
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
194
|
+
}
|
|
192
195
|
if (data.code === 'email_associated_with_different_provider') {
|
|
193
196
|
throw new utils$1.AccountExistsError(data.error, data.payload);
|
|
194
197
|
}
|
|
@@ -237,6 +240,9 @@ const walletsVerify = (environmentId_4, _l) => _tslib.__awaiter(void 0, [environ
|
|
|
237
240
|
walletPublicKey: data.payload.walletPublicKey,
|
|
238
241
|
});
|
|
239
242
|
}
|
|
243
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
244
|
+
throw new utils$1.DynamicError(data.error, utils$1.ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
245
|
+
}
|
|
240
246
|
if (data.code === 'email_associated_with_different_provider') {
|
|
241
247
|
throw new utils$1.AccountExistsError(data.error, data.payload);
|
|
242
248
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { __awaiter } from '../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
|
|
4
4
|
import { TokenScope, VerifyRequestFromJSON } from '@dynamic-labs/sdk-api-core';
|
|
5
|
-
import { DynamicError, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, WalletNotDeployedError, ChainalysisError, GateBlockedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
|
|
5
|
+
import { DynamicError, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, SandboxMaximumThresholdReachedError, WalletNotDeployedError, ChainalysisError, GateBlockedError, NoAccessError, ErrorCode, AccountExistsError } from '@dynamic-labs/utils';
|
|
6
6
|
import '@dynamic-labs-sdk/client/core';
|
|
7
7
|
import '../../../client/client.js';
|
|
8
8
|
import 'react';
|
|
@@ -185,6 +185,9 @@ const verifyWallet = (environmentId_3, _f) => __awaiter(void 0, [environmentId_3
|
|
|
185
185
|
walletPublicKey: data.payload.walletPublicKey,
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
189
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
190
|
+
}
|
|
188
191
|
if (data.code === 'email_associated_with_different_provider') {
|
|
189
192
|
throw new AccountExistsError(data.error, data.payload);
|
|
190
193
|
}
|
|
@@ -233,6 +236,9 @@ const walletsVerify = (environmentId_4, _l) => __awaiter(void 0, [environmentId_
|
|
|
233
236
|
walletPublicKey: data.payload.walletPublicKey,
|
|
234
237
|
});
|
|
235
238
|
}
|
|
239
|
+
if (data.code === 'credential_not_enabled_for_sign_in') {
|
|
240
|
+
throw new DynamicError(data.error, ErrorCode.CREDENTIAL_NOT_ENABLED_FOR_SIGN_IN);
|
|
241
|
+
}
|
|
236
242
|
if (data.code === 'email_associated_with_different_provider') {
|
|
237
243
|
throw new AccountExistsError(data.error, data.payload);
|
|
238
244
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import { AleoIcon, AlgorandIcon, AptosIcon, BitcoinIcon, CosmosIcon, EclipseIcon, EthereumIcon, FlowIcon, SolanaIcon, SparkIcon, StarknetIcon, StellarIcon, SuiIcon, TempoIcon, TonIcon, TronIcon } from '@dynamic-labs/iconic';
|
|
2
|
+
import { AleoIcon, AlgorandIcon, AptosIcon, BitcoinIcon, CosmosIcon, EclipseIcon, EthereumIcon, FlowIcon, MidnightIcon, SolanaIcon, SparkIcon, StarknetIcon, StellarIcon, SuiIcon, TempoIcon, TonIcon, TronIcon } from '@dynamic-labs/iconic';
|
|
3
3
|
import { getChainInfo } from '@dynamic-labs/wallet-connector-core';
|
|
4
4
|
import 'react';
|
|
5
5
|
import { ReactComponent as SvgError } from '../../../assets/error.js';
|
|
@@ -15,6 +15,7 @@ const chainIconMap = {
|
|
|
15
15
|
eclipse: EclipseIcon,
|
|
16
16
|
evm: EthereumIcon,
|
|
17
17
|
flow: FlowIcon,
|
|
18
|
+
midnight: MidnightIcon,
|
|
18
19
|
solana: SolanaIcon,
|
|
19
20
|
spark: SparkIcon,
|
|
20
21
|
starknet: StarknetIcon,
|
|
@@ -84,12 +84,14 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, aleoNetw
|
|
|
84
84
|
bitcoinNetworksOverrides,
|
|
85
85
|
]);
|
|
86
86
|
const createNetwork = (network, parser = (input) => input) => {
|
|
87
|
+
var _a, _b;
|
|
87
88
|
const result = {
|
|
88
89
|
bech32Prefix: network.bech32Prefix,
|
|
89
90
|
blockExplorerUrls: network.blockExplorerUrls,
|
|
90
91
|
chainId: parser(network.chainId),
|
|
91
92
|
cluster: network.cluster,
|
|
92
93
|
genesisHash: network.genesisHash,
|
|
94
|
+
hasNativeToken: (_a = network.hasNativeToken) !== null && _a !== void 0 ? _a : true,
|
|
93
95
|
iconUrls: network.iconUrls,
|
|
94
96
|
isTestnet: network.isTestnet,
|
|
95
97
|
key: network.key,
|
|
@@ -99,6 +101,7 @@ const createNetwork = (network, parser = (input) => input) => {
|
|
|
99
101
|
networkId: parser(network.networkId),
|
|
100
102
|
privateCustomerRpcUrls: network.privateCustomerRpcUrls,
|
|
101
103
|
rpcUrls: network.rpcUrls,
|
|
104
|
+
supportsFeeTokenSelection: (_b = network.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false,
|
|
102
105
|
vanityName: network.vanityName,
|
|
103
106
|
};
|
|
104
107
|
return result;
|
|
@@ -80,12 +80,14 @@ const useNetworkConfigurationsFromProjectSettings = ({ projectSettings, aleoNetw
|
|
|
80
80
|
bitcoinNetworksOverrides,
|
|
81
81
|
]);
|
|
82
82
|
const createNetwork = (network, parser = (input) => input) => {
|
|
83
|
+
var _a, _b;
|
|
83
84
|
const result = {
|
|
84
85
|
bech32Prefix: network.bech32Prefix,
|
|
85
86
|
blockExplorerUrls: network.blockExplorerUrls,
|
|
86
87
|
chainId: parser(network.chainId),
|
|
87
88
|
cluster: network.cluster,
|
|
88
89
|
genesisHash: network.genesisHash,
|
|
90
|
+
hasNativeToken: (_a = network.hasNativeToken) !== null && _a !== void 0 ? _a : true,
|
|
89
91
|
iconUrls: network.iconUrls,
|
|
90
92
|
isTestnet: network.isTestnet,
|
|
91
93
|
key: network.key,
|
|
@@ -95,6 +97,7 @@ const createNetwork = (network, parser = (input) => input) => {
|
|
|
95
97
|
networkId: parser(network.networkId),
|
|
96
98
|
privateCustomerRpcUrls: network.privateCustomerRpcUrls,
|
|
97
99
|
rpcUrls: network.rpcUrls,
|
|
100
|
+
supportsFeeTokenSelection: (_b = network.supportsFeeTokenSelection) !== null && _b !== void 0 ? _b : false,
|
|
98
101
|
vanityName: network.vanityName,
|
|
99
102
|
};
|
|
100
103
|
return result;
|
|
@@ -18,6 +18,11 @@ const useTransition = (_a) => {
|
|
|
18
18
|
const [stage, setStage] = React.useState(initialStage);
|
|
19
19
|
const [mount, setMount] = React.useState(!animateOnMount);
|
|
20
20
|
const [currentDuration, setCurrentDuration] = React.useState(duration);
|
|
21
|
+
// Track current stage in a ref so the transition effect doesn't need `stage`
|
|
22
|
+
// as a dependency. This prevents the effect's cleanup from cancelling an
|
|
23
|
+
// in-flight rAF every time stage changes (the race condition).
|
|
24
|
+
const stageRef = React.useRef(initialStage);
|
|
25
|
+
stageRef.current = stage;
|
|
21
26
|
const performTransition = (runTransition, transitionDelay) => {
|
|
22
27
|
if (transitionDelay) {
|
|
23
28
|
timeoutIdRef.current = animationFrameTimeout.animationFrameTimeout(runTransition, transitionDelay);
|
|
@@ -45,11 +50,14 @@ const useTransition = (_a) => {
|
|
|
45
50
|
}, animationDuration);
|
|
46
51
|
}, [duration, outDuration]);
|
|
47
52
|
React.useEffect(() => {
|
|
48
|
-
|
|
53
|
+
const currentStage = stageRef.current;
|
|
54
|
+
if (isShown && currentStage !== 'ENTERED' && currentStage !== 'ENTERING') {
|
|
49
55
|
const enterDelay = inDelay || delay;
|
|
50
56
|
performTransition(performEnter, enterDelay);
|
|
51
57
|
}
|
|
52
|
-
else if (!isShown &&
|
|
58
|
+
else if (!isShown &&
|
|
59
|
+
currentStage !== 'UNMOUNT' &&
|
|
60
|
+
currentStage !== 'EXITING') {
|
|
53
61
|
const exitDelay = outDelay || delay;
|
|
54
62
|
performTransition(performExit, exitDelay);
|
|
55
63
|
}
|
|
@@ -57,7 +65,10 @@ const useTransition = (_a) => {
|
|
|
57
65
|
animationFrameTimeout.clearAnimationFrameTimeout(animationFrameTimeoutIdRef.current);
|
|
58
66
|
animationFrameTimeout.clearAnimationFrameTimeout(timeoutIdRef.current);
|
|
59
67
|
};
|
|
60
|
-
|
|
68
|
+
// `stage` is intentionally excluded from deps — we read it via stageRef to
|
|
69
|
+
// prevent the cleanup from cancelling an in-flight rAF on every stage change.
|
|
70
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
|
+
}, [inDelay, outDelay, performEnter, performExit, isShown, delay]);
|
|
61
72
|
useTransitionEvents.useTransitionEvents(stage, events);
|
|
62
73
|
return { currentDuration, mount, stage };
|
|
63
74
|
};
|