@dynamic-labs/sdk-react-core 4.62.0 → 4.63.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/package.cjs +4 -4
  3. package/package.js +4 -4
  4. package/package.json +15 -15
  5. package/src/lib/context/DynamicContext/DynamicContext.cjs +3 -0
  6. package/src/lib/context/DynamicContext/DynamicContext.js +3 -0
  7. package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.cjs +4 -0
  8. package/src/lib/context/DynamicContext/hooks/useTieCallbacksToEvents/useTieCallbacksToEvents.js +4 -0
  9. package/src/lib/context/ViewContext/ViewContext.cjs +21 -4
  10. package/src/lib/context/ViewContext/ViewContext.js +22 -5
  11. package/src/lib/events/dynamicEvents.cjs +1 -0
  12. package/src/lib/events/dynamicEvents.d.ts +1 -1
  13. package/src/lib/events/dynamicEvents.js +1 -0
  14. package/src/lib/events/wallets.d.ts +4 -0
  15. package/src/lib/shared/types/dynamicEventsCallbacks.d.ts +8 -0
  16. package/src/lib/utils/constants/values.cjs +2 -0
  17. package/src/lib/utils/constants/values.js +2 -0
  18. package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.cjs +10 -1
  19. package/src/lib/utils/functions/isSupportedNetwork/isSupportedNetwork.js +10 -1
  20. package/src/lib/utils/hooks/events/useDynamicEvents/useDynamicEvents.d.ts +1 -1
  21. package/src/lib/utils/hooks/useDynamicWaas/index.d.ts +1 -0
  22. package/src/lib/utils/hooks/useDynamicWaas/normalizeWaasChainName.cjs +11 -0
  23. package/src/lib/utils/hooks/useDynamicWaas/normalizeWaasChainName.d.ts +1 -0
  24. package/src/lib/utils/hooks/useDynamicWaas/normalizeWaasChainName.js +7 -0
  25. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.cjs +12 -2
  26. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.d.ts +5 -2
  27. package/src/lib/utils/hooks/useDynamicWaas/useDynamicWaas.js +12 -2
  28. package/src/lib/utils/hooks/useGetElevatedAccessToken/index.d.ts +1 -0
  29. package/src/lib/utils/hooks/useGetElevatedAccessToken/useGetElevatedAccessToken.cjs +12 -0
  30. package/src/lib/utils/hooks/useGetElevatedAccessToken/useGetElevatedAccessToken.d.ts +6 -0
  31. package/src/lib/utils/hooks/useGetElevatedAccessToken/useGetElevatedAccessToken.js +8 -0
  32. package/src/lib/utils/hooks/useGetMultichainTokenBalances/useGetMultichainTokenBalances.cjs +5 -1
  33. package/src/lib/utils/hooks/useGetMultichainTokenBalances/useGetMultichainTokenBalances.js +5 -1
  34. package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.cjs +9 -20
  35. package/src/lib/utils/hooks/useTokenBalances/useTokenBalances.js +7 -18
  36. package/src/lib/utils/hooks/useTokenBalances/utils.cjs +77 -0
  37. package/src/lib/utils/hooks/useTokenBalances/utils.d.ts +17 -0
  38. package/src/lib/utils/hooks/useTokenBalances/utils.js +71 -0
  39. package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.cjs +4 -1
  40. package/src/lib/utils/hooks/useWalletConnectorNetwork/useWalletConnectorNetwork.js +4 -1
  41. package/src/lib/utils/hooks/useWalletReturnRoute/index.d.ts +1 -0
  42. package/src/lib/utils/hooks/useWalletReturnRoute/useWalletReturnRoute.cjs +37 -0
  43. package/src/lib/utils/hooks/useWalletReturnRoute/useWalletReturnRoute.d.ts +8 -0
  44. package/src/lib/utils/hooks/useWalletReturnRoute/useWalletReturnRoute.js +33 -0
  45. package/src/lib/views/WalletList/data.cjs +1 -0
  46. package/src/lib/views/WalletList/data.d.ts +1 -1
  47. package/src/lib/views/WalletList/data.js +1 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,35 @@
1
1
 
