@dynamic-labs/sdk-react-core 4.0.0-alpha.2 → 4.0.0-alpha.4

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 (41) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.cjs +2 -2
  3. package/package.js +2 -2
  4. package/package.json +12 -12
  5. package/src/lib/components/QRCode/QRCode.cjs +2 -2
  6. package/src/lib/components/QRCode/QRCode.js +2 -2
  7. package/src/lib/components/SendBalanceForm/SendBalanceForm.cjs +5 -1
  8. package/src/lib/components/SendBalanceForm/SendBalanceForm.js +5 -1
  9. package/src/lib/components/TransactionConfirmationPageLayout/utils.cjs +5 -6
  10. package/src/lib/components/TransactionConfirmationPageLayout/utils.js +5 -6
  11. package/src/lib/context/DynamicContext/DynamicContext.cjs +14 -16
  12. package/src/lib/context/DynamicContext/DynamicContext.js +14 -16
  13. package/src/lib/data/api/oauth/oauth.cjs +14 -0
  14. package/src/lib/data/api/oauth/oauth.d.ts +1 -0
  15. package/src/lib/data/api/oauth/oauth.js +14 -1
  16. package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.cjs +1 -6
  17. package/src/lib/store/internalImplementation/utils/clearExpiredData/clearExpiredData.js +1 -6
  18. package/src/lib/store/stateConfig.cjs +0 -5
  19. package/src/lib/store/stateConfig.js +0 -5
  20. package/src/lib/store/types.d.ts +1 -6
  21. package/src/lib/styles/index.shadow.cjs +1 -1
  22. package/src/lib/styles/index.shadow.js +1 -1
  23. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/index.d.ts +1 -0
  24. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs +63 -0
  25. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.d.ts +9 -0
  26. package/src/lib/utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js +59 -0
  27. package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.cjs +8 -1
  28. package/src/lib/utils/hooks/useResetCookieLocalStorage/useResetCookieLocalStorage.js +8 -1
  29. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.cjs +148 -114
  30. package/src/lib/utils/hooks/useSocialAuth/useSocialAuth.js +151 -117
  31. package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.cjs +20 -7
  32. package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.d.ts +1 -0
  33. package/src/lib/utils/hooks/useTelegramLogin/useTelegramLogin.js +20 -7
  34. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.cjs +1 -1
  35. package/src/lib/views/MfaChooseDeviceView/MfaChooseDeviceView.js +1 -1
  36. package/src/lib/views/WalletList/data.cjs +6 -1
  37. package/src/lib/views/WalletList/data.js +6 -1
  38. package/src/lib/store/state/networkConfigurations/index.d.ts +0 -1
  39. package/src/lib/store/state/networkConfigurations/networkConfigurations.cjs +0 -169
  40. package/src/lib/store/state/networkConfigurations/networkConfigurations.d.ts +0 -10
  41. package/src/lib/store/state/networkConfigurations/networkConfigurations.js +0 -161
package/CHANGELOG.md CHANGED
@@ -1,4 +1,25 @@
1
1
 
