@dynamic-labs-sdk/client 1.16.1 → 1.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +53 -53
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +5 -5
- package/dist/core.native.esm.js +5 -5
- package/dist/exports/index.d.ts +2 -2
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/exports/waas.d.ts +2 -1
- package/dist/exports/waas.d.ts.map +1 -1
- package/dist/exports/waasCore.d.ts +3 -2
- package/dist/exports/waasCore.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-D79icjmX.native.esm.js → getNetworkProviderFromNetworkId-Bfg-NkNJ.native.esm.js} +12 -4
- package/dist/getNetworkProviderFromNetworkId-Bfg-NkNJ.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BHxkTbiJ.cjs → getNetworkProviderFromNetworkId-CS4r9hi7.cjs} +43 -44
- package/dist/{getNetworkProviderFromNetworkId-BHxkTbiJ.cjs.map → getNetworkProviderFromNetworkId-CS4r9hi7.cjs.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BPeOK1Xx.esm.js → getNetworkProviderFromNetworkId-pknqqhk1.esm.js} +2 -3
- package/dist/{getNetworkProviderFromNetworkId-BPeOK1Xx.esm.js.map → getNetworkProviderFromNetworkId-pknqqhk1.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-DzjHW7Rw.esm.js → getSignedSessionId-CUw7LJ35.esm.js} +3 -3
- package/dist/{getSignedSessionId-DzjHW7Rw.esm.js.map → getSignedSessionId-CUw7LJ35.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-Dh4Df1mY.native.esm.js → getSignedSessionId-Cl3PEqa8.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-Dh4Df1mY.native.esm.js.map → getSignedSessionId-Cl3PEqa8.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-BjSUL8Br.cjs → getSignedSessionId-cMGkmojJ.cjs} +11 -11
- package/dist/{getSignedSessionId-BjSUL8Br.cjs.map → getSignedSessionId-cMGkmojJ.cjs.map} +1 -1
- package/dist/getWalletProviderByKey-24co0tBE.native.esm.js +20 -0
- package/dist/getWalletProviderByKey-24co0tBE.native.esm.js.map +1 -0
- package/dist/getWalletProviderByKey-CP9Te5Sz.cjs +31 -0
- package/dist/getWalletProviderByKey-CP9Te5Sz.cjs.map +1 -0
- package/dist/getWalletProviderByKey-lQVfIGFi.esm.js +20 -0
- package/dist/getWalletProviderByKey-lQVfIGFi.esm.js.map +1 -0
- package/dist/index.cjs +560 -541
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +29 -28
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +29 -28
- package/dist/index.native.esm.js.map +1 -1
- package/dist/isDynamicWaasEnabled-BXe0VyI4.native.esm.js +70 -0
- package/dist/isDynamicWaasEnabled-BXe0VyI4.native.esm.js.map +1 -0
- package/dist/isDynamicWaasEnabled-BYaqAOml.esm.js +70 -0
- package/dist/isDynamicWaasEnabled-BYaqAOml.esm.js.map +1 -0
- package/dist/isDynamicWaasEnabled-BwP1oowd.cjs +88 -0
- package/dist/isDynamicWaasEnabled-BwP1oowd.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-3fWX5MEF.cjs → isMfaRequiredForAction-Btejc5g3.cjs} +38 -29
- package/dist/isMfaRequiredForAction-Btejc5g3.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-CkX6CfJf.esm.js → isMfaRequiredForAction-CqEcCTIe.esm.js} +11 -2
- package/dist/isMfaRequiredForAction-CqEcCTIe.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-CBW-d9C6.native.esm.js → isMfaRequiredForAction-Demz9zlH.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CBW-d9C6.native.esm.js.map → isMfaRequiredForAction-Demz9zlH.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-D0JrQGvR.cjs → isUserOnboardingComplete-C86NDY7I.cjs} +13 -13
- package/dist/{isUserOnboardingComplete-D0JrQGvR.cjs.map → isUserOnboardingComplete-C86NDY7I.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-C4_b3pDb.esm.js → isUserOnboardingComplete-CBrAH0ZF.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-C4_b3pDb.esm.js.map → isUserOnboardingComplete-CBrAH0ZF.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-m6E6GbB0.native.esm.js → isUserOnboardingComplete-Cr-YTpcU.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-m6E6GbB0.native.esm.js.map → isUserOnboardingComplete-Cr-YTpcU.native.esm.js.map} +1 -1
- package/dist/migrateFromFireblocks-B_q8Oawb.cjs +82 -0
- package/dist/migrateFromFireblocks-B_q8Oawb.cjs.map +1 -0
- package/dist/migrateFromFireblocks-Bbx2wHZD.esm.js +65 -0
- package/dist/migrateFromFireblocks-Bbx2wHZD.esm.js.map +1 -0
- package/dist/migrateFromFireblocks-D-J6-gRo.native.esm.js +65 -0
- package/dist/migrateFromFireblocks-D-J6-gRo.native.esm.js.map +1 -0
- package/dist/modules/flow/attachFlowSource/attachFlowSource.d.ts.map +1 -1
- package/dist/modules/sessionKeys/generateSessionKeys/generateSessionKeys.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/migrateFromFireblocks/index.d.ts +2 -0
- package/dist/modules/waas/migrateFromFireblocks/index.d.ts.map +1 -0
- package/dist/modules/waas/migrateFromFireblocks/migrateFromFireblocks.d.ts +52 -0
- package/dist/modules/waas/migrateFromFireblocks/migrateFromFireblocks.d.ts.map +1 -0
- package/dist/modules/waas/waas.types.d.ts +9 -1
- package/dist/modules/waas/waas.types.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts +1 -1
- package/dist/modules/wallets/networks/getTransactionHistory/getTransactionHistory.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/events.d.ts +2 -1
- package/dist/modules/wallets/walletProviderRegistry/events.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{InvalidParamError-DCpeZMBr.cjs → updateAuthFromVerifyResponse-CElYpi97.cjs} +291 -9
- package/dist/updateAuthFromVerifyResponse-CElYpi97.cjs.map +1 -0
- package/dist/{InvalidParamError-5AXtm6Zp.native.esm.js → updateAuthFromVerifyResponse-D1w-Aw9P.native.esm.js} +457 -4
- package/dist/updateAuthFromVerifyResponse-D1w-Aw9P.native.esm.js.map +1 -0
- package/dist/{InvalidParamError-PQ2Xen_o.esm.js → updateAuthFromVerifyResponse-azIi_3FB.esm.js} +237 -3
- package/dist/updateAuthFromVerifyResponse-azIi_3FB.esm.js.map +1 -0
- package/dist/waas.cjs +53 -67
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +5 -20
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +5 -20
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +40 -23
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +23 -7
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +23 -7
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +3 -3
- package/dist/InvalidParamError-5AXtm6Zp.native.esm.js.map +0 -1
- package/dist/InvalidParamError-DCpeZMBr.cjs.map +0 -1
- package/dist/InvalidParamError-PQ2Xen_o.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-D79icjmX.native.esm.js.map +0 -1
- package/dist/getWaasWalletProviderFromWalletAccount-BxyUZBpT.cjs +0 -19
- package/dist/getWaasWalletProviderFromWalletAccount-BxyUZBpT.cjs.map +0 -1
- package/dist/getWaasWalletProviderFromWalletAccount-Ca0SiNEz.native.esm.js +0 -14
- package/dist/getWaasWalletProviderFromWalletAccount-Ca0SiNEz.native.esm.js.map +0 -1
- package/dist/getWaasWalletProviderFromWalletAccount-CupLo7EC.esm.js +0 -14
- package/dist/getWaasWalletProviderFromWalletAccount-CupLo7EC.esm.js.map +0 -1
- package/dist/getWalletProviderByKey-B6vtKHJy.esm.js +0 -255
- package/dist/getWalletProviderByKey-B6vtKHJy.esm.js.map +0 -1
- package/dist/getWalletProviderByKey-DIFBlGlR.cjs +0 -321
- package/dist/getWalletProviderByKey-DIFBlGlR.cjs.map +0 -1
- package/dist/getWalletProviderByKey-Dh2qnBmw.native.esm.js +0 -474
- package/dist/getWalletProviderByKey-Dh2qnBmw.native.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-A8Humh0r.cjs +0 -49
- package/dist/isDynamicWaasEnabled-A8Humh0r.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-BmWqrgz1.esm.js +0 -37
- package/dist/isDynamicWaasEnabled-BmWqrgz1.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-Djp4QuBw.native.esm.js +0 -37
- package/dist/isDynamicWaasEnabled-Djp4QuBw.native.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-3fWX5MEF.cjs.map +0 -1
- package/dist/isMfaRequiredForAction-CkX6CfJf.esm.js.map +0 -1
- package/dist/refreshAuth-BKeW1dSq.cjs +0 -43
- package/dist/refreshAuth-BKeW1dSq.cjs.map +0 -1
- package/dist/refreshAuth-Cykyxvpz.native.esm.js +0 -38
- package/dist/refreshAuth-Cykyxvpz.native.esm.js.map +0 -1
- package/dist/refreshAuth-LzA2xxNC.esm.js +0 -38
- package/dist/refreshAuth-LzA2xxNC.esm.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
2
|
-
const
|
|
3
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-D0JrQGvR.cjs');
|
|
1
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-Btejc5g3.cjs');
|
|
2
|
+
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CElYpi97.cjs');
|
|
3
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-CS4r9hi7.cjs');
|
|
4
|
+
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-BwP1oowd.cjs');
|
|
5
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-C86NDY7I.cjs');
|
|
6
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-CP9Te5Sz.cjs');
|
|
8
7
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
9
8
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
10
9
|
let zod_mini = require("zod/mini");
|
|
@@ -34,8 +33,8 @@ const stateChangeEvents = {
|
|
|
34
33
|
//#region src/utils/getNonce/prefetchNoncesIfNeeded/prefetchNoncesIfNeeded.ts
|
|
35
34
|
/** @notInstrumented */
|
|
36
35
|
const prefetchNoncesIfNeeded = async (client) => {
|
|
37
|
-
if (
|
|
38
|
-
await
|
|
36
|
+
if (require_updateAuthFromVerifyResponse.getCore(client).state.get().prefetchedNonces.length >= require_updateAuthFromVerifyResponse.NONCE_POOL_SIZE) return;
|
|
37
|
+
await require_updateAuthFromVerifyResponse.fetchAndStoreNonces(client);
|
|
39
38
|
};
|
|
40
39
|
|
|
41
40
|
//#endregion
|
|
@@ -85,7 +84,7 @@ const setLongTimeout = ({ callback, delay }) => {
|
|
|
85
84
|
* @notInstrumented
|
|
86
85
|
*/
|
|
87
86
|
const initializeAuth = (client) => {
|
|
88
|
-
const core =
|
|
87
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
89
88
|
let clearExpirationTimeout = null;
|
|
90
89
|
const onChangeExpiration = require_getNetworkProviderFromNetworkId.subscribeWithSelector(core.state, (state) => state.sessionExpiresAt);
|
|
91
90
|
const checkExpiration = () => {
|
|
@@ -127,13 +126,13 @@ const initializeAuth = (client) => {
|
|
|
127
126
|
* @notInstrumented
|
|
128
127
|
*/
|
|
129
128
|
const setupCrossTabEventSync = (client) => {
|
|
130
|
-
const core =
|
|
129
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
131
130
|
const handleDeviceRegistrationCompleted = () => {
|
|
132
131
|
core.crossTabBroadcast.send({ event: "deviceRegistrationCompleted" });
|
|
133
132
|
};
|
|
134
133
|
core.eventEmitter.on("deviceRegistrationCompleted", handleDeviceRegistrationCompleted);
|
|
135
134
|
const handleCrossTabDeviceRegistrationCompleted = () => {
|
|
136
|
-
|
|
135
|
+
require_updateAuthFromVerifyResponse.emitEvent({ event: "deviceRegistrationCompletedInAnotherTab" }, client);
|
|
137
136
|
};
|
|
138
137
|
core.crossTabBroadcast.on("deviceRegistrationCompleted", handleCrossTabDeviceRegistrationCompleted);
|
|
139
138
|
};
|
|
@@ -193,7 +192,7 @@ const sessionStorageKeySchema = require_isMfaRequiredForAction.createStorageKeyS
|
|
|
193
192
|
|
|
194
193
|
//#endregion
|
|
195
194
|
//#region src/modules/keychainMigration/migrateSessionKeyToKeychain/KeyMigrationError.ts
|
|
196
|
-
var KeyMigrationError = class extends
|
|
195
|
+
var KeyMigrationError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
197
196
|
constructor(expectedPublicKey, importedPublicKey) {
|
|
198
197
|
super({
|
|
199
198
|
cause: null,
|
|
@@ -263,10 +262,10 @@ const migrateSessionKeyToKeychain = async ({ keychain, logger, state, storage })
|
|
|
263
262
|
//#region src/modules/state/raiseStateEvents/raiseStateEvents.ts
|
|
264
263
|
/** @notInstrumented */
|
|
265
264
|
const raiseStateEvents = (client) => {
|
|
266
|
-
|
|
265
|
+
require_updateAuthFromVerifyResponse.getCore(client).state.subscribe((value, previous) => {
|
|
267
266
|
Object.entries(stateChangeEvents).forEach(([key, event]) => {
|
|
268
267
|
if (require_getNetworkProviderFromNetworkId.isEqualShallow(value[key], previous[key])) return;
|
|
269
|
-
|
|
268
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
270
269
|
args: { [key]: value[key] },
|
|
271
270
|
event
|
|
272
271
|
}, client);
|
|
@@ -278,7 +277,7 @@ const raiseStateEvents = (client) => {
|
|
|
278
277
|
//#region src/modules/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.ts
|
|
279
278
|
/** @notInstrumented */
|
|
280
279
|
const hydrateStateWithStorage = async (client) => {
|
|
281
|
-
const core =
|
|
280
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
282
281
|
const previousState = core.state.get();
|
|
283
282
|
const stateChanges = {};
|
|
284
283
|
const session = await core.storage.getItem(sessionStorageKeySchema);
|
|
@@ -298,7 +297,7 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
298
297
|
stateChanges.sessionKeys = session.sessionKeys;
|
|
299
298
|
}
|
|
300
299
|
const storedState = await core.storage.getItem(stateStorageKeySchema);
|
|
301
|
-
if (storedState?.apiVersion ===
|
|
300
|
+
if (storedState?.apiVersion === require_updateAuthFromVerifyResponse.SDK_API_CORE_VERSION) {
|
|
302
301
|
stateChanges.unverifiedWalletAccounts = storedState.unverifiedWalletAccounts;
|
|
303
302
|
stateChanges.walletProviderKeyMap = storedState.walletProviderKeyMap;
|
|
304
303
|
if (storedState.prefetchedNoncesExpiration && storedState.prefetchedNoncesExpiration > Date.now()) {
|
|
@@ -309,14 +308,14 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
309
308
|
if (isSessionValid || (storedState.unverifiedWalletAccounts ?? []).length > 0) stateChanges.projectSettings = storedState.projectSettings;
|
|
310
309
|
}
|
|
311
310
|
if (Object.keys(stateChanges).length > 0) core.state.set(stateChanges);
|
|
312
|
-
|
|
311
|
+
require_updateAuthFromVerifyResponse.checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);
|
|
313
312
|
};
|
|
314
313
|
|
|
315
314
|
//#endregion
|
|
316
315
|
//#region src/modules/storageSync/syncStateWithStorage/syncStateWithStorage.ts
|
|
317
316
|
/** @notInstrumented */
|
|
318
317
|
const syncStateWithStorage = (client) => {
|
|
319
|
-
const core =
|
|
318
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
320
319
|
core.state.subscribe((state) => {
|
|
321
320
|
if (state.sessionExpiresAt === null) core.storage.removeItem(sessionStorageKeySchema);
|
|
322
321
|
else core.storage.setItem(sessionStorageKeySchema, {
|
|
@@ -334,7 +333,7 @@ const syncStateWithStorage = (client) => {
|
|
|
334
333
|
token: state.token
|
|
335
334
|
});
|
|
336
335
|
core.storage.setItem(stateStorageKeySchema, {
|
|
337
|
-
apiVersion:
|
|
336
|
+
apiVersion: require_updateAuthFromVerifyResponse.SDK_API_CORE_VERSION,
|
|
338
337
|
prefetchedNonces: state.prefetchedNonces,
|
|
339
338
|
prefetchedNoncesExpiration: state.prefetchedNoncesExpiration,
|
|
340
339
|
projectSettings: state.projectSettings,
|
|
@@ -366,22 +365,22 @@ const initializeStorageSync = async (client) => {
|
|
|
366
365
|
* @instrumented
|
|
367
366
|
* @noHook Low-level refresh primitive that is not exposed as a React hook.
|
|
368
367
|
*/
|
|
369
|
-
const refreshUser = async (client =
|
|
370
|
-
const core =
|
|
371
|
-
const apiClient =
|
|
368
|
+
const refreshUser = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
369
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
370
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
372
371
|
const previousState = { ...core.state.get() };
|
|
373
372
|
const user = await apiClient.getAuthenticatedUser({ environmentId: core.environmentId });
|
|
374
373
|
core.state.set({ user });
|
|
375
|
-
|
|
374
|
+
require_updateAuthFromVerifyResponse.checkAndRaiseWalletAccountsChangedEvent({ previousState }, client);
|
|
376
375
|
return user;
|
|
377
376
|
};
|
|
378
377
|
const __refreshUser_impl = refreshUser;
|
|
379
|
-
const __refreshUser_wrapped =
|
|
378
|
+
const __refreshUser_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
380
379
|
fn: __refreshUser_impl,
|
|
381
380
|
functionName: "refreshUser",
|
|
382
381
|
getCore: () => {
|
|
383
382
|
try {
|
|
384
|
-
return
|
|
383
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
385
384
|
} catch {
|
|
386
385
|
return;
|
|
387
386
|
}
|
|
@@ -390,7 +389,7 @@ const __refreshUser_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
390
389
|
|
|
391
390
|
//#endregion
|
|
392
391
|
//#region src/errors/ClientAlreadyInitializedError.ts
|
|
393
|
-
var ClientAlreadyInitializedError = class extends
|
|
392
|
+
var ClientAlreadyInitializedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
394
393
|
constructor() {
|
|
395
394
|
super({
|
|
396
395
|
cause: null,
|
|
@@ -419,8 +418,8 @@ var ClientAlreadyInitializedError = class extends require_InvalidParamError.Base
|
|
|
419
418
|
* @instrumented
|
|
420
419
|
* @noHook Client lifecycle management is not exposed as a React hook.
|
|
421
420
|
*/
|
|
422
|
-
const initializeClient = async (client =
|
|
423
|
-
const core =
|
|
421
|
+
const initializeClient = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
422
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
424
423
|
core.logger.debug("[initializeClient] Initializing client. Current init status", core.state.get().initStatus);
|
|
425
424
|
if (core.state.get().initStatus !== "uninitialized") throw new ClientAlreadyInitializedError();
|
|
426
425
|
core.state.set({
|
|
@@ -471,7 +470,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
471
470
|
* This call can fail with a 401 error if the user is not logged in and the SDK should finish its initialization process
|
|
472
471
|
* without throwing an error because that is an expected behavior.
|
|
473
472
|
*/
|
|
474
|
-
if (
|
|
473
|
+
if (require_updateAuthFromVerifyResponse.isCookieEnabled(client)) await require_isDynamicWaasEnabled.__refreshAuth_wrapped(client).catch(async (error) => {
|
|
475
474
|
if (error.status === 401) {
|
|
476
475
|
core.logger.error("Session expired during initialization", error);
|
|
477
476
|
if (client.user) await require_isMfaRequiredForAction.__logoutWithReason_wrapped({ reason: "session-refresh-unauthorized" }, client);
|
|
@@ -519,15 +518,15 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
519
518
|
});
|
|
520
519
|
throw error;
|
|
521
520
|
}
|
|
522
|
-
if (client.user)
|
|
521
|
+
if (client.user) require_updateAuthFromVerifyResponse.initializeWaasClientsForEagerRecovery(client);
|
|
523
522
|
};
|
|
524
523
|
const __initializeClient_impl = initializeClient;
|
|
525
|
-
const __initializeClient_wrapped =
|
|
524
|
+
const __initializeClient_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
526
525
|
fn: __initializeClient_impl,
|
|
527
526
|
functionName: "initializeClient",
|
|
528
527
|
getCore: () => {
|
|
529
528
|
try {
|
|
530
|
-
return
|
|
529
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
531
530
|
} catch {
|
|
532
531
|
return;
|
|
533
532
|
}
|
|
@@ -599,7 +598,7 @@ const createEventEmitter = () => new eventemitter3.default();
|
|
|
599
598
|
|
|
600
599
|
//#endregion
|
|
601
600
|
//#region src/errors/UnavailableInServerSideError.ts
|
|
602
|
-
var UnavailableInServerSideError = class extends
|
|
601
|
+
var UnavailableInServerSideError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
603
602
|
constructor(unavailableFeature) {
|
|
604
603
|
super({
|
|
605
604
|
cause: null,
|
|
@@ -639,22 +638,22 @@ const connectLoggerToInstrumentation = ({ environmentId, extensions, instrumenta
|
|
|
639
638
|
const { token, user } = state.get();
|
|
640
639
|
instrumentation.log({
|
|
641
640
|
environmentId,
|
|
642
|
-
operatingSystem:
|
|
643
|
-
parameters:
|
|
641
|
+
operatingSystem: require_updateAuthFromVerifyResponse.getOperatingSystem(),
|
|
642
|
+
parameters: require_updateAuthFromVerifyResponse.scrubParameters({
|
|
644
643
|
piiFields: instrumentation.config.piiFields,
|
|
645
644
|
value: {
|
|
646
645
|
args,
|
|
647
646
|
message
|
|
648
647
|
}
|
|
649
648
|
}),
|
|
650
|
-
platform:
|
|
649
|
+
platform: require_updateAuthFromVerifyResponse.getPlatform(),
|
|
651
650
|
registeredExtensionKeys: Array.from(extensions),
|
|
652
651
|
sdkSessionId,
|
|
653
652
|
sdkVersion,
|
|
654
653
|
status: "error",
|
|
655
654
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
656
|
-
tokenSessionId: token ?
|
|
657
|
-
userAgent:
|
|
655
|
+
tokenSessionId: token ? require_updateAuthFromVerifyResponse.extractSessionId(token) : null,
|
|
656
|
+
userAgent: require_updateAuthFromVerifyResponse.getUserAgent(),
|
|
658
657
|
userId: user?.id ?? null
|
|
659
658
|
});
|
|
660
659
|
});
|
|
@@ -663,7 +662,7 @@ const connectLoggerToInstrumentation = ({ environmentId, extensions, instrumenta
|
|
|
663
662
|
//#endregion
|
|
664
663
|
//#region src/services/instrumentation/createInstrumentation/createInstrumentation.ts
|
|
665
664
|
const buildPiiFields = (customFields = []) => {
|
|
666
|
-
const merged = [...
|
|
665
|
+
const merged = [...require_updateAuthFromVerifyResponse.DEFAULT_PII_FIELDS, ...customFields];
|
|
667
666
|
return [...new Set(merged)];
|
|
668
667
|
};
|
|
669
668
|
/**
|
|
@@ -814,7 +813,7 @@ const createDebouncedMutex = () => {
|
|
|
814
813
|
timer: null
|
|
815
814
|
});
|
|
816
815
|
const currentState = mutexState.get(lockKey);
|
|
817
|
-
|
|
816
|
+
require_updateAuthFromVerifyResponse.assertDefined(currentState, `Mutex state for key ${lockKey} not found`);
|
|
818
817
|
currentState.resolutionPromises.push(resolutionPromise);
|
|
819
818
|
if (currentState.timer) clearTimeout(currentState.timer);
|
|
820
819
|
currentState.nextCallback = callback;
|
|
@@ -841,7 +840,7 @@ const createDebouncedMutex = () => {
|
|
|
841
840
|
|
|
842
841
|
//#endregion
|
|
843
842
|
//#region src/errors/InvalidStorageValue.ts
|
|
844
|
-
var InvalidStorageValue = class extends
|
|
843
|
+
var InvalidStorageValue = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
845
844
|
constructor(key, value) {
|
|
846
845
|
super({
|
|
847
846
|
cause: null,
|
|
@@ -973,7 +972,7 @@ const createCore = (config) => {
|
|
|
973
972
|
const debouncedMutex = createDebouncedMutex();
|
|
974
973
|
const eventEmitter = createEventEmitter();
|
|
975
974
|
const initTrack = createAsyncTrack();
|
|
976
|
-
const sdkSessionId =
|
|
975
|
+
const sdkSessionId = require_updateAuthFromVerifyResponse.randomString({ length: 32 });
|
|
977
976
|
const instrumentation = createInstrumentation({ config: config.instrumentation });
|
|
978
977
|
const extensions = /* @__PURE__ */ new Set();
|
|
979
978
|
connectLoggerToInstrumentation({
|
|
@@ -982,7 +981,7 @@ const createCore = (config) => {
|
|
|
982
981
|
instrumentation,
|
|
983
982
|
logger,
|
|
984
983
|
sdkSessionId,
|
|
985
|
-
sdkVersion:
|
|
984
|
+
sdkVersion: require_updateAuthFromVerifyResponse.version,
|
|
986
985
|
state
|
|
987
986
|
});
|
|
988
987
|
if (!require_getNetworkProviderFromNetworkId.isServerSideRendering()) instrumentation.setTransport(createDynamicTransport({
|
|
@@ -1023,7 +1022,7 @@ const createCore = (config) => {
|
|
|
1023
1022
|
state,
|
|
1024
1023
|
storage,
|
|
1025
1024
|
transformers: config.transformers,
|
|
1026
|
-
version:
|
|
1025
|
+
version: require_updateAuthFromVerifyResponse.version,
|
|
1027
1026
|
waas: config.waas
|
|
1028
1027
|
};
|
|
1029
1028
|
};
|
|
@@ -1080,16 +1079,16 @@ const createDynamicClient = (config) => {
|
|
|
1080
1079
|
core.logger.debug("[createDynamicClient] Initializing client...");
|
|
1081
1080
|
__initializeClient_wrapped(client);
|
|
1082
1081
|
}
|
|
1083
|
-
|
|
1082
|
+
require_updateAuthFromVerifyResponse.setDefaultClient(client);
|
|
1084
1083
|
return client;
|
|
1085
1084
|
};
|
|
1086
1085
|
const __createDynamicClient_impl = createDynamicClient;
|
|
1087
|
-
const __createDynamicClient_wrapped =
|
|
1086
|
+
const __createDynamicClient_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1088
1087
|
fn: __createDynamicClient_impl,
|
|
1089
1088
|
functionName: "createDynamicClient",
|
|
1090
1089
|
getCore: () => {
|
|
1091
1090
|
try {
|
|
1092
|
-
return
|
|
1091
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1093
1092
|
} catch {
|
|
1094
1093
|
return;
|
|
1095
1094
|
}
|
|
@@ -1098,7 +1097,7 @@ const __createDynamicClient_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
1098
1097
|
|
|
1099
1098
|
//#endregion
|
|
1100
1099
|
//#region src/errors/CheckoutSessionTokenMissingError.ts
|
|
1101
|
-
var CheckoutSessionTokenMissingError = class extends
|
|
1100
|
+
var CheckoutSessionTokenMissingError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1102
1101
|
constructor({ transactionId }) {
|
|
1103
1102
|
super({
|
|
1104
1103
|
cause: null,
|
|
@@ -1112,7 +1111,7 @@ var CheckoutSessionTokenMissingError = class extends require_InvalidParamError.B
|
|
|
1112
1111
|
|
|
1113
1112
|
//#endregion
|
|
1114
1113
|
//#region src/errors/DeeplinkConnectAndVerifyUnsupportedError.ts
|
|
1115
|
-
var DeeplinkConnectAndVerifyUnsupportedError = class extends
|
|
1114
|
+
var DeeplinkConnectAndVerifyUnsupportedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1116
1115
|
constructor({ walletProviderKey }) {
|
|
1117
1116
|
super({
|
|
1118
1117
|
cause: null,
|
|
@@ -1133,7 +1132,7 @@ var DeeplinkConnectAndVerifyUnsupportedError = class extends require_InvalidPara
|
|
|
1133
1132
|
|
|
1134
1133
|
//#endregion
|
|
1135
1134
|
//#region src/errors/FeeEstimationFailedError.ts
|
|
1136
|
-
var FeeEstimationFailedError = class extends
|
|
1135
|
+
var FeeEstimationFailedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1137
1136
|
constructor(params) {
|
|
1138
1137
|
super({
|
|
1139
1138
|
cause: params.cause || null,
|
|
@@ -1147,7 +1146,7 @@ var FeeEstimationFailedError = class extends require_InvalidParamError.BaseError
|
|
|
1147
1146
|
|
|
1148
1147
|
//#endregion
|
|
1149
1148
|
//#region src/errors/FlowSessionTokenMissingError.ts
|
|
1150
|
-
var FlowSessionTokenMissingError = class extends
|
|
1149
|
+
var FlowSessionTokenMissingError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1151
1150
|
constructor({ flowId }) {
|
|
1152
1151
|
super({
|
|
1153
1152
|
cause: null,
|
|
@@ -1161,7 +1160,7 @@ var FlowSessionTokenMissingError = class extends require_InvalidParamError.BaseE
|
|
|
1161
1160
|
|
|
1162
1161
|
//#endregion
|
|
1163
1162
|
//#region src/errors/InvalidDeviceRegistrationRedirectError.ts
|
|
1164
|
-
var InvalidDeviceRegistrationRedirectError = class extends
|
|
1163
|
+
var InvalidDeviceRegistrationRedirectError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1165
1164
|
constructor() {
|
|
1166
1165
|
super({
|
|
1167
1166
|
cause: null,
|
|
@@ -1176,7 +1175,7 @@ var InvalidDeviceRegistrationRedirectError = class extends require_InvalidParamE
|
|
|
1176
1175
|
|
|
1177
1176
|
//#endregion
|
|
1178
1177
|
//#region src/errors/InvalidRedirectStorageStateError.ts
|
|
1179
|
-
var InvalidRedirectStorageStateError = class extends
|
|
1178
|
+
var InvalidRedirectStorageStateError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1180
1179
|
constructor() {
|
|
1181
1180
|
super({
|
|
1182
1181
|
cause: null,
|
|
@@ -1190,7 +1189,7 @@ var InvalidRedirectStorageStateError = class extends require_InvalidParamError.B
|
|
|
1190
1189
|
|
|
1191
1190
|
//#endregion
|
|
1192
1191
|
//#region src/errors/InvalidSocialCallbackOriginError.ts
|
|
1193
|
-
var InvalidSocialCallbackOriginError = class extends
|
|
1192
|
+
var InvalidSocialCallbackOriginError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1194
1193
|
constructor({ actualOrigin, expectedOrigin }) {
|
|
1195
1194
|
super({
|
|
1196
1195
|
cause: null,
|
|
@@ -1204,7 +1203,7 @@ var InvalidSocialCallbackOriginError = class extends require_InvalidParamError.B
|
|
|
1204
1203
|
|
|
1205
1204
|
//#endregion
|
|
1206
1205
|
//#region src/errors/MissingRedirectStorageStateError.ts
|
|
1207
|
-
var MissingRedirectStorageStateError = class extends
|
|
1206
|
+
var MissingRedirectStorageStateError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1208
1207
|
constructor() {
|
|
1209
1208
|
super({
|
|
1210
1209
|
cause: null,
|
|
@@ -1218,7 +1217,7 @@ var MissingRedirectStorageStateError = class extends require_InvalidParamError.B
|
|
|
1218
1217
|
|
|
1219
1218
|
//#endregion
|
|
1220
1219
|
//#region src/errors/MissingSocialUrlParamError.ts
|
|
1221
|
-
var MissingSocialUrlParamError = class extends
|
|
1220
|
+
var MissingSocialUrlParamError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1222
1221
|
constructor(param) {
|
|
1223
1222
|
super({
|
|
1224
1223
|
cause: null,
|
|
@@ -1232,7 +1231,7 @@ var MissingSocialUrlParamError = class extends require_InvalidParamError.BaseErr
|
|
|
1232
1231
|
|
|
1233
1232
|
//#endregion
|
|
1234
1233
|
//#region src/errors/MissingUserVerificationError.ts
|
|
1235
|
-
var MissingUserVerificationError = class extends
|
|
1234
|
+
var MissingUserVerificationError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1236
1235
|
informationToVerify;
|
|
1237
1236
|
constructor({ informationToVerify, message }) {
|
|
1238
1237
|
super({
|
|
@@ -1248,7 +1247,7 @@ var MissingUserVerificationError = class extends require_InvalidParamError.BaseE
|
|
|
1248
1247
|
|
|
1249
1248
|
//#endregion
|
|
1250
1249
|
//#region src/errors/NetworkAddingUnavailableError.ts
|
|
1251
|
-
var NetworkAddingUnavailableError = class extends
|
|
1250
|
+
var NetworkAddingUnavailableError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1252
1251
|
constructor({ walletProviderKey, originalError, extraMessages }) {
|
|
1253
1252
|
const cause = originalError instanceof Error ? originalError : null;
|
|
1254
1253
|
super({
|
|
@@ -1264,7 +1263,7 @@ var NetworkAddingUnavailableError = class extends require_InvalidParamError.Base
|
|
|
1264
1263
|
|
|
1265
1264
|
//#endregion
|
|
1266
1265
|
//#region src/errors/NetworkNotAddedError.ts
|
|
1267
|
-
var NetworkNotAddedError = class extends
|
|
1266
|
+
var NetworkNotAddedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1268
1267
|
networkData;
|
|
1269
1268
|
constructor({ networkData, networkId, originalError, walletProviderKey }) {
|
|
1270
1269
|
const cause = originalError instanceof Error ? originalError : null;
|
|
@@ -1287,7 +1286,7 @@ var NetworkNotAddedError = class extends require_InvalidParamError.BaseError {
|
|
|
1287
1286
|
|
|
1288
1287
|
//#endregion
|
|
1289
1288
|
//#region src/errors/NetworkSwitchingUnavailableError.ts
|
|
1290
|
-
var NetworkSwitchingUnavailableError = class extends
|
|
1289
|
+
var NetworkSwitchingUnavailableError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1291
1290
|
constructor({ walletProviderKey, originalError, extraMessages }) {
|
|
1292
1291
|
const cause = originalError instanceof Error ? originalError : null;
|
|
1293
1292
|
super({
|
|
@@ -1303,7 +1302,7 @@ var NetworkSwitchingUnavailableError = class extends require_InvalidParamError.B
|
|
|
1303
1302
|
|
|
1304
1303
|
//#endregion
|
|
1305
1304
|
//#region src/errors/NoAddressFoundError.ts
|
|
1306
|
-
var NoAddressFoundError = class extends
|
|
1305
|
+
var NoAddressFoundError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1307
1306
|
constructor() {
|
|
1308
1307
|
super({
|
|
1309
1308
|
cause: null,
|
|
@@ -1317,7 +1316,7 @@ var NoAddressFoundError = class extends require_InvalidParamError.BaseError {
|
|
|
1317
1316
|
|
|
1318
1317
|
//#endregion
|
|
1319
1318
|
//#region src/errors/NoPasskeyCredentialsFoundError.ts
|
|
1320
|
-
var NoPasskeyCredentialsFoundError = class extends
|
|
1319
|
+
var NoPasskeyCredentialsFoundError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1321
1320
|
constructor() {
|
|
1322
1321
|
super({
|
|
1323
1322
|
cause: null,
|
|
@@ -1331,7 +1330,7 @@ var NoPasskeyCredentialsFoundError = class extends require_InvalidParamError.Bas
|
|
|
1331
1330
|
|
|
1332
1331
|
//#endregion
|
|
1333
1332
|
//#region src/errors/NoSmartWalletAccountSignerFoundError.ts
|
|
1334
|
-
var NoSmartWalletAccountSignerFoundError = class extends
|
|
1333
|
+
var NoSmartWalletAccountSignerFoundError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1335
1334
|
constructor(smartWalletAddress) {
|
|
1336
1335
|
super({
|
|
1337
1336
|
cause: null,
|
|
@@ -1345,7 +1344,7 @@ var NoSmartWalletAccountSignerFoundError = class extends require_InvalidParamErr
|
|
|
1345
1344
|
|
|
1346
1345
|
//#endregion
|
|
1347
1346
|
//#region src/errors/NoWebAuthNSupportError.ts
|
|
1348
|
-
var NoWebAuthNSupportError = class extends
|
|
1347
|
+
var NoWebAuthNSupportError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1349
1348
|
constructor() {
|
|
1350
1349
|
super({
|
|
1351
1350
|
cause: null,
|
|
@@ -1359,7 +1358,7 @@ var NoWebAuthNSupportError = class extends require_InvalidParamError.BaseError {
|
|
|
1359
1358
|
|
|
1360
1359
|
//#endregion
|
|
1361
1360
|
//#region src/errors/SimulationFailedError.ts
|
|
1362
|
-
var SimulationFailedError = class extends
|
|
1361
|
+
var SimulationFailedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1363
1362
|
constructor(params) {
|
|
1364
1363
|
super({
|
|
1365
1364
|
cause: params.cause || null,
|
|
@@ -1373,7 +1372,7 @@ var SimulationFailedError = class extends require_InvalidParamError.BaseError {
|
|
|
1373
1372
|
|
|
1374
1373
|
//#endregion
|
|
1375
1374
|
//#region src/errors/TokenSwapError.ts
|
|
1376
|
-
var TokenSwapError = class extends
|
|
1375
|
+
var TokenSwapError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1377
1376
|
constructor({ message, originalError }) {
|
|
1378
1377
|
const cause = originalError && originalError instanceof Error ? originalError : null;
|
|
1379
1378
|
super({
|
|
@@ -1388,7 +1387,7 @@ var TokenSwapError = class extends require_InvalidParamError.BaseError {
|
|
|
1388
1387
|
|
|
1389
1388
|
//#endregion
|
|
1390
1389
|
//#region src/errors/UnrecognizedNetworkError.ts
|
|
1391
|
-
var UnrecognizedNetworkError = class extends
|
|
1390
|
+
var UnrecognizedNetworkError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1392
1391
|
constructor({ networkId, originalError, walletProviderKey }) {
|
|
1393
1392
|
const cause = originalError instanceof Error ? originalError : null;
|
|
1394
1393
|
super({
|
|
@@ -1404,7 +1403,7 @@ var UnrecognizedNetworkError = class extends require_InvalidParamError.BaseError
|
|
|
1404
1403
|
|
|
1405
1404
|
//#endregion
|
|
1406
1405
|
//#region src/errors/UserCancelledSocialPopUpError.ts
|
|
1407
|
-
var UserCancelledSocialPopUpError = class extends
|
|
1406
|
+
var UserCancelledSocialPopUpError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1408
1407
|
constructor() {
|
|
1409
1408
|
super({
|
|
1410
1409
|
cause: null,
|
|
@@ -1418,7 +1417,7 @@ var UserCancelledSocialPopUpError = class extends require_InvalidParamError.Base
|
|
|
1418
1417
|
|
|
1419
1418
|
//#endregion
|
|
1420
1419
|
//#region src/errors/UserNotAuthenticatedError.ts
|
|
1421
|
-
var UserNotAuthenticatedError = class extends
|
|
1420
|
+
var UserNotAuthenticatedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1422
1421
|
constructor({ shortMessage } = {}) {
|
|
1423
1422
|
super({
|
|
1424
1423
|
cause: null,
|
|
@@ -1432,7 +1431,7 @@ var UserNotAuthenticatedError = class extends require_InvalidParamError.BaseErro
|
|
|
1432
1431
|
|
|
1433
1432
|
//#endregion
|
|
1434
1433
|
//#region src/errors/UserRejectedError.ts
|
|
1435
|
-
var UserRejectedError = class extends
|
|
1434
|
+
var UserRejectedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1436
1435
|
constructor({ action }) {
|
|
1437
1436
|
super({
|
|
1438
1437
|
cause: null,
|
|
@@ -1446,7 +1445,7 @@ var UserRejectedError = class extends require_InvalidParamError.BaseError {
|
|
|
1446
1445
|
|
|
1447
1446
|
//#endregion
|
|
1448
1447
|
//#region src/errors/WalletAccountAlreadyVerifiedError.ts
|
|
1449
|
-
var WalletAccountAlreadyVerifiedError = class extends
|
|
1448
|
+
var WalletAccountAlreadyVerifiedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1450
1449
|
constructor(address) {
|
|
1451
1450
|
super({
|
|
1452
1451
|
cause: null,
|
|
@@ -1460,7 +1459,7 @@ var WalletAccountAlreadyVerifiedError = class extends require_InvalidParamError.
|
|
|
1460
1459
|
|
|
1461
1460
|
//#endregion
|
|
1462
1461
|
//#region src/errors/WalletAccountNotSelectedError.ts
|
|
1463
|
-
var WalletAccountNotSelectedError = class extends
|
|
1462
|
+
var WalletAccountNotSelectedError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1464
1463
|
expectedAddress;
|
|
1465
1464
|
selectedAddress;
|
|
1466
1465
|
constructor(params) {
|
|
@@ -1479,7 +1478,7 @@ var WalletAccountNotSelectedError = class extends require_InvalidParamError.Base
|
|
|
1479
1478
|
|
|
1480
1479
|
//#endregion
|
|
1481
1480
|
//#region src/errors/WalletProviderMethodUnavailableError.ts
|
|
1482
|
-
var WalletProviderMethodUnavailableError = class extends
|
|
1481
|
+
var WalletProviderMethodUnavailableError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
1483
1482
|
constructor({ methodName, walletProviderKey }) {
|
|
1484
1483
|
super({
|
|
1485
1484
|
cause: null,
|
|
@@ -1526,8 +1525,8 @@ const STEP_UP_REQUIRED_DEFAULT = {
|
|
|
1526
1525
|
* ```
|
|
1527
1526
|
* @instrumented
|
|
1528
1527
|
*/
|
|
1529
|
-
const checkStepUpAuth = async ({ scope }, client =
|
|
1530
|
-
if (
|
|
1528
|
+
const checkStepUpAuth = async ({ scope }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1529
|
+
if (require_updateAuthFromVerifyResponse.getElevatedAccessToken({
|
|
1531
1530
|
consume: false,
|
|
1532
1531
|
scope
|
|
1533
1532
|
}, client)) return {
|
|
@@ -1535,8 +1534,8 @@ const checkStepUpAuth = async ({ scope }, client = require_InvalidParamError.get
|
|
|
1535
1534
|
isRequired: false
|
|
1536
1535
|
};
|
|
1537
1536
|
try {
|
|
1538
|
-
const core =
|
|
1539
|
-
const response = await
|
|
1537
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1538
|
+
const response = await require_updateAuthFromVerifyResponse.createApiClient({}, client).stepUpCheck({
|
|
1540
1539
|
environmentId: core.environmentId,
|
|
1541
1540
|
stepUpCheckRequest: { scope }
|
|
1542
1541
|
});
|
|
@@ -1550,12 +1549,12 @@ const checkStepUpAuth = async ({ scope }, client = require_InvalidParamError.get
|
|
|
1550
1549
|
}
|
|
1551
1550
|
};
|
|
1552
1551
|
const __checkStepUpAuth_impl = checkStepUpAuth;
|
|
1553
|
-
const __checkStepUpAuth_wrapped =
|
|
1552
|
+
const __checkStepUpAuth_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1554
1553
|
fn: __checkStepUpAuth_impl,
|
|
1555
1554
|
functionName: "checkStepUpAuth",
|
|
1556
1555
|
getCore: () => {
|
|
1557
1556
|
try {
|
|
1558
|
-
return
|
|
1557
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1559
1558
|
} catch {
|
|
1560
1559
|
return;
|
|
1561
1560
|
}
|
|
@@ -1580,16 +1579,16 @@ const __checkStepUpAuth_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1580
1579
|
* @instrumented
|
|
1581
1580
|
* @redact-params
|
|
1582
1581
|
*/
|
|
1583
|
-
const requestExternalAuthElevatedToken = async ({ externalJwt }, client =
|
|
1584
|
-
const core =
|
|
1585
|
-
const response = await
|
|
1582
|
+
const requestExternalAuthElevatedToken = async ({ externalJwt }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1583
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1584
|
+
const response = await require_updateAuthFromVerifyResponse.createApiClient({}, client).externalAuthVerify({
|
|
1586
1585
|
environmentId: core.environmentId,
|
|
1587
1586
|
externalAuthSigninRequest: { jwt: externalJwt }
|
|
1588
1587
|
});
|
|
1589
|
-
const parsedToken =
|
|
1588
|
+
const parsedToken = require_updateAuthFromVerifyResponse.parseElevatedAccessToken({ token: response.elevatedAccessToken });
|
|
1590
1589
|
if (parsedToken) {
|
|
1591
1590
|
const currentTokens = core.state.get().elevatedAccessTokens || [];
|
|
1592
|
-
core.state.set({ elevatedAccessTokens:
|
|
1591
|
+
core.state.set({ elevatedAccessTokens: require_updateAuthFromVerifyResponse.upsertElevatedAccessToken({
|
|
1593
1592
|
currentTokens,
|
|
1594
1593
|
newToken: parsedToken
|
|
1595
1594
|
}) });
|
|
@@ -1597,12 +1596,12 @@ const requestExternalAuthElevatedToken = async ({ externalJwt }, client = requir
|
|
|
1597
1596
|
return response;
|
|
1598
1597
|
};
|
|
1599
1598
|
const __requestExternalAuthElevatedToken_impl = requestExternalAuthElevatedToken;
|
|
1600
|
-
const __requestExternalAuthElevatedToken_wrapped =
|
|
1599
|
+
const __requestExternalAuthElevatedToken_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1601
1600
|
fn: __requestExternalAuthElevatedToken_impl,
|
|
1602
1601
|
functionName: "requestExternalAuthElevatedToken",
|
|
1603
1602
|
getCore: () => {
|
|
1604
1603
|
try {
|
|
1605
|
-
return
|
|
1604
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1606
1605
|
} catch {
|
|
1607
1606
|
return;
|
|
1608
1607
|
}
|
|
@@ -1624,25 +1623,25 @@ const __requestExternalAuthElevatedToken_wrapped = require_InvalidParamError.ins
|
|
|
1624
1623
|
* @instrumented
|
|
1625
1624
|
* @redact-params
|
|
1626
1625
|
*/
|
|
1627
|
-
const signInWithExternalJwt = async ({ externalJwt, sessionPublicKey } = {}, client =
|
|
1628
|
-
const core =
|
|
1629
|
-
const response = await
|
|
1626
|
+
const signInWithExternalJwt = async ({ externalJwt, sessionPublicKey } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1627
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1628
|
+
const response = await require_updateAuthFromVerifyResponse.createApiClient({}, client).externalAuthSignin({
|
|
1630
1629
|
environmentId: core.environmentId,
|
|
1631
1630
|
externalAuthSigninRequest: {
|
|
1632
1631
|
jwt: externalJwt,
|
|
1633
1632
|
sessionPublicKey
|
|
1634
1633
|
}
|
|
1635
1634
|
});
|
|
1636
|
-
|
|
1635
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
1637
1636
|
return response;
|
|
1638
1637
|
};
|
|
1639
1638
|
const __signInWithExternalJwt_impl = signInWithExternalJwt;
|
|
1640
|
-
const __signInWithExternalJwt_wrapped =
|
|
1639
|
+
const __signInWithExternalJwt_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1641
1640
|
fn: __signInWithExternalJwt_impl,
|
|
1642
1641
|
functionName: "signInWithExternalJwt",
|
|
1643
1642
|
getCore: () => {
|
|
1644
1643
|
try {
|
|
1645
|
-
return
|
|
1644
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1646
1645
|
} catch {
|
|
1647
1646
|
return;
|
|
1648
1647
|
}
|
|
@@ -1659,7 +1658,7 @@ const __signInWithExternalJwt_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
1659
1658
|
* @returns A promise that resolves when the logout process is complete.
|
|
1660
1659
|
* @notInstrumented
|
|
1661
1660
|
*/
|
|
1662
|
-
const logout = async (client =
|
|
1661
|
+
const logout = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1663
1662
|
/**
|
|
1664
1663
|
* Delegates to `logoutWithReason` with `'user-intent'` so telemetry correctly
|
|
1665
1664
|
* attributes the logout to an explicit user action. Instrumentation lives on
|
|
@@ -1679,9 +1678,9 @@ const logout = async (client = require_InvalidParamError.getDefaultClient()) =>
|
|
|
1679
1678
|
* @returns A promise that resolves when the passkey is successfully deleted.
|
|
1680
1679
|
* @instrumented
|
|
1681
1680
|
*/
|
|
1682
|
-
const deletePasskey = async ({ passkeyId }, client =
|
|
1683
|
-
const core =
|
|
1684
|
-
await
|
|
1681
|
+
const deletePasskey = async ({ passkeyId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1682
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1683
|
+
await require_updateAuthFromVerifyResponse.createApiClient({
|
|
1685
1684
|
elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink,
|
|
1686
1685
|
includeMfaToken: true
|
|
1687
1686
|
}, client).deletePasskey({
|
|
@@ -1690,12 +1689,12 @@ const deletePasskey = async ({ passkeyId }, client = require_InvalidParamError.g
|
|
|
1690
1689
|
});
|
|
1691
1690
|
};
|
|
1692
1691
|
const __deletePasskey_impl = deletePasskey;
|
|
1693
|
-
const __deletePasskey_wrapped =
|
|
1692
|
+
const __deletePasskey_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1694
1693
|
fn: __deletePasskey_impl,
|
|
1695
1694
|
functionName: "deletePasskey",
|
|
1696
1695
|
getCore: () => {
|
|
1697
1696
|
try {
|
|
1698
|
-
return
|
|
1697
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1699
1698
|
} catch {
|
|
1700
1699
|
return;
|
|
1701
1700
|
}
|
|
@@ -1714,25 +1713,25 @@ const __deletePasskey_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1714
1713
|
* @returns A promise that resolves to an array of the user's registered passkeys.
|
|
1715
1714
|
* @notInstrumented
|
|
1716
1715
|
*/
|
|
1717
|
-
const getPasskeys = async (client =
|
|
1718
|
-
const core =
|
|
1719
|
-
return (await
|
|
1716
|
+
const getPasskeys = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1717
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1718
|
+
return (await require_updateAuthFromVerifyResponse.createApiClient({}, client).getUserPasskeys({ environmentId: core.environmentId })).passkeys;
|
|
1720
1719
|
};
|
|
1721
1720
|
|
|
1722
1721
|
//#endregion
|
|
1723
1722
|
//#region src/modules/auth/passkeys/getPasskeyRegistrationOptions/getPasskeyRegistrationOptions.ts
|
|
1724
1723
|
/** @notInstrumented */
|
|
1725
1724
|
const getPasskeyRegistrationOptions = async (client) => {
|
|
1726
|
-
const core =
|
|
1727
|
-
return await
|
|
1725
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1726
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).getPasskeyRegistrationOptions({ environmentId: core.environmentId });
|
|
1728
1727
|
};
|
|
1729
1728
|
|
|
1730
1729
|
//#endregion
|
|
1731
1730
|
//#region src/modules/auth/passkeys/serverRegisterPasskey/serverRegisterPasskey.ts
|
|
1732
1731
|
/** @notInstrumented */
|
|
1733
1732
|
const serverRegisterPasskey = async ({ registration, createMfaToken }, client) => {
|
|
1734
|
-
const core =
|
|
1735
|
-
return await
|
|
1733
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1734
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentiallink }, client).registerPasskey({
|
|
1736
1735
|
environmentId: core.environmentId,
|
|
1737
1736
|
passkeyRegisterRequest: {
|
|
1738
1737
|
...registration,
|
|
@@ -1761,24 +1760,24 @@ const serverRegisterPasskey = async ({ registration, createMfaToken }, client) =
|
|
|
1761
1760
|
* @instrumented
|
|
1762
1761
|
* @redact-params
|
|
1763
1762
|
*/
|
|
1764
|
-
const registerPasskey = async ({ createMfaToken } = {}, client =
|
|
1765
|
-
const core =
|
|
1763
|
+
const registerPasskey = async ({ createMfaToken } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1764
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1766
1765
|
if (!core.passkey.isSupported()) throw new NoWebAuthNSupportError();
|
|
1767
1766
|
const options = await getPasskeyRegistrationOptions(client);
|
|
1768
1767
|
const response = await serverRegisterPasskey({
|
|
1769
1768
|
createMfaToken,
|
|
1770
1769
|
registration: await core.passkey.register({ optionsJSON: options })
|
|
1771
1770
|
}, client);
|
|
1772
|
-
|
|
1771
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
1773
1772
|
return response;
|
|
1774
1773
|
};
|
|
1775
1774
|
const __registerPasskey_impl = registerPasskey;
|
|
1776
|
-
const __registerPasskey_wrapped =
|
|
1775
|
+
const __registerPasskey_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1777
1776
|
fn: __registerPasskey_impl,
|
|
1778
1777
|
functionName: "registerPasskey",
|
|
1779
1778
|
getCore: () => {
|
|
1780
1779
|
try {
|
|
1781
|
-
return
|
|
1780
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1782
1781
|
} catch {
|
|
1783
1782
|
return;
|
|
1784
1783
|
}
|
|
@@ -1790,8 +1789,8 @@ const __registerPasskey_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1790
1789
|
//#region src/modules/auth/passkeys/getPasskeyAuthenticationSignInOptions/getPasskeyAuthenticationSignInOptions.ts
|
|
1791
1790
|
/** @notInstrumented */
|
|
1792
1791
|
const getPasskeyAuthenticationSignInOptions = async ({ relatedOriginRpId } = {}, client) => {
|
|
1793
|
-
const core =
|
|
1794
|
-
return await
|
|
1792
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1793
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).getPasskeyAuthenticationSigninOptions({
|
|
1795
1794
|
environmentId: core.environmentId,
|
|
1796
1795
|
relatedOriginRpId
|
|
1797
1796
|
});
|
|
@@ -1801,8 +1800,8 @@ const getPasskeyAuthenticationSignInOptions = async ({ relatedOriginRpId } = {},
|
|
|
1801
1800
|
//#region src/modules/auth/passkeys/serverSigninPasskey/serverSigninPasskey.ts
|
|
1802
1801
|
/** @notInstrumented */
|
|
1803
1802
|
const serverSigninPasskey = async ({ authentication, createMfaToken }, client) => {
|
|
1804
|
-
const core =
|
|
1805
|
-
return await
|
|
1803
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1804
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).signinWithPasskey({
|
|
1806
1805
|
environmentId: core.environmentId,
|
|
1807
1806
|
passkeyAuthRequest: {
|
|
1808
1807
|
...authentication,
|
|
@@ -1830,21 +1829,21 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client) =
|
|
|
1830
1829
|
* @instrumented
|
|
1831
1830
|
* @redact-params
|
|
1832
1831
|
*/
|
|
1833
|
-
const signInWithPasskey = async ({ relatedOriginRpId } = {}, client =
|
|
1834
|
-
const core =
|
|
1832
|
+
const signInWithPasskey = async ({ relatedOriginRpId } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1833
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
1835
1834
|
if (!core.passkey.isSupported()) throw new NoWebAuthNSupportError();
|
|
1836
1835
|
const formattedOptions = { ...await getPasskeyAuthenticationSignInOptions({ relatedOriginRpId }, client) };
|
|
1837
1836
|
const response = await serverSigninPasskey({ authentication: await core.passkey.authenticate({ optionsJSON: formattedOptions }) }, client);
|
|
1838
|
-
|
|
1837
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
1839
1838
|
return response;
|
|
1840
1839
|
};
|
|
1841
1840
|
const __signInWithPasskey_impl = signInWithPasskey;
|
|
1842
|
-
const __signInWithPasskey_wrapped =
|
|
1841
|
+
const __signInWithPasskey_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
1843
1842
|
fn: __signInWithPasskey_impl,
|
|
1844
1843
|
functionName: "signInWithPasskey",
|
|
1845
1844
|
getCore: () => {
|
|
1846
1845
|
try {
|
|
1847
|
-
return
|
|
1846
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
1848
1847
|
} catch {
|
|
1849
1848
|
return;
|
|
1850
1849
|
}
|
|
@@ -1862,9 +1861,9 @@ const __signInWithPasskey_wrapped = require_InvalidParamError.instrumentFunction
|
|
|
1862
1861
|
* @notInstrumented
|
|
1863
1862
|
* @hook Exposed as a hook so consumers get the reactive list of social accounts, updated when the user changes.
|
|
1864
1863
|
*/
|
|
1865
|
-
const getUserSocialAccounts = (client =
|
|
1864
|
+
const getUserSocialAccounts = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
1866
1865
|
const { user } = client;
|
|
1867
|
-
|
|
1866
|
+
require_updateAuthFromVerifyResponse.assertDefined(user, "User is not authenticated");
|
|
1868
1867
|
return (user.verifiedCredentials.filter((credential) => credential.format === _dynamic_labs_sdk_api_core.JwtVerifiedCredentialFormatEnum.Oauth) ?? []).map((credential) => ({
|
|
1869
1868
|
accountId: credential.oauthAccountId ?? void 0,
|
|
1870
1869
|
displayName: credential.oauthDisplayName ?? void 0,
|
|
@@ -1928,9 +1927,9 @@ const APPLE_RESPONSE_TYPE = "code id_token";
|
|
|
1928
1927
|
/** Helper function to add OAuth URL parameters to a given base URL. * @notInstrumented
|
|
1929
1928
|
*/
|
|
1930
1929
|
const addOAuthUrlParams = ({ baseUrl, isGoogleDriveBackupEnabled, provider }) => {
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1930
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.clientId, "Client ID not found");
|
|
1931
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.provider, "Provider type not found");
|
|
1932
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.redirectUrl, "Redirect URL not found");
|
|
1934
1933
|
const providerType = provider.provider;
|
|
1935
1934
|
baseUrl.searchParams.set("client_id", provider.clientId);
|
|
1936
1935
|
baseUrl.searchParams.set("response_type", "code");
|
|
@@ -1956,15 +1955,15 @@ const addOAuthUrlParams = ({ baseUrl, isGoogleDriveBackupEnabled, provider }) =>
|
|
|
1956
1955
|
/** Helper function to build the OAuth base URL for a given provider. * @notInstrumented
|
|
1957
1956
|
*/
|
|
1958
1957
|
const getOAuthBaseUrl = (provider) => {
|
|
1959
|
-
|
|
1958
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.provider, "Provider type not found");
|
|
1960
1959
|
const providerType = provider.provider;
|
|
1961
1960
|
if (providerType === _dynamic_labs_sdk_api_core.ProviderEnum.Telegram) {
|
|
1962
|
-
|
|
1961
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.authorizationUrl, "Telegram authorization URL not found");
|
|
1963
1962
|
return new URL(provider.authorizationUrl);
|
|
1964
1963
|
}
|
|
1965
|
-
|
|
1964
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.baseAuthUrl, "Base auth URL not found");
|
|
1966
1965
|
if (providerType === _dynamic_labs_sdk_api_core.ProviderEnum.Shopify) {
|
|
1967
|
-
|
|
1966
|
+
require_updateAuthFromVerifyResponse.assertDefined(provider.shopifyStore, "Shopify store value not found in provider");
|
|
1968
1967
|
const loginBaseUrl = provider.baseAuthUrl.replace("{{shopifyStore}}", provider.shopifyStore);
|
|
1969
1968
|
return new URL(loginBaseUrl);
|
|
1970
1969
|
}
|
|
@@ -1978,10 +1977,10 @@ const providersRequiringPkce = ["twitter", "github"];
|
|
|
1978
1977
|
*/
|
|
1979
1978
|
const buildOAuthUrl = async (core, provider) => {
|
|
1980
1979
|
const { projectSettings } = core.state.get();
|
|
1981
|
-
|
|
1982
|
-
|
|
1980
|
+
require_updateAuthFromVerifyResponse.assertDefined(projectSettings, "Project settings not found");
|
|
1981
|
+
require_updateAuthFromVerifyResponse.assertDefined(projectSettings.providers, "Project providers not found");
|
|
1983
1982
|
const socialProvider = projectSettings.providers.find((p) => p.provider === provider);
|
|
1984
|
-
|
|
1983
|
+
require_updateAuthFromVerifyResponse.assertDefined(socialProvider, `Social provider ${provider} not supported`);
|
|
1985
1984
|
const isGoogleDriveBackupEnabled = projectSettings.sdk.waas?.backupOptions?.includes(_dynamic_labs_sdk_api_core.WaasBackupOptionsEnum.GoogleDrive);
|
|
1986
1985
|
const socialProviderUrl = addOAuthUrlParams({
|
|
1987
1986
|
baseUrl: getOAuthBaseUrl(socialProvider),
|
|
@@ -1989,8 +1988,8 @@ const buildOAuthUrl = async (core, provider) => {
|
|
|
1989
1988
|
provider: socialProvider
|
|
1990
1989
|
});
|
|
1991
1990
|
const usingPkce = providersRequiringPkce.includes(provider);
|
|
1992
|
-
const state =
|
|
1993
|
-
const codeVerifier =
|
|
1991
|
+
const state = require_updateAuthFromVerifyResponse.randomString({ length: 32 });
|
|
1992
|
+
const codeVerifier = require_updateAuthFromVerifyResponse.randomString({ length: 43 });
|
|
1994
1993
|
socialProviderUrl.searchParams.set("state", state);
|
|
1995
1994
|
socialProviderUrl.searchParams.set("response_type", "code");
|
|
1996
1995
|
if (usingPkce) {
|
|
@@ -2022,9 +2021,9 @@ const buildOAuthUrl = async (core, provider) => {
|
|
|
2022
2021
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2023
2022
|
* @instrumented
|
|
2024
2023
|
*/
|
|
2025
|
-
const signInWithSocialRedirect = async ({ provider, redirectUrl }, client =
|
|
2026
|
-
const core =
|
|
2027
|
-
const apiClient =
|
|
2024
|
+
const signInWithSocialRedirect = async ({ provider, redirectUrl }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2025
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2026
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
2028
2027
|
await core.initTrack.waitForAll();
|
|
2029
2028
|
const providerType = provider;
|
|
2030
2029
|
const { url, state, codeVerifier } = await buildOAuthUrl(core, providerType);
|
|
@@ -2044,12 +2043,12 @@ const signInWithSocialRedirect = async ({ provider, redirectUrl }, client = requ
|
|
|
2044
2043
|
await core.navigate(url.toString());
|
|
2045
2044
|
};
|
|
2046
2045
|
const __signInWithSocialRedirect_impl = signInWithSocialRedirect;
|
|
2047
|
-
const __signInWithSocialRedirect_wrapped =
|
|
2046
|
+
const __signInWithSocialRedirect_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2048
2047
|
fn: __signInWithSocialRedirect_impl,
|
|
2049
2048
|
functionName: "signInWithSocialRedirect",
|
|
2050
2049
|
getCore: () => {
|
|
2051
2050
|
try {
|
|
2052
|
-
return
|
|
2051
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2053
2052
|
} catch {
|
|
2054
2053
|
return;
|
|
2055
2054
|
}
|
|
@@ -2065,14 +2064,14 @@ const __signInWithSocialRedirect_wrapped = require_InvalidParamError.instrumentF
|
|
|
2065
2064
|
* @instrumented
|
|
2066
2065
|
* @noHook Deprecated alias that is not exposed as a React hook.
|
|
2067
2066
|
*/
|
|
2068
|
-
const authenticateWithSocial = (params, client =
|
|
2067
|
+
const authenticateWithSocial = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => __signInWithSocialRedirect_wrapped(params, client);
|
|
2069
2068
|
const __authenticateWithSocial_impl = authenticateWithSocial;
|
|
2070
|
-
const __authenticateWithSocial_wrapped =
|
|
2069
|
+
const __authenticateWithSocial_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2071
2070
|
fn: __authenticateWithSocial_impl,
|
|
2072
2071
|
functionName: "authenticateWithSocial",
|
|
2073
2072
|
getCore: () => {
|
|
2074
2073
|
try {
|
|
2075
|
-
return
|
|
2074
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2076
2075
|
} catch {
|
|
2077
2076
|
return;
|
|
2078
2077
|
}
|
|
@@ -2101,8 +2100,8 @@ const __authenticateWithSocial_wrapped = require_InvalidParamError.instrumentFun
|
|
|
2101
2100
|
* @instrumented
|
|
2102
2101
|
*/
|
|
2103
2102
|
const processSocialCallback = async ({ url, requestedScopes }, client) => {
|
|
2104
|
-
const core =
|
|
2105
|
-
const apiClient =
|
|
2103
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2104
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient(client.user ? { elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentiallink } : {}, client);
|
|
2106
2105
|
await core.initTrack.waitForAll();
|
|
2107
2106
|
const dynamicOauthState = url.searchParams.get("dynamicOauthState");
|
|
2108
2107
|
const dynamicOauthCode = url.searchParams.get("dynamicOauthCode");
|
|
@@ -2135,16 +2134,16 @@ const processSocialCallback = async ({ url, requestedScopes }, client) => {
|
|
|
2135
2134
|
},
|
|
2136
2135
|
providerType: provider
|
|
2137
2136
|
});
|
|
2138
|
-
|
|
2137
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
2139
2138
|
return response.user;
|
|
2140
2139
|
};
|
|
2141
2140
|
const __processSocialCallback_impl = processSocialCallback;
|
|
2142
|
-
const __processSocialCallback_wrapped =
|
|
2141
|
+
const __processSocialCallback_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2143
2142
|
fn: __processSocialCallback_impl,
|
|
2144
2143
|
functionName: "processSocialCallback",
|
|
2145
2144
|
getCore: () => {
|
|
2146
2145
|
try {
|
|
2147
|
-
return
|
|
2146
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2148
2147
|
} catch {
|
|
2149
2148
|
return;
|
|
2150
2149
|
}
|
|
@@ -2168,17 +2167,17 @@ const __processSocialCallback_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
2168
2167
|
* @throws InvalidRedirectStorageStateError If the stored state doesn't match.
|
|
2169
2168
|
* @instrumented
|
|
2170
2169
|
*/
|
|
2171
|
-
const completeSocialRedirect = ({ url, requestedScopes }, client =
|
|
2170
|
+
const completeSocialRedirect = ({ url, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => __processSocialCallback_wrapped({
|
|
2172
2171
|
requestedScopes,
|
|
2173
2172
|
url
|
|
2174
2173
|
}, client);
|
|
2175
2174
|
const __completeSocialRedirect_impl = completeSocialRedirect;
|
|
2176
|
-
const __completeSocialRedirect_wrapped =
|
|
2175
|
+
const __completeSocialRedirect_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2177
2176
|
fn: __completeSocialRedirect_impl,
|
|
2178
2177
|
functionName: "completeSocialRedirect",
|
|
2179
2178
|
getCore: () => {
|
|
2180
2179
|
try {
|
|
2181
|
-
return
|
|
2180
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2182
2181
|
} catch {
|
|
2183
2182
|
return;
|
|
2184
2183
|
}
|
|
@@ -2194,14 +2193,14 @@ const __completeSocialRedirect_wrapped = require_InvalidParamError.instrumentFun
|
|
|
2194
2193
|
* @instrumented
|
|
2195
2194
|
* @noHook Deprecated alias; the replacement is exposed via its own hook.
|
|
2196
2195
|
*/
|
|
2197
|
-
const completeSocialAuthentication = (params, client =
|
|
2196
|
+
const completeSocialAuthentication = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => __completeSocialRedirect_wrapped(params, client);
|
|
2198
2197
|
const __completeSocialAuthentication_impl = completeSocialAuthentication;
|
|
2199
|
-
const __completeSocialAuthentication_wrapped =
|
|
2198
|
+
const __completeSocialAuthentication_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2200
2199
|
fn: __completeSocialAuthentication_impl,
|
|
2201
2200
|
functionName: "completeSocialAuthentication",
|
|
2202
2201
|
getCore: () => {
|
|
2203
2202
|
try {
|
|
2204
|
-
return
|
|
2203
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2205
2204
|
} catch {
|
|
2206
2205
|
return;
|
|
2207
2206
|
}
|
|
@@ -2223,8 +2222,8 @@ const __completeSocialAuthentication_wrapped = require_InvalidParamError.instrum
|
|
|
2223
2222
|
* @notInstrumented
|
|
2224
2223
|
* @noHook Low-level redirect-detection primitive that is not exposed as a React hook.
|
|
2225
2224
|
*/
|
|
2226
|
-
const detectSocialRedirectUrl = async ({ url }, client =
|
|
2227
|
-
const core =
|
|
2225
|
+
const detectSocialRedirectUrl = async ({ url }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2226
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2228
2227
|
const dynamicOauthState = url.searchParams.get("dynamicOauthState");
|
|
2229
2228
|
const dynamicOauthCode = url.searchParams.get("dynamicOauthCode");
|
|
2230
2229
|
if (!dynamicOauthState || !dynamicOauthCode) return false;
|
|
@@ -2241,7 +2240,7 @@ const detectSocialRedirectUrl = async ({ url }, client = require_InvalidParamErr
|
|
|
2241
2240
|
* @notInstrumented
|
|
2242
2241
|
* @noHook Deprecated alias; the replacement is exposed via its own hook.
|
|
2243
2242
|
*/
|
|
2244
|
-
const detectOAuthRedirect = (params, client =
|
|
2243
|
+
const detectOAuthRedirect = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => detectSocialRedirectUrl(params, client);
|
|
2245
2244
|
|
|
2246
2245
|
//#endregion
|
|
2247
2246
|
//#region src/modules/auth/social/oauth/signInWithSocialPopUp/signInWithSocialPopUp.ts
|
|
@@ -2256,16 +2255,16 @@ const detectOAuthRedirect = (params, client = require_InvalidParamError.getDefau
|
|
|
2256
2255
|
* @throws MethodNotImplementedError Always on web.
|
|
2257
2256
|
* @instrumented
|
|
2258
2257
|
*/
|
|
2259
|
-
const signInWithSocialPopUp = async ({ provider, requestedScopes }, client =
|
|
2258
|
+
const signInWithSocialPopUp = async ({ provider, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2260
2259
|
throw new require_getNetworkProviderFromNetworkId.MethodNotImplementedError("signInWithSocialPopUp (only available on React Native — use signInWithSocialRedirect on web)");
|
|
2261
2260
|
};
|
|
2262
2261
|
const __signInWithSocialPopUp_impl = signInWithSocialPopUp;
|
|
2263
|
-
const __signInWithSocialPopUp_wrapped =
|
|
2262
|
+
const __signInWithSocialPopUp_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2264
2263
|
fn: __signInWithSocialPopUp_impl,
|
|
2265
2264
|
functionName: "signInWithSocialPopUp",
|
|
2266
2265
|
getCore: () => {
|
|
2267
2266
|
try {
|
|
2268
|
-
return
|
|
2267
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2269
2268
|
} catch {
|
|
2270
2269
|
return;
|
|
2271
2270
|
}
|
|
@@ -2281,8 +2280,8 @@ const __signInWithSocialPopUp_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
2281
2280
|
* This function consolidates this information to determine which wallet was most recently selected.
|
|
2282
2281
|
* @notInstrumented
|
|
2283
2282
|
*/
|
|
2284
|
-
const getPrimaryWalletAccount = (client =
|
|
2285
|
-
const sortedLastSelectedWalletAccounts =
|
|
2283
|
+
const getPrimaryWalletAccount = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2284
|
+
const sortedLastSelectedWalletAccounts = require_updateAuthFromVerifyResponse.getWalletAccounts(client).filter((walletAccount) => Boolean(walletAccount.lastSelectedAt)).sort((a, b) => b.lastSelectedAt.getTime() - a.lastSelectedAt.getTime());
|
|
2286
2285
|
if (sortedLastSelectedWalletAccounts.length === 0) return null;
|
|
2287
2286
|
const [primaryWalletAccount] = sortedLastSelectedWalletAccounts;
|
|
2288
2287
|
return primaryWalletAccount;
|
|
@@ -2305,9 +2304,9 @@ const getPrimaryWalletAccount = (client = require_InvalidParamError.getDefaultCl
|
|
|
2305
2304
|
* @instrumented
|
|
2306
2305
|
* @redact-params
|
|
2307
2306
|
*/
|
|
2308
|
-
const unlinkSocialAccount = async ({ verifiedCredentialId }, client =
|
|
2309
|
-
const core =
|
|
2310
|
-
const apiClient =
|
|
2307
|
+
const unlinkSocialAccount = async ({ verifiedCredentialId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2308
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2309
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink }, client);
|
|
2311
2310
|
const primaryWalletAccount = getPrimaryWalletAccount(client);
|
|
2312
2311
|
const walletId = primaryWalletAccount?.verifiedCredentialId?.replace("-zerodev", "") ?? void 0;
|
|
2313
2312
|
const isEmbeddedWallet = !!primaryWalletAccount && require_getWalletProviderByKey.getVerifiedCredentialForWalletAccount({ walletAccount: primaryWalletAccount }, client)?.walletProvider === _dynamic_labs_sdk_api_core.WalletProviderEnum.EmbeddedWallet;
|
|
@@ -2318,16 +2317,16 @@ const unlinkSocialAccount = async ({ verifiedCredentialId }, client = require_In
|
|
|
2318
2317
|
walletId: isEmbeddedWallet ? void 0 : walletId
|
|
2319
2318
|
}
|
|
2320
2319
|
});
|
|
2321
|
-
|
|
2320
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
2322
2321
|
return response;
|
|
2323
2322
|
};
|
|
2324
2323
|
const __unlinkSocialAccount_impl = unlinkSocialAccount;
|
|
2325
|
-
const __unlinkSocialAccount_wrapped =
|
|
2324
|
+
const __unlinkSocialAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2326
2325
|
fn: __unlinkSocialAccount_impl,
|
|
2327
2326
|
functionName: "unlinkSocialAccount",
|
|
2328
2327
|
getCore: () => {
|
|
2329
2328
|
try {
|
|
2330
|
-
return
|
|
2329
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2331
2330
|
} catch {
|
|
2332
2331
|
return;
|
|
2333
2332
|
}
|
|
@@ -2354,11 +2353,11 @@ const __unlinkSocialAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
2354
2353
|
* @returns A promise that resolves to an array of token balances.
|
|
2355
2354
|
* @notInstrumented
|
|
2356
2355
|
*/
|
|
2357
|
-
const getTokenBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client =
|
|
2358
|
-
const core =
|
|
2359
|
-
const apiClient =
|
|
2356
|
+
const getTokenBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2357
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2358
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
2360
2359
|
if (!networkId && !networkIds) {
|
|
2361
|
-
const activeNetworkId = await
|
|
2360
|
+
const activeNetworkId = await require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
2362
2361
|
networkId = Number(activeNetworkId.networkId);
|
|
2363
2362
|
}
|
|
2364
2363
|
return await apiClient.getAccountBalances({
|
|
@@ -2386,7 +2385,7 @@ const getTokenBalances = async ({ walletAccount, networkId, networkIds, includeP
|
|
|
2386
2385
|
* @notInstrumented
|
|
2387
2386
|
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
2388
2387
|
*/
|
|
2389
|
-
const getBalances = (params, client =
|
|
2388
|
+
const getBalances = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => getTokenBalances(params, client);
|
|
2390
2389
|
|
|
2391
2390
|
//#endregion
|
|
2392
2391
|
//#region src/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.ts
|
|
@@ -2404,9 +2403,9 @@ const getBalances = (params, client = require_InvalidParamError.getDefaultClient
|
|
|
2404
2403
|
* @returns A promise that resolves to the chain balances across multiple networks.
|
|
2405
2404
|
* @notInstrumented
|
|
2406
2405
|
*/
|
|
2407
|
-
const getMultichainTokenBalances = async ({ balanceRequest }, client =
|
|
2408
|
-
const core =
|
|
2409
|
-
return (await
|
|
2406
|
+
const getMultichainTokenBalances = async ({ balanceRequest }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2407
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2408
|
+
return (await require_updateAuthFromVerifyResponse.createApiClient({}, client).postMultichainAccountBalances({
|
|
2410
2409
|
environmentId: core.environmentId,
|
|
2411
2410
|
multichainAccountBalancesRequest: balanceRequest
|
|
2412
2411
|
})).chainBalances;
|
|
@@ -2422,7 +2421,7 @@ const getMultichainTokenBalances = async ({ balanceRequest }, client = require_I
|
|
|
2422
2421
|
* @notInstrumented
|
|
2423
2422
|
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
2424
2423
|
*/
|
|
2425
|
-
const getMultichainBalances = (params, client =
|
|
2424
|
+
const getMultichainBalances = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => getMultichainTokenBalances(params, client);
|
|
2426
2425
|
|
|
2427
2426
|
//#endregion
|
|
2428
2427
|
//#region src/modules/checkout/utils/createCheckoutSessionTokenStorageKey/createCheckoutSessionTokenStorageKey.ts
|
|
@@ -2438,8 +2437,8 @@ const createCheckoutSessionTokenStorageKey = (transactionId) => {
|
|
|
2438
2437
|
//#region src/modules/checkout/utils/createCheckoutApiClient/createCheckoutApiClient.ts
|
|
2439
2438
|
/** @notInstrumented */
|
|
2440
2439
|
const createCheckoutApiClient = async ({ transactionId }, client) => {
|
|
2441
|
-
const core =
|
|
2442
|
-
const apiClient =
|
|
2440
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2441
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
2443
2442
|
const sessionToken = await core.storage.getItem(createCheckoutSessionTokenStorageKey(transactionId));
|
|
2444
2443
|
if (!sessionToken) throw new CheckoutSessionTokenMissingError({ transactionId });
|
|
2445
2444
|
return {
|
|
@@ -2468,7 +2467,7 @@ const createCheckoutApiClient = async ({ transactionId }, client) => {
|
|
|
2468
2467
|
* @notInstrumented
|
|
2469
2468
|
*/
|
|
2470
2469
|
const clearCheckoutSessionToken = async ({ transactionId }, client) => {
|
|
2471
|
-
await
|
|
2470
|
+
await require_updateAuthFromVerifyResponse.getCore(client).storage.removeItem(createCheckoutSessionTokenStorageKey(transactionId));
|
|
2472
2471
|
};
|
|
2473
2472
|
|
|
2474
2473
|
//#endregion
|
|
@@ -2486,10 +2485,10 @@ const withCheckoutSessionTokenCleanupOn401 = async ({ call, transactionId }, cli
|
|
|
2486
2485
|
try {
|
|
2487
2486
|
return await call();
|
|
2488
2487
|
} catch (error) {
|
|
2489
|
-
if (error instanceof
|
|
2488
|
+
if (error instanceof require_updateAuthFromVerifyResponse.APIError && error.status === 401) try {
|
|
2490
2489
|
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2491
2490
|
} catch (cleanupError) {
|
|
2492
|
-
|
|
2491
|
+
require_updateAuthFromVerifyResponse.getCore(client).logger.error("Failed to clear checkout session token after 401", cleanupError);
|
|
2493
2492
|
}
|
|
2494
2493
|
throw error;
|
|
2495
2494
|
}
|
|
@@ -2512,7 +2511,7 @@ const withCheckoutSessionTokenCleanupOn401 = async ({ call, transactionId }, cli
|
|
|
2512
2511
|
* @instrumented
|
|
2513
2512
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2514
2513
|
*/
|
|
2515
|
-
const attachCheckoutTransactionSource = async (params, client =
|
|
2514
|
+
const attachCheckoutTransactionSource = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2516
2515
|
const { transactionId, sourceType = "wallet" } = params;
|
|
2517
2516
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2518
2517
|
const attachSourceRequest = { sourceType };
|
|
@@ -2533,12 +2532,12 @@ const attachCheckoutTransactionSource = async (params, client = require_InvalidP
|
|
|
2533
2532
|
}, client);
|
|
2534
2533
|
};
|
|
2535
2534
|
const __attachCheckoutTransactionSource_impl = attachCheckoutTransactionSource;
|
|
2536
|
-
const __attachCheckoutTransactionSource_wrapped =
|
|
2535
|
+
const __attachCheckoutTransactionSource_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2537
2536
|
fn: __attachCheckoutTransactionSource_impl,
|
|
2538
2537
|
functionName: "attachCheckoutTransactionSource",
|
|
2539
2538
|
getCore: () => {
|
|
2540
2539
|
try {
|
|
2541
|
-
return
|
|
2540
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2542
2541
|
} catch {
|
|
2543
2542
|
return;
|
|
2544
2543
|
}
|
|
@@ -2562,7 +2561,7 @@ const __attachCheckoutTransactionSource_wrapped = require_InvalidParamError.inst
|
|
|
2562
2561
|
* @instrumented
|
|
2563
2562
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2564
2563
|
*/
|
|
2565
|
-
const broadcastCheckoutTransaction = async ({ transactionId, txHash }, client =
|
|
2564
|
+
const broadcastCheckoutTransaction = async ({ transactionId, txHash }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2566
2565
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2567
2566
|
return withCheckoutSessionTokenCleanupOn401({
|
|
2568
2567
|
call: () => apiClient.recordCheckoutBroadcast({
|
|
@@ -2575,12 +2574,12 @@ const broadcastCheckoutTransaction = async ({ transactionId, txHash }, client =
|
|
|
2575
2574
|
}, client);
|
|
2576
2575
|
};
|
|
2577
2576
|
const __broadcastCheckoutTransaction_impl = broadcastCheckoutTransaction;
|
|
2578
|
-
const __broadcastCheckoutTransaction_wrapped =
|
|
2577
|
+
const __broadcastCheckoutTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2579
2578
|
fn: __broadcastCheckoutTransaction_impl,
|
|
2580
2579
|
functionName: "broadcastCheckoutTransaction",
|
|
2581
2580
|
getCore: () => {
|
|
2582
2581
|
try {
|
|
2583
|
-
return
|
|
2582
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2584
2583
|
} catch {
|
|
2585
2584
|
return;
|
|
2586
2585
|
}
|
|
@@ -2600,7 +2599,7 @@ const __broadcastCheckoutTransaction_wrapped = require_InvalidParamError.instrum
|
|
|
2600
2599
|
* @instrumented
|
|
2601
2600
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2602
2601
|
*/
|
|
2603
|
-
const cancelCheckoutTransaction = async ({ transactionId }, client =
|
|
2602
|
+
const cancelCheckoutTransaction = async ({ transactionId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2604
2603
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2605
2604
|
const result = await withCheckoutSessionTokenCleanupOn401({
|
|
2606
2605
|
call: () => apiClient.cancelCheckoutTransaction({
|
|
@@ -2614,12 +2613,12 @@ const cancelCheckoutTransaction = async ({ transactionId }, client = require_Inv
|
|
|
2614
2613
|
return result;
|
|
2615
2614
|
};
|
|
2616
2615
|
const __cancelCheckoutTransaction_impl = cancelCheckoutTransaction;
|
|
2617
|
-
const __cancelCheckoutTransaction_wrapped =
|
|
2616
|
+
const __cancelCheckoutTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2618
2617
|
fn: __cancelCheckoutTransaction_impl,
|
|
2619
2618
|
functionName: "cancelCheckoutTransaction",
|
|
2620
2619
|
getCore: () => {
|
|
2621
2620
|
try {
|
|
2622
|
-
return
|
|
2621
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2623
2622
|
} catch {
|
|
2624
2623
|
return;
|
|
2625
2624
|
}
|
|
@@ -2631,7 +2630,7 @@ const __cancelCheckoutTransaction_wrapped = require_InvalidParamError.instrument
|
|
|
2631
2630
|
/** @notInstrumented */
|
|
2632
2631
|
const getCheckouts = async (client) => {
|
|
2633
2632
|
const projectSettings = client.projectSettings;
|
|
2634
|
-
|
|
2633
|
+
require_updateAuthFromVerifyResponse.assertDefined(projectSettings, "Project settings are not available");
|
|
2635
2634
|
return projectSettings.checkouts ?? [];
|
|
2636
2635
|
};
|
|
2637
2636
|
|
|
@@ -2648,12 +2647,12 @@ const getCheckouts = async (client) => {
|
|
|
2648
2647
|
* @instrumented
|
|
2649
2648
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2650
2649
|
*/
|
|
2651
|
-
const createCheckoutTransaction = async (params, client =
|
|
2652
|
-
const core =
|
|
2653
|
-
const apiClient =
|
|
2650
|
+
const createCheckoutTransaction = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2651
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2652
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
2654
2653
|
const checkouts = await getCheckouts(client);
|
|
2655
2654
|
const checkoutId = params.checkoutId || checkouts?.[0]?.id;
|
|
2656
|
-
|
|
2655
|
+
require_updateAuthFromVerifyResponse.assertDefined(checkoutId, "No checkout found. Please make sure you have a Checkout setup in the Dashboard.");
|
|
2657
2656
|
const result = await apiClient.createCheckoutTransaction({
|
|
2658
2657
|
checkoutId,
|
|
2659
2658
|
checkoutTransactionCreateRequest: {
|
|
@@ -2672,12 +2671,12 @@ const createCheckoutTransaction = async (params, client = require_InvalidParamEr
|
|
|
2672
2671
|
return result;
|
|
2673
2672
|
};
|
|
2674
2673
|
const __createCheckoutTransaction_impl = createCheckoutTransaction;
|
|
2675
|
-
const __createCheckoutTransaction_wrapped =
|
|
2674
|
+
const __createCheckoutTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2676
2675
|
fn: __createCheckoutTransaction_impl,
|
|
2677
2676
|
functionName: "createCheckoutTransaction",
|
|
2678
2677
|
getCore: () => {
|
|
2679
2678
|
try {
|
|
2680
|
-
return
|
|
2679
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2681
2680
|
} catch {
|
|
2682
2681
|
return;
|
|
2683
2682
|
}
|
|
@@ -2697,9 +2696,9 @@ const __createCheckoutTransaction_wrapped = require_InvalidParamError.instrument
|
|
|
2697
2696
|
* @notInstrumented
|
|
2698
2697
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2699
2698
|
*/
|
|
2700
|
-
const getCheckoutTransaction = async ({ transactionId }, client =
|
|
2701
|
-
const core =
|
|
2702
|
-
return
|
|
2699
|
+
const getCheckoutTransaction = async ({ transactionId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2700
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2701
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getCheckoutTransaction({
|
|
2703
2702
|
environmentId: core.environmentId,
|
|
2704
2703
|
transactionId
|
|
2705
2704
|
});
|
|
@@ -2718,7 +2717,7 @@ const getCheckoutTransaction = async ({ transactionId }, client = require_Invali
|
|
|
2718
2717
|
* @notInstrumented
|
|
2719
2718
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2720
2719
|
*/
|
|
2721
|
-
const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slippage, transactionId }, client =
|
|
2720
|
+
const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slippage, transactionId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2722
2721
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2723
2722
|
return withCheckoutSessionTokenCleanupOn401({
|
|
2724
2723
|
call: () => apiClient.quoteCheckoutTransaction({
|
|
@@ -2750,7 +2749,7 @@ const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slip
|
|
|
2750
2749
|
* @instrumented
|
|
2751
2750
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2752
2751
|
*/
|
|
2753
|
-
const prepareCheckoutTransaction = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, transactionId }, client =
|
|
2752
|
+
const prepareCheckoutTransaction = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, transactionId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2754
2753
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2755
2754
|
return withCheckoutSessionTokenCleanupOn401({
|
|
2756
2755
|
call: () => apiClient.prepareCheckoutTransaction({
|
|
@@ -2766,12 +2765,12 @@ const prepareCheckoutTransaction = async ({ assertBalanceForGasCost, assertBalan
|
|
|
2766
2765
|
}, client);
|
|
2767
2766
|
};
|
|
2768
2767
|
const __prepareCheckoutTransaction_impl = prepareCheckoutTransaction;
|
|
2769
|
-
const __prepareCheckoutTransaction_wrapped =
|
|
2768
|
+
const __prepareCheckoutTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2770
2769
|
fn: __prepareCheckoutTransaction_impl,
|
|
2771
2770
|
functionName: "prepareCheckoutTransaction",
|
|
2772
2771
|
getCore: () => {
|
|
2773
2772
|
try {
|
|
2774
|
-
return
|
|
2773
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2775
2774
|
} catch {
|
|
2776
2775
|
return;
|
|
2777
2776
|
}
|
|
@@ -2823,7 +2822,7 @@ const SWAP_SUPPORTED_CHAINS = [
|
|
|
2823
2822
|
* @notInstrumented
|
|
2824
2823
|
*/
|
|
2825
2824
|
const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider }, client) => {
|
|
2826
|
-
const { logger } =
|
|
2825
|
+
const { logger } = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2827
2826
|
if (!requiredNetworkId || !walletProvider.switchActiveNetwork) return;
|
|
2828
2827
|
logger.debug("[ensureCorrectActiveNetwork] Required network id", requiredNetworkId);
|
|
2829
2828
|
try {
|
|
@@ -2852,9 +2851,9 @@ const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider },
|
|
|
2852
2851
|
* @returns The transaction hash.
|
|
2853
2852
|
* @instrumented
|
|
2854
2853
|
*/
|
|
2855
|
-
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange, sponsorshipMode }, client =
|
|
2856
|
-
if (!SWAP_SUPPORTED_CHAINS.includes(walletAccount.chain)) throw new
|
|
2857
|
-
const walletProvider =
|
|
2854
|
+
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange, sponsorshipMode }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2855
|
+
if (!SWAP_SUPPORTED_CHAINS.includes(walletAccount.chain)) throw new require_updateAuthFromVerifyResponse.InvalidParamError(`Chain ${walletAccount.chain} is not supported for swap transactions`);
|
|
2856
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
2858
2857
|
assertWalletProviderMethodDefined(walletProvider, "executeSwapTransaction");
|
|
2859
2858
|
await ensureCorrectActiveNetwork({
|
|
2860
2859
|
requiredNetworkId: signingPayload.chainId,
|
|
@@ -2869,12 +2868,12 @@ const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepCha
|
|
|
2869
2868
|
return { transactionHash };
|
|
2870
2869
|
};
|
|
2871
2870
|
const __executeSwapTransaction_impl = executeSwapTransaction;
|
|
2872
|
-
const __executeSwapTransaction_wrapped =
|
|
2871
|
+
const __executeSwapTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2873
2872
|
fn: __executeSwapTransaction_impl,
|
|
2874
2873
|
functionName: "executeSwapTransaction",
|
|
2875
2874
|
getCore: () => {
|
|
2876
2875
|
try {
|
|
2877
|
-
return
|
|
2876
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2878
2877
|
} catch {
|
|
2879
2878
|
return;
|
|
2880
2879
|
}
|
|
@@ -2900,13 +2899,13 @@ const __executeSwapTransaction_wrapped = require_InvalidParamError.instrumentFun
|
|
|
2900
2899
|
* @instrumented
|
|
2901
2900
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2902
2901
|
*/
|
|
2903
|
-
const submitCheckoutTransaction = async ({ onStepChange, transactionId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount }, client =
|
|
2902
|
+
const submitCheckoutTransaction = async ({ onStepChange, transactionId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2904
2903
|
const signingPayload = (await __prepareCheckoutTransaction_wrapped({
|
|
2905
2904
|
assertBalanceForGasCost,
|
|
2906
2905
|
assertBalanceForTransferAmount,
|
|
2907
2906
|
transactionId
|
|
2908
2907
|
}, client)).quote?.signingPayload;
|
|
2909
|
-
|
|
2908
|
+
require_updateAuthFromVerifyResponse.assertDefined(signingPayload, "No signing payload returned from prepare — quote may be missing transaction data");
|
|
2910
2909
|
const { transactionHash } = await __executeSwapTransaction_wrapped({
|
|
2911
2910
|
onStepChange,
|
|
2912
2911
|
signingPayload,
|
|
@@ -2918,12 +2917,12 @@ const submitCheckoutTransaction = async ({ onStepChange, transactionId, walletAc
|
|
|
2918
2917
|
}, client);
|
|
2919
2918
|
};
|
|
2920
2919
|
const __submitCheckoutTransaction_impl = submitCheckoutTransaction;
|
|
2921
|
-
const __submitCheckoutTransaction_wrapped =
|
|
2920
|
+
const __submitCheckoutTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
2922
2921
|
fn: __submitCheckoutTransaction_impl,
|
|
2923
2922
|
functionName: "submitCheckoutTransaction",
|
|
2924
2923
|
getCore: () => {
|
|
2925
2924
|
try {
|
|
2926
|
-
return
|
|
2925
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
2927
2926
|
} catch {
|
|
2928
2927
|
return;
|
|
2929
2928
|
}
|
|
@@ -2953,7 +2952,7 @@ const __submitCheckoutTransaction_wrapped = require_InvalidParamError.instrument
|
|
|
2953
2952
|
* @notInstrumented
|
|
2954
2953
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2955
2954
|
*/
|
|
2956
|
-
const trackCheckoutTransaction = (_params, client =
|
|
2955
|
+
const trackCheckoutTransaction = (_params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2957
2956
|
return Promise.resolve();
|
|
2958
2957
|
};
|
|
2959
2958
|
|
|
@@ -2976,10 +2975,10 @@ const trackCheckoutTransaction = (_params, client = require_InvalidParamError.ge
|
|
|
2976
2975
|
* @notInstrumented
|
|
2977
2976
|
* @noHook Legacy checkout function not exposed as a React hook; the checkout product is being renamed to flow.
|
|
2978
2977
|
*/
|
|
2979
|
-
const requiresConversion = async ({ transaction }, client =
|
|
2980
|
-
if (!transaction.fromChainId || !transaction.fromChainName || !transaction.fromToken) throw new
|
|
2978
|
+
const requiresConversion = async ({ transaction }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2979
|
+
if (!transaction.fromChainId || !transaction.fromChainName || !transaction.fromToken) throw new require_updateAuthFromVerifyResponse.InvalidParamError("Transaction is missing source information. Make sure that attachCheckoutTransactionSource has been called before calling this function.");
|
|
2981
2980
|
const checkout = (await getCheckouts(client)).find((checkout$1) => checkout$1.id === transaction.checkoutId);
|
|
2982
|
-
|
|
2981
|
+
require_updateAuthFromVerifyResponse.assertDefined(checkout, "Could not find checkout associated with transaction.");
|
|
2983
2982
|
return !checkout.settlementConfig.settlements.some((settlement) => settlement.chainName === transaction.fromChainName && settlement.chainId === transaction.fromChainId && settlement.tokenAddress === transaction.fromToken);
|
|
2984
2983
|
};
|
|
2985
2984
|
|
|
@@ -2987,21 +2986,21 @@ const requiresConversion = async ({ transaction }, client = require_InvalidParam
|
|
|
2987
2986
|
//#region src/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.ts
|
|
2988
2987
|
const DEVICE_REGISTRATION_TOKEN_HEADER = "x-dynamic-device-registration-token";
|
|
2989
2988
|
/** @instrumented */
|
|
2990
|
-
const completeDeviceRegistration = async ({ deviceToken }, client =
|
|
2991
|
-
|
|
2992
|
-
const core =
|
|
2993
|
-
const response = await
|
|
2994
|
-
|
|
2995
|
-
|
|
2989
|
+
const completeDeviceRegistration = async ({ deviceToken }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
2990
|
+
require_updateAuthFromVerifyResponse.assertDefined(deviceToken, "deviceToken is required");
|
|
2991
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
2992
|
+
const response = await require_updateAuthFromVerifyResponse.createApiClient({ headers: { [DEVICE_REGISTRATION_TOKEN_HEADER]: deviceToken } }, client).deviceRegistration({ environmentId: core.environmentId });
|
|
2993
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
2994
|
+
require_updateAuthFromVerifyResponse.emitEvent({ event: "deviceRegistrationCompleted" }, client);
|
|
2996
2995
|
return response;
|
|
2997
2996
|
};
|
|
2998
2997
|
const __completeDeviceRegistration_impl = completeDeviceRegistration;
|
|
2999
|
-
const __completeDeviceRegistration_wrapped =
|
|
2998
|
+
const __completeDeviceRegistration_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3000
2999
|
fn: __completeDeviceRegistration_impl,
|
|
3001
3000
|
functionName: "completeDeviceRegistration",
|
|
3002
3001
|
getCore: () => {
|
|
3003
3002
|
try {
|
|
3004
|
-
return
|
|
3003
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3005
3004
|
} catch {
|
|
3006
3005
|
return;
|
|
3007
3006
|
}
|
|
@@ -3055,9 +3054,9 @@ const detectDeviceRegistrationRedirect = ({ url }) => {
|
|
|
3055
3054
|
//#endregion
|
|
3056
3055
|
//#region src/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.ts
|
|
3057
3056
|
/** @notInstrumented */
|
|
3058
|
-
const getRegisteredDevices = async (client =
|
|
3059
|
-
const core =
|
|
3060
|
-
const apiClient =
|
|
3057
|
+
const getRegisteredDevices = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3058
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3059
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
3061
3060
|
try {
|
|
3062
3061
|
return (await apiClient.listDeviceRegistrations({ environmentId: core.environmentId })).deviceRegistrations;
|
|
3063
3062
|
} catch (error) {
|
|
@@ -3065,7 +3064,7 @@ const getRegisteredDevices = async (client = require_InvalidParamError.getDefaul
|
|
|
3065
3064
|
* The API will return 401 when no devices are registered when there are no
|
|
3066
3065
|
* devices registered. We need to handle this case gracefully.
|
|
3067
3066
|
*/
|
|
3068
|
-
if (error instanceof
|
|
3067
|
+
if (error instanceof require_updateAuthFromVerifyResponse.UnauthorizedError) return [];
|
|
3069
3068
|
throw error;
|
|
3070
3069
|
}
|
|
3071
3070
|
};
|
|
@@ -3073,18 +3072,18 @@ const getRegisteredDevices = async (client = require_InvalidParamError.getDefaul
|
|
|
3073
3072
|
//#endregion
|
|
3074
3073
|
//#region src/modules/deviceRegistration/revokeAllRegisteredDevices/revokeAllRegisteredDevices.ts
|
|
3075
3074
|
/** @instrumented */
|
|
3076
|
-
const revokeAllRegisteredDevices = async (client =
|
|
3077
|
-
const core =
|
|
3078
|
-
await
|
|
3075
|
+
const revokeAllRegisteredDevices = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3076
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3077
|
+
await require_updateAuthFromVerifyResponse.createApiClient({}, client).deleteAllDeviceRegistrations({ environmentId: core.environmentId });
|
|
3079
3078
|
await require_isMfaRequiredForAction.__logoutWithReason_wrapped({ reason: "all-devices-revoked" }, client);
|
|
3080
3079
|
};
|
|
3081
3080
|
const __revokeAllRegisteredDevices_impl = revokeAllRegisteredDevices;
|
|
3082
|
-
const __revokeAllRegisteredDevices_wrapped =
|
|
3081
|
+
const __revokeAllRegisteredDevices_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3083
3082
|
fn: __revokeAllRegisteredDevices_impl,
|
|
3084
3083
|
functionName: "revokeAllRegisteredDevices",
|
|
3085
3084
|
getCore: () => {
|
|
3086
3085
|
try {
|
|
3087
|
-
return
|
|
3086
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3088
3087
|
} catch {
|
|
3089
3088
|
return;
|
|
3090
3089
|
}
|
|
@@ -3094,21 +3093,21 @@ const __revokeAllRegisteredDevices_wrapped = require_InvalidParamError.instrumen
|
|
|
3094
3093
|
//#endregion
|
|
3095
3094
|
//#region src/modules/deviceRegistration/revokeRegisteredDevice/revokeRegisteredDevice.ts
|
|
3096
3095
|
/** @instrumented */
|
|
3097
|
-
const revokeRegisteredDevice = async ({ deviceRegistrationId }, client =
|
|
3098
|
-
|
|
3099
|
-
const core =
|
|
3100
|
-
if ((await
|
|
3096
|
+
const revokeRegisteredDevice = async ({ deviceRegistrationId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3097
|
+
require_updateAuthFromVerifyResponse.assertDefined(deviceRegistrationId, "deviceRegistrationId is required");
|
|
3098
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3099
|
+
if ((await require_updateAuthFromVerifyResponse.createApiClient({}, client).deleteDeviceRegistration({
|
|
3101
3100
|
deviceRegistrationId,
|
|
3102
3101
|
environmentId: core.environmentId
|
|
3103
3102
|
})).currentDeviceRevoked) await require_isMfaRequiredForAction.__logoutWithReason_wrapped({ reason: "device-revoked" }, client);
|
|
3104
3103
|
};
|
|
3105
3104
|
const __revokeRegisteredDevice_impl = revokeRegisteredDevice;
|
|
3106
|
-
const __revokeRegisteredDevice_wrapped =
|
|
3105
|
+
const __revokeRegisteredDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3107
3106
|
fn: __revokeRegisteredDevice_impl,
|
|
3108
3107
|
functionName: "revokeRegisteredDevice",
|
|
3109
3108
|
getCore: () => {
|
|
3110
3109
|
try {
|
|
3111
|
-
return
|
|
3110
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3112
3111
|
} catch {
|
|
3113
3112
|
return;
|
|
3114
3113
|
}
|
|
@@ -3144,7 +3143,7 @@ const createFlowSessionTokenStorageKey = (flowId) => {
|
|
|
3144
3143
|
* @notInstrumented
|
|
3145
3144
|
*/
|
|
3146
3145
|
const clearFlowSessionToken = async ({ flowId }, client) => {
|
|
3147
|
-
await
|
|
3146
|
+
await require_updateAuthFromVerifyResponse.getCore(client).storage.removeItem(createFlowSessionTokenStorageKey(flowId));
|
|
3148
3147
|
};
|
|
3149
3148
|
|
|
3150
3149
|
//#endregion
|
|
@@ -3162,10 +3161,10 @@ const withFlowSessionTokenCleanupOn401 = async ({ call, flowId }, client) => {
|
|
|
3162
3161
|
try {
|
|
3163
3162
|
return await call();
|
|
3164
3163
|
} catch (error) {
|
|
3165
|
-
if (error instanceof
|
|
3164
|
+
if (error instanceof require_updateAuthFromVerifyResponse.APIError && error.status === 401) try {
|
|
3166
3165
|
await clearFlowSessionToken({ flowId }, client);
|
|
3167
3166
|
} catch (cleanupError) {
|
|
3168
|
-
|
|
3167
|
+
require_updateAuthFromVerifyResponse.getCore(client).logger.error("Failed to clear flow session token after 401", cleanupError);
|
|
3169
3168
|
}
|
|
3170
3169
|
throw error;
|
|
3171
3170
|
}
|
|
@@ -3185,10 +3184,10 @@ const withFlowSessionTokenCleanupOn401 = async ({ call, flowId }, client) => {
|
|
|
3185
3184
|
* @returns The updated flow and session token
|
|
3186
3185
|
* @instrumented
|
|
3187
3186
|
*/
|
|
3188
|
-
const attachFlowSource = async (params, client =
|
|
3189
|
-
const core =
|
|
3187
|
+
const attachFlowSource = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3188
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3190
3189
|
const { flowId, sourceType = "wallet" } = params;
|
|
3191
|
-
const apiClient =
|
|
3190
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
3192
3191
|
const flowAttachSourceRequest = { sourceType };
|
|
3193
3192
|
if (params.sourceType === "exchange") flowAttachSourceRequest.exchangeProvider = params.exchangeProvider;
|
|
3194
3193
|
else if (params.sourceType === "deposit_address") {
|
|
@@ -3200,11 +3199,13 @@ const attachFlowSource = async (params, client = require_InvalidParamError.getDe
|
|
|
3200
3199
|
flowAttachSourceRequest.fromChainId = params.fromChainId;
|
|
3201
3200
|
flowAttachSourceRequest.fromChainName = params.fromChainName;
|
|
3202
3201
|
}
|
|
3202
|
+
const existingToken = await core.storage.getItem(createFlowSessionTokenStorageKey(flowId));
|
|
3203
3203
|
const result = await withFlowSessionTokenCleanupOn401({
|
|
3204
3204
|
call: () => apiClient.attachFlowSource({
|
|
3205
3205
|
environmentId: core.environmentId,
|
|
3206
3206
|
flowAttachSourceRequest,
|
|
3207
|
-
flowId
|
|
3207
|
+
flowId,
|
|
3208
|
+
xDynamicFlowSessionToken: existingToken ?? void 0
|
|
3208
3209
|
}),
|
|
3209
3210
|
flowId
|
|
3210
3211
|
}, client);
|
|
@@ -3212,12 +3213,12 @@ const attachFlowSource = async (params, client = require_InvalidParamError.getDe
|
|
|
3212
3213
|
return result;
|
|
3213
3214
|
};
|
|
3214
3215
|
const __attachFlowSource_impl = attachFlowSource;
|
|
3215
|
-
const __attachFlowSource_wrapped =
|
|
3216
|
+
const __attachFlowSource_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3216
3217
|
fn: __attachFlowSource_impl,
|
|
3217
3218
|
functionName: "attachFlowSource",
|
|
3218
3219
|
getCore: () => {
|
|
3219
3220
|
try {
|
|
3220
|
-
return
|
|
3221
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3221
3222
|
} catch {
|
|
3222
3223
|
return;
|
|
3223
3224
|
}
|
|
@@ -3228,8 +3229,8 @@ const __attachFlowSource_wrapped = require_InvalidParamError.instrumentFunction(
|
|
|
3228
3229
|
//#region src/modules/flow/utils/createFlowApiClient/createFlowApiClient.ts
|
|
3229
3230
|
/** @notInstrumented */
|
|
3230
3231
|
const createFlowApiClient = async ({ flowId }, client) => {
|
|
3231
|
-
const core =
|
|
3232
|
-
const apiClient =
|
|
3232
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3233
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
3233
3234
|
const sessionToken = await core.storage.getItem(createFlowSessionTokenStorageKey(flowId));
|
|
3234
3235
|
if (!sessionToken) throw new FlowSessionTokenMissingError({ flowId });
|
|
3235
3236
|
return {
|
|
@@ -3253,7 +3254,7 @@ const createFlowApiClient = async ({ flowId }, client) => {
|
|
|
3253
3254
|
* @returns The updated flow
|
|
3254
3255
|
* @instrumented
|
|
3255
3256
|
*/
|
|
3256
|
-
const broadcastFlow = async ({ flowId, txHash }, client =
|
|
3257
|
+
const broadcastFlow = async ({ flowId, txHash }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3257
3258
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3258
3259
|
return withFlowSessionTokenCleanupOn401({
|
|
3259
3260
|
call: () => apiClient.broadcastFlow({
|
|
@@ -3266,12 +3267,12 @@ const broadcastFlow = async ({ flowId, txHash }, client = require_InvalidParamEr
|
|
|
3266
3267
|
}, client);
|
|
3267
3268
|
};
|
|
3268
3269
|
const __broadcastFlow_impl = broadcastFlow;
|
|
3269
|
-
const __broadcastFlow_wrapped =
|
|
3270
|
+
const __broadcastFlow_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3270
3271
|
fn: __broadcastFlow_impl,
|
|
3271
3272
|
functionName: "broadcastFlow",
|
|
3272
3273
|
getCore: () => {
|
|
3273
3274
|
try {
|
|
3274
|
-
return
|
|
3275
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3275
3276
|
} catch {
|
|
3276
3277
|
return;
|
|
3277
3278
|
}
|
|
@@ -3288,7 +3289,7 @@ const __broadcastFlow_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
3288
3289
|
* @returns The cancelled flow
|
|
3289
3290
|
* @instrumented
|
|
3290
3291
|
*/
|
|
3291
|
-
const cancelFlow = async ({ flowId }, client =
|
|
3292
|
+
const cancelFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3292
3293
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3293
3294
|
const result = await withFlowSessionTokenCleanupOn401({
|
|
3294
3295
|
call: () => apiClient.cancelFlow({
|
|
@@ -3302,12 +3303,12 @@ const cancelFlow = async ({ flowId }, client = require_InvalidParamError.getDefa
|
|
|
3302
3303
|
return result;
|
|
3303
3304
|
};
|
|
3304
3305
|
const __cancelFlow_impl = cancelFlow;
|
|
3305
|
-
const __cancelFlow_wrapped =
|
|
3306
|
+
const __cancelFlow_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3306
3307
|
fn: __cancelFlow_impl,
|
|
3307
3308
|
functionName: "cancelFlow",
|
|
3308
3309
|
getCore: () => {
|
|
3309
3310
|
try {
|
|
3310
|
-
return
|
|
3311
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3311
3312
|
} catch {
|
|
3312
3313
|
return;
|
|
3313
3314
|
}
|
|
@@ -3324,9 +3325,9 @@ const __cancelFlow_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
3324
3325
|
* @returns The flow
|
|
3325
3326
|
* @notInstrumented
|
|
3326
3327
|
*/
|
|
3327
|
-
const getFlow = async ({ flowId }, client =
|
|
3328
|
-
const core =
|
|
3329
|
-
return
|
|
3328
|
+
const getFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3329
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3330
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getFlow({
|
|
3330
3331
|
environmentId: core.environmentId,
|
|
3331
3332
|
flowId
|
|
3332
3333
|
});
|
|
@@ -3342,7 +3343,7 @@ const getFlow = async ({ flowId }, client = require_InvalidParamError.getDefault
|
|
|
3342
3343
|
* @returns The updated flow with quote data
|
|
3343
3344
|
* @notInstrumented
|
|
3344
3345
|
*/
|
|
3345
|
-
const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage }, client =
|
|
3346
|
+
const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3346
3347
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3347
3348
|
return withFlowSessionTokenCleanupOn401({
|
|
3348
3349
|
call: () => apiClient.getFlowQuote({
|
|
@@ -3371,7 +3372,7 @@ const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage },
|
|
|
3371
3372
|
* @returns The updated flow
|
|
3372
3373
|
* @instrumented
|
|
3373
3374
|
*/
|
|
3374
|
-
const prepareFlowSigning = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, flowId }, client =
|
|
3375
|
+
const prepareFlowSigning = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3375
3376
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3376
3377
|
return withFlowSessionTokenCleanupOn401({
|
|
3377
3378
|
call: () => apiClient.prepareFlowSigning({
|
|
@@ -3387,12 +3388,12 @@ const prepareFlowSigning = async ({ assertBalanceForGasCost, assertBalanceForTra
|
|
|
3387
3388
|
}, client);
|
|
3388
3389
|
};
|
|
3389
3390
|
const __prepareFlowSigning_impl = prepareFlowSigning;
|
|
3390
|
-
const __prepareFlowSigning_wrapped =
|
|
3391
|
+
const __prepareFlowSigning_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3391
3392
|
fn: __prepareFlowSigning_impl,
|
|
3392
3393
|
functionName: "prepareFlowSigning",
|
|
3393
3394
|
getCore: () => {
|
|
3394
3395
|
try {
|
|
3395
|
-
return
|
|
3396
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3396
3397
|
} catch {
|
|
3397
3398
|
return;
|
|
3398
3399
|
}
|
|
@@ -3415,13 +3416,13 @@ const __prepareFlowSigning_wrapped = require_InvalidParamError.instrumentFunctio
|
|
|
3415
3416
|
* @returns The broadcasted flow
|
|
3416
3417
|
* @instrumented
|
|
3417
3418
|
*/
|
|
3418
|
-
const submitFlowTransaction = async ({ onStepChange, flowId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount }, client =
|
|
3419
|
+
const submitFlowTransaction = async ({ onStepChange, flowId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3419
3420
|
const signingPayload = (await __prepareFlowSigning_wrapped({
|
|
3420
3421
|
assertBalanceForGasCost,
|
|
3421
3422
|
assertBalanceForTransferAmount,
|
|
3422
3423
|
flowId
|
|
3423
3424
|
}, client)).quote?.signingPayload;
|
|
3424
|
-
|
|
3425
|
+
require_updateAuthFromVerifyResponse.assertDefined(signingPayload, "No signing payload returned from prepare — quote may be missing transaction data");
|
|
3425
3426
|
const { transactionHash } = await __executeSwapTransaction_wrapped({
|
|
3426
3427
|
onStepChange,
|
|
3427
3428
|
signingPayload,
|
|
@@ -3433,12 +3434,12 @@ const submitFlowTransaction = async ({ onStepChange, flowId, walletAccount, asse
|
|
|
3433
3434
|
}, client);
|
|
3434
3435
|
};
|
|
3435
3436
|
const __submitFlowTransaction_impl = submitFlowTransaction;
|
|
3436
|
-
const __submitFlowTransaction_wrapped =
|
|
3437
|
+
const __submitFlowTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3437
3438
|
fn: __submitFlowTransaction_impl,
|
|
3438
3439
|
functionName: "submitFlowTransaction",
|
|
3439
3440
|
getCore: () => {
|
|
3440
3441
|
try {
|
|
3441
|
-
return
|
|
3442
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3442
3443
|
} catch {
|
|
3443
3444
|
return;
|
|
3444
3445
|
}
|
|
@@ -3458,9 +3459,9 @@ const __submitFlowTransaction_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
3458
3459
|
* @notInstrumented
|
|
3459
3460
|
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
3460
3461
|
*/
|
|
3461
|
-
const addCoinbaseOnrampOrderEventListener = ({ listener }, client =
|
|
3462
|
-
const core =
|
|
3463
|
-
if (typeof window === "undefined") throw new
|
|
3462
|
+
const addCoinbaseOnrampOrderEventListener = ({ listener }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3463
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3464
|
+
if (typeof window === "undefined") throw new require_updateAuthFromVerifyResponse.ValueMustBeDefinedError("Window is not available to listen for Coinbase onramp order events");
|
|
3464
3465
|
const handleMessageEvent = (event) => {
|
|
3465
3466
|
if (event.origin !== "https://pay.coinbase.com") return;
|
|
3466
3467
|
core.logger.debug("[addCoinbaseOnrampOrderEventListener] pay.coinbase.com event received", { event });
|
|
@@ -3499,10 +3500,10 @@ const addCoinbaseOnrampOrderEventListener = ({ listener }, client = require_Inva
|
|
|
3499
3500
|
* @throws {ValueMustBeDefinedError} - If the user is not authenticated
|
|
3500
3501
|
* @notInstrumented
|
|
3501
3502
|
*/
|
|
3502
|
-
const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client =
|
|
3503
|
-
if (paymentMethod !== "GUEST_CHECKOUT_APPLE_PAY") throw new
|
|
3503
|
+
const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3504
|
+
if (paymentMethod !== "GUEST_CHECKOUT_APPLE_PAY") throw new require_updateAuthFromVerifyResponse.InvalidParamError(`Invalid payment method: ${paymentMethod}`);
|
|
3504
3505
|
const { user } = client;
|
|
3505
|
-
|
|
3506
|
+
require_updateAuthFromVerifyResponse.assertDefined(user, "User is not authenticated");
|
|
3506
3507
|
const fieldsMissingVerification = [];
|
|
3507
3508
|
const emailVerifiedCredential = user.verifiedCredentials.find((credential) => credential.format === _dynamic_labs_sdk_api_core.JwtVerifiedCredentialFormatEnum.Email);
|
|
3508
3509
|
if (!user.email) fieldsMissingVerification.push({
|
|
@@ -3538,7 +3539,7 @@ const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client
|
|
|
3538
3539
|
/** @notInstrumented */
|
|
3539
3540
|
const validateUserCredentialsForCoinbaseOnrampOrder = (client) => {
|
|
3540
3541
|
const { user } = client;
|
|
3541
|
-
|
|
3542
|
+
require_updateAuthFromVerifyResponse.assertDefined(user, "User is not authenticated");
|
|
3542
3543
|
const fieldsMissingVerification = getMissingVerificationForCoinbaseOnrampOrder({ paymentMethod: "GUEST_CHECKOUT_APPLE_PAY" }, client);
|
|
3543
3544
|
if (fieldsMissingVerification.find((field) => field.field === "email")) throw new MissingUserVerificationError({
|
|
3544
3545
|
informationToVerify: "email",
|
|
@@ -3567,10 +3568,10 @@ const validateUserCredentialsForCoinbaseOnrampOrder = (client) => {
|
|
|
3567
3568
|
* @throws {MissingUserVerificationError} If the user is missing verification for email or phone
|
|
3568
3569
|
* @instrumented
|
|
3569
3570
|
*/
|
|
3570
|
-
const createCoinbaseOnrampOrder = async (orderParams, client =
|
|
3571
|
+
const createCoinbaseOnrampOrder = async (orderParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3571
3572
|
const user = validateUserCredentialsForCoinbaseOnrampOrder(client);
|
|
3572
|
-
const core =
|
|
3573
|
-
const apiClient =
|
|
3573
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3574
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client);
|
|
3574
3575
|
const { isSandbox, ...restOrderParams } = orderParams;
|
|
3575
3576
|
const orderResponse = await apiClient.createCoinbaseOnrampOrder({
|
|
3576
3577
|
coinbaseOnrampOrderCreateRequest: {
|
|
@@ -3590,12 +3591,12 @@ const createCoinbaseOnrampOrder = async (orderParams, client = require_InvalidPa
|
|
|
3590
3591
|
};
|
|
3591
3592
|
};
|
|
3592
3593
|
const __createCoinbaseOnrampOrder_impl = createCoinbaseOnrampOrder;
|
|
3593
|
-
const __createCoinbaseOnrampOrder_wrapped =
|
|
3594
|
+
const __createCoinbaseOnrampOrder_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3594
3595
|
fn: __createCoinbaseOnrampOrder_impl,
|
|
3595
3596
|
functionName: "createCoinbaseOnrampOrder",
|
|
3596
3597
|
getCore: () => {
|
|
3597
3598
|
try {
|
|
3598
|
-
return
|
|
3599
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3599
3600
|
} catch {
|
|
3600
3601
|
return;
|
|
3601
3602
|
}
|
|
@@ -3612,9 +3613,9 @@ const __createCoinbaseOnrampOrder_wrapped = require_InvalidParamError.instrument
|
|
|
3612
3613
|
* @returns an object containing the buy URL
|
|
3613
3614
|
* @notInstrumented
|
|
3614
3615
|
*/
|
|
3615
|
-
const getCoinbaseBuyUrl = async (buyUrlParams, client =
|
|
3616
|
-
const core =
|
|
3617
|
-
return await
|
|
3616
|
+
const getCoinbaseBuyUrl = async (buyUrlParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3617
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3618
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).generateCoinbaseOnrampBuyUrl({
|
|
3618
3619
|
coinbaseOnrampGetBuyUrlRequest: buyUrlParams,
|
|
3619
3620
|
environmentId: core.environmentId
|
|
3620
3621
|
});
|
|
@@ -3630,9 +3631,9 @@ const getCoinbaseBuyUrl = async (buyUrlParams, client = require_InvalidParamErro
|
|
|
3630
3631
|
* @returns The created payment
|
|
3631
3632
|
* @instrumented
|
|
3632
3633
|
*/
|
|
3633
|
-
const createCryptoDotComPayment = async (paymentParams, client =
|
|
3634
|
-
const core =
|
|
3635
|
-
return await
|
|
3634
|
+
const createCryptoDotComPayment = async (paymentParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3635
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3636
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).createCryptoDotComPayment({
|
|
3636
3637
|
cryptoDotComPaymentCreateRequest: {
|
|
3637
3638
|
...paymentParams,
|
|
3638
3639
|
chain: paymentParams.chain
|
|
@@ -3641,12 +3642,12 @@ const createCryptoDotComPayment = async (paymentParams, client = require_Invalid
|
|
|
3641
3642
|
});
|
|
3642
3643
|
};
|
|
3643
3644
|
const __createCryptoDotComPayment_impl = createCryptoDotComPayment;
|
|
3644
|
-
const __createCryptoDotComPayment_wrapped =
|
|
3645
|
+
const __createCryptoDotComPayment_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3645
3646
|
fn: __createCryptoDotComPayment_impl,
|
|
3646
3647
|
functionName: "createCryptoDotComPayment",
|
|
3647
3648
|
getCore: () => {
|
|
3648
3649
|
try {
|
|
3649
|
-
return
|
|
3650
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3650
3651
|
} catch {
|
|
3651
3652
|
return;
|
|
3652
3653
|
}
|
|
@@ -3663,9 +3664,9 @@ const __createCryptoDotComPayment_wrapped = require_InvalidParamError.instrument
|
|
|
3663
3664
|
* @returns The created transfer
|
|
3664
3665
|
* @notInstrumented
|
|
3665
3666
|
*/
|
|
3666
|
-
const createKrakenExchangeTransfer = async (transferParams, client =
|
|
3667
|
-
const core =
|
|
3668
|
-
const apiClient =
|
|
3667
|
+
const createKrakenExchangeTransfer = async (transferParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3668
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3669
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client);
|
|
3669
3670
|
const { accountId, ...createExchangeTransferRequest } = transferParams;
|
|
3670
3671
|
return await apiClient.postExchangeAccountTransfer({
|
|
3671
3672
|
accountId,
|
|
@@ -3675,12 +3676,12 @@ const createKrakenExchangeTransfer = async (transferParams, client = require_Inv
|
|
|
3675
3676
|
});
|
|
3676
3677
|
};
|
|
3677
3678
|
const __createKrakenExchangeTransfer_impl = createKrakenExchangeTransfer;
|
|
3678
|
-
const __createKrakenExchangeTransfer_wrapped =
|
|
3679
|
+
const __createKrakenExchangeTransfer_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3679
3680
|
fn: __createKrakenExchangeTransfer_impl,
|
|
3680
3681
|
functionName: "createKrakenExchangeTransfer",
|
|
3681
3682
|
getCore: () => {
|
|
3682
3683
|
try {
|
|
3683
|
-
return
|
|
3684
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3684
3685
|
} catch {
|
|
3685
3686
|
return;
|
|
3686
3687
|
}
|
|
@@ -3697,9 +3698,9 @@ const __createKrakenExchangeTransfer_wrapped = require_InvalidParamError.instrum
|
|
|
3697
3698
|
* @returns Array of Kraken accounts with balances
|
|
3698
3699
|
* @notInstrumented
|
|
3699
3700
|
*/
|
|
3700
|
-
const getKrakenAccounts = async (params, client =
|
|
3701
|
-
const core =
|
|
3702
|
-
return await
|
|
3701
|
+
const getKrakenAccounts = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3702
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3703
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getUserAccounts({
|
|
3703
3704
|
chainName: params?.chainName,
|
|
3704
3705
|
environmentId: core.environmentId,
|
|
3705
3706
|
exchangeKey: _dynamic_labs_sdk_api_core.ExchangeKeyEnum.Kraken,
|
|
@@ -3716,9 +3717,9 @@ const getKrakenAccounts = async (params, client = require_InvalidParamError.getD
|
|
|
3716
3717
|
* @returns Transfer destinations response with whitelisted addresses
|
|
3717
3718
|
* @notInstrumented
|
|
3718
3719
|
*/
|
|
3719
|
-
const getKrakenWhitelistedAddresses = async (client =
|
|
3720
|
-
const core =
|
|
3721
|
-
return await
|
|
3720
|
+
const getKrakenWhitelistedAddresses = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3721
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3722
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getExchangeTransferDestinations({
|
|
3722
3723
|
environmentId: core.environmentId,
|
|
3723
3724
|
exchangeKey: _dynamic_labs_sdk_api_core.ExchangeKeyEnum.Kraken
|
|
3724
3725
|
});
|
|
@@ -3736,21 +3737,21 @@ const getKrakenWhitelistedAddresses = async (client = require_InvalidParamError.
|
|
|
3736
3737
|
* @returns An array of supported MoonPay currencies.
|
|
3737
3738
|
* @instrumented
|
|
3738
3739
|
*/
|
|
3739
|
-
const getMoonPayCurrencies = async (params, client =
|
|
3740
|
-
const core =
|
|
3741
|
-
return (await
|
|
3740
|
+
const getMoonPayCurrencies = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3741
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3742
|
+
return (await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getMoonPayCurrencies({
|
|
3742
3743
|
chain: params.chain,
|
|
3743
3744
|
environmentId: core.environmentId,
|
|
3744
3745
|
...params.networkId ? { networkId: params.networkId } : {}
|
|
3745
3746
|
})).currencies ?? [];
|
|
3746
3747
|
};
|
|
3747
3748
|
const __getMoonPayCurrencies_impl = getMoonPayCurrencies;
|
|
3748
|
-
const __getMoonPayCurrencies_wrapped =
|
|
3749
|
+
const __getMoonPayCurrencies_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3749
3750
|
fn: __getMoonPayCurrencies_impl,
|
|
3750
3751
|
functionName: "getMoonPayCurrencies",
|
|
3751
3752
|
getCore: () => {
|
|
3752
3753
|
try {
|
|
3753
|
-
return
|
|
3754
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3754
3755
|
} catch {
|
|
3755
3756
|
return;
|
|
3756
3757
|
}
|
|
@@ -3759,7 +3760,7 @@ const __getMoonPayCurrencies_wrapped = require_InvalidParamError.instrumentFunct
|
|
|
3759
3760
|
|
|
3760
3761
|
//#endregion
|
|
3761
3762
|
//#region src/modules/funding/moonpay/errors/MoonPayInvalidUrlError.ts
|
|
3762
|
-
var MoonPayInvalidUrlError = class extends
|
|
3763
|
+
var MoonPayInvalidUrlError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
3763
3764
|
constructor() {
|
|
3764
3765
|
super({
|
|
3765
3766
|
cause: null,
|
|
@@ -3773,7 +3774,7 @@ var MoonPayInvalidUrlError = class extends require_InvalidParamError.BaseError {
|
|
|
3773
3774
|
|
|
3774
3775
|
//#endregion
|
|
3775
3776
|
//#region src/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.ts
|
|
3776
|
-
var MoonPayProviderNotAvailableError = class extends
|
|
3777
|
+
var MoonPayProviderNotAvailableError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
3777
3778
|
constructor() {
|
|
3778
3779
|
super({
|
|
3779
3780
|
cause: null,
|
|
@@ -3802,9 +3803,9 @@ var MoonPayProviderNotAvailableError = class extends require_InvalidParamError.B
|
|
|
3802
3803
|
* return is logged under the synthetic `result` key, which no key-based rule
|
|
3803
3804
|
* covers, so redact the whole event.
|
|
3804
3805
|
*/
|
|
3805
|
-
const getMoonPayUrl = async (params, client =
|
|
3806
|
-
const core =
|
|
3807
|
-
const moonPayProvider = (await
|
|
3806
|
+
const getMoonPayUrl = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3807
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3808
|
+
const moonPayProvider = (await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getSupportedOnramps({
|
|
3808
3809
|
chain: params.chain,
|
|
3809
3810
|
currency: params.currency,
|
|
3810
3811
|
environmentId: core.environmentId,
|
|
@@ -3825,12 +3826,12 @@ const getMoonPayUrl = async (params, client = require_InvalidParamError.getDefau
|
|
|
3825
3826
|
return moonPayProvider.url;
|
|
3826
3827
|
};
|
|
3827
3828
|
const __getMoonPayUrl_impl = getMoonPayUrl;
|
|
3828
|
-
const __getMoonPayUrl_wrapped =
|
|
3829
|
+
const __getMoonPayUrl_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3829
3830
|
fn: __getMoonPayUrl_impl,
|
|
3830
3831
|
functionName: "getMoonPayUrl",
|
|
3831
3832
|
getCore: () => {
|
|
3832
3833
|
try {
|
|
3833
|
-
return
|
|
3834
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3834
3835
|
} catch {
|
|
3835
3836
|
return;
|
|
3836
3837
|
}
|
|
@@ -3848,8 +3849,8 @@ const __getMoonPayUrl_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
3848
3849
|
* @notInstrumented
|
|
3849
3850
|
* @noHook Client lifecycle management is not exposed as a hook; use useInitStatus.
|
|
3850
3851
|
*/
|
|
3851
|
-
const waitForClientInitialized = async (client =
|
|
3852
|
-
await
|
|
3852
|
+
const waitForClientInitialized = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3853
|
+
await require_updateAuthFromVerifyResponse.getCore(client).initTrack.waitForAll();
|
|
3853
3854
|
};
|
|
3854
3855
|
|
|
3855
3856
|
//#endregion
|
|
@@ -3862,16 +3863,16 @@ const waitForClientInitialized = async (client = require_InvalidParamError.getDe
|
|
|
3862
3863
|
* normally but emit no telemetry.
|
|
3863
3864
|
* @instrumented
|
|
3864
3865
|
*/
|
|
3865
|
-
const setInstrumentationEnabled = ({ enabled }, client =
|
|
3866
|
-
|
|
3866
|
+
const setInstrumentationEnabled = ({ enabled }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3867
|
+
require_updateAuthFromVerifyResponse.getCore(client).instrumentation.setEnabled(enabled);
|
|
3867
3868
|
};
|
|
3868
3869
|
const __setInstrumentationEnabled_impl = setInstrumentationEnabled;
|
|
3869
|
-
const __setInstrumentationEnabled_wrapped =
|
|
3870
|
+
const __setInstrumentationEnabled_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3870
3871
|
fn: __setInstrumentationEnabled_impl,
|
|
3871
3872
|
functionName: "setInstrumentationEnabled",
|
|
3872
3873
|
getCore: () => {
|
|
3873
3874
|
try {
|
|
3874
|
-
return
|
|
3875
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3875
3876
|
} catch {
|
|
3876
3877
|
return;
|
|
3877
3878
|
}
|
|
@@ -4033,10 +4034,10 @@ const FETCH_TIMEOUT_MS = 3e4;
|
|
|
4033
4034
|
const fetchWithTimeout = async (client) => {
|
|
4034
4035
|
const controller = new AbortController();
|
|
4035
4036
|
const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
4036
|
-
const core =
|
|
4037
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4037
4038
|
try {
|
|
4038
4039
|
const response = await core.fetch(getWalletBookCdnUrl(), { signal: controller.signal });
|
|
4039
|
-
if (!response.ok) throw new
|
|
4040
|
+
if (!response.ok) throw new require_updateAuthFromVerifyResponse.APIError(`Failed to fetch wallet book: ${response.status} ${response.statusText}`, "wallet_book_fetch_error", response.status);
|
|
4040
4041
|
return await response.json();
|
|
4041
4042
|
} finally {
|
|
4042
4043
|
clearTimeout(timeoutId);
|
|
@@ -4080,7 +4081,7 @@ const RETRY_DELAY_MS = 100;
|
|
|
4080
4081
|
* @notInstrumented
|
|
4081
4082
|
*/
|
|
4082
4083
|
const fetchLegacyWalletBook = async (client) => {
|
|
4083
|
-
const core =
|
|
4084
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4084
4085
|
core.logger.debug("[fetchLegacyWalletBook] Fetching wallet book...");
|
|
4085
4086
|
try {
|
|
4086
4087
|
const walletBook = await require_isMfaRequiredForAction.retryOnFail({
|
|
@@ -4178,7 +4179,7 @@ const shouldFilterWalletForWalletConnect = ({ wallet, walletKey }) => {
|
|
|
4178
4179
|
* @returns The full URL to the sprite icon
|
|
4179
4180
|
* @notInstrumented
|
|
4180
4181
|
*/
|
|
4181
|
-
const getSpriteUrl = ({ spriteId }) => `${
|
|
4182
|
+
const getSpriteUrl = ({ spriteId }) => `${require_updateAuthFromVerifyResponse.DYNAMIC_ICONIC_SPRITE_URL}#${spriteId}`;
|
|
4182
4183
|
|
|
4183
4184
|
//#endregion
|
|
4184
4185
|
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/transformGroup/transformGroup.ts
|
|
@@ -4215,8 +4216,8 @@ const transformGroup = ({ group }) => {
|
|
|
4215
4216
|
*/
|
|
4216
4217
|
const getChainFromWalletBookIdentifier = ({ identifier }) => {
|
|
4217
4218
|
const normalised = identifier.toLowerCase();
|
|
4218
|
-
return Object.keys(
|
|
4219
|
-
const info =
|
|
4219
|
+
return Object.keys(require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP).find((chain) => {
|
|
4220
|
+
const info = require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP[chain];
|
|
4220
4221
|
return info.apiChainName === normalised || info.legacyWalletBookAliases?.includes(normalised) === true;
|
|
4221
4222
|
});
|
|
4222
4223
|
};
|
|
@@ -4248,9 +4249,9 @@ const extractChainPrefix = ({ chainIdentifier }) => {
|
|
|
4248
4249
|
*/
|
|
4249
4250
|
const getChainFromWalletKey = ({ walletKey }) => {
|
|
4250
4251
|
const lowerKey = walletKey.toLowerCase();
|
|
4251
|
-
const chains = Object.keys(
|
|
4252
|
+
const chains = Object.keys(require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP);
|
|
4252
4253
|
for (const chain of chains) {
|
|
4253
|
-
const info =
|
|
4254
|
+
const info = require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP[chain];
|
|
4254
4255
|
if ([info.apiChainName, ...info.legacyWalletBookAliases ?? []].some((pattern) => lowerKey.includes(pattern))) return chain;
|
|
4255
4256
|
}
|
|
4256
4257
|
};
|
|
@@ -4276,7 +4277,7 @@ const getChainFromWalletSchema = ({ wallet, walletKey }) => {
|
|
|
4276
4277
|
const firstChain = wallet.chains[0];
|
|
4277
4278
|
const chainPrefix = extractChainPrefix({ chainIdentifier: firstChain });
|
|
4278
4279
|
try {
|
|
4279
|
-
return
|
|
4280
|
+
return require_updateAuthFromVerifyResponse.getChainFromVerifiedCredentialChain(chainPrefix);
|
|
4280
4281
|
} catch {}
|
|
4281
4282
|
}
|
|
4282
4283
|
if (walletKey) {
|
|
@@ -4356,7 +4357,7 @@ const transformWalletBook = ({ walletBook }) => {
|
|
|
4356
4357
|
* @throws If unable to fetch the wallet book from the API (when both CDN fetch and cache retrieval fail).
|
|
4357
4358
|
* @notInstrumented
|
|
4358
4359
|
*/
|
|
4359
|
-
const getWalletConnectCatalog = async (client =
|
|
4360
|
+
const getWalletConnectCatalog = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4360
4361
|
return transformWalletBook({ walletBook: await fetchLegacyWalletBook(client) });
|
|
4361
4362
|
};
|
|
4362
4363
|
|
|
@@ -4372,7 +4373,7 @@ const getWalletConnectCatalog = async (client = require_InvalidParamError.getDef
|
|
|
4372
4373
|
*/
|
|
4373
4374
|
const extractChainFromNormalizedName = ({ normalizedWalletNameWithChain }) => {
|
|
4374
4375
|
const lowerName = normalizedWalletNameWithChain.toLowerCase();
|
|
4375
|
-
const chainSuffixes = Object.keys(
|
|
4376
|
+
const chainSuffixes = Object.keys(require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP).map((chain) => chain.toLowerCase()).sort((a, b) => b.length - a.length);
|
|
4376
4377
|
for (const suffix of chainSuffixes) if (lowerName.endsWith(suffix)) return suffix.toUpperCase();
|
|
4377
4378
|
};
|
|
4378
4379
|
|
|
@@ -4390,8 +4391,8 @@ const extractChainFromNormalizedName = ({ normalizedWalletNameWithChain }) => {
|
|
|
4390
4391
|
* @returns A promise that resolves to the WalletConnect catalog wallet entry, or undefined if not found.
|
|
4391
4392
|
* @notInstrumented
|
|
4392
4393
|
*/
|
|
4393
|
-
const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProviderKey }, client =
|
|
4394
|
-
const { normalizedWalletNameWithChain } =
|
|
4394
|
+
const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4395
|
+
const { normalizedWalletNameWithChain } = require_updateAuthFromVerifyResponse.splitWalletProviderKey(walletProviderKey);
|
|
4395
4396
|
const chain = extractChainFromNormalizedName({ normalizedWalletNameWithChain });
|
|
4396
4397
|
if (!chain) return;
|
|
4397
4398
|
let walletProviderName = normalizedWalletNameWithChain.toLowerCase();
|
|
@@ -4421,13 +4422,13 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
|
|
|
4421
4422
|
* @instrumented
|
|
4422
4423
|
* @redact-params
|
|
4423
4424
|
*/
|
|
4424
|
-
const updateUser = async ({ userFields }, client =
|
|
4425
|
-
const core =
|
|
4426
|
-
const response = await
|
|
4425
|
+
const updateUser = async ({ userFields }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4426
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4427
|
+
const response = await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).updateSelf({
|
|
4427
4428
|
environmentId: core.environmentId,
|
|
4428
4429
|
userFields
|
|
4429
4430
|
});
|
|
4430
|
-
|
|
4431
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4431
4432
|
if (response.emailVerification) return {
|
|
4432
4433
|
email: response.emailVerification.email,
|
|
4433
4434
|
verificationUUID: response.emailVerification.verificationUUID
|
|
@@ -4440,12 +4441,12 @@ const updateUser = async ({ userFields }, client = require_InvalidParamError.get
|
|
|
4440
4441
|
};
|
|
4441
4442
|
};
|
|
4442
4443
|
const __updateUser_impl = updateUser;
|
|
4443
|
-
const __updateUser_wrapped =
|
|
4444
|
+
const __updateUser_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4444
4445
|
fn: __updateUser_impl,
|
|
4445
4446
|
functionName: "updateUser",
|
|
4446
4447
|
getCore: () => {
|
|
4447
4448
|
try {
|
|
4448
|
-
return
|
|
4449
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4449
4450
|
} catch {
|
|
4450
4451
|
return;
|
|
4451
4452
|
}
|
|
@@ -4465,16 +4466,16 @@ const __updateUser_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
4465
4466
|
* @returns A promise that resolves when the acknowledgment is complete.
|
|
4466
4467
|
* @instrumented
|
|
4467
4468
|
*/
|
|
4468
|
-
const acknowledgeRecoveryCodes = async (client =
|
|
4469
|
+
const acknowledgeRecoveryCodes = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4469
4470
|
return __updateUser_wrapped({ userFields: { mfaBackupCodeAcknowledgement: _dynamic_labs_sdk_api_core.MfaBackupCodeAcknowledgement.Complete } }, client);
|
|
4470
4471
|
};
|
|
4471
4472
|
const __acknowledgeRecoveryCodes_impl = acknowledgeRecoveryCodes;
|
|
4472
|
-
const __acknowledgeRecoveryCodes_wrapped =
|
|
4473
|
+
const __acknowledgeRecoveryCodes_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4473
4474
|
fn: __acknowledgeRecoveryCodes_impl,
|
|
4474
4475
|
functionName: "acknowledgeRecoveryCodes",
|
|
4475
4476
|
getCore: () => {
|
|
4476
4477
|
try {
|
|
4477
|
-
return
|
|
4478
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4478
4479
|
} catch {
|
|
4479
4480
|
return;
|
|
4480
4481
|
}
|
|
@@ -4496,9 +4497,9 @@ const __acknowledgeRecoveryCodes_wrapped = require_InvalidParamError.instrumentF
|
|
|
4496
4497
|
* @returns A promise that resolves to the MFA authentication response.
|
|
4497
4498
|
* @notInstrumented
|
|
4498
4499
|
*/
|
|
4499
|
-
const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, requestedScopes }, client =
|
|
4500
|
-
const core =
|
|
4501
|
-
const apiClient =
|
|
4500
|
+
const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4501
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4502
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4502
4503
|
try {
|
|
4503
4504
|
const response = await apiClient.authMfaRecovery({
|
|
4504
4505
|
environmentId: core.environmentId,
|
|
@@ -4508,14 +4509,14 @@ const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, reques
|
|
|
4508
4509
|
requestedScopes
|
|
4509
4510
|
}
|
|
4510
4511
|
});
|
|
4511
|
-
|
|
4512
|
-
|
|
4512
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4513
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4513
4514
|
args: { mfaToken: response.mfaToken },
|
|
4514
4515
|
event: "mfaCompletionSuccess"
|
|
4515
4516
|
}, client);
|
|
4516
4517
|
return response;
|
|
4517
4518
|
} catch (error) {
|
|
4518
|
-
|
|
4519
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4519
4520
|
args: { error },
|
|
4520
4521
|
event: "mfaCompletionFailure"
|
|
4521
4522
|
}, client);
|
|
@@ -4527,8 +4528,8 @@ const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, reques
|
|
|
4527
4528
|
//#region src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.ts
|
|
4528
4529
|
/** @notInstrumented */
|
|
4529
4530
|
const getPasskeyAuthenticationOptions = async ({ relatedOriginRpId } = {}, client) => {
|
|
4530
|
-
const core =
|
|
4531
|
-
return await
|
|
4531
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4532
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).getPasskeyAuthenticationOptions({
|
|
4532
4533
|
environmentId: core.environmentId,
|
|
4533
4534
|
relatedOriginRpId
|
|
4534
4535
|
});
|
|
@@ -4538,8 +4539,8 @@ const getPasskeyAuthenticationOptions = async ({ relatedOriginRpId } = {}, clien
|
|
|
4538
4539
|
//#region src/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.ts
|
|
4539
4540
|
/** @notInstrumented */
|
|
4540
4541
|
const serverAuthenticatePasskey = async ({ authentication, createMfaToken, requestedScopes }, client) => {
|
|
4541
|
-
const core =
|
|
4542
|
-
return await
|
|
4542
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4543
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).authenticateMfaPasskeyDevice({
|
|
4543
4544
|
environmentId: core.environmentId,
|
|
4544
4545
|
passkeyAuthRequest: {
|
|
4545
4546
|
...authentication,
|
|
@@ -4569,8 +4570,8 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken, reque
|
|
|
4569
4570
|
* @throws NoPasskeyCredentialsFoundError If no passkey credentials are found.
|
|
4570
4571
|
* @notInstrumented
|
|
4571
4572
|
*/
|
|
4572
|
-
const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, requestedScopes } = {}, client =
|
|
4573
|
-
const core =
|
|
4573
|
+
const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, requestedScopes } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4574
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4574
4575
|
try {
|
|
4575
4576
|
if (!core.passkey.isSupported()) throw new NoWebAuthNSupportError();
|
|
4576
4577
|
const options = await getPasskeyAuthenticationOptions({ relatedOriginRpId }, client);
|
|
@@ -4588,14 +4589,14 @@ const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, reque
|
|
|
4588
4589
|
createMfaToken,
|
|
4589
4590
|
requestedScopes
|
|
4590
4591
|
}, client);
|
|
4591
|
-
|
|
4592
|
-
|
|
4592
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4593
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4593
4594
|
args: { mfaToken: response.mfaToken },
|
|
4594
4595
|
event: "mfaCompletionSuccess"
|
|
4595
4596
|
}, client);
|
|
4596
4597
|
return response;
|
|
4597
4598
|
} catch (error) {
|
|
4598
|
-
|
|
4599
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4599
4600
|
args: { error },
|
|
4600
4601
|
event: "mfaCompletionFailure"
|
|
4601
4602
|
}, client);
|
|
@@ -4619,9 +4620,9 @@ const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, reque
|
|
|
4619
4620
|
* @returns A promise that resolves to the MFA authentication response.
|
|
4620
4621
|
* @notInstrumented
|
|
4621
4622
|
*/
|
|
4622
|
-
const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions, requestedScopes }, client =
|
|
4623
|
-
const core =
|
|
4624
|
-
const apiClient =
|
|
4623
|
+
const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4624
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4625
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4625
4626
|
try {
|
|
4626
4627
|
const response = await apiClient.authMfaTotpDevice({
|
|
4627
4628
|
environmentId: core.environmentId,
|
|
@@ -4632,8 +4633,8 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4632
4633
|
requestedScopes
|
|
4633
4634
|
}
|
|
4634
4635
|
});
|
|
4635
|
-
|
|
4636
|
-
|
|
4636
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4637
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4637
4638
|
args: {
|
|
4638
4639
|
deviceId,
|
|
4639
4640
|
mfaToken: response.mfaToken
|
|
@@ -4642,7 +4643,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4642
4643
|
}, client);
|
|
4643
4644
|
return response;
|
|
4644
4645
|
} catch (error) {
|
|
4645
|
-
|
|
4646
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4646
4647
|
args: {
|
|
4647
4648
|
deviceId,
|
|
4648
4649
|
error
|
|
@@ -4666,17 +4667,17 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4666
4667
|
* @instrumented
|
|
4667
4668
|
* @redact-params
|
|
4668
4669
|
*/
|
|
4669
|
-
const createNewMfaRecoveryCodes = async (client =
|
|
4670
|
-
const core =
|
|
4671
|
-
return
|
|
4670
|
+
const createNewMfaRecoveryCodes = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4671
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4672
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).createNewRecoveryCodes({ environmentId: core.environmentId });
|
|
4672
4673
|
};
|
|
4673
4674
|
const __createNewMfaRecoveryCodes_impl = createNewMfaRecoveryCodes;
|
|
4674
|
-
const __createNewMfaRecoveryCodes_wrapped =
|
|
4675
|
+
const __createNewMfaRecoveryCodes_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4675
4676
|
fn: __createNewMfaRecoveryCodes_impl,
|
|
4676
4677
|
functionName: "createNewMfaRecoveryCodes",
|
|
4677
4678
|
getCore: () => {
|
|
4678
4679
|
try {
|
|
4679
|
-
return
|
|
4680
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4680
4681
|
} catch {
|
|
4681
4682
|
return;
|
|
4682
4683
|
}
|
|
@@ -4700,26 +4701,26 @@ const __createNewMfaRecoveryCodes_wrapped = require_InvalidParamError.instrument
|
|
|
4700
4701
|
* @returns A promise that resolves when the MFA device is successfully deleted.
|
|
4701
4702
|
* @instrumented
|
|
4702
4703
|
*/
|
|
4703
|
-
const deleteMfaDevice = async ({ deviceId, mfaAuthToken }, client =
|
|
4704
|
-
const core =
|
|
4705
|
-
|
|
4706
|
-
if (!
|
|
4704
|
+
const deleteMfaDevice = async ({ deviceId, mfaAuthToken }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4705
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4706
|
+
require_updateAuthFromVerifyResponse.assertDefined(deviceId, "deviceId is required");
|
|
4707
|
+
if (!require_updateAuthFromVerifyResponse.getElevatedAccessToken({
|
|
4707
4708
|
consume: false,
|
|
4708
4709
|
scope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink
|
|
4709
|
-
}, client))
|
|
4710
|
-
return
|
|
4710
|
+
}, client)) require_updateAuthFromVerifyResponse.assertDefined(mfaAuthToken, "mfaAuthToken is required");
|
|
4711
|
+
return require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink }, client).deleteMfaDevice({
|
|
4711
4712
|
environmentId: core.environmentId,
|
|
4712
4713
|
mfaDeviceId: deviceId,
|
|
4713
4714
|
xMfaAuthToken: mfaAuthToken ?? ""
|
|
4714
4715
|
});
|
|
4715
4716
|
};
|
|
4716
4717
|
const __deleteMfaDevice_impl = deleteMfaDevice;
|
|
4717
|
-
const __deleteMfaDevice_wrapped =
|
|
4718
|
+
const __deleteMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4718
4719
|
fn: __deleteMfaDevice_impl,
|
|
4719
4720
|
functionName: "deleteMfaDevice",
|
|
4720
4721
|
getCore: () => {
|
|
4721
4722
|
try {
|
|
4722
|
-
return
|
|
4723
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4723
4724
|
} catch {
|
|
4724
4725
|
return;
|
|
4725
4726
|
}
|
|
@@ -4738,9 +4739,9 @@ const __deleteMfaDevice_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
4738
4739
|
* @returns A promise that resolves to an array of the user's registered MFA devices.
|
|
4739
4740
|
* @notInstrumented
|
|
4740
4741
|
*/
|
|
4741
|
-
const getMfaDevices = async (client =
|
|
4742
|
-
const core =
|
|
4743
|
-
const { devices } = await
|
|
4742
|
+
const getMfaDevices = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4743
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4744
|
+
const { devices } = await require_updateAuthFromVerifyResponse.createApiClient({}, client).getUserMfaDevices({ environmentId: core.environmentId });
|
|
4744
4745
|
return devices;
|
|
4745
4746
|
};
|
|
4746
4747
|
|
|
@@ -4758,9 +4759,9 @@ const getMfaDevices = async (client = require_InvalidParamError.getDefaultClient
|
|
|
4758
4759
|
* @returns A promise that resolves to the user's MFA recovery codes.
|
|
4759
4760
|
* @notInstrumented
|
|
4760
4761
|
*/
|
|
4761
|
-
const getMfaRecoveryCodes = async (client =
|
|
4762
|
-
const core =
|
|
4763
|
-
return
|
|
4762
|
+
const getMfaRecoveryCodes = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4763
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4764
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getRecoveryCodes({ environmentId: core.environmentId });
|
|
4764
4765
|
};
|
|
4765
4766
|
|
|
4766
4767
|
//#endregion
|
|
@@ -4779,17 +4780,17 @@ const getMfaRecoveryCodes = async (client = require_InvalidParamError.getDefault
|
|
|
4779
4780
|
* and the `uri` (`otpauth://...?secret=...`); redact the whole event so the
|
|
4780
4781
|
* seed never reaches logs via the un-keyed `uri` field.
|
|
4781
4782
|
*/
|
|
4782
|
-
const registerTotpMfaDevice = async (client =
|
|
4783
|
-
const core =
|
|
4784
|
-
return
|
|
4783
|
+
const registerTotpMfaDevice = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4784
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4785
|
+
return require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentiallink }, client).registerTotpMfaDevice({ environmentId: core.environmentId });
|
|
4785
4786
|
};
|
|
4786
4787
|
const __registerTotpMfaDevice_impl = registerTotpMfaDevice;
|
|
4787
|
-
const __registerTotpMfaDevice_wrapped =
|
|
4788
|
+
const __registerTotpMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4788
4789
|
fn: __registerTotpMfaDevice_impl,
|
|
4789
4790
|
functionName: "registerTotpMfaDevice",
|
|
4790
4791
|
getCore: () => {
|
|
4791
4792
|
try {
|
|
4792
|
-
return
|
|
4793
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4793
4794
|
} catch {
|
|
4794
4795
|
return;
|
|
4795
4796
|
}
|
|
@@ -4810,22 +4811,22 @@ const __registerTotpMfaDevice_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
4810
4811
|
* @returns A promise that resolves when the default MFA device is successfully set.
|
|
4811
4812
|
* @instrumented
|
|
4812
4813
|
*/
|
|
4813
|
-
const setDefaultMfaDevice = async ({ deviceId }, client =
|
|
4814
|
-
const core =
|
|
4815
|
-
const apiClient =
|
|
4816
|
-
|
|
4814
|
+
const setDefaultMfaDevice = async ({ deviceId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4815
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4816
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4817
|
+
require_updateAuthFromVerifyResponse.assertDefined(deviceId, "deviceId is required");
|
|
4817
4818
|
return apiClient.updateUserMfaDevice({
|
|
4818
4819
|
environmentId: core.environmentId,
|
|
4819
4820
|
mfaDeviceId: deviceId
|
|
4820
4821
|
});
|
|
4821
4822
|
};
|
|
4822
4823
|
const __setDefaultMfaDevice_impl = setDefaultMfaDevice;
|
|
4823
|
-
const __setDefaultMfaDevice_wrapped =
|
|
4824
|
+
const __setDefaultMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4824
4825
|
fn: __setDefaultMfaDevice_impl,
|
|
4825
4826
|
functionName: "setDefaultMfaDevice",
|
|
4826
4827
|
getCore: () => {
|
|
4827
4828
|
try {
|
|
4828
|
-
return
|
|
4829
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4829
4830
|
} catch {
|
|
4830
4831
|
return;
|
|
4831
4832
|
}
|
|
@@ -4845,9 +4846,9 @@ const __setDefaultMfaDevice_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
4845
4846
|
* @instrumented
|
|
4846
4847
|
* @redact-params
|
|
4847
4848
|
*/
|
|
4848
|
-
const sendEmailOTP = async ({ email }, client =
|
|
4849
|
-
const core =
|
|
4850
|
-
const apiClient =
|
|
4849
|
+
const sendEmailOTP = async ({ email }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4850
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4851
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4851
4852
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
4852
4853
|
const { verificationUUID } = await apiClient.createEmailVerification({
|
|
4853
4854
|
emailVerificationCreateRequest: {
|
|
@@ -4862,12 +4863,12 @@ const sendEmailOTP = async ({ email }, client = require_InvalidParamError.getDef
|
|
|
4862
4863
|
};
|
|
4863
4864
|
};
|
|
4864
4865
|
const __sendEmailOTP_impl = sendEmailOTP;
|
|
4865
|
-
const __sendEmailOTP_wrapped =
|
|
4866
|
+
const __sendEmailOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4866
4867
|
fn: __sendEmailOTP_impl,
|
|
4867
4868
|
functionName: "sendEmailOTP",
|
|
4868
4869
|
getCore: () => {
|
|
4869
4870
|
try {
|
|
4870
|
-
return
|
|
4871
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4871
4872
|
} catch {
|
|
4872
4873
|
return;
|
|
4873
4874
|
}
|
|
@@ -5808,9 +5809,9 @@ const supportedCountries = {
|
|
|
5808
5809
|
* @instrumented
|
|
5809
5810
|
* @redact-params
|
|
5810
5811
|
*/
|
|
5811
|
-
const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client =
|
|
5812
|
-
const core =
|
|
5813
|
-
const apiClient =
|
|
5812
|
+
const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5813
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5814
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5814
5815
|
const phoneCountryCode = supportedCountries[isoCountryCode].code;
|
|
5815
5816
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
5816
5817
|
const { verificationUUID } = await apiClient.createSmsVerification({
|
|
@@ -5830,12 +5831,12 @@ const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client = require_Inva
|
|
|
5830
5831
|
};
|
|
5831
5832
|
};
|
|
5832
5833
|
const __sendSmsOTP_impl = sendSmsOTP;
|
|
5833
|
-
const __sendSmsOTP_wrapped =
|
|
5834
|
+
const __sendSmsOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
5834
5835
|
fn: __sendSmsOTP_impl,
|
|
5835
5836
|
functionName: "sendSmsOTP",
|
|
5836
5837
|
getCore: () => {
|
|
5837
5838
|
try {
|
|
5838
|
-
return
|
|
5839
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
5839
5840
|
} catch {
|
|
5840
5841
|
return;
|
|
5841
5842
|
}
|
|
@@ -5847,8 +5848,8 @@ const __sendSmsOTP_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
5847
5848
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.ts
|
|
5848
5849
|
/** @notInstrumented */
|
|
5849
5850
|
const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, client) => {
|
|
5850
|
-
const core =
|
|
5851
|
-
const apiClient =
|
|
5851
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5852
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5852
5853
|
const verifyRequest = {
|
|
5853
5854
|
verificationToken,
|
|
5854
5855
|
verificationUUID: otpVerification.verificationUUID
|
|
@@ -5867,8 +5868,8 @@ const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, cl
|
|
|
5867
5868
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.ts
|
|
5868
5869
|
/** @notInstrumented */
|
|
5869
5870
|
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requestedScopes }, client) => {
|
|
5870
|
-
const core =
|
|
5871
|
-
const apiClient =
|
|
5871
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5872
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5872
5873
|
const verifyRequest = {
|
|
5873
5874
|
verificationToken,
|
|
5874
5875
|
verificationUUID: otpVerification.verificationUUID
|
|
@@ -5899,7 +5900,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
5899
5900
|
* @instrumented
|
|
5900
5901
|
* @redact-params
|
|
5901
5902
|
*/
|
|
5902
|
-
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client =
|
|
5903
|
+
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5903
5904
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
5904
5905
|
let response;
|
|
5905
5906
|
if (client.user) response = await verifyOTPForUserUpdate({
|
|
@@ -5911,16 +5912,16 @@ const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }
|
|
|
5911
5912
|
otpVerification,
|
|
5912
5913
|
verificationToken
|
|
5913
5914
|
}, client);
|
|
5914
|
-
|
|
5915
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
5915
5916
|
return response;
|
|
5916
5917
|
};
|
|
5917
5918
|
const __verifyOTP_impl = verifyOTP;
|
|
5918
|
-
const __verifyOTP_wrapped =
|
|
5919
|
+
const __verifyOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
5919
5920
|
fn: __verifyOTP_impl,
|
|
5920
5921
|
functionName: "verifyOTP",
|
|
5921
5922
|
getCore: () => {
|
|
5922
5923
|
try {
|
|
5923
|
-
return
|
|
5924
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
5924
5925
|
} catch {
|
|
5925
5926
|
return;
|
|
5926
5927
|
}
|
|
@@ -5938,11 +5939,11 @@ const __verifyOTP_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
5938
5939
|
* @returns The swap quote details. Use the `signingPayload` field to get the transaction data for the wallet to sign.
|
|
5939
5940
|
* @notInstrumented
|
|
5940
5941
|
*/
|
|
5941
|
-
const getSwapQuote = async (params, client =
|
|
5942
|
-
const core =
|
|
5943
|
-
const apiClient =
|
|
5944
|
-
if (!params.from.amount && !params.to.amount) throw new
|
|
5945
|
-
if (params.from.amount && params.to.amount) throw new
|
|
5942
|
+
const getSwapQuote = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5943
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5944
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5945
|
+
if (!params.from.amount && !params.to.amount) throw new require_updateAuthFromVerifyResponse.InvalidParamError("Either from.amount or to.amount is required");
|
|
5946
|
+
if (params.from.amount && params.to.amount) throw new require_updateAuthFromVerifyResponse.InvalidParamError("Only one of from.amount or to.amount is allowed");
|
|
5946
5947
|
return await apiClient.swapQuote({
|
|
5947
5948
|
environmentId: core.environmentId,
|
|
5948
5949
|
swapQuoteRequest: {
|
|
@@ -5973,9 +5974,9 @@ const getSwapQuote = async (params, client = require_InvalidParamError.getDefaul
|
|
|
5973
5974
|
* @returns The swap status.
|
|
5974
5975
|
* @notInstrumented
|
|
5975
5976
|
*/
|
|
5976
|
-
const getSwapStatus = async (params, client =
|
|
5977
|
-
const core =
|
|
5978
|
-
const apiClient =
|
|
5977
|
+
const getSwapStatus = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5978
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5979
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5979
5980
|
let from;
|
|
5980
5981
|
if (params.from) from = {
|
|
5981
5982
|
chainId: params.from.networkId,
|
|
@@ -6019,18 +6020,18 @@ const getSwapStatus = async (params, client = require_InvalidParamError.getDefau
|
|
|
6019
6020
|
* @returns A promise that resolves when the user account is successfully deleted.
|
|
6020
6021
|
* @instrumented
|
|
6021
6022
|
*/
|
|
6022
|
-
const deleteUser = async (client =
|
|
6023
|
-
const core =
|
|
6024
|
-
await
|
|
6023
|
+
const deleteUser = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
6024
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
6025
|
+
await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).hardDeleteUser({ environmentId: core.environmentId });
|
|
6025
6026
|
await require_isMfaRequiredForAction.__logoutWithReason_wrapped({ reason: "user-deleted" }, client);
|
|
6026
6027
|
};
|
|
6027
6028
|
const __deleteUser_impl = deleteUser;
|
|
6028
|
-
const __deleteUser_wrapped =
|
|
6029
|
+
const __deleteUser_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
6029
6030
|
fn: __deleteUser_impl,
|
|
6030
6031
|
functionName: "deleteUser",
|
|
6031
6032
|
getCore: () => {
|
|
6032
6033
|
try {
|
|
6033
|
-
return
|
|
6034
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
6034
6035
|
} catch {
|
|
6035
6036
|
return;
|
|
6036
6037
|
}
|
|
@@ -6088,8 +6089,8 @@ const findMissingGoogleDriveBackupScopes = (grantedScopes) => GOOGLE_DRIVE_BACKU
|
|
|
6088
6089
|
* @notInstrumented
|
|
6089
6090
|
*/
|
|
6090
6091
|
const fetchGoogleDriveOauthAccess = async ({ oauthAccountId }, client) => {
|
|
6091
|
-
const core =
|
|
6092
|
-
return
|
|
6092
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
6093
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getEndUserOauthAccessToken({
|
|
6093
6094
|
environmentId: core.environmentId,
|
|
6094
6095
|
oauthAccountId
|
|
6095
6096
|
});
|
|
@@ -6148,7 +6149,7 @@ const findGoogleOauthAccountId = (credentials) => credentials?.find((cred) => cr
|
|
|
6148
6149
|
* @returns The readiness result.
|
|
6149
6150
|
* @instrumented
|
|
6150
6151
|
*/
|
|
6151
|
-
const getGoogleDriveBackupReadiness = async (client =
|
|
6152
|
+
const getGoogleDriveBackupReadiness = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
6152
6153
|
const { user } = client;
|
|
6153
6154
|
const oauthAccountId = findGoogleOauthAccountId(user?.verifiedCredentials);
|
|
6154
6155
|
if (!oauthAccountId) return {
|
|
@@ -6174,12 +6175,12 @@ const getGoogleDriveBackupReadiness = async (client = require_InvalidParamError.
|
|
|
6174
6175
|
};
|
|
6175
6176
|
};
|
|
6176
6177
|
const __getGoogleDriveBackupReadiness_impl = getGoogleDriveBackupReadiness;
|
|
6177
|
-
const __getGoogleDriveBackupReadiness_wrapped =
|
|
6178
|
+
const __getGoogleDriveBackupReadiness_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
6178
6179
|
fn: __getGoogleDriveBackupReadiness_impl,
|
|
6179
6180
|
functionName: "getGoogleDriveBackupReadiness",
|
|
6180
6181
|
getCore: () => {
|
|
6181
6182
|
try {
|
|
6182
|
-
return
|
|
6183
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
6183
6184
|
} catch {
|
|
6184
6185
|
return;
|
|
6185
6186
|
}
|
|
@@ -6582,7 +6583,7 @@ const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
|
6582
6583
|
for (const identifier of wallet.chains ?? []) {
|
|
6583
6584
|
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
6584
6585
|
try {
|
|
6585
|
-
const chain =
|
|
6586
|
+
const chain = require_updateAuthFromVerifyResponse.getChainFromVerifiedCredentialChain(prefix);
|
|
6586
6587
|
chains.add(chain);
|
|
6587
6588
|
} catch {}
|
|
6588
6589
|
}
|
|
@@ -6757,9 +6758,9 @@ const hasWalletProviderConnectMethod = ({ walletProvider }) => Boolean(walletPro
|
|
|
6757
6758
|
*/
|
|
6758
6759
|
const classifyWithWalletProviderSource = ({ entry }) => {
|
|
6759
6760
|
const { priority } = entry;
|
|
6760
|
-
if (priority ===
|
|
6761
|
-
if (priority ===
|
|
6762
|
-
if (priority ===
|
|
6761
|
+
if (priority === require_updateAuthFromVerifyResponse.WalletProviderPriority.WALLET_SDK) return "sdk";
|
|
6762
|
+
if (priority === require_updateAuthFromVerifyResponse.WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD) return "selfAnnounced";
|
|
6763
|
+
if (priority === require_updateAuthFromVerifyResponse.WalletProviderPriority.WINDOW_INJECT) return "windowInjected";
|
|
6763
6764
|
};
|
|
6764
6765
|
|
|
6765
6766
|
//#endregion
|
|
@@ -6879,7 +6880,7 @@ const resolveWalletOptionKey = ({ fallback, wallet }) => wallet.group ?? wallet.
|
|
|
6879
6880
|
* @notInstrumented
|
|
6880
6881
|
*/
|
|
6881
6882
|
const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }) => {
|
|
6882
|
-
const { normalizedWalletNameWithChain } =
|
|
6883
|
+
const { normalizedWalletNameWithChain } = require_updateAuthFromVerifyResponse.splitWalletProviderKey(walletProvider.key);
|
|
6883
6884
|
const candidates = [normalizedWalletNameWithChain, stripChainSuffix({
|
|
6884
6885
|
chain,
|
|
6885
6886
|
normalizedName: normalizedWalletNameWithChain
|
|
@@ -6932,7 +6933,7 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
6932
6933
|
if (!hasWalletProviderConnectMethod({ walletProvider: entry.walletProvider })) continue;
|
|
6933
6934
|
const source = classifyWithWalletProviderSource({ entry });
|
|
6934
6935
|
if (!source) {
|
|
6935
|
-
|
|
6936
|
+
require_updateAuthFromVerifyResponse.getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
|
|
6936
6937
|
chain: entry.walletProvider.chain,
|
|
6937
6938
|
displayName: entry.walletProvider.metadata.displayName,
|
|
6938
6939
|
priority: entry.priority,
|
|
@@ -7234,14 +7235,14 @@ const EMPTY_WALLET_BOOK = {
|
|
|
7234
7235
|
* @returns A promise that resolves to the wallet options catalogue.
|
|
7235
7236
|
* @notInstrumented
|
|
7236
7237
|
*/
|
|
7237
|
-
const getWalletOptionsCatalogue = async (params = {}, client =
|
|
7238
|
+
const getWalletOptionsCatalogue = async (params = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7238
7239
|
const includeMobileOptions = params.includeMobileOptions ?? false;
|
|
7239
7240
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
7240
7241
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
7241
7242
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
7242
7243
|
const allConnectionOptions = [];
|
|
7243
7244
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
7244
|
-
const entries =
|
|
7245
|
+
const entries = require_updateAuthFromVerifyResponse.getWalletProviderRegistry(client).listProviderEntries();
|
|
7245
7246
|
allConnectionOptions.push(...buildWithWalletProviderOptions({
|
|
7246
7247
|
entries,
|
|
7247
7248
|
walletBook
|
|
@@ -7291,8 +7292,8 @@ const getWalletOptionsCatalogue = async (params = {}, client = require_InvalidPa
|
|
|
7291
7292
|
* @throws WalletAccountNotSelectedError If the wallet account is not currently selected.
|
|
7292
7293
|
* @notInstrumented
|
|
7293
7294
|
*/
|
|
7294
|
-
const assertWalletAccountSigningAvailability = async ({ walletAccount }, client =
|
|
7295
|
-
const { addresses } = await
|
|
7295
|
+
const assertWalletAccountSigningAvailability = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7296
|
+
const { addresses } = await require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).getConnectedAddresses();
|
|
7296
7297
|
if (addresses.length > 0 && !addresses.includes(walletAccount.address)) throw new WalletAccountNotSelectedError({
|
|
7297
7298
|
expectedAddress: walletAccount.address,
|
|
7298
7299
|
selectedAddress: addresses[0]
|
|
@@ -7315,8 +7316,8 @@ const assertWalletAccountSigningAvailability = async ({ walletAccount }, client
|
|
|
7315
7316
|
* @throws If the wallet provider does not support the confirmTransaction method.
|
|
7316
7317
|
* @instrumented
|
|
7317
7318
|
*/
|
|
7318
|
-
const confirmTransaction = async ({ walletAccount, transactionHash }, client =
|
|
7319
|
-
const walletProvider =
|
|
7319
|
+
const confirmTransaction = async ({ walletAccount, transactionHash }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7320
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7320
7321
|
assertWalletProviderMethodDefined(walletProvider, "confirmTransaction");
|
|
7321
7322
|
await walletProvider.confirmTransaction({
|
|
7322
7323
|
transactionHash,
|
|
@@ -7324,12 +7325,12 @@ const confirmTransaction = async ({ walletAccount, transactionHash }, client = r
|
|
|
7324
7325
|
});
|
|
7325
7326
|
};
|
|
7326
7327
|
const __confirmTransaction_impl = confirmTransaction;
|
|
7327
|
-
const __confirmTransaction_wrapped =
|
|
7328
|
+
const __confirmTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7328
7329
|
fn: __confirmTransaction_impl,
|
|
7329
7330
|
functionName: "confirmTransaction",
|
|
7330
7331
|
getCore: () => {
|
|
7331
7332
|
try {
|
|
7332
|
-
return
|
|
7333
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7333
7334
|
} catch {
|
|
7334
7335
|
return;
|
|
7335
7336
|
}
|
|
@@ -7361,7 +7362,7 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
7361
7362
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
7362
7363
|
* @instrumented
|
|
7363
7364
|
*/
|
|
7364
|
-
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client =
|
|
7365
|
+
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7365
7366
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
7366
7367
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
7367
7368
|
const { addresses } = await walletProvider.connect();
|
|
@@ -7379,7 +7380,7 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
7379
7380
|
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
7380
7381
|
chain: walletProvider.chain,
|
|
7381
7382
|
hardwareWalletVendor,
|
|
7382
|
-
id:
|
|
7383
|
+
id: require_updateAuthFromVerifyResponse.formatWalletAccountId({
|
|
7383
7384
|
address: mainAddress,
|
|
7384
7385
|
chain: walletProvider.chain,
|
|
7385
7386
|
walletProviderKey
|
|
@@ -7393,12 +7394,12 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
7393
7394
|
return reconciledWalletAccount;
|
|
7394
7395
|
};
|
|
7395
7396
|
const __connectWithWalletProvider_impl = connectWithWalletProvider;
|
|
7396
|
-
const __connectWithWalletProvider_wrapped =
|
|
7397
|
+
const __connectWithWalletProvider_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7397
7398
|
fn: __connectWithWalletProvider_impl,
|
|
7398
7399
|
functionName: "connectWithWalletProvider",
|
|
7399
7400
|
getCore: () => {
|
|
7400
7401
|
try {
|
|
7401
|
-
return
|
|
7402
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7402
7403
|
} catch {
|
|
7403
7404
|
return;
|
|
7404
7405
|
}
|
|
@@ -7457,13 +7458,13 @@ const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
|
7457
7458
|
//#region src/modules/wallets/utils/getSignInMessage/getSignInMessage.ts
|
|
7458
7459
|
/** @notInstrumented */
|
|
7459
7460
|
const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client) => {
|
|
7460
|
-
const core =
|
|
7461
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
7461
7462
|
const { appUniversalLink } = require_getNetworkProviderFromNetworkId.getAppMetadata(client);
|
|
7462
|
-
|
|
7463
|
+
require_updateAuthFromVerifyResponse.assertDefined(appUniversalLink, "Universal link is not set");
|
|
7463
7464
|
const url = new URL(appUniversalLink);
|
|
7464
7465
|
const domain = url.host;
|
|
7465
|
-
const nonce = nonceOverride ?? await
|
|
7466
|
-
const walletProvider =
|
|
7466
|
+
const nonce = nonceOverride ?? await require_updateAuthFromVerifyResponse.getNonce(client);
|
|
7467
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7467
7468
|
if (walletProvider.chain === "STARK")
|
|
7468
7469
|
/**
|
|
7469
7470
|
* Starknet requires the strings to be 31 chars long
|
|
@@ -7477,7 +7478,7 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
7477
7478
|
const statement = require_getNetworkProviderFromNetworkId.createSignInMessageStatement(client);
|
|
7478
7479
|
return await require_getNetworkProviderFromNetworkId.formatSignInMessage({
|
|
7479
7480
|
address: walletAccount.address,
|
|
7480
|
-
blockchainName:
|
|
7481
|
+
blockchainName: require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP[walletProvider.chain].blockchainName,
|
|
7481
7482
|
chainId: await getChainIdForAccountVerification({ walletProvider }),
|
|
7482
7483
|
domain,
|
|
7483
7484
|
issuedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -7501,8 +7502,8 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
7501
7502
|
* @returns A promise that resolves to an object containing the message and signature.
|
|
7502
7503
|
* @instrumented
|
|
7503
7504
|
*/
|
|
7504
|
-
const proveWalletAccountOwnership = async ({ walletAccount }, client =
|
|
7505
|
-
const walletProvider =
|
|
7505
|
+
const proveWalletAccountOwnership = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7506
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7506
7507
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
7507
7508
|
const messageToSign = await getSignInMessage({
|
|
7508
7509
|
nonce: walletProvider.getConnectProofNonce?.(),
|
|
@@ -7518,12 +7519,12 @@ const proveWalletAccountOwnership = async ({ walletAccount }, client = require_I
|
|
|
7518
7519
|
};
|
|
7519
7520
|
};
|
|
7520
7521
|
const __proveWalletAccountOwnership_impl = proveWalletAccountOwnership;
|
|
7521
|
-
const __proveWalletAccountOwnership_wrapped =
|
|
7522
|
+
const __proveWalletAccountOwnership_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7522
7523
|
fn: __proveWalletAccountOwnership_impl,
|
|
7523
7524
|
functionName: "proveWalletAccountOwnership",
|
|
7524
7525
|
getCore: () => {
|
|
7525
7526
|
try {
|
|
7526
|
-
return
|
|
7527
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7527
7528
|
} catch {
|
|
7528
7529
|
return;
|
|
7529
7530
|
}
|
|
@@ -7533,10 +7534,10 @@ const __proveWalletAccountOwnership_wrapped = require_InvalidParamError.instrume
|
|
|
7533
7534
|
//#endregion
|
|
7534
7535
|
//#region src/modules/wallets/utils/isSameAddress/isSameAddress.ts
|
|
7535
7536
|
/** @notInstrumented */
|
|
7536
|
-
const isSameAddress = ({ chain, left, right }) =>
|
|
7537
|
+
const isSameAddress = ({ chain, left, right }) => require_updateAuthFromVerifyResponse.normalizeAddress({
|
|
7537
7538
|
address: left,
|
|
7538
7539
|
chain
|
|
7539
|
-
}) ===
|
|
7540
|
+
}) === require_updateAuthFromVerifyResponse.normalizeAddress({
|
|
7540
7541
|
address: right,
|
|
7541
7542
|
chain
|
|
7542
7543
|
});
|
|
@@ -7546,7 +7547,7 @@ const isSameAddress = ({ chain, left, right }) => require_InvalidParamError.norm
|
|
|
7546
7547
|
/** @notInstrumented */
|
|
7547
7548
|
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
7548
7549
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
7549
|
-
const walletProvider =
|
|
7550
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7550
7551
|
const { messageToSign, signature } = await __proveWalletAccountOwnership_wrapped({ walletAccount }, client);
|
|
7551
7552
|
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
7552
7553
|
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
@@ -7567,30 +7568,30 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
7567
7568
|
}, client);
|
|
7568
7569
|
const response = walletProvider.shouldRetryVerificationOnNetworkError ? await retryOnFetchError({
|
|
7569
7570
|
fn: verify,
|
|
7570
|
-
onRetry: ({ error }) =>
|
|
7571
|
+
onRetry: ({ error }) => require_updateAuthFromVerifyResponse.getCore(client).logger.warn("Retrying wallet verification after network error", error)
|
|
7571
7572
|
}) : await verify();
|
|
7572
7573
|
const walletVerifiedCredential = response.user?.verifiedCredentials.find((verifiedCredential) => isSameAddress({
|
|
7573
7574
|
chain: walletAccount.chain,
|
|
7574
7575
|
left: verifiedCredential.address ?? "",
|
|
7575
7576
|
right: walletAccount.address
|
|
7576
7577
|
}));
|
|
7577
|
-
|
|
7578
|
+
require_updateAuthFromVerifyResponse.assertDefined(walletVerifiedCredential, `After verifying, still unable to find verified wallet credential for wallet account ${walletAccount.address} on chain ${walletAccount.chain}`);
|
|
7578
7579
|
require_getNetworkProviderFromNetworkId.updateWalletProviderKeysForVerifiedCredentials({ keysToUpdate: { [walletVerifiedCredential.id]: walletProvider.key } }, client);
|
|
7579
7580
|
/**
|
|
7580
7581
|
* Adds the user with the new wallet verified credential
|
|
7581
7582
|
* This will add the new verified wallet account to the client`s state
|
|
7582
7583
|
*/
|
|
7583
|
-
|
|
7584
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
7584
7585
|
/**
|
|
7585
7586
|
* Remove the now verified wallet account from the unverified wallet accounts
|
|
7586
7587
|
*/
|
|
7587
7588
|
require_getNetworkProviderFromNetworkId.removeUnverifiedWalletAccount({ unverifiedWalletAccount: walletAccount }, client);
|
|
7588
|
-
const verifiedWalletAccount =
|
|
7589
|
+
const verifiedWalletAccount = require_updateAuthFromVerifyResponse.getWalletAccounts(client).find(({ address }) => isSameAddress({
|
|
7589
7590
|
chain: walletAccount.chain,
|
|
7590
7591
|
left: address,
|
|
7591
7592
|
right: walletAccount.address
|
|
7592
7593
|
}));
|
|
7593
|
-
|
|
7594
|
+
require_updateAuthFromVerifyResponse.assertDefined(verifiedWalletAccount, `Unable to find wallet account ${walletAccount.address} on chain ${walletAccount.chain} for verified credential ${walletVerifiedCredential.id}`);
|
|
7594
7595
|
return verifiedWalletAccount;
|
|
7595
7596
|
};
|
|
7596
7597
|
|
|
@@ -7609,7 +7610,7 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
7609
7610
|
* @throws WalletAlreadyLinkedToAnotherUserError If the wallet is linked to another user.
|
|
7610
7611
|
* @instrumented
|
|
7611
7612
|
*/
|
|
7612
|
-
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client =
|
|
7613
|
+
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7613
7614
|
return verifyWalletAccountForSignInOrTransfer({
|
|
7614
7615
|
isTransfer: false,
|
|
7615
7616
|
requestedScopes,
|
|
@@ -7617,12 +7618,12 @@ const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client =
|
|
|
7617
7618
|
}, client);
|
|
7618
7619
|
};
|
|
7619
7620
|
const __verifyWalletAccount_impl = verifyWalletAccount;
|
|
7620
|
-
const __verifyWalletAccount_wrapped =
|
|
7621
|
+
const __verifyWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7621
7622
|
fn: __verifyWalletAccount_impl,
|
|
7622
7623
|
functionName: "verifyWalletAccount",
|
|
7623
7624
|
getCore: () => {
|
|
7624
7625
|
try {
|
|
7625
|
-
return
|
|
7626
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7626
7627
|
} catch {
|
|
7627
7628
|
return;
|
|
7628
7629
|
}
|
|
@@ -7662,7 +7663,7 @@ const isDeeplinkWalletProvider = ({ walletProvider }) => walletProvider.walletPr
|
|
|
7662
7663
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
7663
7664
|
* @instrumented
|
|
7664
7665
|
*/
|
|
7665
|
-
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client =
|
|
7666
|
+
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7666
7667
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
7667
7668
|
if (isMobile() && isDeeplinkWalletProvider({ walletProvider })) throw new DeeplinkConnectAndVerifyUnsupportedError({ walletProviderKey });
|
|
7668
7669
|
const walletAccount = await __connectWithWalletProvider_wrapped({
|
|
@@ -7678,12 +7679,12 @@ const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareW
|
|
|
7678
7679
|
return walletAccount;
|
|
7679
7680
|
};
|
|
7680
7681
|
const __connectAndVerifyWithWalletProvider_impl = connectAndVerifyWithWalletProvider;
|
|
7681
|
-
const __connectAndVerifyWithWalletProvider_wrapped =
|
|
7682
|
+
const __connectAndVerifyWithWalletProvider_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7682
7683
|
fn: __connectAndVerifyWithWalletProvider_impl,
|
|
7683
7684
|
functionName: "connectAndVerifyWithWalletProvider",
|
|
7684
7685
|
getCore: () => {
|
|
7685
7686
|
try {
|
|
7686
|
-
return
|
|
7687
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7687
7688
|
} catch {
|
|
7688
7689
|
return;
|
|
7689
7690
|
}
|
|
@@ -7703,8 +7704,8 @@ const __connectAndVerifyWithWalletProvider_wrapped = require_InvalidParamError.i
|
|
|
7703
7704
|
* @notInstrumented
|
|
7704
7705
|
* @hook Exposed as a hook so consumers get the reactive list of available wallet providers, updated when wallet providers change.
|
|
7705
7706
|
*/
|
|
7706
|
-
const getAvailableWalletProvidersData = (client =
|
|
7707
|
-
return
|
|
7707
|
+
const getAvailableWalletProvidersData = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7708
|
+
return require_updateAuthFromVerifyResponse.getWalletProviders(client).filter((walletProvider) => hasWalletProviderConnectMethod({ walletProvider })).map((walletProvider) => ({
|
|
7708
7709
|
chain: walletProvider.chain,
|
|
7709
7710
|
groupKey: walletProvider.groupKey,
|
|
7710
7711
|
key: walletProvider.key,
|
|
@@ -7726,17 +7727,17 @@ const getAvailableWalletProvidersData = (client = require_InvalidParamError.getD
|
|
|
7726
7727
|
* @returns An array of connected wallet addresses.
|
|
7727
7728
|
* @notInstrumented
|
|
7728
7729
|
*/
|
|
7729
|
-
const getConnectedAddresses = ({ walletProviderKey }, client =
|
|
7730
|
+
const getConnectedAddresses = ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7730
7731
|
return require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client).getConnectedAddresses();
|
|
7731
7732
|
};
|
|
7732
7733
|
|
|
7733
7734
|
//#endregion
|
|
7734
7735
|
//#region src/modules/wallets/getOwnerWalletAccountForSmartWalletAccount/getOwnerWalletAccountForSmartWalletAccount.ts
|
|
7735
7736
|
/** @notInstrumented */
|
|
7736
|
-
const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client =
|
|
7737
|
+
const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7737
7738
|
const smartWalletVerifiedCredential = require_getWalletProviderByKey.getVerifiedCredentialForWalletAccount({ walletAccount: smartWalletAccount }, client);
|
|
7738
|
-
|
|
7739
|
-
return
|
|
7739
|
+
require_updateAuthFromVerifyResponse.assertDefined(smartWalletVerifiedCredential?.signerRefId, "Invalid smart wallet account");
|
|
7740
|
+
return require_updateAuthFromVerifyResponse.getWalletAccounts(client).find((walletAccount) => walletAccount.verifiedCredentialId === smartWalletVerifiedCredential.signerRefId);
|
|
7740
7741
|
};
|
|
7741
7742
|
|
|
7742
7743
|
//#endregion
|
|
@@ -7756,7 +7757,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount }) => {
|
|
|
7756
7757
|
* @returns The data for the wallet provider.
|
|
7757
7758
|
* @notInstrumented
|
|
7758
7759
|
*/
|
|
7759
|
-
const getWalletProviderDataByKey = ({ walletProviderKey }, client =
|
|
7760
|
+
const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7760
7761
|
const { chain, groupKey, key, metadata, walletProviderType } = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
7761
7762
|
return {
|
|
7762
7763
|
chain,
|
|
@@ -7778,7 +7779,7 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_Inva
|
|
|
7778
7779
|
* @returns Whether the wallet provider supports the specified hardware wallet vendor.
|
|
7779
7780
|
* @notInstrumented
|
|
7780
7781
|
*/
|
|
7781
|
-
const canConnectWithHardwareWallet = ({ walletProviderKey, hardwareWalletVendor }, client =
|
|
7782
|
+
const canConnectWithHardwareWallet = ({ walletProviderKey, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7782
7783
|
return require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client).metadata.supportedHardwareWalletVendors?.includes(hardwareWalletVendor) ?? false;
|
|
7783
7784
|
};
|
|
7784
7785
|
|
|
@@ -7807,7 +7808,7 @@ const isHardwareWalletAccount = ({ walletAccount }) => walletAccount.hardwareWal
|
|
|
7807
7808
|
* @returns True if the session has at least one wallet account, false otherwise.
|
|
7808
7809
|
* @notInstrumented
|
|
7809
7810
|
*/
|
|
7810
|
-
const isAnyWalletAccountConnected = (client =
|
|
7811
|
+
const isAnyWalletAccountConnected = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => require_updateAuthFromVerifyResponse.getWalletAccounts(client).length > 0;
|
|
7811
7812
|
|
|
7812
7813
|
//#endregion
|
|
7813
7814
|
//#region src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.ts
|
|
@@ -7837,7 +7838,7 @@ const isWalletAccountVerified = ({ walletAccount }) => {
|
|
|
7837
7838
|
* @throws NetworkAddingUnavailableError If the wallet provider doesn't support adding networks.
|
|
7838
7839
|
* @instrumented
|
|
7839
7840
|
*/
|
|
7840
|
-
const addNetwork = async ({ networkData, walletAccount }, client =
|
|
7841
|
+
const addNetwork = async ({ networkData, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7841
7842
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey: walletAccount.walletProviderKey }, client);
|
|
7842
7843
|
if (walletProvider.addNetwork === void 0) throw new NetworkAddingUnavailableError({
|
|
7843
7844
|
extraMessages: [`Wallet provider ${walletAccount.walletProviderKey} does not have addNetwork method`],
|
|
@@ -7847,12 +7848,12 @@ const addNetwork = async ({ networkData, walletAccount }, client = require_Inval
|
|
|
7847
7848
|
return walletProvider.addNetwork({ networkData });
|
|
7848
7849
|
};
|
|
7849
7850
|
const __addNetwork_impl = addNetwork;
|
|
7850
|
-
const __addNetwork_wrapped =
|
|
7851
|
+
const __addNetwork_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7851
7852
|
fn: __addNetwork_impl,
|
|
7852
7853
|
functionName: "addNetwork",
|
|
7853
7854
|
getCore: () => {
|
|
7854
7855
|
try {
|
|
7855
|
-
return
|
|
7856
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7856
7857
|
} catch {
|
|
7857
7858
|
return;
|
|
7858
7859
|
}
|
|
@@ -7873,8 +7874,8 @@ const __addNetwork_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
7873
7874
|
* @returns A promise that resolves to the network data, or undefined if not found.
|
|
7874
7875
|
* @notInstrumented
|
|
7875
7876
|
*/
|
|
7876
|
-
const getActiveNetworkData = async ({ walletAccount }, client =
|
|
7877
|
-
const walletProvider =
|
|
7877
|
+
const getActiveNetworkData = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7878
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7878
7879
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7879
7880
|
return { networkData: require_getNetworkProviderFromNetworkId.getNetworksData(client).find((data) => data.networkId === networkId && data.chain === walletProvider.chain) };
|
|
7880
7881
|
};
|
|
@@ -7889,8 +7890,8 @@ const getActiveNetworkData = async ({ walletAccount }, client = require_InvalidP
|
|
|
7889
7890
|
* @returns A promise that resolves to the active network ID for the wallet account.
|
|
7890
7891
|
* @notInstrumented
|
|
7891
7892
|
*/
|
|
7892
|
-
const getActiveNetworkId = ({ walletAccount }, client =
|
|
7893
|
-
return
|
|
7893
|
+
const getActiveNetworkId = ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7894
|
+
return require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
7894
7895
|
};
|
|
7895
7896
|
|
|
7896
7897
|
//#endregion
|
|
@@ -7910,8 +7911,8 @@ const getActiveNetworkId = ({ walletAccount }, client = require_InvalidParamErro
|
|
|
7910
7911
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7911
7912
|
* @notInstrumented
|
|
7912
7913
|
*/
|
|
7913
|
-
const getNativeBalance = async ({ walletAccount }, client =
|
|
7914
|
-
const walletProvider =
|
|
7914
|
+
const getNativeBalance = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7915
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7915
7916
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7916
7917
|
return require_getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId({
|
|
7917
7918
|
chain: walletProvider.chain,
|
|
@@ -7930,7 +7931,7 @@ const getNativeBalance = async ({ walletAccount }, client = require_InvalidParam
|
|
|
7930
7931
|
* @notInstrumented
|
|
7931
7932
|
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
7932
7933
|
*/
|
|
7933
|
-
const getBalance = (params, client =
|
|
7934
|
+
const getBalance = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => getNativeBalance(params, client);
|
|
7934
7935
|
|
|
7935
7936
|
//#endregion
|
|
7936
7937
|
//#region src/modules/wallets/networks/getBalanceForAddress/getBalanceForAddress.ts
|
|
@@ -7947,12 +7948,12 @@ const getBalance = (params, client = require_InvalidParamError.getDefaultClient(
|
|
|
7947
7948
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7948
7949
|
* @notInstrumented
|
|
7949
7950
|
*/
|
|
7950
|
-
const getBalanceForAddress = async ({ address, chain, networkId }, client =
|
|
7951
|
+
const getBalanceForAddress = async ({ address, chain, networkId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7951
7952
|
const networkProvider = require_getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId({
|
|
7952
7953
|
chain,
|
|
7953
7954
|
networkId
|
|
7954
7955
|
}, client);
|
|
7955
|
-
|
|
7956
|
+
require_updateAuthFromVerifyResponse.assertDefined(networkProvider, `No network found for chain ${chain} and network id ${networkId}. Please ensure you've enabled this network in the Dashboard.`);
|
|
7956
7957
|
return networkProvider.getBalance({ address });
|
|
7957
7958
|
};
|
|
7958
7959
|
|
|
@@ -7974,9 +7975,9 @@ const getBalanceForAddress = async ({ address, chain, networkId }, client = requ
|
|
|
7974
7975
|
* @returns A promise that resolves to the transaction history along with nextOffset for the given wallet address and chain.
|
|
7975
7976
|
* @notInstrumented
|
|
7976
7977
|
*/
|
|
7977
|
-
const getTransactionHistory = async (params, client =
|
|
7978
|
-
const core =
|
|
7979
|
-
return await
|
|
7978
|
+
const getTransactionHistory = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7979
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
7980
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).getWalletTransactions({
|
|
7980
7981
|
address: params.address,
|
|
7981
7982
|
chainName: params.chain,
|
|
7982
7983
|
environmentId: core.environmentId,
|
|
@@ -8000,7 +8001,7 @@ const getTransactionHistory = async (params, client = require_InvalidParamError.
|
|
|
8000
8001
|
* @returns True if programmatic network switching is available, false otherwise.
|
|
8001
8002
|
* @notInstrumented
|
|
8002
8003
|
*/
|
|
8003
|
-
const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client =
|
|
8004
|
+
const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8004
8005
|
return require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey: walletAccount.walletProviderKey }, client).switchActiveNetwork !== void 0;
|
|
8005
8006
|
};
|
|
8006
8007
|
|
|
@@ -8019,7 +8020,7 @@ const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client = requir
|
|
|
8019
8020
|
* @throws NetworkSwitchingUnavailableError If the wallet provider doesn't support network switching.
|
|
8020
8021
|
* @instrumented
|
|
8021
8022
|
*/
|
|
8022
|
-
const switchActiveNetwork = async ({ networkId, walletAccount }, client =
|
|
8023
|
+
const switchActiveNetwork = async ({ networkId, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8023
8024
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey: walletAccount.walletProviderKey }, client);
|
|
8024
8025
|
if (walletProvider.switchActiveNetwork === void 0) throw new NetworkSwitchingUnavailableError({
|
|
8025
8026
|
extraMessages: [`Wallet provider ${walletAccount.walletProviderKey} does not have switchActiveNetwork method`],
|
|
@@ -8029,12 +8030,12 @@ const switchActiveNetwork = async ({ networkId, walletAccount }, client = requir
|
|
|
8029
8030
|
return walletProvider.switchActiveNetwork({ networkId });
|
|
8030
8031
|
};
|
|
8031
8032
|
const __switchActiveNetwork_impl = switchActiveNetwork;
|
|
8032
|
-
const __switchActiveNetwork_wrapped =
|
|
8033
|
+
const __switchActiveNetwork_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8033
8034
|
fn: __switchActiveNetwork_impl,
|
|
8034
8035
|
functionName: "switchActiveNetwork",
|
|
8035
8036
|
getCore: () => {
|
|
8036
8037
|
try {
|
|
8037
|
-
return
|
|
8038
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8038
8039
|
} catch {
|
|
8039
8040
|
return;
|
|
8040
8041
|
}
|
|
@@ -8048,10 +8049,10 @@ const __switchActiveNetwork_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
8048
8049
|
* @instrumented
|
|
8049
8050
|
* @noHook The primary-wallet concept is discouraged and not exposed as a hook.
|
|
8050
8051
|
*/
|
|
8051
|
-
const selectPrimaryWalletAccount = async ({ walletAccount }, client =
|
|
8052
|
-
const core =
|
|
8052
|
+
const selectPrimaryWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8053
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
8053
8054
|
if (getPrimaryWalletAccount(client)?.id === walletAccount.id) return;
|
|
8054
|
-
if (walletAccount.verifiedCredentialId)
|
|
8055
|
+
if (walletAccount.verifiedCredentialId) require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response: await require_updateAuthFromVerifyResponse.createApiClient({}, client).selectUserWallet({
|
|
8055
8056
|
environmentId: core.environmentId,
|
|
8056
8057
|
userWalletSelectionRequest: { walletId: walletAccount.verifiedCredentialId }
|
|
8057
8058
|
}) }, client);
|
|
@@ -8061,12 +8062,12 @@ const selectPrimaryWalletAccount = async ({ walletAccount }, client = require_In
|
|
|
8061
8062
|
}] }, client);
|
|
8062
8063
|
};
|
|
8063
8064
|
const __selectPrimaryWalletAccount_impl = selectPrimaryWalletAccount;
|
|
8064
|
-
const __selectPrimaryWalletAccount_wrapped =
|
|
8065
|
+
const __selectPrimaryWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8065
8066
|
fn: __selectPrimaryWalletAccount_impl,
|
|
8066
8067
|
functionName: "selectPrimaryWalletAccount",
|
|
8067
8068
|
getCore: () => {
|
|
8068
8069
|
try {
|
|
8069
|
-
return
|
|
8070
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8070
8071
|
} catch {
|
|
8071
8072
|
return;
|
|
8072
8073
|
}
|
|
@@ -8084,9 +8085,9 @@ const __selectPrimaryWalletAccount_wrapped = require_InvalidParamError.instrumen
|
|
|
8084
8085
|
*/
|
|
8085
8086
|
const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
8086
8087
|
try {
|
|
8087
|
-
await
|
|
8088
|
+
await require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).disconnectWalletAccount?.({ walletAccount });
|
|
8088
8089
|
} catch (error) {
|
|
8089
|
-
if (error instanceof
|
|
8090
|
+
if (error instanceof require_updateAuthFromVerifyResponse.NoWalletProviderFoundError) return;
|
|
8090
8091
|
throw error;
|
|
8091
8092
|
}
|
|
8092
8093
|
};
|
|
@@ -8105,26 +8106,26 @@ const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
|
8105
8106
|
* @returns A promise that resolves when the wallet account is successfully removed.
|
|
8106
8107
|
* @instrumented
|
|
8107
8108
|
*/
|
|
8108
|
-
const removeWalletAccount = async ({ walletAccount }, client =
|
|
8109
|
-
const core =
|
|
8110
|
-
const apiClient =
|
|
8109
|
+
const removeWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8110
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
8111
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
8111
8112
|
await disconnectWalletAccount({ walletAccount }, client);
|
|
8112
8113
|
if (!walletAccount.verifiedCredentialId) {
|
|
8113
8114
|
require_getNetworkProviderFromNetworkId.removeUnverifiedWalletAccount({ unverifiedWalletAccount: walletAccount }, client);
|
|
8114
8115
|
return;
|
|
8115
8116
|
}
|
|
8116
|
-
|
|
8117
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response: await apiClient.verifyUnlink({
|
|
8117
8118
|
environmentId: core.environmentId,
|
|
8118
8119
|
verifyUnlinkRequest: { walletId: walletAccount.verifiedCredentialId }
|
|
8119
8120
|
}) }, client);
|
|
8120
8121
|
};
|
|
8121
8122
|
const __removeWalletAccount_impl = removeWalletAccount;
|
|
8122
|
-
const __removeWalletAccount_wrapped =
|
|
8123
|
+
const __removeWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8123
8124
|
fn: __removeWalletAccount_impl,
|
|
8124
8125
|
functionName: "removeWalletAccount",
|
|
8125
8126
|
getCore: () => {
|
|
8126
8127
|
try {
|
|
8127
|
-
return
|
|
8128
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8128
8129
|
} catch {
|
|
8129
8130
|
return;
|
|
8130
8131
|
}
|
|
@@ -8145,8 +8146,8 @@ const __removeWalletAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
8145
8146
|
* @returns A promise that resolves to an object containing the signature.
|
|
8146
8147
|
* @instrumented
|
|
8147
8148
|
*/
|
|
8148
|
-
const signMessage = async ({ walletAccount, message }, client =
|
|
8149
|
-
const walletProvider =
|
|
8149
|
+
const signMessage = async ({ walletAccount, message }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8150
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
8150
8151
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
8151
8152
|
const { signature } = await walletProvider.signMessage({
|
|
8152
8153
|
message,
|
|
@@ -8155,12 +8156,12 @@ const signMessage = async ({ walletAccount, message }, client = require_InvalidP
|
|
|
8155
8156
|
return { signature };
|
|
8156
8157
|
};
|
|
8157
8158
|
const __signMessage_impl = signMessage;
|
|
8158
|
-
const __signMessage_wrapped =
|
|
8159
|
+
const __signMessage_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8159
8160
|
fn: __signMessage_impl,
|
|
8160
8161
|
functionName: "signMessage",
|
|
8161
8162
|
getCore: () => {
|
|
8162
8163
|
try {
|
|
8163
|
-
return
|
|
8164
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8164
8165
|
} catch {
|
|
8165
8166
|
return;
|
|
8166
8167
|
}
|
|
@@ -8184,8 +8185,8 @@ const __signMessage_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
8184
8185
|
* @throws If the wallet provider does not support the transfer amount method.
|
|
8185
8186
|
* @instrumented
|
|
8186
8187
|
*/
|
|
8187
|
-
const transferAmount = async ({ walletAccount, amount, recipient, token }, client =
|
|
8188
|
-
const walletProvider =
|
|
8188
|
+
const transferAmount = async ({ walletAccount, amount, recipient, token }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8189
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
8189
8190
|
assertWalletProviderMethodDefined(walletProvider, "transferAmount");
|
|
8190
8191
|
const { transactionHash } = await walletProvider.transferAmount({
|
|
8191
8192
|
amount,
|
|
@@ -8196,12 +8197,12 @@ const transferAmount = async ({ walletAccount, amount, recipient, token }, clien
|
|
|
8196
8197
|
return { transactionHash };
|
|
8197
8198
|
};
|
|
8198
8199
|
const __transferAmount_impl = transferAmount;
|
|
8199
|
-
const __transferAmount_wrapped =
|
|
8200
|
+
const __transferAmount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8200
8201
|
fn: __transferAmount_impl,
|
|
8201
8202
|
functionName: "transferAmount",
|
|
8202
8203
|
getCore: () => {
|
|
8203
8204
|
try {
|
|
8204
|
-
return
|
|
8205
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8205
8206
|
} catch {
|
|
8206
8207
|
return;
|
|
8207
8208
|
}
|
|
@@ -8221,7 +8222,7 @@ const __transferAmount_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
8221
8222
|
* @returns A promise that resolves to the transferred wallet account.
|
|
8222
8223
|
* @instrumented
|
|
8223
8224
|
*/
|
|
8224
|
-
const transferWalletAccount = async ({ walletProviderKey }, client =
|
|
8225
|
+
const transferWalletAccount = async ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8225
8226
|
return verifyWalletAccountForSignInOrTransfer({
|
|
8226
8227
|
isTransfer: true,
|
|
8227
8228
|
walletAccount: await __connectWithWalletProvider_wrapped({
|
|
@@ -8231,12 +8232,12 @@ const transferWalletAccount = async ({ walletProviderKey }, client = require_Inv
|
|
|
8231
8232
|
}, client);
|
|
8232
8233
|
};
|
|
8233
8234
|
const __transferWalletAccount_impl = transferWalletAccount;
|
|
8234
|
-
const __transferWalletAccount_wrapped =
|
|
8235
|
+
const __transferWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8235
8236
|
fn: __transferWalletAccount_impl,
|
|
8236
8237
|
functionName: "transferWalletAccount",
|
|
8237
8238
|
getCore: () => {
|
|
8238
8239
|
try {
|
|
8239
|
-
return
|
|
8240
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8240
8241
|
} catch {
|
|
8241
8242
|
return;
|
|
8242
8243
|
}
|
|
@@ -8257,8 +8258,8 @@ const __transferWalletAccount_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
8257
8258
|
* @returns The matching wallet account, or undefined if not found.
|
|
8258
8259
|
* @notInstrumented
|
|
8259
8260
|
*/
|
|
8260
|
-
const getWalletAccountFromAddress = ({ address, chain }, client =
|
|
8261
|
-
return
|
|
8261
|
+
const getWalletAccountFromAddress = ({ address, chain }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8262
|
+
return require_updateAuthFromVerifyResponse.getWalletAccounts(client).find((walletAccount) => walletAccount.address === address && walletAccount.chain === chain);
|
|
8262
8263
|
};
|
|
8263
8264
|
|
|
8264
8265
|
//#endregion
|
|
@@ -8274,7 +8275,7 @@ const getWalletAccountFromAddress = ({ address, chain }, client = require_Invali
|
|
|
8274
8275
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8275
8276
|
* @notInstrumented
|
|
8276
8277
|
*/
|
|
8277
|
-
const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
8278
|
+
const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8278
8279
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
8279
8280
|
assertWalletProviderMethodDefined(walletProvider, "events");
|
|
8280
8281
|
walletProvider.events.off(event, callback);
|
|
@@ -8293,7 +8294,7 @@ const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
|
8293
8294
|
* @notInstrumented
|
|
8294
8295
|
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
8295
8296
|
*/
|
|
8296
|
-
const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
8297
|
+
const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8297
8298
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
8298
8299
|
assertWalletProviderMethodDefined(walletProvider, "events");
|
|
8299
8300
|
walletProvider.events.on(event, callback);
|
|
@@ -8410,10 +8411,10 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
8410
8411
|
|
|
8411
8412
|
//#endregion
|
|
8412
8413
|
//#region src/exports/index.ts
|
|
8413
|
-
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(
|
|
8414
|
+
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_updateAuthFromVerifyResponse.name, require_updateAuthFromVerifyResponse.version);
|
|
8414
8415
|
|
|
8415
8416
|
//#endregion
|
|
8416
|
-
exports.BaseError =
|
|
8417
|
+
exports.BaseError = require_updateAuthFromVerifyResponse.BaseError;
|
|
8417
8418
|
exports.CheckoutSessionTokenMissingError = CheckoutSessionTokenMissingError;
|
|
8418
8419
|
exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
8419
8420
|
exports.DeeplinkConnectAndVerifyUnsupportedError = DeeplinkConnectAndVerifyUnsupportedError;
|
|
@@ -8421,19 +8422,25 @@ exports.FeeEstimationFailedError = FeeEstimationFailedError;
|
|
|
8421
8422
|
exports.FlowSessionTokenMissingError = FlowSessionTokenMissingError;
|
|
8422
8423
|
exports.GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES = GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES;
|
|
8423
8424
|
exports.InvalidDeviceRegistrationRedirectError = InvalidDeviceRegistrationRedirectError;
|
|
8424
|
-
exports.InvalidExternalAuthError =
|
|
8425
|
-
exports.InvalidParamError =
|
|
8425
|
+
exports.InvalidExternalAuthError = require_updateAuthFromVerifyResponse.InvalidExternalAuthError;
|
|
8426
|
+
exports.InvalidParamError = require_updateAuthFromVerifyResponse.InvalidParamError;
|
|
8426
8427
|
exports.InvalidRedirectStorageStateError = InvalidRedirectStorageStateError;
|
|
8427
8428
|
exports.InvalidSocialCallbackOriginError = InvalidSocialCallbackOriginError;
|
|
8428
|
-
exports
|
|
8429
|
+
Object.defineProperty(exports, 'JwtVerifiedCredentialFormatEnum', {
|
|
8430
|
+
enumerable: true,
|
|
8431
|
+
get: function () {
|
|
8432
|
+
return _dynamic_labs_sdk_api_core.JwtVerifiedCredentialFormatEnum;
|
|
8433
|
+
}
|
|
8434
|
+
});
|
|
8435
|
+
exports.LinkCredentialError = require_updateAuthFromVerifyResponse.LinkCredentialError;
|
|
8429
8436
|
Object.defineProperty(exports, 'MFAAction', {
|
|
8430
8437
|
enumerable: true,
|
|
8431
8438
|
get: function () {
|
|
8432
8439
|
return _dynamic_labs_sdk_api_core.MFAAction;
|
|
8433
8440
|
}
|
|
8434
8441
|
});
|
|
8435
|
-
exports.MfaInvalidOtpError =
|
|
8436
|
-
exports.MfaRateLimitedError =
|
|
8442
|
+
exports.MfaInvalidOtpError = require_updateAuthFromVerifyResponse.MfaInvalidOtpError;
|
|
8443
|
+
exports.MfaRateLimitedError = require_updateAuthFromVerifyResponse.MfaRateLimitedError;
|
|
8437
8444
|
exports.MissingRedirectStorageStateError = MissingRedirectStorageStateError;
|
|
8438
8445
|
exports.MissingSocialUrlParamError = MissingSocialUrlParamError;
|
|
8439
8446
|
exports.MissingUserVerificationError = MissingUserVerificationError;
|
|
@@ -8446,10 +8453,22 @@ exports.NoPasskeyCredentialsFoundError = NoPasskeyCredentialsFoundError;
|
|
|
8446
8453
|
exports.NoSmartWalletAccountSignerFoundError = NoSmartWalletAccountSignerFoundError;
|
|
8447
8454
|
exports.NoWebAuthNSupportError = NoWebAuthNSupportError;
|
|
8448
8455
|
exports.NotWaasWalletAccountError = require_isDynamicWaasEnabled.NotWaasWalletAccountError;
|
|
8449
|
-
exports
|
|
8456
|
+
Object.defineProperty(exports, 'ProviderEnum', {
|
|
8457
|
+
enumerable: true,
|
|
8458
|
+
get: function () {
|
|
8459
|
+
return _dynamic_labs_sdk_api_core.ProviderEnum;
|
|
8460
|
+
}
|
|
8461
|
+
});
|
|
8462
|
+
exports.SandboxMaximumThresholdReachedError = require_updateAuthFromVerifyResponse.SandboxMaximumThresholdReachedError;
|
|
8450
8463
|
exports.SimulationFailedError = SimulationFailedError;
|
|
8464
|
+
Object.defineProperty(exports, 'TokenScope', {
|
|
8465
|
+
enumerable: true,
|
|
8466
|
+
get: function () {
|
|
8467
|
+
return _dynamic_labs_sdk_api_core.TokenScope;
|
|
8468
|
+
}
|
|
8469
|
+
});
|
|
8451
8470
|
exports.TokenSwapError = TokenSwapError;
|
|
8452
|
-
exports.UnauthorizedError =
|
|
8471
|
+
exports.UnauthorizedError = require_updateAuthFromVerifyResponse.UnauthorizedError;
|
|
8453
8472
|
exports.UnavailableInServerSideError = UnavailableInServerSideError;
|
|
8454
8473
|
exports.UnrecognizedNetworkError = UnrecognizedNetworkError;
|
|
8455
8474
|
exports.UserCancelledSocialPopUpError = UserCancelledSocialPopUpError;
|
|
@@ -8511,9 +8530,9 @@ exports.getCheckoutTransaction = getCheckoutTransaction;
|
|
|
8511
8530
|
exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
|
|
8512
8531
|
exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;
|
|
8513
8532
|
exports.getConnectedAddresses = getConnectedAddresses;
|
|
8514
|
-
exports.getDefaultClient =
|
|
8533
|
+
exports.getDefaultClient = require_updateAuthFromVerifyResponse.getDefaultClient;
|
|
8515
8534
|
exports.getDeviceRegistrationTokenFromUrl = getDeviceRegistrationTokenFromUrl;
|
|
8516
|
-
exports.getElevatedAccessToken =
|
|
8535
|
+
exports.getElevatedAccessToken = require_updateAuthFromVerifyResponse.getElevatedAccessToken;
|
|
8517
8536
|
exports.getFlow = getFlow;
|
|
8518
8537
|
exports.getFlowQuote = getFlowQuote;
|
|
8519
8538
|
exports.getGoogleDriveBackupReadiness = __getGoogleDriveBackupReadiness_wrapped;
|
|
@@ -8541,7 +8560,7 @@ exports.getTransactionHistory = getTransactionHistory;
|
|
|
8541
8560
|
exports.getUserSocialAccounts = getUserSocialAccounts;
|
|
8542
8561
|
exports.getWalletAccountAddressByType = getWalletAccountAddressByType;
|
|
8543
8562
|
exports.getWalletAccountFromAddress = getWalletAccountFromAddress;
|
|
8544
|
-
exports.getWalletAccounts =
|
|
8563
|
+
exports.getWalletAccounts = require_updateAuthFromVerifyResponse.getWalletAccounts;
|
|
8545
8564
|
exports.getWalletConnectCatalog = getWalletConnectCatalog;
|
|
8546
8565
|
exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
|
|
8547
8566
|
exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
|
|
@@ -8560,21 +8579,21 @@ exports.isMobile = isMobile;
|
|
|
8560
8579
|
exports.isPendingRecoveryCodesAcknowledgment = require_isUserOnboardingComplete.isPendingRecoveryCodesAcknowledgment;
|
|
8561
8580
|
exports.isProgrammaticNetworkSwitchAvailable = isProgrammaticNetworkSwitchAvailable;
|
|
8562
8581
|
exports.isSignedIn = require_isMfaRequiredForAction.isSignedIn;
|
|
8563
|
-
exports.isUserMissingMfaAuth =
|
|
8582
|
+
exports.isUserMissingMfaAuth = require_updateAuthFromVerifyResponse.isUserMissingMfaAuth;
|
|
8564
8583
|
exports.isUserOnboardingComplete = require_isUserOnboardingComplete.isUserOnboardingComplete;
|
|
8565
8584
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|
|
8566
8585
|
exports.logout = logout;
|
|
8567
8586
|
exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
|
|
8568
|
-
exports.offEvent =
|
|
8587
|
+
exports.offEvent = require_updateAuthFromVerifyResponse.offEvent;
|
|
8569
8588
|
exports.offWalletProviderEvent = offWalletProviderEvent;
|
|
8570
|
-
exports.onEvent =
|
|
8589
|
+
exports.onEvent = require_updateAuthFromVerifyResponse.onEvent;
|
|
8571
8590
|
exports.onWalletProviderEvent = onWalletProviderEvent;
|
|
8572
|
-
exports.onceEvent =
|
|
8591
|
+
exports.onceEvent = require_updateAuthFromVerifyResponse.onceEvent;
|
|
8573
8592
|
exports.parseUserAgent = parseUserAgent;
|
|
8574
8593
|
exports.prepareCheckoutTransaction = __prepareCheckoutTransaction_wrapped;
|
|
8575
8594
|
exports.prepareFlowSigning = __prepareFlowSigning_wrapped;
|
|
8576
8595
|
exports.proveWalletAccountOwnership = __proveWalletAccountOwnership_wrapped;
|
|
8577
|
-
exports.refreshAuth =
|
|
8596
|
+
exports.refreshAuth = require_isDynamicWaasEnabled.__refreshAuth_wrapped;
|
|
8578
8597
|
exports.refreshUser = __refreshUser_wrapped;
|
|
8579
8598
|
exports.registerPasskey = __registerPasskey_wrapped;
|
|
8580
8599
|
exports.registerTotpMfaDevice = __registerTotpMfaDevice_wrapped;
|