@dynamic-labs/sdk-react-core 4.16.0 → 4.18.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/package.cjs +1 -1
  3. package/package.js +1 -1
  4. package/package.json +13 -13
  5. package/src/lib/components/InlineSubmitButton/InlineSubmitButton.cjs +2 -2
  6. package/src/lib/components/InlineSubmitButton/InlineSubmitButton.js +2 -2
  7. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.cjs +0 -1
  8. package/src/lib/context/DynamicContext/hooks/useHandleLogout/useHandleLogout.js +1 -2
  9. package/src/lib/context/PasskeyContext/PasskeyContext.cjs +18 -7
  10. package/src/lib/context/PasskeyContext/PasskeyContext.js +18 -7
  11. package/src/lib/data/api/email/email.cjs +4 -4
  12. package/src/lib/data/api/email/email.js +4 -4
  13. package/src/lib/styles/index.shadow.cjs +1 -1
  14. package/src/lib/styles/index.shadow.js +1 -1
  15. package/src/lib/utils/constants/localStorage.cjs +0 -2
  16. package/src/lib/utils/constants/localStorage.d.ts +0 -1
  17. package/src/lib/utils/constants/localStorage.js +1 -2
  18. package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.cjs +2 -2
  19. package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.d.ts +1 -1
  20. package/src/lib/utils/hooks/authenticationHooks/helpers/showPendingConnectView.js +1 -1
  21. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.cjs +2 -3
  22. package/src/lib/utils/hooks/useConnectWallet/useConnectWallet.js +1 -2
  23. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.cjs +2 -3
  24. package/src/lib/utils/hooks/useTransferWallet/useTransferWallet.js +1 -2
  25. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.cjs +1 -2
  26. package/src/lib/utils/hooks/useVerifyWallet/useVerifyWallet.js +1 -2
  27. package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.cjs +1 -0
  28. package/src/lib/utils/hooks/useWalletConnectors/utils/smartWallet/smartWallet.js +1 -0
  29. package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.cjs +5 -4
  30. package/src/lib/views/LoginView/sections/EmailSignInSection/LoginEmailForm.js +5 -4
  31. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.cjs +17 -16
  32. package/src/lib/views/TransactionConfirmationView/TransactionConfirmationView.js +18 -17
  33. package/src/lib/utils/functions/getWalletProvider/getWalletProvider.cjs +0 -21
  34. package/src/lib/utils/functions/getWalletProvider/getWalletProvider.d.ts +0 -3
  35. package/src/lib/utils/functions/getWalletProvider/getWalletProvider.js +0 -17
  36. package/src/lib/utils/functions/getWalletProvider/index.d.ts +0 -1
@@ -18,7 +18,6 @@ const EMBEDDED_WALLET_SESSION_SETTINGS = 'dynamic_embedded_wallet_session_settin
18
18
  const EMBEDDED_WALLET_SECURE_BANNER = 'dynamic_embedded_secure_banner';
19
19
  const PHONE_INPUT_DEFAULT_COUNTRY = 'dynamic_phone_input_default_country';
20
20
  const CAPTCHA_TOKEN = 'dynamic_captcha_token';
21
- const ZERODEV_AUTHORIZATION = 'zerodev_authorization';
22
21
  /**
23
22
  * Used to identify the purpose of a signature after phantom redirects back to the app in mobile
24
23
  */
@@ -48,4 +47,3 @@ exports.SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = SECURE_ENCLAVE_WALL
48
47
  exports.STORE_STORAGE_KEY = STORE_STORAGE_KEY;
49
48
  exports.WAGMI_LAST_SESSION_SETTINGS = WAGMI_LAST_SESSION_SETTINGS;
50
49
  exports.WALLET_PICKER_SEARCH_KEY = WALLET_PICKER_SEARCH_KEY;
51
- exports.ZERODEV_AUTHORIZATION = ZERODEV_AUTHORIZATION;
@@ -16,7 +16,6 @@ export declare const EMBEDDED_WALLET_SESSION_SETTINGS = "dynamic_embedded_wallet
16
16
  export declare const EMBEDDED_WALLET_SECURE_BANNER = "dynamic_embedded_secure_banner";