2
+ ## [4.0.0-alpha.4](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.3...v4.0.0-alpha.4) (2024-09-23)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * issue where builtin stream module was a dependency ([#6968](https://github.com/dynamic-labs/DynamicAuth/issues/6968)) ([0661129](https://github.com/dynamic-labs/DynamicAuth/commit/0661129920ba70ebbcd4d17ee5aa988c51d1b477))
8
+ * update in memory secure storage ([#6955](https://github.com/dynamic-labs/DynamicAuth/issues/6955)) ([697fc20](https://github.com/dynamic-labs/DynamicAuth/commit/697fc20740b243fa31ecf06e8b2ed9d09932a544))
9
+
10
+ ## [4.0.0-alpha.3](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.2...v4.0.0-alpha.3) (2024-09-20)
11
+
12
+
13
+ ### Features
14
+
15
+ * developers provide global connectivity appkit project id ([#6941](https://github.com/dynamic-labs/DynamicAuth/issues/6941)) ([83760ea](https://github.com/dynamic-labs/DynamicAuth/commit/83760ea57591685b12caee945f173f6a7f9312d1))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * don't try to set up event listeners if wallet provider doesn't support it ([#6943](https://github.com/dynamic-labs/DynamicAuth/issues/6943)) ([439f1bb](https://github.com/dynamic-labs/DynamicAuth/commit/439f1bbb3c765959756cfc6eeb8429e4018e0379))
21
+ * dont verify all signatures for solana embedded multisig tx ([#6953](https://github.com/dynamic-labs/DynamicAuth/issues/6953)) ([7a7973e](https://github.com/dynamic-labs/DynamicAuth/commit/7a7973e05f0960421b348a55c6a00c9fd873b0b7))
22
+
2
23
  ## [4.0.0-alpha.2](https://github.com/dynamic-labs/DynamicAuth/compare/v4.0.0-alpha.1...v4.0.0-alpha.2) (2024-09-18)
3
24
 
4
25
 
package/package.cjs CHANGED
@@ -3,9 +3,9 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.0.0-alpha.2";
6
+ var version = "4.0.0-alpha.4";
7
7
  var dependencies = {
8
- "@dynamic-labs/sdk-api-core": "0.0.530",
8
+ "@dynamic-labs/sdk-api-core": "0.0.535",
9
9
  "@hcaptcha/react-hcaptcha": "1.4.4",
10
10
  "country-list": "2.3.0",
11
11
  formik: "2.2.9",
package/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use client'
2
- var version = "4.0.0-alpha.2";
2
+ var version = "4.0.0-alpha.4";
3
3
  var dependencies = {
4
- "@dynamic-labs/sdk-api-core": "0.0.530",
4
+ "@dynamic-labs/sdk-api-core": "0.0.535",
5
5
  "@hcaptcha/react-hcaptcha": "1.4.4",
6
6
  "country-list": "2.3.0",
7
7
  formik: "2.2.9",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "4.0.0-alpha.2",
3
+ "version": "4.0.0-alpha.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
7
7
  "directory": "packages/sdk-react-core"
8
8
  },
9
9
  "dependencies": {
10
- "@dynamic-labs/sdk-api-core": "0.0.530",
10
+ "@dynamic-labs/sdk-api-core": "0.0.535",
11
11
  "@hcaptcha/react-hcaptcha": "1.4.4",
12
12
  "country-list": "2.3.0",
13
13
  "formik": "2.2.9",
@@ -17,16 +17,16 @@
17
17
  "react-i18next": "13.5.0",
18
18
  "yup": "0.32.11",
19
19
  "react-international-phone": "4.2.5",
20
- "@dynamic-labs/iconic": "4.0.0-alpha.2",
21
- "@dynamic-labs/logger": "4.0.0-alpha.2",
22
- "@dynamic-labs/message-transport": "4.0.0-alpha.2",
23
- "@dynamic-labs/multi-wallet": "4.0.0-alpha.2",
24
- "@dynamic-labs/rpc-providers": "4.0.0-alpha.2",
25
- "@dynamic-labs/store": "4.0.0-alpha.2",
26
- "@dynamic-labs/types": "4.0.0-alpha.2",
27
- "@dynamic-labs/utils": "4.0.0-alpha.2",
28
- "@dynamic-labs/wallet-book": "4.0.0-alpha.2",
29
- "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.2",
20
+ "@dynamic-labs/iconic": "4.0.0-alpha.4",
21
+ "@dynamic-labs/logger": "4.0.0-alpha.4",
22
+ "@dynamic-labs/message-transport": "4.0.0-alpha.4",
23
+ "@dynamic-labs/multi-wallet": "4.0.0-alpha.4",
24
+ "@dynamic-labs/rpc-providers": "4.0.0-alpha.4",
25
+ "@dynamic-labs/store": "4.0.0-alpha.4",
26
+ "@dynamic-labs/types": "4.0.0-alpha.4",
27
+ "@dynamic-labs/utils": "4.0.0-alpha.4",
28
+ "@dynamic-labs/wallet-book": "4.0.0-alpha.4",
29
+ "@dynamic-labs/wallet-connector-core": "4.0.0-alpha.4",
30
30
  "eventemitter3": "5.0.1"
31
31
  },
32
32
  "devDependencies": {
@@ -103,7 +103,7 @@ const generateMatrix = (value, errorCorrectionLevel) => {
103
103
  ? rows.push([key])
104
104
  : rows[rows.length - 1].push(key)) && rows, []);
105
105
  };
106
- const QRCode = ({ ecl = 'M', Icon, logoMargin = 0, logoSize = 40, size = 250, value, accentColor, walletKey = undefined, showQrCodeImage, }) => {
106
+ const QRCode = ({ ecl = 'M', Icon, logoMargin = 0, logoSize = 40, size = 250, value, accentColor = 'currentColor', walletKey = undefined, showQrCodeImage, }) => {
107
107
  const { data } = usePromise.usePromise(() => QRCodeUtil__default["default"].toDataURL(value));
108
108
  const dots = React.useMemo(() => {
109
109
  const dots = [];
@@ -118,7 +118,7 @@ const QRCode = ({ ecl = 'M', Icon, logoMargin = 0, logoSize = 40, size = 250, va
118
118
  const x1 = (matrix.length - 7) * cellSize * x;
119
119
  const y1 = (matrix.length - 7) * cellSize * y;
120
120
  for (let i = 0; i < 3; i++) {
121
- dots.push(jsxRuntime.jsx("rect", { fill: i % 2 !== 0 ? 'currentColor' : accentColor, height: cellSize * (7 - i * 2), rx: i === 0 ? 10 : i === 1 ? 7 : 20, ry: i === 0 ? 10 : i === 1 ? 7 : 20, width: cellSize * (7 - i * 2), x: x1 + cellSize * i, y: y1 + cellSize * i }, `corner-square-${x}-${y}-${i}`));
121
+ dots.push(jsxRuntime.jsx("rect", { "data-key": `corner-square-${x}-${y}-${i}`, fill: i % 2 !== 0 ? 'var(--background)' : accentColor, height: cellSize * (7 - i * 2), rx: i === 0 ? 10 : i === 1 ? 7 : 20, ry: i === 0 ? 10 : i === 1 ? 7 : 20, width: cellSize * (7 - i * 2), x: x1 + cellSize * i, y: y1 + cellSize * i }, `corner-square-${x}-${y}-${i}`));
122
122
  }
123
123
  });
124
124
  const clearArenaSize = Math.floor((logoSize * 1.5) / cellSize);
@@ -95,7 +95,7 @@ const generateMatrix = (value, errorCorrectionLevel) => {
95
95
  ? rows.push([key])
96
96
  : rows[rows.length - 1].push(key)) && rows, []);
97
97
  };
98
- const QRCode = ({ ecl = 'M', Icon, logoMargin = 0, logoSize = 40, size = 250, value, accentColor, walletKey = undefined, showQrCodeImage, }) => {
98
+ const QRCode = ({ ecl = 'M', Icon, logoMargin = 0, logoSize = 40, size = 250, value, accentColor = 'currentColor', walletKey = undefined, showQrCodeImage, }) => {
99
99
  const { data } = usePromise(() => QRCodeUtil.toDataURL(value));
100
100
  const dots = useMemo(() => {
101
101
  const dots = [];
@@ -110,7 +110,7 @@ const QRCode = ({ ecl = 'M', Icon, logoMargin = 0, logoSize = 40, size = 250, va
110
110
  const x1 = (matrix.length - 7) * cellSize * x;
111
111
  const y1 = (matrix.length - 7) * cellSize * y;
112
112
  for (let i = 0; i < 3; i++) {
113
- dots.push(jsx("rect", { fill: i % 2 !== 0 ? 'currentColor' : accentColor, height: cellSize * (7 - i * 2), rx: i === 0 ? 10 : i === 1 ? 7 : 20, ry: i === 0 ? 10 : i === 1 ? 7 : 20, width: cellSize * (7 - i * 2), x: x1 + cellSize * i, y: y1 + cellSize * i }, `corner-square-${x}-${y}-${i}`));
113
+ dots.push(jsx("rect", { "data-key": `corner-square-${x}-${y}-${i}`, fill: i % 2 !== 0 ? 'var(--background)' : accentColor, height: cellSize * (7 - i * 2), rx: i === 0 ? 10 : i === 1 ? 7 : 20, ry: i === 0 ? 10 : i === 1 ? 7 : 20, width: cellSize * (7 - i * 2), x: x1 + cellSize * i, y: y1 + cellSize * i }, `corner-square-${x}-${y}-${i}`));
114
114
  }
115
115
  });
116
116
  const clearArenaSize = Math.floor((logoSize * 1.5) / cellSize);
@@ -153,7 +153,7 @@ const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddre
153
153
  }),
154
154
  });
155
155
  }, [decimals, validateAddress, validateAmount]);
156
- return (jsxRuntime.jsx(formik.Formik, { initialValues: initialValues || sendBalanceFormInitialValues, validationSchema: sendBalanceFormValidationSchema, onSubmit: (values) => onSubmit(values), validateOnChange: false, validateOnBlur: false, children: ({ errors, touched, values, handleChange, setFieldValue, setErrors, }) => {
156
+ return (jsxRuntime.jsx(formik.Formik, { initialValues: initialValues || sendBalanceFormInitialValues, validationSchema: sendBalanceFormValidationSchema, onSubmit: (values) => onSubmit(values), validateOnChange: false, validateOnBlur: false, children: ({ errors, touched, values, handleChange, setFieldValue, setErrors, handleBlur, setFieldTouched, validateField, }) => {
157
157
  var _a;
158
158
  return (jsxRuntime.jsxs(formik.Form, { className: 'send-balance-form', children: [jsxRuntime.jsxs("div", { className: 'send-balance-page-layout__balance-container', children: [jsxRuntime.jsx(FormFieldLabel.FormFieldLabel, { children: "Select any token" }), jsxRuntime.jsx(TokensBalanceDropdown.TokensBalanceDropdown, { tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, setFieldValue: setFieldValue, setErrors: setErrors })] }), jsxRuntime.jsxs("div", { className: 'send-balance-form__amount-container', children: [jsxRuntime.jsx(formik.Field, { variant: 'regular', className: `send-balance-form__amount-container__field ${showFiat ? 'fiat' : ''}`, name: 'amount', id: 'amount', onChange: (e) => {
159
159
  const newValue = e.target.value;
@@ -168,6 +168,10 @@ const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddre
168
168
  return;
169
169
  }
170
170
  sendBalances.setSendBalanceVariable('amount', (currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) ? Number(newValue) : undefined);
171
+ }, onBlur: (e) => {
172
+ handleBlur(e);
173
+ setFieldTouched('amount', true);
174
+ validateField('amount');
171
175
  }, placeholder: t('dyn_send_transaction.data.amount.placeholder'), as: Input.Input, error: errors['amount'], copykey: 'dyn_send_transaction.data.amount.label', message: touched['amount'] &&
172
176
  getDisplayErrorMessage(errors, t, 'amount', decimals), style: {
173
177
  paddingLeft: `${leftSymbolPadding}px`,
@@ -149,7 +149,7 @@ const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddre
149
149
  }),
150
150
  });
151
151
  }, [decimals, validateAddress, validateAmount]);
152
- return (jsx(Formik, { initialValues: initialValues || sendBalanceFormInitialValues, validationSchema: sendBalanceFormValidationSchema, onSubmit: (values) => onSubmit(values), validateOnChange: false, validateOnBlur: false, children: ({ errors, touched, values, handleChange, setFieldValue, setErrors, }) => {
152
+ return (jsx(Formik, { initialValues: initialValues || sendBalanceFormInitialValues, validationSchema: sendBalanceFormValidationSchema, onSubmit: (values) => onSubmit(values), validateOnChange: false, validateOnBlur: false, children: ({ errors, touched, values, handleChange, setFieldValue, setErrors, handleBlur, setFieldTouched, validateField, }) => {
153
153
  var _a;
154
154
  return (jsxs(Form, { className: 'send-balance-form', children: [jsxs("div", { className: 'send-balance-page-layout__balance-container', children: [jsx(FormFieldLabel, { children: "Select any token" }), jsx(TokensBalanceDropdown, { tokenBalances: tokenBalances !== null && tokenBalances !== void 0 ? tokenBalances : (currentToken && [currentToken]), currentToken: currentToken, setCurrentToken: setCurrentToken, isLoading: isLoading, setFieldValue: setFieldValue, setErrors: setErrors })] }), jsxs("div", { className: 'send-balance-form__amount-container', children: [jsx(Field, { variant: 'regular', className: `send-balance-form__amount-container__field ${showFiat ? 'fiat' : ''}`, name: 'amount', id: 'amount', onChange: (e) => {
155
155
  const newValue = e.target.value;
@@ -164,6 +164,10 @@ const SendBalanceForm = ({ initialValues, onSubmit, decimals = 18, validateAddre
164
164
  return;
165
165
  }
166
166
  setSendBalanceVariable('amount', (currentToken === null || currentToken === void 0 ? void 0 : currentToken.price) ? Number(newValue) : undefined);
167
+ }, onBlur: (e) => {
168
+ handleBlur(e);
169
+ setFieldTouched('amount', true);
170
+ validateField('amount');
167
171
  }, placeholder: t('dyn_send_transaction.data.amount.placeholder'), as: Input, error: errors['amount'], copykey: 'dyn_send_transaction.data.amount.label', message: touched['amount'] &&
168
172
  getDisplayErrorMessage(errors, t, 'amount', decimals), style: {
169
173
  paddingLeft: `${leftSymbolPadding}px`,
@@ -37,13 +37,12 @@ const getValueRounded = (isNativeToken, transaction) => {
37
37
  const calculateFiatPrice = (amount, price, decimals) => {
38
38
  if (amount === undefined || isNaN(amount) || !decimals || !price)
39
39
  return 0;
40
- const SCALE = BigInt(Math.pow(10, decimals));
41
- const paddedPrice = Number(price.toFixed(decimals));
40
+ const scalingFactor = Math.pow(10, decimals);
42
41
  try {
43
- const scaledTokenAmount = BigInt(amount * Number(SCALE));
44
- const fiatPriceBigInt = BigInt(paddedPrice * Number(SCALE));
45
- const product = scaledTokenAmount * fiatPriceBigInt;
46
- return Number(product / SCALE) / Number(SCALE);
42
+ const amountBigInt = BigInt(Math.round(amount * scalingFactor));
43
+ const priceBigInt = BigInt(Math.round(price * scalingFactor));
44
+ const fiatValue = (amountBigInt * priceBigInt) / BigInt(scalingFactor);
45
+ return Number(fiatValue) / scalingFactor;
47
46
  }
48
47
  catch (e) {
49
48
  // Possible issue: getting wrong price / decimals.
@@ -33,13 +33,12 @@ const getValueRounded = (isNativeToken, transaction) => {
33
33
  const calculateFiatPrice = (amount, price, decimals) => {
34
34
  if (amount === undefined || isNaN(amount) || !decimals || !price)
35
35
  return 0;
36
- const SCALE = BigInt(Math.pow(10, decimals));
37
- const paddedPrice = Number(price.toFixed(decimals));
36
+ const scalingFactor = Math.pow(10, decimals);
38
37
  try {
39
- const scaledTokenAmount = BigInt(amount * Number(SCALE));
40
- const fiatPriceBigInt = BigInt(paddedPrice * Number(SCALE));
41
- const product = scaledTokenAmount * fiatPriceBigInt;
42
- return Number(product / SCALE) / Number(SCALE);
38
+ const amountBigInt = BigInt(Math.round(amount * scalingFactor));
39
+ const priceBigInt = BigInt(Math.round(price * scalingFactor));
40
+ const fiatValue = (amountBigInt * priceBigInt) / BigInt(scalingFactor);
41
+ return Number(fiatValue) / scalingFactor;
43
42
  }
44
43
  catch (e) {
45
44
  // Possible issue: getting wrong price / decimals.
@@ -122,7 +122,7 @@ var PhantomRedirectContext = require('../PhantomRedirectContext/PhantomRedirectC
122
122
  var ReinitializeContextProvider = require('../ReinitializeContext/ReinitializeContextProvider.cjs');
123
123
  var SendBalanceContext = require('../SendBalanceContext/SendBalanceContext.cjs');
124
124
  var UseNetworkValidation = require('../UseNetworkValidation/UseNetworkValidation.cjs');
125
- var networkConfigurations = require('../../store/state/networkConfigurations/networkConfigurations.cjs');
125
+ var useNetworkConfigurationsFromProjectSettings = require('../../utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.cjs');
126
126
  var helpers = require('./helpers/helpers.cjs');
127
127
  var useDisplayOrderState = require('./hooks/useDisplayOrderState/useDisplayOrderState.cjs');
128
128
  var useEmailLoginState = require('./hooks/useEmailLoginState/useEmailLoginState.cjs');
@@ -198,16 +198,21 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
198
198
  const { user: user$1, userWithMissingInfo } = user.useUser();
199
199
  const isAuthenticated = Boolean(user$1);
200
200
  if (user$1) {
201
- logger$1.logger.setMetaData('user', user$1);
201
+ logger$1.logger.metaData.set('user', user$1);
202
202
  }
203
203
  else {
204
- logger$1.logger.setMetaData('user', undefined);
204
+ logger$1.logger.metaData.set('user', undefined);
205
205
  }
206
206
  const { consumeNonce } = useFetchNonce.useFetchNonce(environmentId);
207
207
  const [qrcodeUri, setQrcodeUri] = React.useState('');
208
208
  const [desktopUri, setDesktopUri] = React.useState('');
209
209
  const [multiWalletWidgetState, setMultiWalletWidgetState, { awaiting_account_switch: [accountSwitchState], awaiting_signature: [awaitingSignatureState], },] = useMultiWalletWidgetState.useMultiWalletWidgetState();
210
210
  const { settings: projectSettings$1 } = projectSettings.useProjectSettings();
211
+ const serverNetworkConfigurations = useNetworkConfigurationsFromProjectSettings.useNetworkConfigurationsFromProjectSettings({
212
+ cosmosNetworkOverrides: (_d = settings$1.overrides) === null || _d === void 0 ? void 0 : _d.cosmosNetworks,
213
+ evmNetworksOverrides: (_e = settings$1.overrides) === null || _e === void 0 ? void 0 : _e.evmNetworks,
214
+ projectSettings: projectSettings$1,
215
+ });
211
216
  useSendDynamicProps.useSendDynamicProps({ environmentId, settings: settings$1 });
212
217
  // Console warning for end user safety
213
218
  useEndUserWarning.useEndUserWarning({
@@ -216,27 +221,20 @@ const InnerDynamicContextProvider = ({ children, theme, settings: settings$1, lo
216
221
  });
217
222
  const multiWallet = useMultiWallet.useMultiWallet({
218
223
  isBridgeFlow,
219
- multiWalletOverride: (_d = settings$1.overrides) === null || _d === void 0 ? void 0 : _d.multiWallet,
220
- multiWalletSettings: (_e = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _e === void 0 ? void 0 : _e.multiWallet,
224
+ multiWalletOverride: (_f = settings$1.overrides) === null || _f === void 0 ? void 0 : _f.multiWallet,
225
+ multiWalletSettings: (_g = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _g === void 0 ? void 0 : _g.multiWallet,
221
226
  });
222
227
  const multiAsset = useMultiAsset.useMultiAsset({
223
- multiAssetOverride: (_f = settings$1.overrides) === null || _f === void 0 ? void 0 : _f.multiAsset,
224
- multiAssetSettings: (_g = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _g === void 0 ? void 0 : _g.enableMultiAsset,
228
+ multiAssetOverride: (_h = settings$1.overrides) === null || _h === void 0 ? void 0 : _h.multiAsset,
229
+ multiAssetSettings: (_j = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _j === void 0 ? void 0 : _j.enableMultiAsset,
225
230
  });
226
231
  const showFiat = useShowFiat.useShowFiat({
227
- showFiatOverride: (_h = settings$1.overrides) === null || _h === void 0 ? void 0 : _h.showFiat,
228
- showFiatSettings: (_j = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _j === void 0 ? void 0 : _j.showFiat,
232
+ showFiatOverride: (_k = settings$1.overrides) === null || _k === void 0 ? void 0 : _k.showFiat,
233
+ showFiatSettings: (_l = projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.sdk) === null || _l === void 0 ? void 0 : _l.showFiat,
229
234
  });
230
235
  // Used inside useVerifyOnAwaitingSignature. Is legacy and should be removed asap
231
236
  const [legacyIsVerifying, setLegacyIsVerifying] = React.useState(false);
232
237
  const walletBook$1 = walletBook.useWalletBookCdn();
233
- networkConfigurations.useFetchNetworkConfigurations({
234
- cosmosNetworkOverrides: (_k = settings$1.overrides) === null || _k === void 0 ? void 0 : _k.cosmosNetworks,
235
- environmentId,
236
- evmNetworksOverrides: (_l = settings$1.overrides) === null || _l === void 0 ? void 0 : _l.evmNetworks,
237
- projectSettings: projectSettings$1,
238
- });
239
- const { networkConfigurations: serverNetworkConfigurations } = networkConfigurations.useNetworkConfigurations();
240
238
  const { imageUserInAccessList, imageUserNotInAccessList, displayName, appLogo, } = (projectSettings$1 === null || projectSettings$1 === void 0 ? void 0 : projectSettings$1.general) || {};
241
239
  appLogoUrl = appLogo || appLogoUrl;
242
240
  appName = displayName || appName;
@@ -118,7 +118,7 @@ import { PhantomRedirectContextProvider } from '../PhantomRedirectContext/Phanto
118
118
  import { ReinitializeContextProvider } from '../ReinitializeContext/ReinitializeContextProvider.js';
119
119
  import { SendBalanceContextProvider } from '../SendBalanceContext/SendBalanceContext.js';
120
120
  import { UseNetworkValidation } from '../UseNetworkValidation/UseNetworkValidation.js';
121
- import { useFetchNetworkConfigurations, useNetworkConfigurations } from '../../store/state/networkConfigurations/networkConfigurations.js';
121
+ import { useNetworkConfigurationsFromProjectSettings } from '../../utils/hooks/useNetworkConfigurationsFromProjectSettings/useNetworkConfigurationsFromProjectSettings.js';
122
122
  import { resolveNetworkValidationMode, initExpirationTime, getInitialView, getDeepLinkPreference } from './helpers/helpers.js';
123
123
  import { useDisplayOrderState } from './hooks/useDisplayOrderState/useDisplayOrderState.js';
124
124
  import { useEmailLoginState } from './hooks/useEmailLoginState/useEmailLoginState.js';
@@ -194,16 +194,21 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
194
194
  const { user, userWithMissingInfo } = useUser();
195
195
  const isAuthenticated = Boolean(user);
196
196
  if (user) {
197
- logger.setMetaData('user', user);
197
+ logger.metaData.set('user', user);
198
198
  }
199
199
  else {
200
- logger.setMetaData('user', undefined);
200
+ logger.metaData.set('user', undefined);
201
201
  }
202
202
  const { consumeNonce } = useFetchNonce(environmentId);
203
203
  const [qrcodeUri, setQrcodeUri] = useState('');
204
204
  const [desktopUri, setDesktopUri] = useState('');
205
205
  const [multiWalletWidgetState, setMultiWalletWidgetState, { awaiting_account_switch: [accountSwitchState], awaiting_signature: [awaitingSignatureState], },] = useMultiWalletWidgetState();
206
206
  const { settings: projectSettings } = useProjectSettings();
207
+ const serverNetworkConfigurations = useNetworkConfigurationsFromProjectSettings({
208
+ cosmosNetworkOverrides: (_d = settings.overrides) === null || _d === void 0 ? void 0 : _d.cosmosNetworks,
209
+ evmNetworksOverrides: (_e = settings.overrides) === null || _e === void 0 ? void 0 : _e.evmNetworks,
210
+ projectSettings,
211
+ });
207
212
  useSendDynamicProps({ environmentId, settings });
208
213
  // Console warning for end user safety
209
214
  useEndUserWarning({
@@ -212,27 +217,20 @@ const InnerDynamicContextProvider = ({ children, theme, settings, locale, enable
212
217
  });
213
218
  const multiWallet = useMultiWallet({
214
219
  isBridgeFlow,
215
- multiWalletOverride: (_d = settings.overrides) === null || _d === void 0 ? void 0 : _d.multiWallet,
216
- multiWalletSettings: (_e = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _e === void 0 ? void 0 : _e.multiWallet,
220
+ multiWalletOverride: (_f = settings.overrides) === null || _f === void 0 ? void 0 : _f.multiWallet,
221
+ multiWalletSettings: (_g = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _g === void 0 ? void 0 : _g.multiWallet,
217
222
  });
218
223
  const multiAsset = useMultiAsset({
219
- multiAssetOverride: (_f = settings.overrides) === null || _f === void 0 ? void 0 : _f.multiAsset,
220
- multiAssetSettings: (_g = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _g === void 0 ? void 0 : _g.enableMultiAsset,
224
+ multiAssetOverride: (_h = settings.overrides) === null || _h === void 0 ? void 0 : _h.multiAsset,
225
+ multiAssetSettings: (_j = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _j === void 0 ? void 0 : _j.enableMultiAsset,
221
226
  });
222
227
  const showFiat = useShowFiat({
223
- showFiatOverride: (_h = settings.overrides) === null || _h === void 0 ? void 0 : _h.showFiat,
224
- showFiatSettings: (_j = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _j === void 0 ? void 0 : _j.showFiat,
228
+ showFiatOverride: (_k = settings.overrides) === null || _k === void 0 ? void 0 : _k.showFiat,
229
+ showFiatSettings: (_l = projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.sdk) === null || _l === void 0 ? void 0 : _l.showFiat,
225
230
  });
226
231
  // Used inside useVerifyOnAwaitingSignature. Is legacy and should be removed asap
227
232
  const [legacyIsVerifying, setLegacyIsVerifying] = useState(false);
228
233
  const walletBook = useWalletBookCdn();
229
- useFetchNetworkConfigurations({
230
- cosmosNetworkOverrides: (_k = settings.overrides) === null || _k === void 0 ? void 0 : _k.cosmosNetworks,
231
- environmentId,
232
- evmNetworksOverrides: (_l = settings.overrides) === null || _l === void 0 ? void 0 : _l.evmNetworks,
233
- projectSettings,
234
- });
235
- const { networkConfigurations: serverNetworkConfigurations } = useNetworkConfigurations();
236
234
  const { imageUserInAccessList, imageUserNotInAccessList, displayName, appLogo, } = (projectSettings === null || projectSettings === void 0 ? void 0 : projectSettings.general) || {};
237
235
  appLogoUrl = appLogo || appLogoUrl;
238
236
  appName = displayName || appName;
@@ -143,6 +143,19 @@ const telegramSignIn = (environmentId, oauthResultRequest) => _tslib.__awaiter(v
143
143
  return handleSignInError(e);
144
144
  }
145
145
  });
146
+ const isUserLinkedWithTelegram = (environmentId, oauthResultRequest) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
147
+ const telegramCheckAuthRequest = {
148
+ environmentId,
149
+ oauthResultRequest,
150
+ };
151
+ try {
152
+ yield api.sdkApi().telegramCheckAuth(telegramCheckAuthRequest);
153
+ return true;
154
+ }
155
+ catch (e) {
156
+ return false;
157
+ }
158
+ });
146
159
  const telegramVerify = (environmentId, oauthResultRequest) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
147
160
  const telegramVerifyRequest = {
148
161
  environmentId,
@@ -195,6 +208,7 @@ exports.farcasterSignIn = farcasterSignIn;
195
208
  exports.farcasterVerify = farcasterVerify;
196
209
  exports.getOAuthResult = getOAuthResult;
197
210
  exports.initAuth = initAuth;
211
+ exports.isUserLinkedWithTelegram = isUserLinkedWithTelegram;
198
212
  exports.signInOAuth = signInOAuth;
199
213
  exports.telegramSignIn = telegramSignIn;
200
214
  exports.telegramVerify = telegramVerify;
@@ -13,4 +13,5 @@ export declare const getOAuthResult: (environmentId: string, providerType: Provi
13
13
  export declare const farcasterSignIn: (environmentId: string, farcasterSignInRequest: FarcasterSignInRequest) => Promise<UserProfile | undefined>;
14
14
  export declare const farcasterVerify: (farcasterVerifyRequest: FarcasterVerifyRequest) => Promise<UserProfile | undefined>;
15
15
  export declare const telegramSignIn: (environmentId: string, oauthResultRequest: OauthResultRequest) => Promise<UserProfile | undefined>;
16
+ export declare const isUserLinkedWithTelegram: (environmentId: string, oauthResultRequest: OauthResultRequest) => Promise<boolean | undefined>;
16
17
  export declare const telegramVerify: (environmentId: string, oauthResultRequest: OauthResultRequest) => Promise<UserProfile | undefined>;
@@ -139,6 +139,19 @@ const telegramSignIn = (environmentId, oauthResultRequest) => __awaiter(void 0,
139
139
  return handleSignInError(e);
140
140
  }
141
141
  });
142
+ const isUserLinkedWithTelegram = (environmentId, oauthResultRequest) => __awaiter(void 0, void 0, void 0, function* () {
143
+ const telegramCheckAuthRequest = {
144
+ environmentId,
145
+ oauthResultRequest,
146
+ };
147
+ try {
148
+ yield sdkApi().telegramCheckAuth(telegramCheckAuthRequest);
149
+ return true;
150
+ }
151
+ catch (e) {
152
+ return false;
153
+ }
154
+ });
142
155
  const telegramVerify = (environmentId, oauthResultRequest) => __awaiter(void 0, void 0, void 0, function* () {
143
156
  const telegramVerifyRequest = {
144
157
  environmentId,
@@ -187,4 +200,4 @@ const handleSignInError = (e) => __awaiter(void 0, void 0, void 0, function* ()
187
200
  return undefined;
188
201
  });
189
202
 
190
- export { farcasterSignIn, farcasterVerify, getOAuthResult, initAuth, signInOAuth, telegramSignIn, telegramVerify, unlinkOAuth, verifyOAuth };
203
+ export { farcasterSignIn, farcasterVerify, getOAuthResult, initAuth, isUserLinkedWithTelegram, signInOAuth, telegramSignIn, telegramVerify, unlinkOAuth, verifyOAuth };
@@ -7,7 +7,7 @@ var utils = require('@dynamic-labs/utils');
7
7
  var localStorage = require('../../../../utils/constants/localStorage.cjs');
8
8
 
9
9
  const clearExpiredData = (store) => {
10
- const { projectSettings, networkConfigurations, user } = store.getState();
10
+ const { projectSettings, user } = store.getState();
11
11
  // TODO: we can clean this up once we move wallet info to the store
12
12
  const [connectedWalletData] = utils.StorageService.getItem(localStorage.CONNECTED_WALLETS_INFO) || [];
13
13
  const shouldRemoveSettingsAndConfigs = !user && !connectedWalletData;
@@ -18,11 +18,6 @@ const clearExpiredData = (store) => {
18
18
  projectSettings: store.getInitialState().projectSettings,
19
19
  });
20
20
  }
21
- if (isExpired(networkConfigurations)) {
22
- store.setState({
23
- networkConfigurations: store.getInitialState().networkConfigurations,
24
- });
25
- }
26
21
  return store;
27
22
  };
28
23
 
@@ -3,7 +3,7 @@ import { StorageService } from '@dynamic-labs/utils';
3
3
  import { CONNECTED_WALLETS_INFO } from '../../../../utils/constants/localStorage.js';
4
4
 
5
5
  const clearExpiredData = (store) => {
6
- const { projectSettings, networkConfigurations, user } = store.getState();
6
+ const { projectSettings, user } = store.getState();
7
7
  // TODO: we can clean this up once we move wallet info to the store
8
8
  const [connectedWalletData] = StorageService.getItem(CONNECTED_WALLETS_INFO) || [];
9
9
  const shouldRemoveSettingsAndConfigs = !user && !connectedWalletData;
@@ -14,11 +14,6 @@ const clearExpiredData = (store) => {
14
14
  projectSettings: store.getInitialState().projectSettings,
15
15
  });
16
16
  }
17
- if (isExpired(networkConfigurations)) {
18
- store.setState({
19
- networkConfigurations: store.getInitialState().networkConfigurations,
20
- });
21
- }
22
17
  return store;
23
18
  };
24
19
 
@@ -11,10 +11,6 @@ const createInitialStates = ({ environmentId, }) => ({
11
11
  loadingAndLifecycle: {
12
12
  sessionValidation: false,
13
13
  },
14
- networkConfigurations: {
15
- expiresAt: undefined,
16
- networkConfigurations: undefined,
17
- },
18
14
  projectSettings: { expiresAt: undefined, settings: undefined },
19
15
  sendBalanceState: {
20
16
  amount: undefined,
@@ -36,7 +32,6 @@ const createInitialStates = ({ environmentId, }) => ({
36
32
  */
37
33
  const transformStateForLocalStorage = (state) => ({
38
34
  environmentId: state.environmentId,
39
- networkConfigurations: state.networkConfigurations,
40
35
  projectSettings: state.projectSettings,
41
36
  user: state.user,
42
37
  });
@@ -7,10 +7,6 @@ const createInitialStates = ({ environmentId, }) => ({
7
7
  loadingAndLifecycle: {
8
8
  sessionValidation: false,
9
9
  },
10
- networkConfigurations: {
11
- expiresAt: undefined,
12
- networkConfigurations: undefined,
13
- },
14
10
  projectSettings: { expiresAt: undefined, settings: undefined },
15
11
  sendBalanceState: {
16
12
  amount: undefined,
@@ -32,7 +28,6 @@ const createInitialStates = ({ environmentId, }) => ({
32
28
  */
33
29
  const transformStateForLocalStorage = (state) => ({
34
30
  environmentId: state.environmentId,
35
- networkConfigurations: state.networkConfigurations,
36
31
  projectSettings: state.projectSettings,
37
32
  user: state.user,
38
33
  });
@@ -1,5 +1,5 @@
1
1
  import { ProjectSettings, TokenBalance } from '@dynamic-labs/sdk-api-core';
2
- import { NetworkConfigurationMap, UserProfile } from '@dynamic-labs/types';
2
+ import { UserProfile } from '@dynamic-labs/types';
3
3
  import { WalletOption } from '../shared/types/wallets';
4
4
  export type SdkStoreProps = {
5
5
  environmentId: string;
@@ -9,7 +9,6 @@ export type SdkStore = {
9
9
  environmentId: string;
10
10
  user: UserProfile | undefined;
11
11
  projectSettings: StoredProjectSettings;
12
- networkConfigurations: StoredNetworkConfigurations;
13
12
  tokenBalancesState: TokenBalancesState;
14
13
  sendBalanceState: SendBalanceState;
15
14
  walletConnectorOptions: WalletOption[];
@@ -36,10 +35,6 @@ export type StoredProjectSettings = {
36
35
  expiresAt: number | undefined;
37
36
  settings: ProjectSettings | undefined;
38
37
  };
39
- export type StoredNetworkConfigurations = {
40
- expiresAt: number | undefined;
41
- networkConfigurations: NetworkConfigurationMap | undefined;
42
- };
43
38
  export type StateConfig = {
44
39
  [K in keyof SdkStore]: {
45
40
  initialValue: SdkStore[K];