@dynamic-labs-sdk/client 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InvalidParamError-BxBgwLQB.native.esm.js → InvalidParamError-BUpLSb5x.native.esm.js} +4 -2
- package/dist/{InvalidParamError-BxBgwLQB.native.esm.js.map → InvalidParamError-BUpLSb5x.native.esm.js.map} +1 -1
- package/dist/{InvalidParamError-BmFmxeXx.esm.js → InvalidParamError-BazEwozw.esm.js} +5 -2
- package/dist/{InvalidParamError-BmFmxeXx.esm.js.map → InvalidParamError-BazEwozw.esm.js.map} +1 -1
- package/dist/{InvalidParamError-CGZRSAOn.cjs → InvalidParamError-CMesesy6.cjs} +6 -3
- package/dist/{InvalidParamError-CGZRSAOn.cjs.map → InvalidParamError-CMesesy6.cjs.map} +1 -1
- package/dist/{NotWaasWalletAccountError-DO313zza.esm.js → NotWaasWalletAccountError-CIjFmQ_l.esm.js} +2 -2
- package/dist/{NotWaasWalletAccountError-DO313zza.esm.js.map → NotWaasWalletAccountError-CIjFmQ_l.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-cIj987D7.cjs → NotWaasWalletAccountError-D-yqOoH6.cjs} +2 -2
- package/dist/{NotWaasWalletAccountError-cIj987D7.cjs.map → NotWaasWalletAccountError-D-yqOoH6.cjs.map} +1 -1
- package/dist/{NotWaasWalletAccountError-CkH85cm5.native.esm.js → NotWaasWalletAccountError-DWXGDcpr.native.esm.js} +2 -2
- package/dist/{NotWaasWalletAccountError-CkH85cm5.native.esm.js.map → NotWaasWalletAccountError-DWXGDcpr.native.esm.js.map} +1 -1
- package/dist/client/types/DynamicClient.d.ts +3 -0
- package/dist/client/types/DynamicClient.d.ts.map +1 -1
- package/dist/core.cjs +5 -5
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/exports/index.d.ts +6 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CsAg0JU7.esm.js → getNetworkProviderFromNetworkId-BfBE-dei.esm.js} +3 -3
- package/dist/{getNetworkProviderFromNetworkId-CsAg0JU7.esm.js.map → getNetworkProviderFromNetworkId-BfBE-dei.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CxGbMwFL.native.esm.js → getNetworkProviderFromNetworkId-C-1rPWZm.native.esm.js} +5 -4
- package/dist/getNetworkProviderFromNetworkId-C-1rPWZm.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-2wYAIZ6w.cjs → getNetworkProviderFromNetworkId-D4xzWb7w.cjs} +4 -4
- package/dist/{getNetworkProviderFromNetworkId-2wYAIZ6w.cjs.map → getNetworkProviderFromNetworkId-D4xzWb7w.cjs.map} +1 -1
- package/dist/{getSignedSessionId-E9JM9zum.esm.js → getSignedSessionId-BWxWFaJW.esm.js} +3 -3
- package/dist/{getSignedSessionId-E9JM9zum.esm.js.map → getSignedSessionId-BWxWFaJW.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-E3o2_FL7.cjs → getSignedSessionId-BimmHQvA.cjs} +3 -3
- package/dist/{getSignedSessionId-E3o2_FL7.cjs.map → getSignedSessionId-BimmHQvA.cjs.map} +1 -1
- package/dist/{getSignedSessionId-BZHJglv0.native.esm.js → getSignedSessionId-fwHlhBvt.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-BZHJglv0.native.esm.js.map → getSignedSessionId-fwHlhBvt.native.esm.js.map} +1 -1
- package/dist/{getWaasWalletProviderFromWalletAccount-CeoFLRbo.native.esm.js → getWaasWalletProviderFromWalletAccount-CJdnAlDf.native.esm.js} +3 -3
- package/dist/{getWaasWalletProviderFromWalletAccount-CeoFLRbo.native.esm.js.map → getWaasWalletProviderFromWalletAccount-CJdnAlDf.native.esm.js.map} +1 -1
- package/dist/{getWaasWalletProviderFromWalletAccount-CXv6xEJZ.esm.js → getWaasWalletProviderFromWalletAccount-OM-BlEFR.esm.js} +3 -3
- package/dist/{getWaasWalletProviderFromWalletAccount-CXv6xEJZ.esm.js.map → getWaasWalletProviderFromWalletAccount-OM-BlEFR.esm.js.map} +1 -1
- package/dist/{getWaasWalletProviderFromWalletAccount-BaxUhLEp.cjs → getWaasWalletProviderFromWalletAccount-sEzYqoCf.cjs} +3 -3
- package/dist/{getWaasWalletProviderFromWalletAccount-BaxUhLEp.cjs.map → getWaasWalletProviderFromWalletAccount-sEzYqoCf.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-DMNpwDEn.cjs → getWalletProviderByKey-1zHjzqbz.cjs} +3 -3
- package/dist/{getWalletProviderByKey-DMNpwDEn.cjs.map → getWalletProviderByKey-1zHjzqbz.cjs.map} +1 -1
- package/dist/{getWalletProviderByKey-AQmQQpmk.esm.js → getWalletProviderByKey-BXGcVzkf.esm.js} +2 -2
- package/dist/{getWalletProviderByKey-AQmQQpmk.esm.js.map → getWalletProviderByKey-BXGcVzkf.esm.js.map} +1 -1
- package/dist/{getWalletProviderByKey-C5w8qJ0f.native.esm.js → getWalletProviderByKey-CAQkYCGi.native.esm.js} +3 -2
- package/dist/getWalletProviderByKey-CAQkYCGi.native.esm.js.map +1 -0
- package/dist/index.cjs +157 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +155 -22
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +155 -22
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BmJKVaMQ.native.esm.js → isMfaRequiredForAction-CPadAr7k.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BmJKVaMQ.native.esm.js.map → isMfaRequiredForAction-CPadAr7k.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-C9Fw0v_g.cjs → isMfaRequiredForAction-CxWuGsmB.cjs} +3 -2
- package/dist/isMfaRequiredForAction-CxWuGsmB.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-BNgq1huY.esm.js → isMfaRequiredForAction-DZVNUtPY.esm.js} +3 -2
- package/dist/isMfaRequiredForAction-DZVNUtPY.esm.js.map +1 -0
- package/dist/modules/auth/social/getUserSocialAccounts/getUserSocialAccounts.d.ts +1 -0
- package/dist/modules/auth/social/getUserSocialAccounts/getUserSocialAccounts.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts +1 -0
- package/dist/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/detectOAuthRedirect/detectOAuthRedirect.d.ts +1 -0
- package/dist/modules/auth/social/oauth/detectOAuthRedirect/detectOAuthRedirect.d.ts.map +1 -1
- package/dist/modules/balances/getBalances/getBalances.d.ts +1 -0
- package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts +1 -0
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts.map +1 -1
- package/dist/modules/clientEvents/clientEvents.d.ts +2 -0
- package/dist/modules/clientEvents/clientEvents.d.ts.map +1 -1
- package/dist/modules/flow/broadcastFlow/broadcastFlow.d.ts +24 -0
- package/dist/modules/flow/broadcastFlow/broadcastFlow.d.ts.map +1 -0
- package/dist/modules/flow/broadcastFlow/index.d.ts +3 -0
- package/dist/modules/flow/broadcastFlow/index.d.ts.map +1 -0
- package/dist/modules/flow/cancelFlow/cancelFlow.d.ts +14 -0
- package/dist/modules/flow/cancelFlow/cancelFlow.d.ts.map +1 -0
- package/dist/modules/flow/cancelFlow/index.d.ts +3 -0
- package/dist/modules/flow/cancelFlow/index.d.ts.map +1 -0
- package/dist/modules/flow/submitFlowTransaction/index.d.ts +3 -0
- package/dist/modules/flow/submitFlowTransaction/index.d.ts.map +1 -0
- package/dist/modules/flow/submitFlowTransaction/submitFlowTransaction.d.ts +24 -0
- package/dist/modules/flow/submitFlowTransaction/submitFlowTransaction.d.ts.map +1 -0
- package/dist/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.d.ts +1 -0
- package/dist/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.d.ts.map +1 -1
- package/dist/modules/initializeClient/initializeClient.d.ts +1 -0
- package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts +1 -0
- package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts.map +1 -1
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +1 -0
- package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
- package/dist/modules/user/refreshUser/refreshUser.d.ts +1 -0
- package/dist/modules/user/refreshUser/refreshUser.d.ts.map +1 -1
- package/dist/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts +1 -0
- package/dist/modules/wallets/getWalletAccounts/getWalletAccounts.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts +1 -0
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts.map +1 -1
- package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts +1 -0
- package/dist/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts +1 -0
- package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts.map +1 -1
- package/dist/{refreshAuth-DfcR3CWf.cjs → refreshAuth-CKcNynMk.cjs} +3 -3
- package/dist/{refreshAuth-DfcR3CWf.cjs.map → refreshAuth-CKcNynMk.cjs.map} +1 -1
- package/dist/{refreshAuth-CVUpYNs6.native.esm.js → refreshAuth-Cl3adySI.native.esm.js} +3 -3
- package/dist/{refreshAuth-CVUpYNs6.native.esm.js.map → refreshAuth-Cl3adySI.native.esm.js.map} +1 -1
- package/dist/{refreshAuth-D8dU3BLP.esm.js → refreshAuth-DlQw3Dky.esm.js} +3 -3
- package/dist/{refreshAuth-D8dU3BLP.esm.js.map → refreshAuth-DlQw3Dky.esm.js.map} +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs +5 -5
- package/dist/waas.esm.js +4 -4
- package/dist/waas.native.esm.js +4 -4
- package/dist/waasCore.cjs +4 -4
- package/dist/waasCore.esm.js +4 -4
- package/dist/waasCore.native.esm.js +4 -4
- package/package.json +2 -2
- package/dist/getNetworkProviderFromNetworkId-CxGbMwFL.native.esm.js.map +0 -1
- package/dist/getWalletProviderByKey-C5w8qJ0f.native.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-BNgq1huY.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-C9Fw0v_g.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as getDefaultClient, L as instrumentFunction, P as assertDefined, Q as getCore, Z as BaseError, b as createApiClient } from "./InvalidParamError-
|
|
1
|
+
import { J as getDefaultClient, L as instrumentFunction, P as assertDefined, Q as getCore, Z as BaseError, b as createApiClient } from "./InvalidParamError-BUpLSb5x.native.esm.js";
|
|
2
2
|
|
|
3
3
|
//#region src/errors/NativeModuleNotLinkedError.ts
|
|
4
4
|
var NativeModuleNotLinkedError = class extends BaseError {
|
|
@@ -105,4 +105,4 @@ const isMfaRequiredForAction = async ({ mfaAction }, client = getDefaultClient()
|
|
|
105
105
|
|
|
106
106
|
//#endregion
|
|
107
107
|
export { NativeModuleNotLinkedError as i, getMfaMethods as n, __consumeMfaToken_wrapped as r, isMfaRequiredForAction as t };
|
|
108
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
108
|
+
//# sourceMappingURL=isMfaRequiredForAction-CPadAr7k.native.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isMfaRequiredForAction-
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-CPadAr7k.native.esm.js","names":[],"sources":["../src/errors/NativeModuleNotLinkedError.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { BaseError } from './base';\n\ntype NativeModuleNotLinkedErrorParams = {\n moduleName: string;\n};\n\nexport class NativeModuleNotLinkedError extends BaseError {\n constructor({ moduleName }: NativeModuleNotLinkedErrorParams) {\n super({\n cause: null,\n code: 'native_module_not_linked_error',\n details: [\n `The \"${moduleName}\" TurboModule is not registered with React Native.`,\n 'This usually means the native module was not autolinked into the host app,',\n 'or the app binary was not rebuilt after installing the SDK.',\n '',\n 'To resolve:',\n ' 1. Ensure \"@dynamic-labs-sdk/client\" is a direct dependency of the app',\n ' and reinstall (e.g. `pnpm install`).',\n ' 2. Rebuild the native app:',\n ' iOS: `cd ios && pod install && cd .. && npx react-native run-ios`',\n ' Android: `npx react-native run-android`',\n ' Expo: `npx expo prebuild --clean` then run the app.',\n ' 3. Confirm autolinking sees the package:',\n ' `npx expo-modules-autolinking react-native-config --json`',\n ].join('\\n'),\n docsUrl: null,\n name: 'NativeModuleNotLinkedError',\n shortMessage: `Native TurboModule \"${moduleName}\" is not linked.`,\n });\n }\n}\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n * @instrumented\n * @redact-params\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n * @not-instrumented\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n * @not-instrumented\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":";;;AAMA,IAAa,6BAAb,cAAgD,UAAU;CACxD,YAAY,EAAE,cAAgD;AAC5D,QAAM;GACJ,OAAO;GACP,MAAM;GACN,SAAS;IACP,QAAQ,WAAW;IACnB;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACD,CAAC,KAAK,KAAK;GACZ,SAAS;GACT,MAAM;GACN,cAAc,uBAAuB,WAAW;GACjD,CAAC;;;;;;;;;;;;;;;;;;ACVN,MAAE,mBAAsB,SAAU,kBAAU,KAAA;;;AAK1C,eAAY,UAAI,qBAAA;kBAGhB,UAAO,MACR,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACdD,MAAa,gBAAgB,OAAO,SAAS,kBAAkB,KAAK;CAClE,MAAM,OAAO,QAAQ,OAAO;AAQ5B,QALuB,MAFL,gBAAgB,EAAE,EAAE,OAAO,CAEN,kBAAkB;EACvD,eAAe,KAAK;EACpB,cAAc;EACf,CAAC;;;;;;;;;;;;;;;;ACDJ,MAAa,yBAAyB,OACpC,EAAE,aACF,SAAS,kBAAkB,KACxB;CACH,MAAM,kBAAkB,OAAO;AAQ/B,KAAI,CANwB,iBAAiB,UAAU,KAAK,SAAS,MAClE,WAAW,OAAO,WAAW,aAAa,OAAO,SACnD,CAKC,QAAO;AAMT,KAH4B,iBAAiB,UAAU,KAAK,SAI1D,QAAO;AAMT,SAHmB,MAAM,cAAc,OAAO,EAG5B"}
|
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
28
|
+
const require_InvalidParamError = require('./InvalidParamError-CMesesy6.cjs');
|
|
29
29
|
let zod_mini = require("zod/mini");
|
|
30
30
|
zod_mini = __toESM(zod_mini);
|
|
31
31
|
|
|
@@ -120,6 +120,7 @@ const PROJECT_SETTINGS_EXPIRATION_TIME = 1e3 * 60 * 5;
|
|
|
120
120
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
121
121
|
* @returns A promise that resolves to the updated project settings.
|
|
122
122
|
* @not-instrumented
|
|
123
|
+
* @noHook Internal settings fetch that is not part of the public hook surface.
|
|
123
124
|
*/
|
|
124
125
|
const fetchProjectSettings = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
125
126
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -402,4 +403,4 @@ Object.defineProperty(exports, 'retryOnFail', {
|
|
|
402
403
|
return retryOnFail;
|
|
403
404
|
}
|
|
404
405
|
});
|
|
405
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
406
|
+
//# sourceMappingURL=isMfaRequiredForAction-CxWuGsmB.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-CxWuGsmB.cjs","names":["BaseError","getDefaultClient","getWalletAccounts","z","getDefaultClient","getCore","createApiClient","CLIENT_SDK_NAME","getCore","getCore","walletProvidersMap: Map<string, WalletProvider>","getWalletAccounts","getWalletProviderFromWalletAccount","getCore","getDefaultClient","getCore","createApiClient","getDefaultClient"],"sources":["../src/utils/retryOnFail/InvalidRetryOnFailCallError.ts","../src/utils/retryOnFail/retryOnFail.ts","../src/modules/auth/isSignedIn/isSignedIn.ts","../src/services/storage/createStorageKeySchema/createStorageKeySchema.ts","../src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.ts","../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts","../src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts","../src/modules/wallets/utils/getAvailableWalletProvidersFromWalletAccounts/getAvailableWalletProvidersFromWalletAccounts.ts","../src/modules/wallets/destroyWalletProviders/destroyWalletProviders.ts","../src/modules/auth/logoutWithReason/logoutWithReason.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { BaseError } from '../../errors/base';\n\n/**\n * This error is thrown when the `retryOnFail` function is called with an invalid\n * number of retries (i.e. less than 0).\n */\nexport class InvalidRetryOnFailCallError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(maxRetries: number) {\n super({\n cause: null,\n code: 'invalid_retry_on_fail_call_error',\n docsUrl: null,\n name: 'InvalidRetryOnFailCallError',\n shortMessage: `Invalid retries parameter for retryOnFail call: ${maxRetries}`,\n });\n }\n}\n","import { InvalidRetryOnFailCallError } from './InvalidRetryOnFailCallError';\n\nexport type RetryOnFailParams<T> = {\n /**\n * The delay between retries in milliseconds.\n */\n delay?: number;\n /**\n * The function to call.\n */\n fn: () => Promise<T>;\n /**\n * The maximum number of retries.\n *\n * When set to 0, the function will be called only once and is\n * therefore equivalent to calling the function directly.\n */\n maxRetries: number;\n};\n\n/** @not-instrumented */\nexport const retryOnFail = async <T>({\n delay = 0,\n fn,\n maxRetries,\n}: RetryOnFailParams<T>) => {\n for (let retry = 0; retry <= maxRetries; retry++) {\n try {\n return await fn();\n } catch (error) {\n if (retry >= maxRetries) {\n throw error;\n }\n\n if (delay > 0) {\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n }\n\n /**\n * Reaching this point should never happen and this\n * error is thrown to help us debug the issue.\n */\n throw new InvalidRetryOnFailCallError(maxRetries);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\n\n/**\n * Checks if the user is currently signed in to the Dynamic client.\n *\n * The client is considered to be in a signed in state if a user has\n * authenticated or if the client has at least one wallet connected.\n *\n * @deprecated What counts as \"signed in\" is your app's business logic, not the\n * SDK's. This helper bakes in one opinion (a user OR any connected wallet),\n * which rarely matches every app and forces a dependency on us for every\n * variation. Compose your own check from the underlying primitives instead —\n * e.g. `Boolean(client.user) || isAnyWalletAccountConnected(client)` — and\n * layer in whatever your app requires (device registration, completed\n * onboarding, satisfied MFA, a required embedded wallet, …). See the\n * \"Check if signed in\" guide:\n * https://www.dynamic.xyz/docs/javascript/user-session-management\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user is signed in, false otherwise.\n * @not-instrumented\n */\nexport const isSignedIn = (client = getDefaultClient()) =>\n Boolean(client.user || getWalletAccounts(client).length > 0);\n","import type * as z from 'zod/mini';\n\nimport type { StorageKeySchema, StorageKeySchemaConfig } from '../storage.types';\n\n/** @not-instrumented */\nexport const createStorageKeySchema = <T>(params: {\n config?: StorageKeySchemaConfig;\n key: string;\n schema: z.ZodMiniType<T>;\n}): StorageKeySchema<T> => {\n return params;\n};\n","import * as z from 'zod/mini';\n\nimport { createStorageKeySchema } from '../../../services/storage';\n\n/**\n * The schema to track the expiration time of the project settings.\n */\nexport const projectSettingsExpirationStorageKeySchema = createStorageKeySchema(\n {\n key: 'projectSettingsExpiration',\n schema: z.number(),\n }\n);\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { retryOnFail } from '../../../utils/retryOnFail';\nimport { createApiClient } from '../../apiClient';\nimport { CLIENT_SDK_NAME } from '../../apiClient/constants';\nimport { isSignedIn } from '../../auth/isSignedIn';\nimport { projectSettingsExpirationStorageKeySchema } from './projectSettingsExpirationScheme';\n\n/**\n * Expiration time of the project settings in milliseconds.\n */\nexport const PROJECT_SETTINGS_EXPIRATION_TIME = 1000 * 60 * 5; // 5 minutes\n\n/**\n * Fetches and updates the project settings from the API.\n *\n * This function retrieves the latest project configuration settings\n * from Dynamic's servers, including authentication options, enabled chains,\n * and security configurations. The settings are cached for performance.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the updated project settings.\n * @not-instrumented\n * @noHook Internal settings fetch that is not part of the public hook surface.\n */\nexport const fetchProjectSettings = async (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const currentExpiration = await core.storage.getItem(\n projectSettingsExpirationStorageKeySchema\n );\n\n const hasProjectSettings = Boolean(client.projectSettings);\n const isExpired = currentExpiration && currentExpiration < Date.now();\n\n // We want to cache the project settings if its valid and user is connected.\n // This avoids unnecessary API calls and speeds up the initial load.\n if (hasProjectSettings && !isExpired && isSignedIn(client)) {\n return client.projectSettings;\n }\n\n const apiClient = createApiClient({}, client);\n\n core.logger.debug('[fetchProjectSettings] Fetching project settings...');\n\n const doFetch = async () =>\n apiClient.getEnvironmentSettings(\n {\n environmentId: core.environmentId,\n sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`,\n },\n {\n credentials: 'omit',\n }\n );\n\n const projectSettings = await retryOnFail({\n fn: doFetch,\n maxRetries: 2,\n });\n\n core.state.set({ projectSettings: projectSettings ?? null });\n\n await core.storage.setItem(\n projectSettingsExpirationStorageKeySchema,\n Date.now() + PROJECT_SETTINGS_EXPIRATION_TIME\n );\n\n return projectSettings;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { SessionKeys } from '../sessionKeys.types';\n\n/** @not-instrumented */\nexport const generateSessionKeys = async (\n client: DynamicClient\n): Promise<SessionKeys> => {\n const core = getCore(client);\n\n await core.keychain.removeKey('session');\n\n const publicKey = await core.keychain.generateKey('session');\n\n assertDefined(publicKey, 'Public key not found');\n\n core.state.set({\n sessionKeys: publicKey,\n });\n\n return { publicKey };\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { getWalletAccounts } from '../../getWalletAccounts';\nimport type { WalletProvider } from '../../walletProvider';\nimport { getWalletProviderFromWalletAccount } from '../getWalletProviderFromWalletAccount';\n\n/** @not-instrumented */\nexport const getAvailableWalletProvidersFromWalletAccounts = (\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProvidersMap: Map<string, WalletProvider> = new Map();\n\n const walletAccounts = getWalletAccounts(client);\n\n walletAccounts.forEach((walletAccount) => {\n if (walletProvidersMap.has(walletAccount.walletProviderKey)) {\n return;\n }\n\n try {\n const walletProvider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);\n } catch (error) {\n core.logger.debug('Wallet provider not found for wallet account', {\n error,\n walletAccount: walletAccount.address,\n });\n }\n });\n\n return Array.from(walletProvidersMap.values());\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { LogoutReason } from '../../auth/logoutReason';\nimport { getAvailableWalletProvidersFromWalletAccounts } from '../utils/getAvailableWalletProvidersFromWalletAccounts';\n\n/**\n * Tear down every wallet provider on the client.\n *\n * Each provider's `destroy` is responsible for its own local + remote\n * cleanup. We swallow errors so a failing destroy on one provider does not\n * block teardown of the others (e.g. during logout).\n *\n * @not-instrumented\n */\nexport const destroyWalletProviders = async (\n { reason }: { reason?: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProviders = getAvailableWalletProvidersFromWalletAccounts(client);\n\n await Promise.all(\n walletProviders.map(async (walletProvider) => {\n if (!walletProvider.destroy) return;\n try {\n await walletProvider.destroy({ reason });\n } catch (err) {\n core.logger.error(\n `Error destroying wallet provider ${walletProvider.key}`,\n err\n );\n }\n })\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getCore } from '../../../client/core/getCore';\nimport { setCookie } from '../../../utils/setCookie';\nimport { createApiClient } from '../../apiClient';\nimport { emitEvent } from '../../clientEvents';\nimport { fetchProjectSettings } from '../../projectSettings/fetchProjectSettings';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { generateSessionKeys } from '../../sessionKeys/generateSessionKeys';\nimport { destroyWalletProviders } from '../../wallets/destroyWalletProviders';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport type { LogoutReason } from '../logoutReason';\n\n/**\n * Logs the user out with an explicit reason.\n *\n * Revokes the session, clears auth state, terminates wallet providers, and\n * emits the `logout` client event with the given reason. The reason is also\n * captured as an argument on the function-instrumentation event, which is\n * how Datadog distinguishes between different logout causes.\n *\n * Use this instead of the public `logout` when triggering a logout from\n * internal or extension code — the caller owns the reason string, so the\n * telemetry correctly attributes *why* the logout happened.\n *\n * @param params - The logout params.\n * @param params.reason - Why the logout is being triggered. Extension authors\n * needing a reason outside the SDK catalog can cast with `as LogoutReason`.\n * @param client - The Dynamic client instance.\n * @instrumented\n */\nexport const logoutWithReason = async (\n { reason }: { reason: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n core.logger.debug('[logoutWithReason] Logging out...', { reason });\n\n await destroyWalletProviders({ reason }, client);\n\n if (client.user !== null) {\n const apiClient = createApiClient({}, client);\n\n try {\n await apiClient.revokeSession({\n environmentId: core.environmentId,\n });\n } catch (error) {\n core.logger.error('Failed to revoke session', error);\n }\n\n /**\n * This deletes the auth cookie if it exists.\n * If the cookie doesn't exist, this sets a new cookie that expires immediately.\n */\n if (isCookieEnabled(client)) {\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`\n );\n }\n }\n\n await core.keychain.removeKey('session');\n\n core.state.set({\n captchaToken: null,\n elevatedAccessTokens: [],\n legacyToken: null,\n mfaToken: null,\n sessionExpiresAt: null,\n sessionKeys: null,\n token: null,\n unverifiedWalletAccounts: [],\n user: null,\n });\n\n emitEvent({ args: { reason }, event: 'logout' }, client);\n\n // Refetch project settings\n void fetchProjectSettings(client);\n\n // Regenerate session keys\n void generateSessionKeys(client);\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n * @instrumented\n * @redact-params\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n * @not-instrumented\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n * @not-instrumented\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":"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"}
|
package/dist/{isMfaRequiredForAction-BNgq1huY.esm.js → isMfaRequiredForAction-DZVNUtPY.esm.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as createApiClient, O as setCookie, U as isCookieEnabled, W as assertDefined, c as DYNAMIC_AUTH_COOKIE_NAME, ct as getCore, it as getDefaultClient, l as getWalletProviderFromWalletAccount, m as getWalletAccounts, q as instrumentFunction, st as BaseError, tt as CLIENT_SDK_NAME, w as emitEvent } from "./InvalidParamError-
|
|
1
|
+
import { A as createApiClient, O as setCookie, U as isCookieEnabled, W as assertDefined, c as DYNAMIC_AUTH_COOKIE_NAME, ct as getCore, it as getDefaultClient, l as getWalletProviderFromWalletAccount, m as getWalletAccounts, q as instrumentFunction, st as BaseError, tt as CLIENT_SDK_NAME, w as emitEvent } from "./InvalidParamError-BazEwozw.esm.js";
|
|
2
2
|
import * as z from "zod/mini";
|
|
3
3
|
|
|
4
4
|
//#region src/utils/retryOnFail/InvalidRetryOnFailCallError.ts
|
|
@@ -92,6 +92,7 @@ const PROJECT_SETTINGS_EXPIRATION_TIME = 1e3 * 60 * 5;
|
|
|
92
92
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
93
93
|
* @returns A promise that resolves to the updated project settings.
|
|
94
94
|
* @not-instrumented
|
|
95
|
+
* @noHook Internal settings fetch that is not part of the public hook surface.
|
|
95
96
|
*/
|
|
96
97
|
const fetchProjectSettings = async (client = getDefaultClient()) => {
|
|
97
98
|
const core = getCore(client);
|
|
@@ -315,4 +316,4 @@ const isMfaRequiredForAction = async ({ mfaAction }, client = getDefaultClient()
|
|
|
315
316
|
|
|
316
317
|
//#endregion
|
|
317
318
|
export { generateSessionKeys as a, isSignedIn as c, __logoutWithReason_wrapped as i, retryOnFail as l, getMfaMethods as n, fetchProjectSettings as o, __consumeMfaToken_wrapped as r, createStorageKeySchema as s, isMfaRequiredForAction as t };
|
|
318
|
-
//# sourceMappingURL=isMfaRequiredForAction-
|
|
319
|
+
//# sourceMappingURL=isMfaRequiredForAction-DZVNUtPY.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isMfaRequiredForAction-DZVNUtPY.esm.js","names":["walletProvidersMap: Map<string, WalletProvider>"],"sources":["../src/utils/retryOnFail/InvalidRetryOnFailCallError.ts","../src/utils/retryOnFail/retryOnFail.ts","../src/modules/auth/isSignedIn/isSignedIn.ts","../src/services/storage/createStorageKeySchema/createStorageKeySchema.ts","../src/modules/projectSettings/fetchProjectSettings/projectSettingsExpirationScheme.ts","../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts","../src/modules/sessionKeys/generateSessionKeys/generateSessionKeys.ts","../src/modules/wallets/utils/getAvailableWalletProvidersFromWalletAccounts/getAvailableWalletProvidersFromWalletAccounts.ts","../src/modules/wallets/destroyWalletProviders/destroyWalletProviders.ts","../src/modules/auth/logoutWithReason/logoutWithReason.ts","../src/modules/mfa/consumeMfaToken/consumeMfaToken.ts","../src/modules/mfa/getMfaMethods/getMfaMethods.ts","../src/modules/mfa/isMfaRequiredForAction/isMfaRequiredForAction.ts"],"sourcesContent":["import { BaseError } from '../../errors/base';\n\n/**\n * This error is thrown when the `retryOnFail` function is called with an invalid\n * number of retries (i.e. less than 0).\n */\nexport class InvalidRetryOnFailCallError extends BaseError {\n // eslint-disable-next-line custom-rules/require-single-object-param\n constructor(maxRetries: number) {\n super({\n cause: null,\n code: 'invalid_retry_on_fail_call_error',\n docsUrl: null,\n name: 'InvalidRetryOnFailCallError',\n shortMessage: `Invalid retries parameter for retryOnFail call: ${maxRetries}`,\n });\n }\n}\n","import { InvalidRetryOnFailCallError } from './InvalidRetryOnFailCallError';\n\nexport type RetryOnFailParams<T> = {\n /**\n * The delay between retries in milliseconds.\n */\n delay?: number;\n /**\n * The function to call.\n */\n fn: () => Promise<T>;\n /**\n * The maximum number of retries.\n *\n * When set to 0, the function will be called only once and is\n * therefore equivalent to calling the function directly.\n */\n maxRetries: number;\n};\n\n/** @not-instrumented */\nexport const retryOnFail = async <T>({\n delay = 0,\n fn,\n maxRetries,\n}: RetryOnFailParams<T>) => {\n for (let retry = 0; retry <= maxRetries; retry++) {\n try {\n return await fn();\n } catch (error) {\n if (retry >= maxRetries) {\n throw error;\n }\n\n if (delay > 0) {\n await new Promise((resolve) => setTimeout(resolve, delay));\n }\n }\n }\n\n /**\n * Reaching this point should never happen and this\n * error is thrown to help us debug the issue.\n */\n throw new InvalidRetryOnFailCallError(maxRetries);\n};\n","import { getDefaultClient } from '../../../client/defaultClient';\nimport { getWalletAccounts } from '../../wallets/getWalletAccounts';\n\n/**\n * Checks if the user is currently signed in to the Dynamic client.\n *\n * The client is considered to be in a signed in state if a user has\n * authenticated or if the client has at least one wallet connected.\n *\n * @deprecated What counts as \"signed in\" is your app's business logic, not the\n * SDK's. This helper bakes in one opinion (a user OR any connected wallet),\n * which rarely matches every app and forces a dependency on us for every\n * variation. Compose your own check from the underlying primitives instead —\n * e.g. `Boolean(client.user) || isAnyWalletAccountConnected(client)` — and\n * layer in whatever your app requires (device registration, completed\n * onboarding, satisfied MFA, a required embedded wallet, …). See the\n * \"Check if signed in\" guide:\n * https://www.dynamic.xyz/docs/javascript/user-session-management\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns True if the user is signed in, false otherwise.\n * @not-instrumented\n */\nexport const isSignedIn = (client = getDefaultClient()) =>\n Boolean(client.user || getWalletAccounts(client).length > 0);\n","import type * as z from 'zod/mini';\n\nimport type { StorageKeySchema, StorageKeySchemaConfig } from '../storage.types';\n\n/** @not-instrumented */\nexport const createStorageKeySchema = <T>(params: {\n config?: StorageKeySchemaConfig;\n key: string;\n schema: z.ZodMiniType<T>;\n}): StorageKeySchema<T> => {\n return params;\n};\n","import * as z from 'zod/mini';\n\nimport { createStorageKeySchema } from '../../../services/storage';\n\n/**\n * The schema to track the expiration time of the project settings.\n */\nexport const projectSettingsExpirationStorageKeySchema = createStorageKeySchema(\n {\n key: 'projectSettingsExpiration',\n schema: z.number(),\n }\n);\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { retryOnFail } from '../../../utils/retryOnFail';\nimport { createApiClient } from '../../apiClient';\nimport { CLIENT_SDK_NAME } from '../../apiClient/constants';\nimport { isSignedIn } from '../../auth/isSignedIn';\nimport { projectSettingsExpirationStorageKeySchema } from './projectSettingsExpirationScheme';\n\n/**\n * Expiration time of the project settings in milliseconds.\n */\nexport const PROJECT_SETTINGS_EXPIRATION_TIME = 1000 * 60 * 5; // 5 minutes\n\n/**\n * Fetches and updates the project settings from the API.\n *\n * This function retrieves the latest project configuration settings\n * from Dynamic's servers, including authentication options, enabled chains,\n * and security configurations. The settings are cached for performance.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the updated project settings.\n * @not-instrumented\n * @noHook Internal settings fetch that is not part of the public hook surface.\n */\nexport const fetchProjectSettings = async (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const currentExpiration = await core.storage.getItem(\n projectSettingsExpirationStorageKeySchema\n );\n\n const hasProjectSettings = Boolean(client.projectSettings);\n const isExpired = currentExpiration && currentExpiration < Date.now();\n\n // We want to cache the project settings if its valid and user is connected.\n // This avoids unnecessary API calls and speeds up the initial load.\n if (hasProjectSettings && !isExpired && isSignedIn(client)) {\n return client.projectSettings;\n }\n\n const apiClient = createApiClient({}, client);\n\n core.logger.debug('[fetchProjectSettings] Fetching project settings...');\n\n const doFetch = async () =>\n apiClient.getEnvironmentSettings(\n {\n environmentId: core.environmentId,\n sdkVersion: `${CLIENT_SDK_NAME}/${core.version}`,\n },\n {\n credentials: 'omit',\n }\n );\n\n const projectSettings = await retryOnFail({\n fn: doFetch,\n maxRetries: 2,\n });\n\n core.state.set({ projectSettings: projectSettings ?? null });\n\n await core.storage.setItem(\n projectSettingsExpirationStorageKeySchema,\n Date.now() + PROJECT_SETTINGS_EXPIRATION_TIME\n );\n\n return projectSettings;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types';\nimport { assertDefined } from '../../../utils/assertDefined';\nimport type { SessionKeys } from '../sessionKeys.types';\n\n/** @not-instrumented */\nexport const generateSessionKeys = async (\n client: DynamicClient\n): Promise<SessionKeys> => {\n const core = getCore(client);\n\n await core.keychain.removeKey('session');\n\n const publicKey = await core.keychain.generateKey('session');\n\n assertDefined(publicKey, 'Public key not found');\n\n core.state.set({\n sessionKeys: publicKey,\n });\n\n return { publicKey };\n};\n","import { getCore } from '../../../../client/core/getCore';\nimport type { DynamicClient } from '../../../../client/types';\nimport { getWalletAccounts } from '../../getWalletAccounts';\nimport type { WalletProvider } from '../../walletProvider';\nimport { getWalletProviderFromWalletAccount } from '../getWalletProviderFromWalletAccount';\n\n/** @not-instrumented */\nexport const getAvailableWalletProvidersFromWalletAccounts = (\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProvidersMap: Map<string, WalletProvider> = new Map();\n\n const walletAccounts = getWalletAccounts(client);\n\n walletAccounts.forEach((walletAccount) => {\n if (walletProvidersMap.has(walletAccount.walletProviderKey)) {\n return;\n }\n\n try {\n const walletProvider = getWalletProviderFromWalletAccount(\n {\n walletAccount,\n },\n client\n );\n\n walletProvidersMap.set(walletAccount.walletProviderKey, walletProvider);\n } catch (error) {\n core.logger.debug('Wallet provider not found for wallet account', {\n error,\n walletAccount: walletAccount.address,\n });\n }\n });\n\n return Array.from(walletProvidersMap.values());\n};\n","import { getCore } from '../../../client/core/getCore';\nimport type { DynamicClient } from '../../../client/types/DynamicClient';\nimport type { LogoutReason } from '../../auth/logoutReason';\nimport { getAvailableWalletProvidersFromWalletAccounts } from '../utils/getAvailableWalletProvidersFromWalletAccounts';\n\n/**\n * Tear down every wallet provider on the client.\n *\n * Each provider's `destroy` is responsible for its own local + remote\n * cleanup. We swallow errors so a failing destroy on one provider does not\n * block teardown of the others (e.g. during logout).\n *\n * @not-instrumented\n */\nexport const destroyWalletProviders = async (\n { reason }: { reason?: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n const walletProviders = getAvailableWalletProvidersFromWalletAccounts(client);\n\n await Promise.all(\n walletProviders.map(async (walletProvider) => {\n if (!walletProvider.destroy) return;\n try {\n await walletProvider.destroy({ reason });\n } catch (err) {\n core.logger.error(\n `Error destroying wallet provider ${walletProvider.key}`,\n err\n );\n }\n })\n );\n};\n","import type { DynamicClient } from '../../../client/types';\nimport { getCore } from '../../../client/core/getCore';\nimport { setCookie } from '../../../utils/setCookie';\nimport { createApiClient } from '../../apiClient';\nimport { emitEvent } from '../../clientEvents';\nimport { fetchProjectSettings } from '../../projectSettings/fetchProjectSettings';\nimport { isCookieEnabled } from '../../projectSettings/isCookieEnabled';\nimport { generateSessionKeys } from '../../sessionKeys/generateSessionKeys';\nimport { destroyWalletProviders } from '../../wallets/destroyWalletProviders';\nimport { DYNAMIC_AUTH_COOKIE_NAME } from '../consts';\nimport type { LogoutReason } from '../logoutReason';\n\n/**\n * Logs the user out with an explicit reason.\n *\n * Revokes the session, clears auth state, terminates wallet providers, and\n * emits the `logout` client event with the given reason. The reason is also\n * captured as an argument on the function-instrumentation event, which is\n * how Datadog distinguishes between different logout causes.\n *\n * Use this instead of the public `logout` when triggering a logout from\n * internal or extension code — the caller owns the reason string, so the\n * telemetry correctly attributes *why* the logout happened.\n *\n * @param params - The logout params.\n * @param params.reason - Why the logout is being triggered. Extension authors\n * needing a reason outside the SDK catalog can cast with `as LogoutReason`.\n * @param client - The Dynamic client instance.\n * @instrumented\n */\nexport const logoutWithReason = async (\n { reason }: { reason: LogoutReason },\n client: DynamicClient\n) => {\n const core = getCore(client);\n\n core.logger.debug('[logoutWithReason] Logging out...', { reason });\n\n await destroyWalletProviders({ reason }, client);\n\n if (client.user !== null) {\n const apiClient = createApiClient({}, client);\n\n try {\n await apiClient.revokeSession({\n environmentId: core.environmentId,\n });\n } catch (error) {\n core.logger.error('Failed to revoke session', error);\n }\n\n /**\n * This deletes the auth cookie if it exists.\n * If the cookie doesn't exist, this sets a new cookie that expires immediately.\n */\n if (isCookieEnabled(client)) {\n setCookie(\n `${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`\n );\n }\n }\n\n await core.keychain.removeKey('session');\n\n core.state.set({\n captchaToken: null,\n elevatedAccessTokens: [],\n legacyToken: null,\n mfaToken: null,\n sessionExpiresAt: null,\n sessionKeys: null,\n token: null,\n unverifiedWalletAccounts: [],\n user: null,\n });\n\n emitEvent({ args: { reason }, event: 'logout' }, client);\n\n // Refetch project settings\n void fetchProjectSettings(client);\n\n // Regenerate session keys\n void generateSessionKeys(client);\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { assertDefined } from '../../../utils/assertDefined';\n\n/**\n * Consumes and clears the current MFA token from the client state.\n *\n * This function retrieves the MFA token obtained from a successful MFA authentication,\n * and removes it from the client, to prevent it from being used again.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns The MFA token that was consumed.\n * @throws Error if no MFA token is found.\n * @instrumented\n * @redact-params\n */\nexport const consumeMfaToken = (client = getDefaultClient()) => {\n const core = getCore(client);\n\n const mfaToken = core.state.get().mfaToken;\n\n assertDefined(mfaToken, 'No MFA token found');\n\n core.state.set({\n mfaToken: null,\n });\n\n return mfaToken;\n};\n","import { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\n\n/**\n * Retrieves the available MFA methods for the current user.\n *\n * This function fetches information about which multi-factor authentication\n * methods are available and configured for the user's account.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the user's MFA methods configuration.\n * @not-instrumented\n */\nexport const getMfaMethods = async (client = getDefaultClient()) => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const userMfaMethods = await apiClient.getUserMfaMethods({\n environmentId: core.environmentId,\n verifiedOnly: true,\n });\n\n return userMfaMethods;\n};\n","import type { MFAAction } from '@dynamic-labs/sdk-api-core';\n\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { getMfaMethods } from '../getMfaMethods';\n\ntype IsMfaRequiredForActionParams = {\n mfaAction: MFAAction;\n};\n\n/**\n * Checks if MFA is required for a specific action.\n *\n * This function determines whether multi-factor authentication is required\n * for the specified action based on project settings and user configuration.\n *\n * @param params.mfaAction - The action to check MFA requirements for.\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to true if MFA is required for the action, false otherwise.\n * @not-instrumented\n */\nexport const isMfaRequiredForAction = async (\n { mfaAction }: IsMfaRequiredForActionParams,\n client = getDefaultClient()\n) => {\n const projectSettings = client.projectSettings;\n\n const isRequiredForAction = projectSettings?.security?.mfa?.actions?.some(\n (action) => action.action === mfaAction && action.required\n );\n\n // if mfa is not required for the action, return false\n // no matter if general mfa is set to required or not\n if (!isRequiredForAction) {\n return false;\n }\n\n const isMfaMethodRequired = projectSettings?.security?.mfa?.required;\n\n // if mfa is required for the action and also set as required in general, return true\n if (isMfaMethodRequired) {\n return true;\n }\n\n const mfaMethods = await getMfaMethods(client);\n // if general mfa is optional, but user has registered methods,\n // then it should be required for the action\n return mfaMethods.userHasVerifiedMfaMethods;\n};\n"],"mappings":"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"}
|
|
@@ -5,6 +5,7 @@ import type { SocialAccount } from '../social.types';
|
|
|
5
5
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6
6
|
* @returns An array of `SocialAccount` objects associated with the user.
|
|
7
7
|
* @not-instrumented
|
|
8
|
+
* @hook Exposed as a hook so consumers get the reactive list of social accounts, updated when the user changes.
|
|
8
9
|
*/
|
|
9
10
|
export declare const getUserSocialAccounts: (client?: import("../../../../exports").DynamicClient) => SocialAccount[];
|
|
10
11
|
//# sourceMappingURL=getUserSocialAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getUserSocialAccounts.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/social/getUserSocialAccounts/getUserSocialAccounts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AAErE
|
|
1
|
+
{"version":3,"file":"getUserSocialAccounts.d.ts","sourceRoot":"","sources":["../../../../../src/modules/auth/social/getUserSocialAccounts/getUserSocialAccounts.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,iBAAiB,CAAC;AAErE;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,4DAE/B,aAAa,EAoBf,CAAC"}
|
|
@@ -9,6 +9,7 @@ type CompleteSocialAuthenticationParams = {
|
|
|
9
9
|
* removed in a future major version.
|
|
10
10
|
*
|
|
11
11
|
* @instrumented
|
|
12
|
+
* @noHook Deprecated alias; the replacement is exposed via its own hook.
|
|
12
13
|
*/
|
|
13
14
|
export declare const completeSocialAuthentication: (params: CompleteSocialAuthenticationParams, client?: import("../../../../../exports").DynamicClient) => Promise<User | null>;
|
|
14
15
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"completeSocialAuthentication.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGxD,KAAK,kCAAkC,GAAG;IACxC,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"completeSocialAuthentication.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/completeSocialAuthentication/completeSocialAuthentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGxD,KAAK,kCAAkC,GAAG;IACxC,eAAe,CAAC,EAAE,UAAU,EAAE,CAAC;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,WAC/B,kCAAkC,8DAEzC,OAAO,CAAC,IAAI,GAAG,IAAI,CAA2C,CAAC"}
|
|
@@ -6,6 +6,7 @@ type DetectOAuthRedirectParams = {
|
|
|
6
6
|
* removed in a future major version.
|
|
7
7
|
*
|
|
8
8
|
* @not-instrumented
|
|
9
|
+
* @noHook Deprecated alias; the replacement is exposed via its own hook.
|
|
9
10
|
*/
|
|
10
11
|
export declare const detectOAuthRedirect: (params: DetectOAuthRedirectParams, client?: import("../../../../../exports").DynamicClient) => Promise<boolean>;
|
|
11
12
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"detectOAuthRedirect.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/detectOAuthRedirect/detectOAuthRedirect.ts"],"names":[],"mappings":"AAGA,KAAK,yBAAyB,GAAG;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"detectOAuthRedirect.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/auth/social/oauth/detectOAuthRedirect/detectOAuthRedirect.ts"],"names":[],"mappings":"AAGA,KAAK,yBAAyB,GAAG;IAC/B,GAAG,EAAE,GAAG,CAAC;CACV,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,WACtB,yBAAyB,8DAEhC,OAAO,CAAC,OAAO,CAA4C,CAAC"}
|
|
@@ -11,6 +11,7 @@ export type GetBalancesParams = GetTokenBalancesParams;
|
|
|
11
11
|
* multi-chain `getMultichainTokenBalances`.
|
|
12
12
|
*
|
|
13
13
|
* @not-instrumented
|
|
14
|
+
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
14
15
|
*/
|
|
15
16
|
export declare const getBalances: (params: GetTokenBalancesParams, client?: import("../../../exports").DynamicClient) => ReturnType<typeof getTokenBalances>;
|
|
16
17
|
//# sourceMappingURL=getBalances.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBalances.d.ts","sourceRoot":"","sources":["../../../../src/modules/balances/getBalances/getBalances.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"getBalances.d.ts","sourceRoot":"","sources":["../../../../src/modules/balances/getBalances/getBalances.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAGxE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AAEvD;;;;;;;;GAQG;AAGH,eAAO,MAAM,WAAW,WACd,sBAAsB,wDAE7B,UAAU,CAAC,OAAO,gBAAgB,CAAqC,CAAC"}
|
|
@@ -14,6 +14,7 @@ export type GetMultichainBalancesParams = GetMultichainTokenBalancesParams;
|
|
|
14
14
|
* token balances (not native-only) across multiple chains.
|
|
15
15
|
*
|
|
16
16
|
* @not-instrumented
|
|
17
|
+
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
17
18
|
*/
|
|
18
19
|
export declare const getMultichainBalances: (params: GetMultichainTokenBalancesParams, client?: import("../../../exports").DynamicClient) => ReturnType<typeof getMultichainTokenBalances>;
|
|
19
20
|
//# sourceMappingURL=getMultichainBalances.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMultichainBalances.d.ts","sourceRoot":"","sources":["../../../../src/modules/balances/getMultichainBalances/getMultichainBalances.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wCAAwC,EACxC,gCAAgC,EACjC,MAAM,0DAA0D,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAGtG;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC7C,wCAAwC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,CAAC;AAE3E
|
|
1
|
+
{"version":3,"file":"getMultichainBalances.d.ts","sourceRoot":"","sources":["../../../../src/modules/balances/getMultichainBalances/getMultichainBalances.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wCAAwC,EACxC,gCAAgC,EACjC,MAAM,0DAA0D,CAAC;AAClE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0DAA0D,CAAC;AAGtG;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAC7C,wCAAwC,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,CAAC;AAE3E;;;;;;;GAOG;AAGH,eAAO,MAAM,qBAAqB,WACxB,gCAAgC,wDAEvC,UAAU,CAAC,OAAO,0BAA0B,CACH,CAAC"}
|
|
@@ -11,6 +11,7 @@ import type { DynamicEvents, EmitEventParams, OffEventParams, OnEventParams, Onc
|
|
|
11
11
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
12
12
|
* @returns A function that can be called to remove the listener.
|
|
13
13
|
* @not-instrumented
|
|
14
|
+
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
14
15
|
*/
|
|
15
16
|
export declare const onEvent: <E extends keyof DynamicEvents>({ event, listener }: OnEventParams<E>, client?: DynamicClient) => () => void;
|
|
16
17
|
/**
|
|
@@ -36,6 +37,7 @@ export declare const offEvent: <E extends keyof DynamicEvents>({ event, listener
|
|
|
36
37
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
37
38
|
* @returns A function that can be called to remove the listener before it fires.
|
|
38
39
|
* @not-instrumented
|
|
40
|
+
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
39
41
|
*/
|
|
40
42
|
export declare const onceEvent: <E extends keyof DynamicEvents>({ event, listener }: OnceEventParams<E>, client?: DynamicClient) => () => void;
|
|
41
43
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientEvents.d.ts","sourceRoot":"","sources":["../../../src/modules/clientEvents/clientEvents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B
|
|
1
|
+
{"version":3,"file":"clientEvents.d.ts","sourceRoot":"","sources":["../../../src/modules/clientEvents/clientEvents.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,aAAa,EACb,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,aAAa,uBAC9B,aAAa,CAAC,CAAC,CAAC,uCAUtC,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,aAAa,uBAC/B,cAAc,CAAC,CAAC,CAAC,iCAMvC,CAAC;AAEF;;;;;;;;;;;;GAYG;AAEH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,aAAa,uBAChC,eAAe,CAAC,CAAC,CAAC,uCAUxC,CAAC;AAEF;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,MAAM,aAAa,mBACpC,eAAe,CAAC,CAAC,CAAC,UAC3B,aAAa,SAKtB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DynamicClient } from '../../../client/types';
|
|
2
|
+
import type { Flow } from '../flow.types';
|
|
3
|
+
export type BroadcastFlowParams = {
|
|
4
|
+
flowId: string;
|
|
5
|
+
/**
|
|
6
|
+
* The on-chain transaction hash. Required for wallet sources, optional
|
|
7
|
+
* for exchange sources (the user may not have it).
|
|
8
|
+
*/
|
|
9
|
+
txHash?: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Records that a flow transaction has been broadcasted.
|
|
13
|
+
*
|
|
14
|
+
* For wallet sources, pass the `txHash` from the on-chain transaction.
|
|
15
|
+
* For exchange sources, `txHash` can be omitted — the user confirms
|
|
16
|
+
* they completed the payment and the flow moves to `broadcasted`.
|
|
17
|
+
*
|
|
18
|
+
* @param params BroadcastFlowParams - The flow ID and optional tx hash.
|
|
19
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
20
|
+
* @returns The updated flow
|
|
21
|
+
* @instrumented
|
|
22
|
+
*/
|
|
23
|
+
export declare const broadcastFlow: ({ flowId, txHash }: BroadcastFlowParams, client?: DynamicClient) => Promise<Flow>;
|
|
24
|
+
//# sourceMappingURL=broadcastFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"broadcastFlow.d.ts","sourceRoot":"","sources":["../../../../src/modules/flow/broadcastFlow/broadcastFlow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAI1C,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,uBACJ,mBAAmB,WAC/B,aAAa,KACpB,OAAO,CAAC,IAAI,CAmBd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/flow/broadcastFlow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Flow } from '../flow.types';
|
|
2
|
+
export type CancelFlowParams = {
|
|
3
|
+
flowId: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Cancels a flow before it has been broadcasted
|
|
7
|
+
*
|
|
8
|
+
* @param params CancelFlowParams - The flow to cancel.
|
|
9
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
10
|
+
* @returns The cancelled flow
|
|
11
|
+
* @instrumented
|
|
12
|
+
*/
|
|
13
|
+
export declare const cancelFlow: ({ flowId }: CancelFlowParams, client?: import("../../../exports").DynamicClient) => Promise<Flow>;
|
|
14
|
+
//# sourceMappingURL=cancelFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cancelFlow.d.ts","sourceRoot":"","sources":["../../../../src/modules/flow/cancelFlow/cancelFlow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAK1C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,eACT,gBAAgB,wDAE3B,OAAO,CAAC,IAAI,CAsBd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/flow/cancelFlow/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/flow/submitFlowTransaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { WalletAccount } from '../../wallets/walletAccount';
|
|
2
|
+
import type { Flow } from '../flow.types';
|
|
3
|
+
import { type PrepareFlowSigningParams } from '../prepareFlowSigning';
|
|
4
|
+
export type SubmitFlowTransactionParams = {
|
|
5
|
+
flowId: string;
|
|
6
|
+
onStepChange?: (step: 'approval' | 'transaction') => void;
|
|
7
|
+
walletAccount: WalletAccount;
|
|
8
|
+
} & PrepareFlowSigningParams;
|
|
9
|
+
/**
|
|
10
|
+
* Prepares, signs, and broadcasts a flow transaction in one call.
|
|
11
|
+
*
|
|
12
|
+
* Orchestrates the full submission flow:
|
|
13
|
+
* 1. Calls prepareFlowSigning to advance to signing state and lock the quote
|
|
14
|
+
* 2. Ensures the wallet is on the correct network for the transaction
|
|
15
|
+
* 3. Delegates on-chain signing to the wallet provider's executeSwapTransaction method
|
|
16
|
+
* 4. Calls broadcastFlow with the resulting txHash
|
|
17
|
+
*
|
|
18
|
+
* @param params SubmitFlowTransactionParams - The flow ID, wallet account, and optional step callback.
|
|
19
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
20
|
+
* @returns The broadcasted flow
|
|
21
|
+
* @instrumented
|
|
22
|
+
*/
|
|
23
|
+
export declare const submitFlowTransaction: ({ onStepChange, flowId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount, }: SubmitFlowTransactionParams, client?: import("../../../exports").DynamicClient) => Promise<Flow>;
|
|
24
|
+
//# sourceMappingURL=submitFlowTransaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submitFlowTransaction.d.ts","sourceRoot":"","sources":["../../../../src/modules/flow/submitFlowTransaction/submitFlowTransaction.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEjE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,aAAa,KAAK,IAAI,CAAC;IAC1D,aAAa,EAAE,aAAa,CAAC;CAC9B,GAAG,wBAAwB,CAAC;AAE7B;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,qBAAqB,sGAO7B,2BAA2B,wDAE7B,OAAO,CAAC,IAAI,CAuBd,CAAC"}
|
|
@@ -13,6 +13,7 @@ type AddCoinbaseOnrampOrderEventListenerParams = {
|
|
|
13
13
|
* @throws {ValueMustBeDefinedError} If the window is not available.
|
|
14
14
|
* @docs https://docs.cdp.coinbase.com/onramp-&-offramp/onramp-apis/apple-pay-onramp-api#events-names
|
|
15
15
|
* @not-instrumented
|
|
16
|
+
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
16
17
|
*/
|
|
17
18
|
export declare const addCoinbaseOnrampOrderEventListener: ({ listener }: AddCoinbaseOnrampOrderEventListenerParams, client?: import("../../../../exports").DynamicClient) => VoidFunction;
|
|
18
19
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addCoinbaseOnrampOrderEventListener.d.ts","sourceRoot":"","sources":["../../../../../src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.ts"],"names":[],"mappings":"AAMA,KAAK,yCAAyC,GAAG;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;KACnB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"addCoinbaseOnrampOrderEventListener.d.ts","sourceRoot":"","sources":["../../../../../src/modules/funding/coinbase/addCoinbaseOnrampOrderEventListener/addCoinbaseOnrampOrderEventListener.ts"],"names":[],"mappings":"AAMA,KAAK,yCAAyC,GAAG;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE;QAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9B,SAAS,EAAE,MAAM,CAAC;KACnB,KAAK,IAAI,CAAC;CACZ,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,iBAChC,yCAAyC,2DAEtD,YA6CF,CAAC"}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @returns A promise that resolves when initialization is complete.
|
|
12
12
|
* @throws ClientAlreadyInitializedError If the client is already initialized.
|
|
13
13
|
* @instrumented
|
|
14
|
+
* @noHook Client lifecycle management is not exposed as a React hook.
|
|
14
15
|
*/
|
|
15
16
|
export declare const initializeClient: (client?: import("../../exports").DynamicClient) => Promise<void>;
|
|
16
17
|
//# sourceMappingURL=initializeClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initializeClient.d.ts","sourceRoot":"","sources":["../../../src/modules/initializeClient/initializeClient.ts"],"names":[],"mappings":"AAwBA
|
|
1
|
+
{"version":3,"file":"initializeClient.d.ts","sourceRoot":"","sources":["../../../src/modules/initializeClient/initializeClient.ts"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gBAAgB,mEAqK5B,CAAC"}
|
package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @returns a promise that resolves once the client is fully initialized.
|
|
6
6
|
* @not-instrumented
|
|
7
|
+
* @noHook Client lifecycle management is not exposed as a hook; use useInitStatus.
|
|
7
8
|
*/
|
|
8
9
|
export declare const waitForClientInitialized: (client?: import("../../../exports").DynamicClient) => Promise<void>;
|
|
9
10
|
//# sourceMappingURL=waitForClientInitialized.d.ts.map
|
package/dist/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitForClientInitialized.d.ts","sourceRoot":"","sources":["../../../../src/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"waitForClientInitialized.d.ts","sourceRoot":"","sources":["../../../../src/modules/initializeClient/waitForClientInitialized/waitForClientInitialized.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,sEAIpC,CAAC"}
|
|
@@ -12,6 +12,7 @@ export declare const PROJECT_SETTINGS_EXPIRATION_TIME: number;
|
|
|
12
12
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
13
13
|
* @returns A promise that resolves to the updated project settings.
|
|
14
14
|
* @not-instrumented
|
|
15
|
+
* @noHook Internal settings fetch that is not part of the public hook surface.
|
|
15
16
|
*/
|
|
16
17
|
export declare const fetchProjectSettings: (client?: import("../../../exports").DynamicClient) => Promise<import("@dynamic-labs/sdk-api-core").ProjectSettings | null>;
|
|
17
18
|
//# sourceMappingURL=fetchProjectSettings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchProjectSettings.d.ts","sourceRoot":"","sources":["../../../../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AAE9D
|
|
1
|
+
{"version":3,"file":"fetchProjectSettings.d.ts","sourceRoot":"","sources":["../../../../src/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.ts"],"names":[],"mappings":"AAQA;;GAEG;AACH,eAAO,MAAM,gCAAgC,QAAgB,CAAC;AAE9D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,6HA4ChC,CAAC"}
|
|
@@ -8,6 +8,7 @@ import type { SdkUser } from '@dynamic-labs/sdk-api-core';
|
|
|
8
8
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
9
9
|
* @returns A promise that resolves to the authenticated user.
|
|
10
10
|
* @instrumented
|
|
11
|
+
* @noHook Low-level refresh primitive that is not exposed as a React hook.
|
|
11
12
|
*/
|
|
12
13
|
export declare const refreshUser: (client?: import("../../../exports").DynamicClient) => Promise<SdkUser>;
|
|
13
14
|
//# sourceMappingURL=refreshUser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshUser.d.ts","sourceRoot":"","sources":["../../../../src/modules/user/refreshUser/refreshUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAO1D
|
|
1
|
+
{"version":3,"file":"refreshUser.d.ts","sourceRoot":"","sources":["../../../../src/modules/user/refreshUser/refreshUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAO1D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,yDAErB,OAAO,CAAC,OAAO,CAejB,CAAC"}
|
|
@@ -10,6 +10,7 @@ import type { WalletAccount } from '../walletAccount';
|
|
|
10
10
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
11
11
|
* @returns An array of wallet accounts associated with the session.
|
|
12
12
|
* @not-instrumented
|
|
13
|
+
* @hook Exposed as a hook so consumers get the reactive list of wallet accounts.
|
|
13
14
|
*/
|
|
14
15
|
export declare const getWalletAccounts: (client?: import("../../../exports").DynamicClient) => WalletAccount[];
|
|
15
16
|
//# sourceMappingURL=getWalletAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getWalletAccounts.d.ts","sourceRoot":"","sources":["../../../../src/modules/wallets/getWalletAccounts/getWalletAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD
|
|
1
|
+
{"version":3,"file":"getWalletAccounts.d.ts","sourceRoot":"","sources":["../../../../src/modules/wallets/getWalletAccounts/getWalletAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,iBAAiB,yDAE3B,aAAa,EAKf,CAAC"}
|
|
@@ -7,6 +7,7 @@ type GetBalanceParams = Parameters<typeof getNativeBalance>[0];
|
|
|
7
7
|
* `getMultichainTokenBalances`).
|
|
8
8
|
*
|
|
9
9
|
* @not-instrumented
|
|
10
|
+
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
10
11
|
*/
|
|
11
12
|
export declare const getBalance: (params: GetBalanceParams, client?: import("../../../../exports").DynamicClient) => ReturnType<typeof getNativeBalance>;
|
|
12
13
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../../../../src/modules/wallets/networks/getBalance/getBalance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D
|
|
1
|
+
{"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../../../../src/modules/wallets/networks/getBalance/getBalance.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/D;;;;;;;;GAQG;AAGH,eAAO,MAAM,UAAU,WACb,gBAAgB,2DAEvB,UAAU,CAAC,OAAO,gBAAgB,CAAqC,CAAC"}
|
|
@@ -5,6 +5,7 @@ type SelectPrimaryWalletAccountParams = {
|
|
|
5
5
|
/**
|
|
6
6
|
* Make the wallet account provided as the primary wallet account.
|
|
7
7
|
* @instrumented
|
|
8
|
+
* @noHook The primary-wallet concept is discouraged and not exposed as a hook.
|
|
8
9
|
*/
|
|
9
10
|
export declare const selectPrimaryWalletAccount: ({ walletAccount }: SelectPrimaryWalletAccountParams, client?: import("../../../../exports").DynamicClient) => Promise<void>;
|
|
10
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectPrimaryWalletAccount.d.ts","sourceRoot":"","sources":["../../../../../src/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,KAAK,gCAAgC,GAAG;IACtC,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"selectPrimaryWalletAccount.d.ts","sourceRoot":"","sources":["../../../../../src/modules/wallets/primaryWalletAccount/selectPrimaryWalletAccount/selectPrimaryWalletAccount.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,KAAK,gCAAgC,GAAG;IACtC,aAAa,EAAE,aAAa,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,sBAClB,gCAAgC,2DAElD,OAAO,CAAC,IAAI,CAiCd,CAAC"}
|
package/dist/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type OnWalletProviderEventParams<E extends Extract<keyof WalletProviderEv
|
|
|
13
13
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
14
14
|
* @returns A function that can be called to remove the listener.
|
|
15
15
|
* @not-instrumented
|
|
16
|
+
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
16
17
|
*/
|
|
17
18
|
export declare const onWalletProviderEvent: <E extends Extract<keyof WalletProviderEvents, string>>({ callback, event, walletProviderKey }: OnWalletProviderEventParams<E>, client?: import("../../../../../exports").DynamicClient) => () => void;
|
|
18
19
|
//# sourceMappingURL=onWalletProviderEvent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onWalletProviderEvent.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,MAAM,2BAA2B,CACrC,CAAC,SAAS,OAAO,CAAC,MAAM,oBAAoB,EAAE,MAAM,CAAC,IACnD;IACF,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,CAAC;IACT,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"onWalletProviderEvent.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/wallets/walletProvider/events/onWalletProviderEvent/onWalletProviderEvent.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAE1E,MAAM,MAAM,2BAA2B,CACrC,CAAC,SAAS,OAAO,CAAC,MAAM,oBAAoB,EAAE,MAAM,CAAC,IACnD;IACF,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,CAAC;IACT,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,qBAAqB,GAChC,CAAC,SAAS,OAAO,CAAC,MAAM,oBAAoB,EAAE,MAAM,CAAC,0CAEb,2BAA2B,CAAC,CAAC,CAAC,wEAevE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
2
|
-
const require_getWalletProviderByKey = require('./getWalletProviderByKey-
|
|
1
|
+
const require_InvalidParamError = require('./InvalidParamError-CMesesy6.cjs');
|
|
2
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-1zHjzqbz.cjs');
|
|
3
3
|
|
|
4
4
|
//#region src/modules/user/refreshAuth/refreshAuth.ts
|
|
5
5
|
/**
|
|
@@ -40,4 +40,4 @@ Object.defineProperty(exports, '__refreshAuth_wrapped', {
|
|
|
40
40
|
return __refreshAuth_wrapped;
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
//# sourceMappingURL=refreshAuth-
|
|
43
|
+
//# sourceMappingURL=refreshAuth-CKcNynMk.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshAuth-
|
|
1
|
+
{"version":3,"file":"refreshAuth-CKcNynMk.cjs","names":[],"sources":["../src/modules/user/refreshAuth/refreshAuth.ts"],"sourcesContent":["import type { VerifyResponse } from '@dynamic-labs/sdk-api-core';\n\nimport { getCore } from '../../../client/core/getCore';\nimport { getDefaultClient } from '../../../client/defaultClient';\nimport { createApiClient } from '../../apiClient';\nimport { updateAuthFromVerifyResponse } from '../../auth/updateAuthFromVerifyResponse';\n\n/**\n * Refreshes the current user's data from the server.\n *\n * This function fetches the latest user information and token from the backend\n * updating the local user and token states with any changes.\n *\n * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.\n * @returns A promise that resolves to the verify response.\n * @instrumented\n * @redact-params\n */\nexport const refreshAuth = async (\n client = getDefaultClient()\n): Promise<VerifyResponse> => {\n const core = getCore(client);\n const apiClient = createApiClient({}, client);\n\n const response = await apiClient.refreshAuth({\n environmentId: core.environmentId,\n });\n\n updateAuthFromVerifyResponse({ response }, client);\n\n return response;\n};\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAE,cAAa,OACb,SAAM,4CAAY;CAElB,MAAM,OAAA,kCAAW,OAAM;wBACN,0CAAK,EAAa,EAAA,OAAA,eAGnC,eAAA,KAAA;AAGD,6DAAA,EAAA,UAAA,EAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { J as getDefaultClient, L as instrumentFunction, Q as getCore, b as createApiClient } from "./InvalidParamError-
|
|
2
|
-
import { r as updateAuthFromVerifyResponse } from "./getWalletProviderByKey-
|
|
1
|
+
import { J as getDefaultClient, L as instrumentFunction, Q as getCore, b as createApiClient } from "./InvalidParamError-BUpLSb5x.native.esm.js";
|
|
2
|
+
import { r as updateAuthFromVerifyResponse } from "./getWalletProviderByKey-CAQkYCGi.native.esm.js";
|
|
3
3
|
|
|
4
4
|
//#region src/modules/user/refreshAuth/refreshAuth.ts
|
|
5
5
|
/**
|
|
@@ -35,4 +35,4 @@ const __refreshAuth_wrapped = instrumentFunction({
|
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
37
|
export { __refreshAuth_wrapped as t };
|
|
38
|
-
//# sourceMappingURL=refreshAuth-
|
|
38
|
+
//# sourceMappingURL=refreshAuth-Cl3adySI.native.esm.js.map
|