17
17
  export declare const PHONE_INPUT_DEFAULT_COUNTRY = "dynamic_phone_input_default_country";
18
18
  export declare const CAPTCHA_TOKEN = "dynamic_captcha_token";
19
- export declare const ZERODEV_AUTHORIZATION = "zerodev_authorization";
20
19
  export type PhantomSignatureState = {
21
20
  /**
22
21
  * Whether the user has agreed to transfer a wallet even if that means
@@ -14,7 +14,6 @@ const EMBEDDED_WALLET_SESSION_SETTINGS = 'dynamic_embedded_wallet_session_settin
14
14
  const EMBEDDED_WALLET_SECURE_BANNER = 'dynamic_embedded_secure_banner';
15
15
  const PHONE_INPUT_DEFAULT_COUNTRY = 'dynamic_phone_input_default_country';
16
16
  const CAPTCHA_TOKEN = 'dynamic_captcha_token';
17
- const ZERODEV_AUTHORIZATION = 'zerodev_authorization';
18
17
  /**
19
18
  * Used to identify the purpose of a signature after phantom redirects back to the app in mobile
20
19
  */
@@ -25,4 +24,4 @@ const SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS = {
25
24
  priority: ['secureStorage', 'localStorage'],
26
25
  };
27
26
 
28
- export { AUTH_EXPIRES_AT, AUTH_MIN_TOKEN, AUTH_TOKEN, BRIDGE_ONBOARDING_COMPLETED, CAPTCHA_TOKEN, CONNECTED_WALLET_NAME_SERVICE, DEVICE_FINGERPRINT, DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS, EMBEDDED_WALLET_SECURE_BANNER, EMBEDDED_WALLET_SESSION_SETTINGS, LAST_USED_WALLET, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, PHANTOM_SIGNATURE_STATE, PHONE_INPUT_DEFAULT_COUNTRY, SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS, STORE_STORAGE_KEY, WAGMI_LAST_SESSION_SETTINGS, WALLET_PICKER_SEARCH_KEY, ZERODEV_AUTHORIZATION };
27
+ export { AUTH_EXPIRES_AT, AUTH_MIN_TOKEN, AUTH_TOKEN, BRIDGE_ONBOARDING_COMPLETED, CAPTCHA_TOKEN, CONNECTED_WALLET_NAME_SERVICE, DEVICE_FINGERPRINT, DYNAMIC_CONTEXT_LAST_SESSION_SETTINGS, EMBEDDED_WALLET_SECURE_BANNER, EMBEDDED_WALLET_SESSION_SETTINGS, LAST_USED_WALLET, NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY, PHANTOM_SIGNATURE_STATE, PHONE_INPUT_DEFAULT_COUNTRY, SECURE_ENCLAVE_WALLET_SESSION_KEYS, SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS, STORE_STORAGE_KEY, WAGMI_LAST_SESSION_SETTINGS, WALLET_PICKER_SEARCH_KEY };
@@ -4,11 +4,11 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../../../../_virtual/_tslib.cjs');
7
- var getWalletProvider = require('../../../functions/getWalletProvider/getWalletProvider.cjs');
7
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
8
8
 
9
9
  const specialCareWallets = ['bloctoevm', 'perawallet', 'metamaskstarknet'];
10
10
  const showPendingConnectView = (walletConnector, pushView) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
11
- const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
11
+ const walletProvider = walletConnectorCore.getWalletProvider(walletConnector);
12
12
  // We don't want to show the pending connect view for qrCode and walletConnect
13
13
  // They have their own view with qrCode so we don't need to show the pending connect view
14
14
  if (walletProvider === 'walletConnect' || walletProvider === 'qrCode') {
@@ -1,3 +1,3 @@
1
- import type { WalletConnector } from '@dynamic-labs/wallet-connector-core';
1
+ import { type WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
2
  import { ViewType } from '../../../../context/ViewContext';
3
3
  export declare const showPendingConnectView: (walletConnector: WalletConnector, pushView: (view: ViewType) => void) => Promise<void>;
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../../_virtual/_tslib.js';
3
- import { getWalletProvider } from '../../../functions/getWalletProvider/getWalletProvider.js';
3
+ import { getWalletProvider } from '@dynamic-labs/wallet-connector-core';
4
4
 
5
5
  const specialCareWallets = ['bloctoevm', 'perawallet', 'metamaskstarknet'];
6
6
  const showPendingConnectView = (walletConnector, pushView) => __awaiter(void 0, void 0, void 0, function* () {
@@ -28,7 +28,6 @@ var getWalletUniqueId = require('../../functions/getWalletUniqueId/getWalletUniq
28
28
  require('../../../store/state/user/user.cjs');
29
29
  var session = require('../../../data/api/session/session.cjs');
30
30
  require('../../../locale/locale.cjs');
31
- var getWalletProvider = require('../../functions/getWalletProvider/getWalletProvider.cjs');
32
31
  var isConnectOnly = require('../authenticationHooks/helpers/isConnectOnly.cjs');
33
32
  var getWalletConnectorForWallet = require('../../functions/getWalletConnectorForWallet/getWalletConnectorForWallet.cjs');
34
33
  var useDebounce = require('../useDebounce/useDebounce.cjs');
@@ -209,7 +208,7 @@ const useConnectWallet = ({ authMode, enableVisitTrackingOnConnectOnly, environm
209
208
  environmentId,
210
209
  publicWalletAddress: walletAddress,
211
210
  walletName: walletConnector.key,
212
- walletProvider: getWalletProvider.getWalletProvider(walletConnector),
211
+ walletProvider: walletConnectorCore.getWalletProvider(walletConnector),
213
212
  });
214
213
  }
215
214
  // On connect and sign, we don't want to add this wallet to userWallets
@@ -234,7 +233,7 @@ const useConnectWallet = ({ authMode, enableVisitTrackingOnConnectOnly, environm
234
233
  }
235
234
  else {
236
235
  applyConnectedWalletToStore({
237
- provider: getWalletProvider.getWalletProvider(walletConnector),
236
+ provider: walletConnectorCore.getWalletProvider(walletConnector),
238
237
  walletAddress: walletAddress,
239
238
  walletChain,
240
239
  walletConnectorKey: walletConnector.key,
@@ -2,7 +2,7 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useState, useCallback, useEffect } from 'react';
4
4
  import { CustomError, MissingPublicAddressError } from '@dynamic-labs/utils';
5
- import { getWalletConnectorByKey, logger, isHardwareWalletConnector } from '@dynamic-labs/wallet-connector-core';
5
+ import { getWalletConnectorByKey, logger, isHardwareWalletConnector, getWalletProvider } from '@dynamic-labs/wallet-connector-core';
6
6
  import { HardwareWalletEnum } from '@dynamic-labs/sdk-api-core';
7
7
  import { useInternalUserWallets } from '../../../context/UserWalletsContext/UserWalletsContext.js';
8
8
  import '../../../config/ApiEndpoint.js';
@@ -24,7 +24,6 @@ import { getWalletUniqueId } from '../../functions/getWalletUniqueId/getWalletUn
24
24
  import '../../../store/state/user/user.js';
25
25
  import { createVisit } from '../../../data/api/session/session.js';
26
26
  import '../../../locale/locale.js';
27
- import { getWalletProvider } from '../../functions/getWalletProvider/getWalletProvider.js';
28
27
  import { isConnectOnly } from '../authenticationHooks/helpers/isConnectOnly.js';
29
28
  import { getWalletConnectorForWallet } from '../../functions/getWalletConnectorForWallet/getWalletConnectorForWallet.js';
30
29
  import { useDebounce } from '../useDebounce/useDebounce.js';
@@ -6,12 +6,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
7
  var React = require('react');
8
8
  var utils = require('@dynamic-labs/utils');
9
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
9
10
  require('../../../context/DynamicContext/DynamicContext.cjs');
10
11
  require('../../../store/state/loadingAndLifecycle/loadingAndLifecycle.cjs');
11
12
  require('@dynamic-labs/sdk-api-core');
12
13
  require('../../../shared/logger.cjs');
13
14
  require('@dynamic-labs/iconic');
14
- require('@dynamic-labs/wallet-connector-core');
15
15
  require('react/jsx-runtime');
16
16
  require('../../../context/ViewContext/ViewContext.cjs');
17
17
  require('@dynamic-labs/wallet-book');
@@ -34,7 +34,6 @@ require('../../../config/ApiEndpoint.cjs');
34
34
  require('../../../store/state/user/user.cjs');
35
35
  require('../../../locale/locale.cjs');
36
36
  var wallets = require('../../../data/api/wallets/wallets.cjs');
37
- var getWalletProvider = require('../../functions/getWalletProvider/getWalletProvider.cjs');
38
37
  require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
39
38
  require('../../../context/VerificationContext/VerificationContext.cjs');
40
39
  require('../../../store/state/nonce/nonce.cjs');
@@ -127,7 +126,7 @@ const useTransferWallet = () => {
127
126
  throw new utils.DynamicError(errors.USER_NOT_LOGGED_IN);
128
127
  const { overrideSiweStatement, walletConnector } = props;
129
128
  const args = Object.assign(Object.assign({}, props), { displaySiweStatement,
130
- environmentId, siweStatement: overrideSiweStatement, walletProvider: getWalletProvider.getWalletProvider(walletConnector) });
129
+ environmentId, siweStatement: overrideSiweStatement, walletProvider: walletConnectorCore.getWalletProvider(walletConnector) });
131
130
  const verifyArgs = yield getVerifyArgs.getVerifyArgs(args);
132
131
  const userProfile = yield wallets.transferWallet(environmentId, verifyArgs);
133
132
  if (!userProfile) {
@@ -2,12 +2,12 @@
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { useCallback } from 'react';
4
4
  import { DynamicError } from '@dynamic-labs/utils';
5
+ import { getWalletProvider } from '@dynamic-labs/wallet-connector-core';
5
6
  import '../../../context/DynamicContext/DynamicContext.js';
6
7
  import '../../../store/state/loadingAndLifecycle/loadingAndLifecycle.js';
7
8
  import '@dynamic-labs/sdk-api-core';
8
9
  import '../../../shared/logger.js';
9
10
  import '@dynamic-labs/iconic';
10
- import '@dynamic-labs/wallet-connector-core';
11
11
  import 'react/jsx-runtime';
12
12
  import '../../../context/ViewContext/ViewContext.js';
13
13
  import '@dynamic-labs/wallet-book';
@@ -30,7 +30,6 @@ import '../../../config/ApiEndpoint.js';
30
30
  import '../../../store/state/user/user.js';
31
31
  import '../../../locale/locale.js';
32
32
  import { transferWallet } from '../../../data/api/wallets/wallets.js';
33
- import { getWalletProvider } from '../../functions/getWalletProvider/getWalletProvider.js';
34
33
  import '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
35
34
  import '../../../context/VerificationContext/VerificationContext.js';
36
35
  import '../../../store/state/nonce/nonce.js';
@@ -37,7 +37,6 @@ require('../../../store/state/user/user.cjs');
37
37
  require('../../../locale/locale.cjs');
38
38
  var wallets = require('../../../data/api/wallets/wallets.cjs');
39
39
  var getSiweStatement = require('../../functions/getSiweStatement/getSiweStatement.cjs');
40
- var getWalletProvider = require('../../functions/getWalletProvider/getWalletProvider.cjs');
41
40
  var connectedWalletsInfo = require('../../../store/state/connectedWalletsInfo/connectedWalletsInfo.cjs');
42
41
  require('../../../context/VerificationContext/VerificationContext.cjs');
43
42
  require('../../../store/state/nonce/nonce.cjs');
@@ -273,7 +272,7 @@ const useVerifyWallet = ({ displaySiweStatement, environmentId, projectSettings,
273
272
  }
274
273
  };
275
274
  return (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ walletConnector, getAddressOpts, publicWalletAddress, captchaToken, oauth, signedMessageOverride, messageToSignOverride, }) {
276
- const walletProvider = getWalletProvider.getWalletProvider(walletConnector);
275
+ const walletProvider = walletConnectorCore.getWalletProvider(walletConnector);
277
276
  dynamicEvents.dynamicEvents.emit('authInit', {
278
277
  address: publicWalletAddress,
279
278
  connectorName: walletConnector.name,
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
3
  import { DynamicError, StorageService, EmbeddedWalletExistsError, WalletUsedError, MergeAccountsConfirmationError, ChainalysisError, GateBlockedError, SandboxMaximumThresholdReachedError, NoAccessError, AccountExistsError } from '@dynamic-labs/utils';
4
- import { isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
4
+ import { getWalletProvider, isSocialWalletConnector } from '@dynamic-labs/wallet-connector-core';
5
5
  import 'react';
6
6
  import { dynamicEvents } from '../../../events/dynamicEvents.js';
7
7
  import '../../../context/DynamicContext/DynamicContext.js';
@@ -33,7 +33,6 @@ import '../../../store/state/user/user.js';
33
33
  import '../../../locale/locale.js';
34
34
  import { verifyWallet, linkWallet } from '../../../data/api/wallets/wallets.js';
35
35
  import { getSiweStatement } from '../../functions/getSiweStatement/getSiweStatement.js';
36
- import { getWalletProvider } from '../../functions/getWalletProvider/getWalletProvider.js';
37
36
  import { resetConnectedWalletsInfo } from '../../../store/state/connectedWalletsInfo/connectedWalletsInfo.js';
38
37
  import '../../../context/VerificationContext/VerificationContext.js';
39
38
  import '../../../store/state/nonce/nonce.js';
@@ -51,6 +51,7 @@ const initializeSmartWallet = (_a) => _tslib.__awaiter(void 0, [_a], void 0, fun
51
51
  properties: account.walletProperties,
52
52
  shouldSetEoaConnector: primaryWalletId === owner.id || primaryWalletId === account.id,
53
53
  smartWalletAddress: account.address,
54
+ verifiedCredentials,
54
55
  });
55
56
  });
56
57
 
@@ -47,6 +47,7 @@ const initializeSmartWallet = (_a) => __awaiter(void 0, [_a], void 0, function*
47
47
  properties: account.walletProperties,
48
48
  shouldSetEoaConnector: primaryWalletId === owner.id || primaryWalletId === account.id,
49
49
  smartWalletAddress: account.address,
50
+ verifiedCredentials,
50
51
  });
51
52
  });
52
53
 
@@ -103,19 +103,20 @@ const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, clas
103
103
  const { projectSettings } = useInternalDynamicContext.useInternalDynamicContext();
104
104
  const { view, pushView } = ViewContext.useViewContext();
105
105
  const { setVerificationUUID, setDisplayedDestination } = VerificationContext.useVerification();
106
- const { setErrorMessage } = ErrorContext.useErrorContext();
106
+ const { setError } = ErrorContext.useErrorContext();
107
107
  const [invalidEmail, setInvalidEmail] = React.useState(false);
108
108
  const { connectWithEmail } = useEmailProvider.useEmailProvider();
109
109
  const handleEmailSubmitError = React.useCallback((error) => {
110
- if (error.message === 'Email is not valid') {
110
+ if (error.message === 'Email is not valid' ||
111
+ error.message === 'Invalid Email Address') {
111
112
  setInvalidEmail(true);
112
113
  }
113
114
  else {
114
- setErrorMessage(error.message);
115
+ setError(error.message);
115
116
  }
116
117
  logger.logger.debug(error);
117
118
  onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
118
- }, [setErrorMessage, onSubmitError]);
119
+ }, [setError, onSubmitError]);
119
120
  /** Handles the user submit event */
120
121
  const handleSubmit = React.useCallback((emailInput) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
121
122
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
@@ -99,19 +99,20 @@ const LoginEmailForm = ({ isLoading, onSubmit, onSubmitError, currentEmail, clas
99
99
  const { projectSettings } = useInternalDynamicContext();
100
100
  const { view, pushView } = useViewContext();
101
101
  const { setVerificationUUID, setDisplayedDestination } = useVerification();
102
- const { setErrorMessage } = useErrorContext();
102
+ const { setError } = useErrorContext();
103
103
  const [invalidEmail, setInvalidEmail] = useState(false);
104
104
  const { connectWithEmail } = useEmailProvider();
105
105
  const handleEmailSubmitError = useCallback((error) => {
106
- if (error.message === 'Email is not valid') {
106
+ if (error.message === 'Email is not valid' ||
107
+ error.message === 'Invalid Email Address') {
107
108
  setInvalidEmail(true);
108
109
  }
109
110
  else {
110
- setErrorMessage(error.message);
111
+ setError(error.message);
111
112
  }
112
113
  logger.debug(error);
113
114
  onSubmitError === null || onSubmitError === void 0 ? void 0 : onSubmitError();
114
- }, [setErrorMessage, onSubmitError]);
115
+ }, [setError, onSubmitError]);
115
116
  /** Handles the user submit event */
116
117
  const handleSubmit = useCallback((emailInput) => __awaiter(void 0, void 0, void 0, function* () {
117
118
  onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
@@ -120,6 +120,7 @@ var SimulationStatus;
120
120
  const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
121
121
  const { primaryWallet, environmentId } = useInternalDynamicContext.useInternalDynamicContext();
122
122
  const [isGasSponsored, setIsGasSponsored] = React.useState(false);
123
+ const [isGasSponsoredLoading, setIsGasSponsoredLoading] = React.useState(false);
123
124
  const update = useForceUpdate.useForceUpdate();
124
125
  const { t } = reactI18next.useTranslation();
125
126
  const { currency } = useFetchCurrency.useFetchCurrency(walletConnector);
@@ -135,13 +136,20 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
135
136
  status: SimulationStatus.LOADING,
136
137
  });
137
138
  const [recipient, setRecipient] = React.useState(undefined);
139
+ const isFetchingSimulationRef = React.useRef(false);
138
140
  const fetchSimulationResult = React.useCallback(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
139
141
  var _a, _b, _c, _d, _e, _f, _g;
140
142
  if (simulationState.status !== SimulationStatus.LOADING) {
141
143
  return;
142
144
  }
145
+ if (isFetchingSimulationRef.current) {
146
+ // Already fetching, prevent duplicate call
147
+ return;
148
+ }
149
+ isFetchingSimulationRef.current = true;
143
150
  if (sendBalanceTransaction || hideModal) {
144
151
  setSimulationState({ status: SimulationStatus.SKIPPED });
152
+ isFetchingSimulationRef.current = false;
145
153
  return;
146
154
  }
147
155
  if (!primaryWallet || (!chainId && (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) !== 'SOL')) {
@@ -151,13 +159,16 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
151
159
  primaryWallet,
152
160
  });
153
161
  setSimulationState({ status: SimulationStatus.FAILED });
162
+ isFetchingSimulationRef.current = false;
154
163
  return;
155
164
  }
156
165
  try {
157
166
  let result;
158
167
  if (primaryWallet.connector.key === 'zerodev') {
159
168
  const connector = primaryWallet.connector;
160
- const { userOperation } = yield connector.getCurrentUserOperation(transaction);
169
+ const { userOperation, sponsored } = yield connector.getCurrentUserOperation(transaction);
170
+ setIsGasSponsored(sponsored);
171
+ setIsGasSponsoredLoading(false);
161
172
  if (userOperation) {
162
173
  const formattedUserOperation = yield connector.formatUserOperation(userOperation);
163
174
  // Set the gas fee on the transaction, only for zero dev
@@ -224,6 +235,9 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
224
235
  logger.logger.error('[TransactionConfirmationView] Simulation failed:', error);
225
236
  setSimulationState({ status: SimulationStatus.FAILED });
226
237
  }
238
+ finally {
239
+ isFetchingSimulationRef.current = false;
240
+ }
227
241
  }), [
228
242
  sendBalanceTransaction,
229
243
  hideModal,
@@ -232,6 +246,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
232
246
  environmentId,
233
247
  transaction,
234
248
  walletConnector,
249
+ simulationState.status,
250
+ setSimulationState,
235
251
  ]);
236
252
  React.useEffect(() => {
237
253
  if (simulationState.status === SimulationStatus.SUCCESS ||
@@ -253,21 +269,6 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
253
269
  }
254
270
  transaction.fetchFee().finally(update);
255
271
  }, [primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain, transaction, update]);
256
- const { isLoading: isGasSponsoredLoading } = usePromise.usePromise(() => {
257
- if (!walletConnectorCore.isAccountAbstractionConnector(walletConnector)) {
258
- return false;
259
- }
260
- return walletConnector.canSponsorTransactionGas(transaction);
261
- }, {
262
- initialData: false,
263
- onReject: logger.logger.error,
264
- onResolve: (isGasSponsored) => {
265
- setIsGasSponsored(isGasSponsored);
266
- if (!isGasSponsored && walletConnectorCore.isAccountAbstractionConnector(walletConnector)) {
267
- walletConnector.disableGasSponsorshipOnce();
268
- }
269
- },
270
- });
271
272
  React.useEffect(() => {
272
273
  var _a;
273
274
  // solana gas sponsorship check
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../../_virtual/_tslib.js';
3
3
  import { jsx, jsxs } from 'react/jsx-runtime';
4
- import { useState, useMemo, useCallback, useEffect } from 'react';
4
+ import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
5
5
  import { useTranslation } from 'react-i18next';
6
6
  import bs58 from 'bs58';
7
7
  import { isAccountAbstractionConnector } from '@dynamic-labs/wallet-connector-core';
@@ -112,6 +112,7 @@ var SimulationStatus;
112
112
  const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation, onClickBack, walletConnector, onClickClose, title, displayPoweredByDynamicFooter = false, copykey, hideModal, currentToken, isNativeToken, transactionValue, isModal, sendBalanceTransaction, }) => {
113
113
  const { primaryWallet, environmentId } = useInternalDynamicContext();
114
114
  const [isGasSponsored, setIsGasSponsored] = useState(false);
115
+ const [isGasSponsoredLoading, setIsGasSponsoredLoading] = useState(false);
115
116
  const update = useForceUpdate();
116
117
  const { t } = useTranslation();
117
118
  const { currency } = useFetchCurrency(walletConnector);
@@ -127,13 +128,20 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
127
128
  status: SimulationStatus.LOADING,
128
129
  });
129
130
  const [recipient, setRecipient] = useState(undefined);
131
+ const isFetchingSimulationRef = useRef(false);
130
132
  const fetchSimulationResult = useCallback(() => __awaiter(void 0, void 0, void 0, function* () {
131
133
  var _a, _b, _c, _d, _e, _f, _g;
132
134
  if (simulationState.status !== SimulationStatus.LOADING) {
133
135
  return;
134
136
  }
137
+ if (isFetchingSimulationRef.current) {
138
+ // Already fetching, prevent duplicate call
139
+ return;
140
+ }
141
+ isFetchingSimulationRef.current = true;
135
142
  if (sendBalanceTransaction || hideModal) {
136
143
  setSimulationState({ status: SimulationStatus.SKIPPED });
144
+ isFetchingSimulationRef.current = false;
137
145
  return;
138
146
  }
139
147
  if (!primaryWallet || (!chainId && (primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain) !== 'SOL')) {
@@ -143,13 +151,16 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
143
151
  primaryWallet,
144
152
  });
145
153
  setSimulationState({ status: SimulationStatus.FAILED });
154
+ isFetchingSimulationRef.current = false;
146
155
  return;
147
156
  }
148
157
  try {
149
158
  let result;
150
159
  if (primaryWallet.connector.key === 'zerodev') {
151
160
  const connector = primaryWallet.connector;
152
- const { userOperation } = yield connector.getCurrentUserOperation(transaction);
161
+ const { userOperation, sponsored } = yield connector.getCurrentUserOperation(transaction);
162
+ setIsGasSponsored(sponsored);
163
+ setIsGasSponsoredLoading(false);
153
164
  if (userOperation) {
154
165
  const formattedUserOperation = yield connector.formatUserOperation(userOperation);
155
166
  // Set the gas fee on the transaction, only for zero dev
@@ -216,6 +227,9 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
216
227
  logger.error('[TransactionConfirmationView] Simulation failed:', error);
217
228
  setSimulationState({ status: SimulationStatus.FAILED });
218
229
  }
230
+ finally {
231
+ isFetchingSimulationRef.current = false;
232
+ }
219
233
  }), [
220
234
  sendBalanceTransaction,
221
235
  hideModal,
@@ -224,6 +238,8 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
224
238
  environmentId,
225
239
  transaction,
226
240
  walletConnector,
241
+ simulationState.status,
242
+ setSimulationState,
227
243
  ]);
228
244
  useEffect(() => {
229
245
  if (simulationState.status === SimulationStatus.SUCCESS ||
@@ -245,21 +261,6 @@ const TransactionConfirmationView = ({ transaction, onError, onSuccess, mutation
245
261
  }
246
262
  transaction.fetchFee().finally(update);
247
263
  }, [primaryWallet === null || primaryWallet === void 0 ? void 0 : primaryWallet.chain, transaction, update]);
248
- const { isLoading: isGasSponsoredLoading } = usePromise(() => {
249
- if (!isAccountAbstractionConnector(walletConnector)) {
250
- return false;
251
- }
252
- return walletConnector.canSponsorTransactionGas(transaction);
253
- }, {
254
- initialData: false,
255
- onReject: logger.error,
256
- onResolve: (isGasSponsored) => {
257
- setIsGasSponsored(isGasSponsored);
258
- if (!isGasSponsored && isAccountAbstractionConnector(walletConnector)) {
259
- walletConnector.disableGasSponsorshipOnce();
260
- }
261
- },
262
- });
263
264
  useEffect(() => {
264
265
  var _a;
265
266
  // solana gas sponsorship check
@@ -1,21 +0,0 @@
1
- 'use client'
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var utils = require('@dynamic-labs/utils');
7
-
8
- const getWalletProvider = (connector) => {
9
- if (connector.isEmbeddedWallet) {
10
- return 'embeddedWallet';
11
- }
12
- if (connector.canConnectViaCustodialService) {
13
- return 'custodialService';
14
- }
15
- if (connector.isInstalledOnBrowser()) {
16
- return 'browserExtension';
17
- }
18
- return utils.isMobile() ? 'deepLink' : 'qrCode';
19
- };
20
-
21
- exports.getWalletProvider = getWalletProvider;
@@ -1,3 +0,0 @@
1
- import { WalletConnector } from '@dynamic-labs/wallet-connector-core';
2
- import { WalletProvider } from '../../../shared';
3
- export declare const getWalletProvider: (connector: WalletConnector) => WalletProvider;
@@ -1,17 +0,0 @@
1
- 'use client'
2
- import { isMobile } from '@dynamic-labs/utils';
3
-
4
- const getWalletProvider = (connector) => {
5
- if (connector.isEmbeddedWallet) {
6
- return 'embeddedWallet';
7
- }
8
- if (connector.canConnectViaCustodialService) {
9
- return 'custodialService';
10
- }
11
- if (connector.isInstalledOnBrowser()) {
12
- return 'browserExtension';
13
- }
14
- return isMobile() ? 'deepLink' : 'qrCode';
15
- };
16
-
17
- export { getWalletProvider };
@@ -1 +0,0 @@
1
- export * from './getWalletProvider';