2
+ ### [4.63.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.63.0...v4.63.1) (2026-02-24)
3
+
4
+
5
+ ### Features
6
+
7
+ * add elevated access token to WaaS export ([#10481](https://github.com/dynamic-labs/dynamic-auth/issues/10481)) ([9a3c6a6](https://github.com/dynamic-labs/dynamic-auth/commit/9a3c6a6eaa4bd7ced5aeb873fe7872717d0e25d9))
8
+ * add multi-wallet delegation support with React parity ([#10450](https://github.com/dynamic-labs/dynamic-auth/issues/10450)) ([e4d5135](https://github.com/dynamic-labs/dynamic-auth/commit/e4d5135c50595c022dfb02da2d9f05a389c0ee09))
9
+ * add Stellar chain support with balance fetching and network mapping ([#10494](https://github.com/dynamic-labs/dynamic-auth/issues/10494)) ([f12553c](https://github.com/dynamic-labs/dynamic-auth/commit/f12553ce864a56a75f87d1d55c087e1fc9378cc6))
10
+ * add Stellar WaaS transaction signing and broadcast UI ([#10495](https://github.com/dynamic-labs/dynamic-auth/issues/10495)) ([f87a860](https://github.com/dynamic-labs/dynamic-auth/commit/f87a860f59cdf5b0c4f99586c61e60186efc19f2))
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * cancel authFlowClose timeout when navigation occurs during delay ([#10487](https://github.com/dynamic-labs/dynamic-auth/issues/10487)) ([aef92b4](https://github.com/dynamic-labs/dynamic-auth/commit/aef92b4a80827c517819cc63414acdf3e9ad7b05))
16
+ * **e2e:** update gating test to expect user:basic scope ([#10505](https://github.com/dynamic-labs/dynamic-auth/issues/10505)) ([56f449a](https://github.com/dynamic-labs/dynamic-auth/commit/56f449a282f37b33d365d60380c7a68c1cf5eced)), closes [dynamic-labs/redcoast#8339](https://github.com/dynamic-labs/redcoast/issues/8339)
17
+ * use selected network for Horizon server and include WaaS connector in StellarWalletConnectors ([#10493](https://github.com/dynamic-labs/dynamic-auth/issues/10493)) ([f340c09](https://github.com/dynamic-labs/dynamic-auth/commit/f340c094f08afb39829f2d90db2ec665a69ba469))
18
+ * **waas:** normalize SOL to SVM chain name when looking up WaaS connector ([#10506](https://github.com/dynamic-labs/dynamic-auth/issues/10506)) ([102d314](https://github.com/dynamic-labs/dynamic-auth/commit/102d3142d65d0e67338884affc736e5151a8e296))
19
+
20
+ ## [4.63.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.62.0...v4.63.0) (2026-02-24)
21
+
22
+
23
+ ### Features
24
+
25
+ * **react-native:** raise walletReturnFromDeepLink event to allow redirecting back to the same route as before ([#10364](https://github.com/dynamic-labs/dynamic-auth/issues/10364)) ([cd56fd0](https://github.com/dynamic-labs/dynamic-auth/commit/cd56fd089e867bb5ed09a7c999b04480d8f59f81))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * **react-native:** include redirectUrl in WalletConnect connection deep links on iOS and add session redirect metadata for Solana ([#10479](https://github.com/dynamic-labs/dynamic-auth/issues/10479)) ([68829f9](https://github.com/dynamic-labs/dynamic-auth/commit/68829f9ef39c845917ce49bfd63922e5252c2299))
31
+ * ton external wallet connection ([#10460](https://github.com/dynamic-labs/dynamic-auth/issues/10460)) ([7431a74](https://github.com/dynamic-labs/dynamic-auth/commit/7431a74fcd0bcd04755e6a81b49aa24dfc261f09))
32
+
2
33
  ## [4.62.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.61.7...v4.62.0) (2026-02-23)
3
34
 
4
35
 
package/package.cjs CHANGED
@@ -3,11 +3,11 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.62.0";
6
+ var version = "4.63.1";
7
7
  var dependencies = {
8
- "@dynamic-labs/sdk-api-core": "0.0.864",
9
- "@dynamic-labs-sdk/client": "0.8.0",
10
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.269",
8
+ "@dynamic-labs/sdk-api-core": "0.0.875",
9
+ "@dynamic-labs-sdk/client": "0.12.1",
10
+ "@dynamic-labs-wallet/browser-wallet-client": "0.0.276",
11
11
  "@hcaptcha/react-hcaptcha": "1.4.4",
12
12
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
13
13
  "country-list": "2.3.0",
package/package.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use client'
2
- var version = "4.62.0";
2
+ var version = "4.63.1";
3
3
  var dependencies = {
4
- "@dynamic-labs/sdk-api-core": "0.0.864",
5
- "@dynamic-labs-sdk/client": "0.8.0",
6
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.269",
4
+ "@dynamic-labs/sdk-api-core": "0.0.875",
5
+ "@dynamic-labs-sdk/client": "0.12.1",
6
+ "@dynamic-labs-wallet/browser-wallet-client": "0.0.276",
7
7
  "@hcaptcha/react-hcaptcha": "1.4.4",
8
8
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
9
9
  "country-list": "2.3.0",
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.62.0",
3
+ "version": "4.63.1",
4
4
  "dependencies": {
5
- "@dynamic-labs/sdk-api-core": "0.0.864",
6
- "@dynamic-labs-sdk/client": "0.8.0",
7
- "@dynamic-labs-wallet/browser-wallet-client": "0.0.269",
5
+ "@dynamic-labs/sdk-api-core": "0.0.875",
6
+ "@dynamic-labs-sdk/client": "0.12.1",
7
+ "@dynamic-labs-wallet/browser-wallet-client": "0.0.276",
8
8
  "@hcaptcha/react-hcaptcha": "1.4.4",
9
9
  "@thumbmarkjs/thumbmarkjs": "0.16.0",
10
10
  "country-list": "2.3.0",
@@ -16,17 +16,17 @@
16
16
  "yup": "0.32.11",
17
17
  "react-international-phone": "4.5.0",
18
18
  "bs58": "5.0.0",
19
- "@dynamic-labs/assert-package-version": "4.62.0",
20
- "@dynamic-labs/iconic": "4.62.0",
21
- "@dynamic-labs/locale": "4.62.0",
22
- "@dynamic-labs/logger": "4.62.0",
23
- "@dynamic-labs/multi-wallet": "4.62.0",
24
- "@dynamic-labs/rpc-providers": "4.62.0",
25
- "@dynamic-labs/store": "4.62.0",
26
- "@dynamic-labs/types": "4.62.0",
27
- "@dynamic-labs/utils": "4.62.0",
28
- "@dynamic-labs/wallet-book": "4.62.0",
29
- "@dynamic-labs/wallet-connector-core": "4.62.0",
19
+ "@dynamic-labs/assert-package-version": "4.63.1",
20
+ "@dynamic-labs/iconic": "4.63.1",
21
+ "@dynamic-labs/locale": "4.63.1",
22
+ "@dynamic-labs/logger": "4.63.1",
23
+ "@dynamic-labs/multi-wallet": "4.63.1",
24
+ "@dynamic-labs/rpc-providers": "4.63.1",
25
+ "@dynamic-labs/store": "4.63.1",
26
+ "@dynamic-labs/types": "4.63.1",
27
+ "@dynamic-labs/utils": "4.63.1",
28
+ "@dynamic-labs/wallet-book": "4.63.1",
29
+ "@dynamic-labs/wallet-connector-core": "4.63.1",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "devDependencies": {
@@ -153,6 +153,7 @@ var PhantomRedirectContext = require('../PhantomRedirectContext/PhantomRedirectC
153
153
  var ReinitializeContextProvider = require('../ReinitializeContext/ReinitializeContextProvider.cjs');
154
154
  var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs');
155
155
  var UseNetworkValidation = require('../UseNetworkValidation/UseNetworkValidation.cjs');
156
+ var useWalletReturnRoute = require('../../utils/hooks/useWalletReturnRoute/useWalletReturnRoute.cjs');
156
157
  var onReinitialize = require('./functions/onReinitialize/onReinitialize.cjs');
157
158
  var helpers = require('./helpers/helpers.cjs');
158
159
  var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
@@ -416,6 +417,8 @@ const InnerDynamicContextProvider = (props) => {
416
417
  clientCallbacks: settings$1.events,
417
418
  user,
418
419
  });
420
+ // Listen for wallet deep link returns and emit events (mobile only)
421
+ useWalletReturnRoute.useWalletReturnRoute();
419
422
  const removeWallet = useRemoveWallet.useRemoveWallet({
420
423
  handleLogOut,
421
424
  secondaryWallets,
@@ -149,6 +149,7 @@ import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/Phanto
149
149
  import { useReinitializeState, ReinitializeContextProvider } from '../ReinitializeContext/ReinitializeContextProvider.js';
150
150
  import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceContext.js';
151
151
  import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
152
+ import { useWalletReturnRoute } from '../../utils/hooks/useWalletReturnRoute/useWalletReturnRoute.js';
152
153
  import { onReinitialize } from './functions/onReinitialize/onReinitialize.js';
153
154
  import { resolveNetworkValidationMode, getDeepLinkPreference } from './helpers/helpers.js';
154
155
  import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
@@ -412,6 +413,8 @@ const InnerDynamicContextProvider = (props) => {
412
413
  clientCallbacks: settings.events,
413
414
  user,
414
415
  });
416
+ // Listen for wallet deep link returns and emit events (mobile only)
417
+ useWalletReturnRoute();
415
418
  const removeWallet = useRemoveWallet({
416
419
  handleLogOut,
417
420
  secondaryWallets,
@@ -186,6 +186,10 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, }) => {
186
186
  var _a;
187
187
  (_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletConnectionFailed) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, walletConnector, error);
188
188
  });
189
+ useDynamicEvents.useInternalDynamicEvents('walletReturnFromDeepLink', (params) => {
190
+ var _a;
191
+ (_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletReturnFromDeepLink) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, params);
192
+ });
189
193
  };
190
194
 
191
195
  exports.useTieCallbacksToEvents = useTieCallbacksToEvents;
@@ -182,6 +182,10 @@ const useTieCallbacksToEvents = ({ clientCallbacks, user, }) => {
182
182
  var _a;
183
183
  (_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletConnectionFailed) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, walletConnector, error);
184
184
  });
185
+ useInternalDynamicEvents('walletReturnFromDeepLink', (params) => {
186
+ var _a;
187
+ (_a = clientCallbacks === null || clientCallbacks === void 0 ? void 0 : clientCallbacks.onWalletReturnFromDeepLink) === null || _a === void 0 ? void 0 : _a.call(clientCallbacks, params);
188
+ });
185
189
  };
186
190
 
187
191
  export { useTieCallbacksToEvents };
@@ -13,6 +13,13 @@ const ViewContext = React.createContext(undefined);
13
13
  const ViewContextProvider = ({ children, initialViewType }) => {
14
14
  var _a;
15
15
  const [stack, setStack] = React.useState([]);
16
+ const authFlowCloseTimeoutRef = React.useRef(null);
17
+ const cancelAuthFlowCloseTimeout = React.useCallback(() => {
18
+ if (authFlowCloseTimeoutRef.current !== null) {
19
+ clearTimeout(authFlowCloseTimeoutRef.current);
20
+ authFlowCloseTimeoutRef.current = null;
21
+ }
22
+ }, []);
16
23
  const initialView = React.useMemo(() => ({ type: initialViewType }), [initialViewType]);
17
24
  const view = (_a = stack[stack.length - 1]) !== null && _a !== void 0 ? _a : initialView;
18
25
  const { clearError } = ErrorContext.useErrorContext();
@@ -20,10 +27,12 @@ const ViewContextProvider = ({ children, initialViewType }) => {
20
27
  if (view.type === type) {
21
28
  // Update the current view props and events
22
29
  if (props !== view.props || events !== view.events) {
30
+ cancelAuthFlowCloseTimeout();
23
31
  setStack((stack) => [...stack.slice(0, -1), { events, props, type }]);
24
32
  }
25
33
  return;
26
34
  }
35
+ cancelAuthFlowCloseTimeout();
27
36
  clearError();
28
37
  // If the stack was "empty" (i.e. showing a default view), let's make sure the stack
29
38
  // reflects this by having this default view as the first item in the stack
@@ -33,10 +42,11 @@ const ViewContextProvider = ({ children, initialViewType }) => {
33
42
  else
34
43
  return [...stack, { events, props, type }];
35
44
  });
36
- }, [clearError, view.type, initialViewType]);
45
+ }, [cancelAuthFlowCloseTimeout, clearError, view.type, initialViewType]);
37
46
  const replaceView = React.useCallback((type, props, events) => {
38
47
  if (view.type === type)
39
48
  return;
49
+ cancelAuthFlowCloseTimeout();
40
50
  clearError();
41
51
  setStack((prev) => {
42
52
  if (prev.length <= 1) {
@@ -44,7 +54,7 @@ const ViewContextProvider = ({ children, initialViewType }) => {
44
54
  }
45
55
  return [...prev.slice(0, -1), { events, props, type }];
46
56
  });
47
- }, [clearError, initialViewType, view.type]);
57
+ }, [cancelAuthFlowCloseTimeout, clearError, initialViewType, view.type]);
48
58
  const canGoBack = stack.length > 1;
49
59
  const goBack = React.useCallback(() => {
50
60
  if (!canGoBack)
@@ -54,9 +64,10 @@ const ViewContextProvider = ({ children, initialViewType }) => {
54
64
  dynamicEvents.dynamicEvents.emit('goBack');
55
65
  }, [canGoBack, clearError]);
56
66
  const clearStackAndPush = React.useCallback((type, props, events) => {
67
+ cancelAuthFlowCloseTimeout();
57
68
  clearError();
58
69
  setStack([{ events, props, type }]);
59
- }, [clearError]);
70
+ }, [cancelAuthFlowCloseTimeout, clearError]);
60
71
  const clearStackAndPushInitialView = React.useCallback(() => {
61
72
  clearError();
62
73
  setStack((stack) => {
@@ -67,7 +78,13 @@ const ViewContextProvider = ({ children, initialViewType }) => {
67
78
  }, [clearError]);
68
79
  useDynamicEvents.useInternalDynamicEvents('logout', clearStackAndPushInitialView);
69
80
  // Wait for the auth flow animation transition to finish before clearing the stack
70
- useDynamicEvents.useInternalDynamicEvents('authFlowClose', () => setTimeout(clearStackAndPushInitialView, 100));
81
+ useDynamicEvents.useInternalDynamicEvents('authFlowClose', () => {
82
+ cancelAuthFlowCloseTimeout();
83
+ authFlowCloseTimeoutRef.current = setTimeout(() => {
84
+ authFlowCloseTimeoutRef.current = null;
85
+ clearStackAndPushInitialView();
86
+ }, 100);
87
+ });
71
88
  const value = React.useMemo(() => ({
72
89
  canGoBack: stack.length > 1,
73
90
  clearStackAndPush,
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { createContext, useContext, useState, useMemo, useCallback } from 'react';
3
+ import { createContext, useContext, useState, useRef, useCallback, useMemo } from 'react';
4
4
  import { useInternalDynamicEvents } from '../../utils/hooks/events/useDynamicEvents/useDynamicEvents.js';
5
5
  import { useErrorContext } from '../ErrorContext/ErrorContext.js';
6
6
  import { dynamicEvents } from '../../events/dynamicEvents.js';
@@ -9,6 +9,13 @@ const ViewContext = createContext(undefined);
9
9
  const ViewContextProvider = ({ children, initialViewType }) => {
10
10
  var _a;
11
11
  const [stack, setStack] = useState([]);
12
+ const authFlowCloseTimeoutRef = useRef(null);
13
+ const cancelAuthFlowCloseTimeout = useCallback(() => {
14
+ if (authFlowCloseTimeoutRef.current !== null) {
15
+ clearTimeout(authFlowCloseTimeoutRef.current);
16
+ authFlowCloseTimeoutRef.current = null;
17
+ }
18
+ }, []);
12
19
  const initialView = useMemo(() => ({ type: initialViewType }), [initialViewType]);
13
20
  const view = (_a = stack[stack.length - 1]) !== null && _a !== void 0 ? _a : initialView;
14
21
  const { clearError } = useErrorContext();
@@ -16,10 +23,12 @@ const ViewContextProvider = ({ children, initialViewType }) => {
16
23
  if (view.type === type) {
17
24
  // Update the current view props and events
18
25
  if (props !== view.props || events !== view.events) {
26
+ cancelAuthFlowCloseTimeout();
19
27
  setStack((stack) => [...stack.slice(0, -1), { events, props, type }]);
20
28
  }
21
29
  return;
22
30
  }
31
+ cancelAuthFlowCloseTimeout();
23
32
  clearError();
24
33
  // If the stack was "empty" (i.e. showing a default view), let's make sure the stack
25
34
  // reflects this by having this default view as the first item in the stack
@@ -29,10 +38,11 @@ const ViewContextProvider = ({ children, initialViewType }) => {
29
38
  else
30
39
  return [...stack, { events, props, type }];
31
40
  });
32
- }, [clearError, view.type, initialViewType]);
41
+ }, [cancelAuthFlowCloseTimeout, clearError, view.type, initialViewType]);
33
42
  const replaceView = useCallback((type, props, events) => {
34
43
  if (view.type === type)
35
44
  return;
45
+ cancelAuthFlowCloseTimeout();
36
46
  clearError();
37
47
  setStack((prev) => {
38
48
  if (prev.length <= 1) {
@@ -40,7 +50,7 @@ const ViewContextProvider = ({ children, initialViewType }) => {
40
50
  }
41
51
  return [...prev.slice(0, -1), { events, props, type }];
42
52
  });
43
- }, [clearError, initialViewType, view.type]);
53
+ }, [cancelAuthFlowCloseTimeout, clearError, initialViewType, view.type]);
44
54
  const canGoBack = stack.length > 1;
45
55
  const goBack = useCallback(() => {
46
56
  if (!canGoBack)
@@ -50,9 +60,10 @@ const ViewContextProvider = ({ children, initialViewType }) => {
50
60
  dynamicEvents.emit('goBack');
51
61
  }, [canGoBack, clearError]);
52
62
  const clearStackAndPush = useCallback((type, props, events) => {
63
+ cancelAuthFlowCloseTimeout();
53
64
  clearError();
54
65
  setStack([{ events, props, type }]);
55
- }, [clearError]);
66
+ }, [cancelAuthFlowCloseTimeout, clearError]);
56
67
  const clearStackAndPushInitialView = useCallback(() => {
57
68
  clearError();
58
69
  setStack((stack) => {
@@ -63,7 +74,13 @@ const ViewContextProvider = ({ children, initialViewType }) => {
63
74
  }, [clearError]);
64
75
  useInternalDynamicEvents('logout', clearStackAndPushInitialView);
65
76
  // Wait for the auth flow animation transition to finish before clearing the stack
66
- useInternalDynamicEvents('authFlowClose', () => setTimeout(clearStackAndPushInitialView, 100));
77
+ useInternalDynamicEvents('authFlowClose', () => {
78
+ cancelAuthFlowCloseTimeout();
79
+ authFlowCloseTimeoutRef.current = setTimeout(() => {
80
+ authFlowCloseTimeoutRef.current = null;
81
+ clearStackAndPushInitialView();
82
+ }, 100);
83
+ });
67
84
  const value = useMemo(() => ({
68
85
  canGoBack: stack.length > 1,
69
86
  clearStackAndPush,
@@ -33,6 +33,7 @@ const externalEvents = [
33
33
  'walletConnectionFailed',
34
34
  'embeddedWalletRevealCompleted',
35
35
  'embeddedWalletRevealFailed',
36
+ 'walletReturnFromDeepLink',
36
37
  ];
37
38
  // Full internal event emitter
38
39
  const dynamicEvents = new EventEmitter__default["default"]();
@@ -14,7 +14,7 @@ import { WalletEvents } from './wallets';
14
14
  export type DynamicEvents = AuthEvents & UIEvents & OTPEvents & WalletEvents & PasskeyEvents & SocialEvents & EmbeddedWalletEvents & MultiWalletInternalEvents & TokenBalancesEvents & UserEvents & FundingEvents;
15
15
  type PublicDynamicEvents = Pick<DynamicEvents, typeof externalEvents[number]>;
16
16
  /** Which events are accessible by our clients */
17
- export declare const externalEvents: ("authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "embeddedWalletCreated" | "embeddedWalletRevealCompleted" | "embeddedWalletRevealFailed" | "walletConnectedForFunding")[];
17
+ export declare const externalEvents: ("authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "walletReturnFromDeepLink" | "embeddedWalletCreated" | "embeddedWalletRevealCompleted" | "embeddedWalletRevealFailed" | "walletConnectedForFunding")[];
18
18
  export declare const dynamicEvents: EventEmitter<DynamicEvents, any>;
19
19
  export declare const publicDynamicEvents: EventEmitter<PublicDynamicEvents, any>;
20
20
  export type DynamicEventEmitter = typeof dynamicEvents;
@@ -25,6 +25,7 @@ const externalEvents = [
25
25
  'walletConnectionFailed',
26
26
  'embeddedWalletRevealCompleted',
27
27
  'embeddedWalletRevealFailed',
28
+ 'walletReturnFromDeepLink',
28
29
  ];
29
30
  // Full internal event emitter
30
31
  const dynamicEvents = new EventEmitter();
@@ -39,4 +39,8 @@ export type WalletEvents = {
39
39
  walletConnectionFailed: (walletConnector: WalletConnector, error: unknown) => void;
40
40
  /** Triggered when a wallet connection QR code is ready */
41
41
  walletConnectionQrCodeReady: (qrCodeUri: string) => void;
42
+ /** Triggered when the app returns from a wallet deep link (mobile only) */
43
+ walletReturnFromDeepLink: (params: {
44
+ previousRoute: string;
45
+ }) => void;
42
46
  };
@@ -39,6 +39,14 @@ export type DynamicEventsCallbacks = {
39
39
  index: number;
40
40
  tab: WalletListViewTabItem;
41
41
  }) => void;
42
+ /**
43
+ * Called when the app returns from a wallet deep link (mobile only).
44
+ * Use this to navigate back to the route the user was on before
45
+ * the wallet operation.
46
+ */
47
+ onWalletReturnFromDeepLink?: (params: {
48
+ previousRoute: string;
49
+ }) => void;
42
50
  };
43
51
  export type OnAuthSuccess = (params: {
44
52
  handleLogOut: () => Promise<void>;
@@ -18,6 +18,7 @@ const ChainEnumToVerifiedCredentialName = {
18
18
  FLOW: 'flow',
19
19
  SOL: 'solana',
20
20
  STARK: 'starknet',
21
+ STELLAR: 'stellar',
21
22
  TON: 'ton',
22
23
  };
23
24
  const VerifiedCredentialNameToChainEnum = {
@@ -28,6 +29,7 @@ const VerifiedCredentialNameToChainEnum = {
28
29
  flow: sdkApiCore.ChainEnum.Flow,
29
30
  solana: sdkApiCore.ChainEnum.Sol,
30
31
  starknet: sdkApiCore.ChainEnum.Stark,
32
+ stellar: sdkApiCore.ChainEnum.Stellar,
31
33
  sui: sdkApiCore.ChainEnum.Sui,
32
34
  ton: sdkApiCore.ChainEnum.Ton,
33
35
  };
@@ -14,6 +14,7 @@ const ChainEnumToVerifiedCredentialName = {
14
14
  FLOW: 'flow',
15
15
  SOL: 'solana',
16
16
  STARK: 'starknet',
17
+ STELLAR: 'stellar',
17
18
  TON: 'ton',
18
19
  };
19
20
  const VerifiedCredentialNameToChainEnum = {
@@ -24,6 +25,7 @@ const VerifiedCredentialNameToChainEnum = {
24
25
  flow: ChainEnum.Flow,
25
26
  solana: ChainEnum.Sol,
26
27
  starknet: ChainEnum.Stark,
28
+ stellar: ChainEnum.Stellar,
27
29
  sui: ChainEnum.Sui,
28
30
  ton: ChainEnum.Ton,
29
31
  };
@@ -5,10 +5,19 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  const isSupportedNetwork = ({ walletConnector, network }) => {
7
7
  const enabledNetworks = walletConnector.getEnabledNetworks();
8
+ // If no networks are configured, all networks are supported
8
9
  if (!enabledNetworks.length) {
9
10
  return true;
10
11
  }
11
- const isCurrentNetworkSupported = enabledNetworks.some(({ chainId }) => String(chainId) === String(network));
12
+ // If network is undefined, the connector hasn't determined the network yet
13
+ // This can happen during initial load before getNetwork() resolves
14
+ if (network === undefined) {
15
+ return false;
16
+ }
17
+ // Check if network matches either chainId or networkId
18
+ // This supports chains like Stellar where getNetwork() returns the chainId hash
19
+ const isCurrentNetworkSupported = enabledNetworks.some(({ chainId, networkId }) => String(chainId) === String(network) ||
20
+ String(networkId) === String(network));
12
21
  return isCurrentNetworkSupported;
13
22
  };
14
23
 
@@ -1,10 +1,19 @@
1
1
  'use client'
2
2
  const isSupportedNetwork = ({ walletConnector, network }) => {
3
3
  const enabledNetworks = walletConnector.getEnabledNetworks();
4
+ // If no networks are configured, all networks are supported
4
5
  if (!enabledNetworks.length) {
5
6
  return true;
6
7
  }
7
- const isCurrentNetworkSupported = enabledNetworks.some(({ chainId }) => String(chainId) === String(network));
8
+ // If network is undefined, the connector hasn't determined the network yet
9
+ // This can happen during initial load before getNetwork() resolves
10
+ if (network === undefined) {
11
+ return false;
12
+ }
13
+ // Check if network matches either chainId or networkId
14
+ // This supports chains like Stellar where getNetwork() returns the chainId hash
15
+ const isCurrentNetworkSupported = enabledNetworks.some(({ chainId, networkId }) => String(chainId) === String(network) ||
16
+ String(networkId) === String(network));
8
17
  return isCurrentNetworkSupported;
9
18
  };
10
19
 
@@ -4,5 +4,5 @@ type DynamicEventListener<E extends keyof DynamicEvents> = (...args: EventArgs<D
4
4
  /** Allows us to subscribe to all dynamicEvents with a hook, even the internal ones */
5
5
  export declare const useInternalDynamicEvents: <E extends keyof import("../../../../events/auth").AuthEvents | keyof import("../../../../events/ui").UIEvents | keyof import("../../../../events/otp").OTPEvents | keyof import("../../../../events/wallets").WalletEvents | keyof import("../../../../events/passkey").PasskeyEvents | "farcasterConnectCancelled" | keyof import("../../../../events/embeddedWallet").EmbeddedWalletEvents | keyof import("../../../../events/multiWallet").MultiWalletInternalEvents | "tokenBalancesChanged" | "userProfileUpdated" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
6
6
  /** Allows subscribing to dynamic events directly inside components with a hook */
7
- export declare const useDynamicEvents: <E extends "authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "embeddedWalletCreated" | "embeddedWalletRevealCompleted" | "embeddedWalletRevealFailed" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
7
+ export declare const useDynamicEvents: <E extends "authFailure" | "authInit" | "logout" | "mfaCompletionSuccess" | "mfaCompletionFailure" | "authFlowOpen" | "authFlowClose" | "authFlowCancelled" | "walletTabSelected" | "emailVerificationResult" | "smsVerificationResult" | "walletAdded" | "walletRemoved" | "primaryWalletChanged" | "primaryWalletNetworkChanged" | "userWalletsChanged" | "walletConnectionFailed" | "walletConnectionQrCodeReady" | "walletReturnFromDeepLink" | "embeddedWalletCreated" | "embeddedWalletRevealCompleted" | "embeddedWalletRevealFailed" | "walletConnectedForFunding">(event: E, listener: DynamicEventListener<E>) => void;
8
8
  export {};
@@ -1 +1,2 @@
1
+ export * from './normalizeWaasChainName';
1
2
  export * from './useDynamicWaas';
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ const connectedChainToWaasChainName = {
7
+ SOL: 'SVM',
8
+ };
9
+ const normalizeWaasChainName = (chainName) => { var _a; return (_a = connectedChainToWaasChainName[chainName]) !== null && _a !== void 0 ? _a : chainName; };
10
+
11
+ exports.normalizeWaasChainName = normalizeWaasChainName;
@@ -0,0 +1 @@
1
+ export declare const normalizeWaasChainName: (chainName: string) => string;
@@ -0,0 +1,7 @@
1
+ 'use client'
2
+ const connectedChainToWaasChainName = {
3
+ SOL: 'SVM',
4
+ };
5
+ const normalizeWaasChainName = (chainName) => { var _a; return (_a = connectedChainToWaasChainName[chainName]) !== null && _a !== void 0 ? _a : chainName; };
6
+
7
+ export { normalizeWaasChainName };
@@ -87,11 +87,13 @@ require('formik');
87
87
  require('../useSubdomainCheck/useSubdomainCheck.cjs');
88
88
  require('../../../context/WalletGroupContext/WalletGroupContext.cjs');
89
89
  require('../../../widgets/DynamicWidget/context/DynamicWidgetContext.cjs');
90
+ var normalizeWaasChainName = require('./normalizeWaasChainName.cjs');
90
91
  var apiUrl = require('../../constants/waas/apiUrl.cjs');
91
92
  var useClientSessionKeys = require('../useClientSessionKeys/useClientSessionKeys.cjs');
92
93
  var useGetMfaToken = require('../useGetMfaToken/useGetMfaToken.cjs');
93
94
  var useGetWalletPassword = require('../useGetWalletPassword/useGetWalletPassword.cjs');
94
95
  var useRefreshAuth = require('../useRefreshAuth/useRefreshAuth.cjs');
96
+ var useGetElevatedAccessToken = require('../useGetElevatedAccessToken/useGetElevatedAccessToken.cjs');
95
97
  var constants = require('./constants.cjs');
96
98
  var normalizeWalletRequirements = require('./normalizeWalletRequirements.cjs');
97
99
  require('../useWalletBackup/useWalletBackup.cjs');
@@ -123,7 +125,7 @@ require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
123
125
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
124
126
 
125
127
  const dynamicWaasKey = 'dynamicwaas';
126
- const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, }) => {
128
+ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, getElevatedAccessToken, }) => {
127
129
  var _a;
128
130
  walletConnector.setEnvironmentId(environmentId);
129
131
  walletConnector.setBaseApiUrl((_a = (apiBaseUrl || apiUrl.DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
@@ -139,6 +141,10 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
139
141
  walletConnector.setRelayUrl(relayUrl);
140
142
  walletConnector.setGetMfaTokenFunction(getMfaToken);
141
143
  walletConnector.setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl);
144
+ // Set elevated access token provider
145
+ if (getElevatedAccessToken) {
146
+ walletConnector.setGetElevatedAccessTokenFunction(getElevatedAccessToken);
147
+ }
142
148
  // Set password provider for locked wallets
143
149
  if (getWalletPassword) {
144
150
  walletConnector.setGetWalletPasswordFunction(getWalletPassword);
@@ -178,6 +184,7 @@ const useDynamicWaas = () => {
178
184
  const { getSignedSessionId } = useClientSessionKeys.useClientSessionKeys();
179
185
  const getMfaToken = useGetMfaToken.useGetMfaToken();
180
186
  const getWalletPassword = useGetWalletPassword.useGetWalletPassword();
187
+ const getElevatedAccessToken = useGetElevatedAccessToken.useGetElevatedAccessToken();
181
188
  const isCookieAuthEnabled = projectSettings && isCookieEnabled.isCookieEnabled();
182
189
  const isUpgrading = React.useRef(false);
183
190
  const [recoveredWallets, setRecoveredWallets] = React.useState(() => new Set());
@@ -189,7 +196,8 @@ const useDynamicWaas = () => {
189
196
  if (!walletConnectorOptions.length || !environmentId)
190
197
  return undefined;
191
198
  const walletConnector = (_a = walletConnectorOptions.find((option) => option.key.includes(dynamicWaasKey) &&
192
- option.walletConnector.connectedChain === chainName)) === null || _a === void 0 ? void 0 : _a.walletConnector;
199
+ normalizeWaasChainName.normalizeWaasChainName(option.walletConnector.connectedChain) ===
200
+ normalizeWaasChainName.normalizeWaasChainName(chainName))) === null || _a === void 0 ? void 0 : _a.walletConnector;
193
201
  if (!walletConnector) {
194
202
  throw new utils.DynamicError(constants.DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR);
195
203
  }
@@ -198,6 +206,7 @@ const useDynamicWaas = () => {
198
206
  authMode: isCookieAuthEnabled ? 'cookie' : 'header',
199
207
  baseClientKeysharesRelayApiUrl,
200
208
  environmentId,
209
+ getElevatedAccessToken,
201
210
  getMfaToken,
202
211
  getSignedSessionId,
203
212
  getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
@@ -212,6 +221,7 @@ const useDynamicWaas = () => {
212
221
  walletConnectorOptions,
213
222
  environmentId,
214
223
  apiBaseUrl,
224
+ getElevatedAccessToken,
215
225
  getMfaToken,
216
226
  getWalletPassword,
217
227
  getSignedSessionId,
@@ -1,4 +1,4 @@
1
- import { ChainEnum, MFAAction } from '@dynamic-labs/sdk-api-core';
1
+ import { ChainEnum, MFAAction, TokenScope } from '@dynamic-labs/sdk-api-core';
2
2
  import { GetWalletPasswordFn, IDynamicWaasConnector, Wallet, WalletConnectorCore } from '@dynamic-labs/wallet-connector-core';
3
3
  /**
4
4
  * Type for wallet creation requirements
@@ -12,7 +12,7 @@ export type WalletCreationRequirement = {
12
12
  network?: string;
13
13
  };
14
14
  };
15
- export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled, }: {
15
+ export declare const configWaasWalletConnector: ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode, getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled, getElevatedAccessToken, }: {
16
16
  walletConnector: IDynamicWaasConnector;
17
17
  environmentId: string;
18
18
  apiBaseUrl: string;
@@ -25,6 +25,9 @@ export declare const configWaasWalletConnector: ({ walletConnector, environmentI
25
25
  }) => Promise<string | undefined>;
26
26
  getWalletPassword?: GetWalletPasswordFn;
27
27
  getSvmGasSponsorshipEnabled?: () => boolean;
28
+ getElevatedAccessToken?: (params: {
29
+ scope: TokenScope;
30
+ }) => Promise<string | undefined>;
28
31
  }) => IDynamicWaasConnector;
29
32
  export declare const useDynamicWaas: () => {
30
33
  areWalletsReadyForSettings: () => boolean;
@@ -83,11 +83,13 @@ import 'formik';
83
83
  import '../useSubdomainCheck/useSubdomainCheck.js';
84
84
  import '../../../context/WalletGroupContext/WalletGroupContext.js';
85
85
  import '../../../widgets/DynamicWidget/context/DynamicWidgetContext.js';
86
+ import { normalizeWaasChainName } from './normalizeWaasChainName.js';
86
87
  import { DEFAULT_WAAS_API_URL } from '../../constants/waas/apiUrl.js';
87
88
  import { useClientSessionKeys } from '../useClientSessionKeys/useClientSessionKeys.js';
88
89
  import { useGetMfaToken } from '../useGetMfaToken/useGetMfaToken.js';
89
90
  import { useGetWalletPassword } from '../useGetWalletPassword/useGetWalletPassword.js';
90
91
  import { useRefreshAuth } from '../useRefreshAuth/useRefreshAuth.js';
92
+ import { useGetElevatedAccessToken } from '../useGetElevatedAccessToken/useGetElevatedAccessToken.js';
91
93
  import { DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR, NO_ENABLED_CHAINS_ERROR, INVALID_CHAINS_ERROR, WALLET_CREATION_FAILED_ERROR } from './constants.js';
92
94
  import { normalizeWalletRequirements } from './normalizeWalletRequirements.js';
93
95
  import '../useWalletBackup/useWalletBackup.js';
@@ -119,7 +121,7 @@ import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
119
121
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
120
122
 
121
123
  const dynamicWaasKey = 'dynamicwaas';
122
- const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, }) => {
124
+ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl, relayUrl, baseClientKeysharesRelayApiUrl, authMode = 'header', getSignedSessionId, getMfaToken, getWalletPassword, getSvmGasSponsorshipEnabled = () => false, getElevatedAccessToken, }) => {
123
125
  var _a;
124
126
  walletConnector.setEnvironmentId(environmentId);
125
127
  walletConnector.setBaseApiUrl((_a = (apiBaseUrl || DEFAULT_WAAS_API_URL)) === null || _a === void 0 ? void 0 : _a.replace('/api/v0', ''));
@@ -135,6 +137,10 @@ const configWaasWalletConnector = ({ walletConnector, environmentId, apiBaseUrl,
135
137
  walletConnector.setRelayUrl(relayUrl);
136
138
  walletConnector.setGetMfaTokenFunction(getMfaToken);
137
139
  walletConnector.setBaseClientKeysharesRelayApiUrl(baseClientKeysharesRelayApiUrl);
140
+ // Set elevated access token provider
141
+ if (getElevatedAccessToken) {
142
+ walletConnector.setGetElevatedAccessTokenFunction(getElevatedAccessToken);
143
+ }
138
144
  // Set password provider for locked wallets
139
145
  if (getWalletPassword) {
140
146
  walletConnector.setGetWalletPasswordFunction(getWalletPassword);
@@ -174,6 +180,7 @@ const useDynamicWaas = () => {
174
180
  const { getSignedSessionId } = useClientSessionKeys();
175
181
  const getMfaToken = useGetMfaToken();
176
182
  const getWalletPassword = useGetWalletPassword();
183
+ const getElevatedAccessToken = useGetElevatedAccessToken();
177
184
  const isCookieAuthEnabled = projectSettings && isCookieEnabled();
178
185
  const isUpgrading = useRef(false);
179
186
  const [recoveredWallets, setRecoveredWallets] = useState(() => new Set());
@@ -185,7 +192,8 @@ const useDynamicWaas = () => {
185
192
  if (!walletConnectorOptions.length || !environmentId)
186
193
  return undefined;
187
194
  const walletConnector = (_a = walletConnectorOptions.find((option) => option.key.includes(dynamicWaasKey) &&
188
- option.walletConnector.connectedChain === chainName)) === null || _a === void 0 ? void 0 : _a.walletConnector;
195
+ normalizeWaasChainName(option.walletConnector.connectedChain) ===
196
+ normalizeWaasChainName(chainName))) === null || _a === void 0 ? void 0 : _a.walletConnector;
189
197
  if (!walletConnector) {
190
198
  throw new DynamicError(DYNAMIC_WAAS_CONNECTOR_NOT_FOUND_ERROR);
191
199
  }
@@ -194,6 +202,7 @@ const useDynamicWaas = () => {
194
202
  authMode: isCookieAuthEnabled ? 'cookie' : 'header',
195
203
  baseClientKeysharesRelayApiUrl,
196
204
  environmentId,
205
+ getElevatedAccessToken,
197
206
  getMfaToken,
198
207
  getSignedSessionId,
199
208
  getSvmGasSponsorshipEnabled: () => svmGasSponsorshipEnabledRef.current,
@@ -208,6 +217,7 @@ const useDynamicWaas = () => {
208
217
  walletConnectorOptions,
209
218
  environmentId,
210
219
  apiBaseUrl,
220
+ getElevatedAccessToken,
211
221
  getMfaToken,
212
222
  getWalletPassword,
213
223
  getSignedSessionId,
@@ -0,0 +1 @@
1
+ export { useGetElevatedAccessToken } from './useGetElevatedAccessToken';
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var _tslib = require('../../../../../_virtual/_tslib.cjs');
7
+ var React = require('react');
8
+ var client = require('@dynamic-labs-sdk/client');
9
+
10
+ const useGetElevatedAccessToken = () => React.useCallback((_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ scope }) { return client.getElevatedAccessToken({ scope }); }), []);
11
+
12
+ exports.useGetElevatedAccessToken = useGetElevatedAccessToken;
@@ -0,0 +1,6 @@
1
+ import { TokenScope } from '@dynamic-labs/sdk-api-core';
2
+ type UseGetElevatedAccessToken = (params: {
3
+ scope: TokenScope;
4
+ }) => Promise<string | undefined>;
5
+ export declare const useGetElevatedAccessToken: () => UseGetElevatedAccessToken;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ import { __awaiter } from '../../../../../_virtual/_tslib.js';
3
+ import { useCallback } from 'react';
4
+ import { getElevatedAccessToken } from '@dynamic-labs-sdk/client';
5
+
6
+ const useGetElevatedAccessToken = () => useCallback((_a) => __awaiter(void 0, [_a], void 0, function* ({ scope }) { return getElevatedAccessToken({ scope }); }), []);
7
+
8
+ export { useGetElevatedAccessToken };
@@ -42,6 +42,10 @@ var client = require('@dynamic-labs-sdk/client');
42
42
  * );
43
43
  * }
44
44
  */
45
- const useGetMultichainTokenBalances = () => React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return client.getMultichainBalances({ balanceRequest: props }); }), []);
45
+ const useGetMultichainTokenBalances = () => React.useCallback((props) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
46
+ return client.getMultichainBalances({
47
+ balanceRequest: props,
48
+ });
49
+ }), []);
46
50
 
47
51
  exports.useGetMultichainTokenBalances = useGetMultichainTokenBalances;
@@ -38,6 +38,10 @@ import { getMultichainBalances } from '@dynamic-labs-sdk/client';
38
38
  * );
39
39
  * }
40
40
  */
41
- const useGetMultichainTokenBalances = () => useCallback((props) => __awaiter(void 0, void 0, void 0, function* () { return getMultichainBalances({ balanceRequest: props }); }), []);
41
+ const useGetMultichainTokenBalances = () => useCallback((props) => __awaiter(void 0, void 0, void 0, function* () {
42
+ return getMultichainBalances({
43
+ balanceRequest: props,
44
+ });
45
+ }), []);
42
46
 
43
47
  export { useGetMultichainTokenBalances };
@@ -24,7 +24,7 @@ var errors = require('../../constants/errors.cjs');
24
24
  require('@dynamic-labs/multi-wallet');
25
25
  require('react-international-phone');
26
26
  require('../../../store/state/nonce/nonce.cjs');
27
- var utils = require('../../../data/api/utils.cjs');
27
+ var utils$1 = require('../../../data/api/utils.cjs');
28
28
  require('@dynamic-labs/locale');
29
29
  var dynamicContextProps = require('../../../store/state/dynamicContextProps/dynamicContextProps.cjs');
30
30
  require('../../../store/state/primaryWalletId/primaryWalletId.cjs');
@@ -108,6 +108,7 @@ require('../../../../index.cjs');
108
108
  require('../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.cjs');
109
109
  var balances = require('../../../data/api/chains/balances.cjs');
110
110
  var tokenBalances = require('../../../store/state/tokenBalances.cjs');
111
+ var utils = require('./utils.cjs');
111
112
  require('../../../store/state/multichainBalances.cjs');
112
113
  require('../../../shared/utils/functions/getInitialUrl/getInitialUrl.cjs');
113
114
  var useInternalDynamicContext = require('../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.cjs');
@@ -134,15 +135,12 @@ const useTokenBalances = ({ accountAddress, networkId, chainName, tokenAddresses
134
135
  !((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.featureFlags) === null || _b === void 0 ? void 0 : _b.connectOnlyMultiAsset)) {
135
136
  return;
136
137
  }
137
- // the reason why we need to get the network here again insteaf of using the value
138
+ // the reason why we need to get the network here again instead of using the value
138
139
  // from DynamicContext is because this function might run before the network state is
139
140
  // properly set when switching wallets, so we want to make sure we have the latest network
140
- let requestNetwork = networkId !== null && networkId !== void 0 ? networkId : (yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(true)));
141
- if (requestChainName === sdkApiCore.ChainEnum.Btc) {
142
- // Bitcoin does not need a network ID to fetch token balances but the request requires a network ID
143
- requestNetwork = 1;
144
- }
145
- const isValidRequest = requestNetwork && !isNaN(Number(requestNetwork));
141
+ const rawNetworkId = networkId !== null && networkId !== void 0 ? networkId : (yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(true)));
142
+ const requestNetwork = utils.resolveNetworkIdForRequest(requestChainName, rawNetworkId);
143
+ const isValidRequest = requestNetwork !== undefined;
146
144
  logger.logger.logVerboseTroubleshootingMessage('[useTokenBalances] will try to fetch token balances', {
147
145
  isLoading,
148
146
  isValidRequest,
@@ -166,7 +164,7 @@ const useTokenBalances = ({ accountAddress, networkId, chainName, tokenAddresses
166
164
  forceRefresh,
167
165
  includeNative: includeNativeBalance,
168
166
  includePrices: includeFiat,
169
- networkId: Number(requestNetwork),
167
+ networkId: requestNetwork,
170
168
  whitelistedContracts,
171
169
  });
172
170
  if (!response) {
@@ -178,17 +176,8 @@ const useTokenBalances = ({ accountAddress, networkId, chainName, tokenAddresses
178
176
  }
179
177
  catch (e) {
180
178
  const logLevel = (e === null || e === void 0 ? void 0 : e.code) >= 500 || (e === null || e === void 0 ? void 0 : e.code) < 400 ? 'error' : 'warn';
181
- yield utils.logResponseError(e, 'Error getting token balances', logLevel);
182
- let errorMessage = '';
183
- if ((e === null || e === void 0 ? void 0 : e.code) === 429) {
184
- errorMessage = 'Too many requests fetching balances';
185
- }
186
- else if (e === null || e === void 0 ? void 0 : e.message) {
187
- errorMessage = e.message;
188
- }
189
- else {
190
- errorMessage = 'error fetching token balance';
191
- }
179
+ yield utils$1.logResponseError(e, 'Error getting token balances', logLevel);
180
+ const errorMessage = utils.getTokenBalanceErrorMessage(e);
192
181
  tokenBalances.setTokenBalanceVariable('error', errorMessage);
193
182
  }
194
183
  finally {
@@ -104,6 +104,7 @@ import '../../../../index.js';
104
104
  import '../../../widgets/DynamicWidget/views/ReceiveWalletFunds/ReceiveWalletFunds.js';
105
105
  import { getAccountTokenBalances } from '../../../data/api/chains/balances.js';
106
106
  import { useTokenBalancesState, setTokenBalanceVariable } from '../../../store/state/tokenBalances.js';
107
+ import { resolveNetworkIdForRequest, getTokenBalanceErrorMessage } from './utils.js';
107
108
  import '../../../store/state/multichainBalances.js';
108
109
  import '../../../shared/utils/functions/getInitialUrl/getInitialUrl.js';
109
110
  import { useInternalDynamicContext } from '../../../context/DynamicContext/useDynamicContext/useInternalDynamicContext/useInternalDynamicContext.js';
@@ -130,15 +131,12 @@ const useTokenBalances = ({ accountAddress, networkId, chainName, tokenAddresses
130
131
  !((_b = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk.featureFlags) === null || _b === void 0 ? void 0 : _b.connectOnlyMultiAsset)) {
131
132
  return;
132
133
  }
133
- // the reason why we need to get the network here again insteaf of using the value
134
+ // the reason why we need to get the network here again instead of using the value
134
135
  // from DynamicContext is because this function might run before the network state is
135
136
  // properly set when switching wallets, so we want to make sure we have the latest network
136
- let requestNetwork = networkId !== null && networkId !== void 0 ? networkId : (yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(true)));
137
- if (requestChainName === ChainEnum.Btc) {
138
- // Bitcoin does not need a network ID to fetch token balances but the request requires a network ID
139
- requestNetwork = 1;
140
- }
141
- const isValidRequest = requestNetwork && !isNaN(Number(requestNetwork));
137
+ const rawNetworkId = networkId !== null && networkId !== void 0 ? networkId : (yield (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.getNetwork(true)));
138
+ const requestNetwork = resolveNetworkIdForRequest(requestChainName, rawNetworkId);
139
+ const isValidRequest = requestNetwork !== undefined;
142
140
  logger.logVerboseTroubleshootingMessage('[useTokenBalances] will try to fetch token balances', {
143
141
  isLoading,
144
142
  isValidRequest,
@@ -162,7 +160,7 @@ const useTokenBalances = ({ accountAddress, networkId, chainName, tokenAddresses
162
160
  forceRefresh,
163
161
  includeNative: includeNativeBalance,
164
162
  includePrices: includeFiat,
165
- networkId: Number(requestNetwork),
163
+ networkId: requestNetwork,
166
164
  whitelistedContracts,
167
165
  });
168
166
  if (!response) {
@@ -175,16 +173,7 @@ const useTokenBalances = ({ accountAddress, networkId, chainName, tokenAddresses
175
173
  catch (e) {
176
174
  const logLevel = (e === null || e === void 0 ? void 0 : e.code) >= 500 || (e === null || e === void 0 ? void 0 : e.code) < 400 ? 'error' : 'warn';
177
175
  yield logResponseError(e, 'Error getting token balances', logLevel);
178
- let errorMessage = '';
179
- if ((e === null || e === void 0 ? void 0 : e.code) === 429) {
180
- errorMessage = 'Too many requests fetching balances';
181
- }
182
- else if (e === null || e === void 0 ? void 0 : e.message) {
183
- errorMessage = e.message;
184
- }
185
- else {
186
- errorMessage = 'error fetching token balance';
187
- }
176
+ const errorMessage = getTokenBalanceErrorMessage(e);
188
177
  setTokenBalanceVariable('error', errorMessage);
189
178
  }
190
179
  finally {
@@ -0,0 +1,77 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
7
+
8
+ // Stellar mainnet network hash prefix
9
+ const STELLAR_MAINNET_HASH_PREFIX = '7ac33997';
10
+ // Stellar testnet network hash prefix
11
+ const STELLAR_TESTNET_HASH_PREFIX = 'cee0302d';
12
+ // Stellar CAIP-2 mainnet identifier
13
+ const STELLAR_CAIP2_MAINNET = 'stellar:pubnet';
14
+ // Stellar CAIP-2 testnet identifier
15
+ const STELLAR_CAIP2_TESTNET = 'stellar:testnet';
16
+ // Stellar mainnet numeric network ID
17
+ const STELLAR_MAINNET_NETWORK_ID = 800;
18
+ // Stellar testnet numeric network ID
19
+ const STELLAR_TESTNET_NETWORK_ID = 801;
20
+ /**
21
+ * Converts Stellar network identifiers to numeric network IDs.
22
+ * Supports both hash format (7ac33997...) and CAIP-2 format (stellar:pubnet).
23
+ */
24
+ const convertStellarNetworkToNumeric = (networkId) => {
25
+ if (networkId === undefined) {
26
+ return undefined;
27
+ }
28
+ const networkStr = String(networkId);
29
+ const isMainnet = networkStr.startsWith(STELLAR_MAINNET_HASH_PREFIX) ||
30
+ networkStr === STELLAR_CAIP2_MAINNET;
31
+ if (isMainnet) {
32
+ return STELLAR_MAINNET_NETWORK_ID;
33
+ }
34
+ const isTestnet = networkStr.startsWith(STELLAR_TESTNET_HASH_PREFIX) ||
35
+ networkStr === STELLAR_CAIP2_TESTNET;
36
+ if (isTestnet) {
37
+ return STELLAR_TESTNET_NETWORK_ID;
38
+ }
39
+ // Return original if it's already numeric
40
+ const numericId = Number(networkId);
41
+ return isNaN(numericId) ? undefined : numericId;
42
+ };
43
+ /**
44
+ * Resolves the network ID for API requests, handling chain-specific conversions.
45
+ */
46
+ const resolveNetworkIdForRequest = (chainName, networkId) => {
47
+ // Bitcoin does not need a network ID but the request requires one
48
+ if (chainName === sdkApiCore.ChainEnum.Btc) {
49
+ return 1;
50
+ }
51
+ if (chainName === sdkApiCore.ChainEnum.Stellar) {
52
+ return convertStellarNetworkToNumeric(networkId);
53
+ }
54
+ if (networkId === undefined) {
55
+ return undefined;
56
+ }
57
+ const numericId = Number(networkId);
58
+ return isNaN(numericId) ? undefined : numericId;
59
+ };
60
+ // Error code for rate limiting
61
+ const RATE_LIMIT_CODE = 429;
62
+ /**
63
+ * Extracts an appropriate error message from an error object.
64
+ */
65
+ const getTokenBalanceErrorMessage = (error) => {
66
+ if ((error === null || error === void 0 ? void 0 : error.code) === RATE_LIMIT_CODE) {
67
+ return 'Too many requests fetching balances';
68
+ }
69
+ if (error === null || error === void 0 ? void 0 : error.message) {
70
+ return error.message;
71
+ }
72
+ return 'error fetching token balance';
73
+ };
74
+
75
+ exports.convertStellarNetworkToNumeric = convertStellarNetworkToNumeric;
76
+ exports.getTokenBalanceErrorMessage = getTokenBalanceErrorMessage;
77
+ exports.resolveNetworkIdForRequest = resolveNetworkIdForRequest;
@@ -0,0 +1,17 @@
1
+ import { ChainEnum } from '@dynamic-labs/sdk-api-core';
2
+ /**
3
+ * Converts Stellar network identifiers to numeric network IDs.
4
+ * Supports both hash format (7ac33997...) and CAIP-2 format (stellar:pubnet).
5
+ */
6
+ export declare const convertStellarNetworkToNumeric: (networkId: string | number | undefined) => number | undefined;
7
+ /**
8
+ * Resolves the network ID for API requests, handling chain-specific conversions.
9
+ */
10
+ export declare const resolveNetworkIdForRequest: (chainName: ChainEnum, networkId: string | number | undefined) => number | undefined;
11
+ /**
12
+ * Extracts an appropriate error message from an error object.
13
+ */
14
+ export declare const getTokenBalanceErrorMessage: (error: {
15
+ code?: number;
16
+ message?: string;
17
+ }) => string;
@@ -0,0 +1,71 @@
1
+ 'use client'
2
+ import { ChainEnum } from '@dynamic-labs/sdk-api-core';
3
+
4
+ // Stellar mainnet network hash prefix
5
+ const STELLAR_MAINNET_HASH_PREFIX = '7ac33997';
6
+ // Stellar testnet network hash prefix
7
+ const STELLAR_TESTNET_HASH_PREFIX = 'cee0302d';
8
+ // Stellar CAIP-2 mainnet identifier
9
+ const STELLAR_CAIP2_MAINNET = 'stellar:pubnet';
10
+ // Stellar CAIP-2 testnet identifier
11
+ const STELLAR_CAIP2_TESTNET = 'stellar:testnet';
12
+ // Stellar mainnet numeric network ID
13
+ const STELLAR_MAINNET_NETWORK_ID = 800;
14
+ // Stellar testnet numeric network ID
15
+ const STELLAR_TESTNET_NETWORK_ID = 801;
16
+ /**
17
+ * Converts Stellar network identifiers to numeric network IDs.
18
+ * Supports both hash format (7ac33997...) and CAIP-2 format (stellar:pubnet).
19
+ */
20
+ const convertStellarNetworkToNumeric = (networkId) => {
21
+ if (networkId === undefined) {
22
+ return undefined;
23
+ }
24
+ const networkStr = String(networkId);
25
+ const isMainnet = networkStr.startsWith(STELLAR_MAINNET_HASH_PREFIX) ||
26
+ networkStr === STELLAR_CAIP2_MAINNET;
27
+ if (isMainnet) {
28
+ return STELLAR_MAINNET_NETWORK_ID;
29
+ }
30
+ const isTestnet = networkStr.startsWith(STELLAR_TESTNET_HASH_PREFIX) ||
31
+ networkStr === STELLAR_CAIP2_TESTNET;
32
+ if (isTestnet) {
33
+ return STELLAR_TESTNET_NETWORK_ID;
34
+ }
35
+ // Return original if it's already numeric
36
+ const numericId = Number(networkId);
37
+ return isNaN(numericId) ? undefined : numericId;
38
+ };
39
+ /**
40
+ * Resolves the network ID for API requests, handling chain-specific conversions.
41
+ */
42
+ const resolveNetworkIdForRequest = (chainName, networkId) => {
43
+ // Bitcoin does not need a network ID but the request requires one
44
+ if (chainName === ChainEnum.Btc) {
45
+ return 1;
46
+ }
47
+ if (chainName === ChainEnum.Stellar) {
48
+ return convertStellarNetworkToNumeric(networkId);
49
+ }
50
+ if (networkId === undefined) {
51
+ return undefined;
52
+ }
53
+ const numericId = Number(networkId);
54
+ return isNaN(numericId) ? undefined : numericId;
55
+ };
56
+ // Error code for rate limiting
57
+ const RATE_LIMIT_CODE = 429;
58
+ /**
59
+ * Extracts an appropriate error message from an error object.
60
+ */
61
+ const getTokenBalanceErrorMessage = (error) => {
62
+ if ((error === null || error === void 0 ? void 0 : error.code) === RATE_LIMIT_CODE) {
63
+ return 'Too many requests fetching balances';
64
+ }
65
+ if (error === null || error === void 0 ? void 0 : error.message) {
66
+ return error.message;
67
+ }
68
+ return 'error fetching token balance';
69
+ };
70
+
71
+ export { convertStellarNetworkToNumeric, getTokenBalanceErrorMessage, resolveNetworkIdForRequest };
@@ -50,7 +50,10 @@ const useWalletConnectorNetwork = (walletConnector, { onChange } = { onChange: (
50
50
  },
51
51
  });
52
52
  useWalletConnectorEvent.useWalletConnectorEvent(walletConnector || undefined, 'chainChange', ({ chain }) => {
53
- const parsedChain = (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'STARK' ? chain : parseInt(chain);
53
+ // STARK and STELLAR use string chainIds; others use numeric
54
+ const useChainAsString = (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'STARK' ||
55
+ (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'STELLAR';
56
+ const parsedChain = useChainAsString ? chain : parseInt(chain);
54
57
  setNetwork(parsedChain);
55
58
  onChange === null || onChange === void 0 ? void 0 : onChange(parsedChain);
56
59
  });
@@ -46,7 +46,10 @@ const useWalletConnectorNetwork = (walletConnector, { onChange } = { onChange: (
46
46
  },
47
47
  });
48
48
  useWalletConnectorEvent(walletConnector || undefined, 'chainChange', ({ chain }) => {
49
- const parsedChain = (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'STARK' ? chain : parseInt(chain);
49
+ // STARK and STELLAR use string chainIds; others use numeric
50
+ const useChainAsString = (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'STARK' ||
51
+ (walletConnector === null || walletConnector === void 0 ? void 0 : walletConnector.connectedChain) === 'STELLAR';
52
+ const parsedChain = useChainAsString ? chain : parseInt(chain);
50
53
  setNetwork(parsedChain);
51
54
  onChange === null || onChange === void 0 ? void 0 : onChange(parsedChain);
52
55
  });
@@ -0,0 +1 @@
1
+ export { useWalletReturnRoute } from './useWalletReturnRoute';
@@ -0,0 +1,37 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var React = require('react');
7
+ var utils = require('@dynamic-labs/utils');
8
+ var dynamicEvents = require('../../../events/dynamicEvents.cjs');
9
+
10
+ /**
11
+ * Hook that listens for URL updates (from wallet deep link returns) and
12
+ * emits the walletReturnFromDeepLink event with the previous route.
13
+ *
14
+ * This allows customers to navigate back to where the user was before
15
+ * the wallet operation.
16
+ */
17
+ const useWalletReturnRoute = () => {
18
+ React.useEffect(() => {
19
+ // Check immediately on mount in case the WebView was unmounted while the wallet
20
+ // was open and the URL redirect arrived before listeners were registered
21
+ const routeOnMount = utils.walletReturnRoute.getAndClear();
22
+ if (routeOnMount) {
23
+ dynamicEvents.dynamicEvents.emit('walletReturnFromDeepLink', {
24
+ previousRoute: routeOnMount,
25
+ });
26
+ }
27
+ const unsubscribe = utils.PlatformService.onUrlUpdate(() => {
28
+ const previousRoute = utils.walletReturnRoute.getAndClear();
29
+ if (previousRoute) {
30
+ dynamicEvents.dynamicEvents.emit('walletReturnFromDeepLink', { previousRoute });
31
+ }
32
+ });
33
+ return unsubscribe;
34
+ }, []);
35
+ };
36
+
37
+ exports.useWalletReturnRoute = useWalletReturnRoute;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Hook that listens for URL updates (from wallet deep link returns) and
3
+ * emits the walletReturnFromDeepLink event with the previous route.
4
+ *
5
+ * This allows customers to navigate back to where the user was before
6
+ * the wallet operation.
7
+ */
8
+ export declare const useWalletReturnRoute: () => void;
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+ import { useEffect } from 'react';
3
+ import { walletReturnRoute, PlatformService } from '@dynamic-labs/utils';
4
+ import { dynamicEvents } from '../../../events/dynamicEvents.js';
5
+
6
+ /**
7
+ * Hook that listens for URL updates (from wallet deep link returns) and
8
+ * emits the walletReturnFromDeepLink event with the previous route.
9
+ *
10
+ * This allows customers to navigate back to where the user was before
11
+ * the wallet operation.
12
+ */
13
+ const useWalletReturnRoute = () => {
14
+ useEffect(() => {
15
+ // Check immediately on mount in case the WebView was unmounted while the wallet
16
+ // was open and the URL redirect arrived before listeners were registered
17
+ const routeOnMount = walletReturnRoute.getAndClear();
18
+ if (routeOnMount) {
19
+ dynamicEvents.emit('walletReturnFromDeepLink', {
20
+ previousRoute: routeOnMount,
21
+ });
22
+ }
23
+ const unsubscribe = PlatformService.onUrlUpdate(() => {
24
+ const previousRoute = walletReturnRoute.getAndClear();
25
+ if (previousRoute) {
26
+ dynamicEvents.emit('walletReturnFromDeepLink', { previousRoute });
27
+ }
28
+ });
29
+ return unsubscribe;
30
+ }, []);
31
+ };
32
+
33
+ export { useWalletReturnRoute };
@@ -24,6 +24,7 @@ require('../../shared/consts/index.cjs');
24
24
  */
25
25
  const chainInfoOverrides = {
26
26
  starknet: 'STARK',
27
+ stellar: 'STELLAR',
27
28
  };
28
29
  const getEnabledChains = (chains) => chains
29
30
  .filter(({ enabled }) => enabled)
@@ -4,7 +4,7 @@ interface IChain {
4
4
  enabled: boolean;
5
5
  name: string;
6
6
  }
7
- export declare const getEnabledChains: (chains: IChain[]) => ("STARK" | "ALGO" | "APTOS" | "ATOM" | "BTC" | "COSMOS" | "ECLIPSE" | "ETH" | "EVM" | "FLOW" | "SOL" | "SPARK" | "STELLAR" | "SUI" | "TRON" | "TON")[];
7
+ export declare const getEnabledChains: (chains: IChain[]) => ("STARK" | "STELLAR" | "ALGO" | "APTOS" | "ATOM" | "BTC" | "COSMOS" | "ECLIPSE" | "ETH" | "EVM" | "FLOW" | "SOL" | "SPARK" | "SUI" | "TRON" | "TON")[];
8
8
  type BaseGetSupportedWalletOpts = Omit<GetSupportedWalletsOpts, 'walletConnectProjectId' | 'chainRpcProviders'>;
9
9
  export declare const getWallets: (props: {
10
10
  getSupportedWalletOpts: BaseGetSupportedWalletOpts;
@@ -20,6 +20,7 @@ import '../../shared/consts/index.js';
20
20
  */
21
21
  const chainInfoOverrides = {
22
22
  starknet: 'STARK',
23
+ stellar: 'STELLAR',
23
24
  };
24
25
  const getEnabledChains = (chains) => chains
25
26
  .filter(({ enabled }) => enabled)