@dynamic-labs-sdk/client 1.16.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +53 -53
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +7 -7
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +5 -5
- 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-CregkqLB.esm.js → getNetworkProviderFromNetworkId-BVVs3arj.esm.js} +6 -7
- package/dist/getNetworkProviderFromNetworkId-BVVs3arj.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BURAkmc3.native.esm.js → getNetworkProviderFromNetworkId-DC1bhMuB.native.esm.js} +3 -4
- package/dist/{getNetworkProviderFromNetworkId-BURAkmc3.native.esm.js.map → getNetworkProviderFromNetworkId-DC1bhMuB.native.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BpvoqbEH.cjs → getNetworkProviderFromNetworkId-DzzocxRc.cjs} +43 -44
- package/dist/{getNetworkProviderFromNetworkId-BpvoqbEH.cjs.map → getNetworkProviderFromNetworkId-DzzocxRc.cjs.map} +1 -1
- package/dist/{getSignedSessionId-Czpvp58E.esm.js → getSignedSessionId-Bnuz2Aqc.esm.js} +3 -3
- package/dist/{getSignedSessionId-Czpvp58E.esm.js.map → getSignedSessionId-Bnuz2Aqc.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-C98wdvMw.cjs → getSignedSessionId-Dx0qQLMP.cjs} +11 -11
- package/dist/{getSignedSessionId-C98wdvMw.cjs.map → getSignedSessionId-Dx0qQLMP.cjs.map} +1 -1
- package/dist/{getSignedSessionId-upC71vLP.native.esm.js → getSignedSessionId-Pc_5wscD.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-upC71vLP.native.esm.js.map → getSignedSessionId-Pc_5wscD.native.esm.js.map} +1 -1
- package/dist/getWalletProviderByKey-BL3u0e-d.esm.js +20 -0
- package/dist/getWalletProviderByKey-BL3u0e-d.esm.js.map +1 -0
- package/dist/getWalletProviderByKey-BLWcueTR.cjs +31 -0
- package/dist/getWalletProviderByKey-BLWcueTR.cjs.map +1 -0
- package/dist/getWalletProviderByKey-DhqKzh7g.native.esm.js +20 -0
- package/dist/getWalletProviderByKey-DhqKzh7g.native.esm.js.map +1 -0
- package/dist/index.cjs +539 -540
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +9 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +6 -7
- package/dist/index.native.esm.js.map +1 -1
- package/dist/isDynamicWaasEnabled-BEn7FcD9.cjs +88 -0
- package/dist/isDynamicWaasEnabled-BEn7FcD9.cjs.map +1 -0
- package/dist/isDynamicWaasEnabled-CvBaMGlR.native.esm.js +70 -0
- package/dist/isDynamicWaasEnabled-CvBaMGlR.native.esm.js.map +1 -0
- package/dist/isDynamicWaasEnabled-DYy0TvLy.esm.js +70 -0
- package/dist/isDynamicWaasEnabled-DYy0TvLy.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-CgVdSGRA.esm.js → isMfaRequiredForAction-B7wNkqQf.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-CgVdSGRA.esm.js.map → isMfaRequiredForAction-B7wNkqQf.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-juTvf3Pl.native.esm.js → isMfaRequiredForAction-CJ9qbBUz.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-juTvf3Pl.native.esm.js.map → isMfaRequiredForAction-CJ9qbBUz.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DECknr5q.cjs → isMfaRequiredForAction-CaNdGc-m.cjs} +29 -29
- package/dist/{isMfaRequiredForAction-DECknr5q.cjs.map → isMfaRequiredForAction-CaNdGc-m.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-DFrrp61b.esm.js → isUserOnboardingComplete-CGz-9Iyw.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DFrrp61b.esm.js.map → isUserOnboardingComplete-CGz-9Iyw.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-Dtr1_Mi4.native.esm.js → isUserOnboardingComplete-FRAIuxdi.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-Dtr1_Mi4.native.esm.js.map → isUserOnboardingComplete-FRAIuxdi.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-DvCQh8Dj.cjs → isUserOnboardingComplete-w1IkCC_p.cjs} +13 -13
- package/dist/{isUserOnboardingComplete-DvCQh8Dj.cjs.map → isUserOnboardingComplete-w1IkCC_p.cjs.map} +1 -1
- package/dist/migrateFromFireblocks-C-IqJz3q.native.esm.js +65 -0
- package/dist/migrateFromFireblocks-C-IqJz3q.native.esm.js.map +1 -0
- package/dist/migrateFromFireblocks-CjQWJPZW.cjs +82 -0
- package/dist/migrateFromFireblocks-CjQWJPZW.cjs.map +1 -0
- package/dist/migrateFromFireblocks-DXs3odF_.esm.js +65 -0
- package/dist/migrateFromFireblocks-DXs3odF_.esm.js.map +1 -0
- 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/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{InvalidParamError-Dn_riAvL.esm.js → updateAuthFromVerifyResponse-BdokPJ21.esm.js} +237 -3
- package/dist/updateAuthFromVerifyResponse-BdokPJ21.esm.js.map +1 -0
- package/dist/{InvalidParamError-DHriGGNI.cjs → updateAuthFromVerifyResponse-CUnvs5Af.cjs} +291 -9
- package/dist/updateAuthFromVerifyResponse-CUnvs5Af.cjs.map +1 -0
- package/dist/{InvalidParamError-DYezznCD.native.esm.js → updateAuthFromVerifyResponse-DW-tPgdV.native.esm.js} +457 -4
- package/dist/updateAuthFromVerifyResponse-DW-tPgdV.native.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 +2 -2
- package/dist/InvalidParamError-DHriGGNI.cjs.map +0 -1
- package/dist/InvalidParamError-DYezznCD.native.esm.js.map +0 -1
- package/dist/InvalidParamError-Dn_riAvL.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CregkqLB.esm.js.map +0 -1
- package/dist/getWaasWalletProviderFromWalletAccount-BrskhuL8.cjs +0 -19
- package/dist/getWaasWalletProviderFromWalletAccount-BrskhuL8.cjs.map +0 -1
- package/dist/getWaasWalletProviderFromWalletAccount-DHKga3uH.native.esm.js +0 -14
- package/dist/getWaasWalletProviderFromWalletAccount-DHKga3uH.native.esm.js.map +0 -1
- package/dist/getWaasWalletProviderFromWalletAccount-Dc6QvHVt.esm.js +0 -14
- package/dist/getWaasWalletProviderFromWalletAccount-Dc6QvHVt.esm.js.map +0 -1
- package/dist/getWalletProviderByKey-DDNCUbUe.cjs +0 -321
- package/dist/getWalletProviderByKey-DDNCUbUe.cjs.map +0 -1
- package/dist/getWalletProviderByKey-DTi6MhKt.esm.js +0 -255
- package/dist/getWalletProviderByKey-DTi6MhKt.esm.js.map +0 -1
- package/dist/getWalletProviderByKey-OYhHm11_.native.esm.js +0 -474
- package/dist/getWalletProviderByKey-OYhHm11_.native.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-Bj3v8LZ_.cjs +0 -49
- package/dist/isDynamicWaasEnabled-Bj3v8LZ_.cjs.map +0 -1
- package/dist/isDynamicWaasEnabled-CuSe2RO1.esm.js +0 -37
- package/dist/isDynamicWaasEnabled-CuSe2RO1.esm.js.map +0 -1
- package/dist/isDynamicWaasEnabled-CvD8_c7H.native.esm.js +0 -37
- package/dist/isDynamicWaasEnabled-CvD8_c7H.native.esm.js.map +0 -1
- package/dist/refreshAuth-CKHkaRJo.native.esm.js +0 -38
- package/dist/refreshAuth-CKHkaRJo.native.esm.js.map +0 -1
- package/dist/refreshAuth-Q5fxSi3Z.esm.js +0 -38
- package/dist/refreshAuth-Q5fxSi3Z.esm.js.map +0 -1
- package/dist/refreshAuth-oycoOXtD.cjs +0 -43
- package/dist/refreshAuth-oycoOXtD.cjs.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-DvCQh8Dj.cjs');
|
|
1
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-CaNdGc-m.cjs');
|
|
2
|
+
const require_updateAuthFromVerifyResponse = require('./updateAuthFromVerifyResponse-CUnvs5Af.cjs');
|
|
3
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DzzocxRc.cjs');
|
|
4
|
+
const require_isDynamicWaasEnabled = require('./isDynamicWaasEnabled-BEn7FcD9.cjs');
|
|
5
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-w1IkCC_p.cjs');
|
|
6
|
+
const require_getWalletProviderByKey = require('./getWalletProviderByKey-BLWcueTR.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") {
|
|
@@ -3212,12 +3211,12 @@ const attachFlowSource = async (params, client = require_InvalidParamError.getDe
|
|
|
3212
3211
|
return result;
|
|
3213
3212
|
};
|
|
3214
3213
|
const __attachFlowSource_impl = attachFlowSource;
|
|
3215
|
-
const __attachFlowSource_wrapped =
|
|
3214
|
+
const __attachFlowSource_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3216
3215
|
fn: __attachFlowSource_impl,
|
|
3217
3216
|
functionName: "attachFlowSource",
|
|
3218
3217
|
getCore: () => {
|
|
3219
3218
|
try {
|
|
3220
|
-
return
|
|
3219
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3221
3220
|
} catch {
|
|
3222
3221
|
return;
|
|
3223
3222
|
}
|
|
@@ -3228,8 +3227,8 @@ const __attachFlowSource_wrapped = require_InvalidParamError.instrumentFunction(
|
|
|
3228
3227
|
//#region src/modules/flow/utils/createFlowApiClient/createFlowApiClient.ts
|
|
3229
3228
|
/** @notInstrumented */
|
|
3230
3229
|
const createFlowApiClient = async ({ flowId }, client) => {
|
|
3231
|
-
const core =
|
|
3232
|
-
const apiClient =
|
|
3230
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3231
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
3233
3232
|
const sessionToken = await core.storage.getItem(createFlowSessionTokenStorageKey(flowId));
|
|
3234
3233
|
if (!sessionToken) throw new FlowSessionTokenMissingError({ flowId });
|
|
3235
3234
|
return {
|
|
@@ -3253,7 +3252,7 @@ const createFlowApiClient = async ({ flowId }, client) => {
|
|
|
3253
3252
|
* @returns The updated flow
|
|
3254
3253
|
* @instrumented
|
|
3255
3254
|
*/
|
|
3256
|
-
const broadcastFlow = async ({ flowId, txHash }, client =
|
|
3255
|
+
const broadcastFlow = async ({ flowId, txHash }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3257
3256
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3258
3257
|
return withFlowSessionTokenCleanupOn401({
|
|
3259
3258
|
call: () => apiClient.broadcastFlow({
|
|
@@ -3266,12 +3265,12 @@ const broadcastFlow = async ({ flowId, txHash }, client = require_InvalidParamEr
|
|
|
3266
3265
|
}, client);
|
|
3267
3266
|
};
|
|
3268
3267
|
const __broadcastFlow_impl = broadcastFlow;
|
|
3269
|
-
const __broadcastFlow_wrapped =
|
|
3268
|
+
const __broadcastFlow_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3270
3269
|
fn: __broadcastFlow_impl,
|
|
3271
3270
|
functionName: "broadcastFlow",
|
|
3272
3271
|
getCore: () => {
|
|
3273
3272
|
try {
|
|
3274
|
-
return
|
|
3273
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3275
3274
|
} catch {
|
|
3276
3275
|
return;
|
|
3277
3276
|
}
|
|
@@ -3288,7 +3287,7 @@ const __broadcastFlow_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
3288
3287
|
* @returns The cancelled flow
|
|
3289
3288
|
* @instrumented
|
|
3290
3289
|
*/
|
|
3291
|
-
const cancelFlow = async ({ flowId }, client =
|
|
3290
|
+
const cancelFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3292
3291
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3293
3292
|
const result = await withFlowSessionTokenCleanupOn401({
|
|
3294
3293
|
call: () => apiClient.cancelFlow({
|
|
@@ -3302,12 +3301,12 @@ const cancelFlow = async ({ flowId }, client = require_InvalidParamError.getDefa
|
|
|
3302
3301
|
return result;
|
|
3303
3302
|
};
|
|
3304
3303
|
const __cancelFlow_impl = cancelFlow;
|
|
3305
|
-
const __cancelFlow_wrapped =
|
|
3304
|
+
const __cancelFlow_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3306
3305
|
fn: __cancelFlow_impl,
|
|
3307
3306
|
functionName: "cancelFlow",
|
|
3308
3307
|
getCore: () => {
|
|
3309
3308
|
try {
|
|
3310
|
-
return
|
|
3309
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3311
3310
|
} catch {
|
|
3312
3311
|
return;
|
|
3313
3312
|
}
|
|
@@ -3324,9 +3323,9 @@ const __cancelFlow_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
3324
3323
|
* @returns The flow
|
|
3325
3324
|
* @notInstrumented
|
|
3326
3325
|
*/
|
|
3327
|
-
const getFlow = async ({ flowId }, client =
|
|
3328
|
-
const core =
|
|
3329
|
-
return
|
|
3326
|
+
const getFlow = async ({ flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3327
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3328
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getFlow({
|
|
3330
3329
|
environmentId: core.environmentId,
|
|
3331
3330
|
flowId
|
|
3332
3331
|
});
|
|
@@ -3342,7 +3341,7 @@ const getFlow = async ({ flowId }, client = require_InvalidParamError.getDefault
|
|
|
3342
3341
|
* @returns The updated flow with quote data
|
|
3343
3342
|
* @notInstrumented
|
|
3344
3343
|
*/
|
|
3345
|
-
const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage }, client =
|
|
3344
|
+
const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3346
3345
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3347
3346
|
return withFlowSessionTokenCleanupOn401({
|
|
3348
3347
|
call: () => apiClient.getFlowQuote({
|
|
@@ -3371,7 +3370,7 @@ const getFlowQuote = async ({ flowId, fromChainId, fromTokenAddress, slippage },
|
|
|
3371
3370
|
* @returns The updated flow
|
|
3372
3371
|
* @instrumented
|
|
3373
3372
|
*/
|
|
3374
|
-
const prepareFlowSigning = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, flowId }, client =
|
|
3373
|
+
const prepareFlowSigning = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, flowId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3375
3374
|
const { apiClient, environmentId, sessionToken } = await createFlowApiClient({ flowId }, client);
|
|
3376
3375
|
return withFlowSessionTokenCleanupOn401({
|
|
3377
3376
|
call: () => apiClient.prepareFlowSigning({
|
|
@@ -3387,12 +3386,12 @@ const prepareFlowSigning = async ({ assertBalanceForGasCost, assertBalanceForTra
|
|
|
3387
3386
|
}, client);
|
|
3388
3387
|
};
|
|
3389
3388
|
const __prepareFlowSigning_impl = prepareFlowSigning;
|
|
3390
|
-
const __prepareFlowSigning_wrapped =
|
|
3389
|
+
const __prepareFlowSigning_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3391
3390
|
fn: __prepareFlowSigning_impl,
|
|
3392
3391
|
functionName: "prepareFlowSigning",
|
|
3393
3392
|
getCore: () => {
|
|
3394
3393
|
try {
|
|
3395
|
-
return
|
|
3394
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3396
3395
|
} catch {
|
|
3397
3396
|
return;
|
|
3398
3397
|
}
|
|
@@ -3415,13 +3414,13 @@ const __prepareFlowSigning_wrapped = require_InvalidParamError.instrumentFunctio
|
|
|
3415
3414
|
* @returns The broadcasted flow
|
|
3416
3415
|
* @instrumented
|
|
3417
3416
|
*/
|
|
3418
|
-
const submitFlowTransaction = async ({ onStepChange, flowId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount }, client =
|
|
3417
|
+
const submitFlowTransaction = async ({ onStepChange, flowId, walletAccount, assertBalanceForGasCost, assertBalanceForTransferAmount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3419
3418
|
const signingPayload = (await __prepareFlowSigning_wrapped({
|
|
3420
3419
|
assertBalanceForGasCost,
|
|
3421
3420
|
assertBalanceForTransferAmount,
|
|
3422
3421
|
flowId
|
|
3423
3422
|
}, client)).quote?.signingPayload;
|
|
3424
|
-
|
|
3423
|
+
require_updateAuthFromVerifyResponse.assertDefined(signingPayload, "No signing payload returned from prepare — quote may be missing transaction data");
|
|
3425
3424
|
const { transactionHash } = await __executeSwapTransaction_wrapped({
|
|
3426
3425
|
onStepChange,
|
|
3427
3426
|
signingPayload,
|
|
@@ -3433,12 +3432,12 @@ const submitFlowTransaction = async ({ onStepChange, flowId, walletAccount, asse
|
|
|
3433
3432
|
}, client);
|
|
3434
3433
|
};
|
|
3435
3434
|
const __submitFlowTransaction_impl = submitFlowTransaction;
|
|
3436
|
-
const __submitFlowTransaction_wrapped =
|
|
3435
|
+
const __submitFlowTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3437
3436
|
fn: __submitFlowTransaction_impl,
|
|
3438
3437
|
functionName: "submitFlowTransaction",
|
|
3439
3438
|
getCore: () => {
|
|
3440
3439
|
try {
|
|
3441
|
-
return
|
|
3440
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3442
3441
|
} catch {
|
|
3443
3442
|
return;
|
|
3444
3443
|
}
|
|
@@ -3458,9 +3457,9 @@ const __submitFlowTransaction_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
3458
3457
|
* @notInstrumented
|
|
3459
3458
|
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
3460
3459
|
*/
|
|
3461
|
-
const addCoinbaseOnrampOrderEventListener = ({ listener }, client =
|
|
3462
|
-
const core =
|
|
3463
|
-
if (typeof window === "undefined") throw new
|
|
3460
|
+
const addCoinbaseOnrampOrderEventListener = ({ listener }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3461
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3462
|
+
if (typeof window === "undefined") throw new require_updateAuthFromVerifyResponse.ValueMustBeDefinedError("Window is not available to listen for Coinbase onramp order events");
|
|
3464
3463
|
const handleMessageEvent = (event) => {
|
|
3465
3464
|
if (event.origin !== "https://pay.coinbase.com") return;
|
|
3466
3465
|
core.logger.debug("[addCoinbaseOnrampOrderEventListener] pay.coinbase.com event received", { event });
|
|
@@ -3499,10 +3498,10 @@ const addCoinbaseOnrampOrderEventListener = ({ listener }, client = require_Inva
|
|
|
3499
3498
|
* @throws {ValueMustBeDefinedError} - If the user is not authenticated
|
|
3500
3499
|
* @notInstrumented
|
|
3501
3500
|
*/
|
|
3502
|
-
const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client =
|
|
3503
|
-
if (paymentMethod !== "GUEST_CHECKOUT_APPLE_PAY") throw new
|
|
3501
|
+
const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3502
|
+
if (paymentMethod !== "GUEST_CHECKOUT_APPLE_PAY") throw new require_updateAuthFromVerifyResponse.InvalidParamError(`Invalid payment method: ${paymentMethod}`);
|
|
3504
3503
|
const { user } = client;
|
|
3505
|
-
|
|
3504
|
+
require_updateAuthFromVerifyResponse.assertDefined(user, "User is not authenticated");
|
|
3506
3505
|
const fieldsMissingVerification = [];
|
|
3507
3506
|
const emailVerifiedCredential = user.verifiedCredentials.find((credential) => credential.format === _dynamic_labs_sdk_api_core.JwtVerifiedCredentialFormatEnum.Email);
|
|
3508
3507
|
if (!user.email) fieldsMissingVerification.push({
|
|
@@ -3538,7 +3537,7 @@ const getMissingVerificationForCoinbaseOnrampOrder = ({ paymentMethod }, client
|
|
|
3538
3537
|
/** @notInstrumented */
|
|
3539
3538
|
const validateUserCredentialsForCoinbaseOnrampOrder = (client) => {
|
|
3540
3539
|
const { user } = client;
|
|
3541
|
-
|
|
3540
|
+
require_updateAuthFromVerifyResponse.assertDefined(user, "User is not authenticated");
|
|
3542
3541
|
const fieldsMissingVerification = getMissingVerificationForCoinbaseOnrampOrder({ paymentMethod: "GUEST_CHECKOUT_APPLE_PAY" }, client);
|
|
3543
3542
|
if (fieldsMissingVerification.find((field) => field.field === "email")) throw new MissingUserVerificationError({
|
|
3544
3543
|
informationToVerify: "email",
|
|
@@ -3567,10 +3566,10 @@ const validateUserCredentialsForCoinbaseOnrampOrder = (client) => {
|
|
|
3567
3566
|
* @throws {MissingUserVerificationError} If the user is missing verification for email or phone
|
|
3568
3567
|
* @instrumented
|
|
3569
3568
|
*/
|
|
3570
|
-
const createCoinbaseOnrampOrder = async (orderParams, client =
|
|
3569
|
+
const createCoinbaseOnrampOrder = async (orderParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3571
3570
|
const user = validateUserCredentialsForCoinbaseOnrampOrder(client);
|
|
3572
|
-
const core =
|
|
3573
|
-
const apiClient =
|
|
3571
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3572
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client);
|
|
3574
3573
|
const { isSandbox, ...restOrderParams } = orderParams;
|
|
3575
3574
|
const orderResponse = await apiClient.createCoinbaseOnrampOrder({
|
|
3576
3575
|
coinbaseOnrampOrderCreateRequest: {
|
|
@@ -3590,12 +3589,12 @@ const createCoinbaseOnrampOrder = async (orderParams, client = require_InvalidPa
|
|
|
3590
3589
|
};
|
|
3591
3590
|
};
|
|
3592
3591
|
const __createCoinbaseOnrampOrder_impl = createCoinbaseOnrampOrder;
|
|
3593
|
-
const __createCoinbaseOnrampOrder_wrapped =
|
|
3592
|
+
const __createCoinbaseOnrampOrder_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3594
3593
|
fn: __createCoinbaseOnrampOrder_impl,
|
|
3595
3594
|
functionName: "createCoinbaseOnrampOrder",
|
|
3596
3595
|
getCore: () => {
|
|
3597
3596
|
try {
|
|
3598
|
-
return
|
|
3597
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3599
3598
|
} catch {
|
|
3600
3599
|
return;
|
|
3601
3600
|
}
|
|
@@ -3612,9 +3611,9 @@ const __createCoinbaseOnrampOrder_wrapped = require_InvalidParamError.instrument
|
|
|
3612
3611
|
* @returns an object containing the buy URL
|
|
3613
3612
|
* @notInstrumented
|
|
3614
3613
|
*/
|
|
3615
|
-
const getCoinbaseBuyUrl = async (buyUrlParams, client =
|
|
3616
|
-
const core =
|
|
3617
|
-
return await
|
|
3614
|
+
const getCoinbaseBuyUrl = async (buyUrlParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3615
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3616
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).generateCoinbaseOnrampBuyUrl({
|
|
3618
3617
|
coinbaseOnrampGetBuyUrlRequest: buyUrlParams,
|
|
3619
3618
|
environmentId: core.environmentId
|
|
3620
3619
|
});
|
|
@@ -3630,9 +3629,9 @@ const getCoinbaseBuyUrl = async (buyUrlParams, client = require_InvalidParamErro
|
|
|
3630
3629
|
* @returns The created payment
|
|
3631
3630
|
* @instrumented
|
|
3632
3631
|
*/
|
|
3633
|
-
const createCryptoDotComPayment = async (paymentParams, client =
|
|
3634
|
-
const core =
|
|
3635
|
-
return await
|
|
3632
|
+
const createCryptoDotComPayment = async (paymentParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3633
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3634
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).createCryptoDotComPayment({
|
|
3636
3635
|
cryptoDotComPaymentCreateRequest: {
|
|
3637
3636
|
...paymentParams,
|
|
3638
3637
|
chain: paymentParams.chain
|
|
@@ -3641,12 +3640,12 @@ const createCryptoDotComPayment = async (paymentParams, client = require_Invalid
|
|
|
3641
3640
|
});
|
|
3642
3641
|
};
|
|
3643
3642
|
const __createCryptoDotComPayment_impl = createCryptoDotComPayment;
|
|
3644
|
-
const __createCryptoDotComPayment_wrapped =
|
|
3643
|
+
const __createCryptoDotComPayment_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3645
3644
|
fn: __createCryptoDotComPayment_impl,
|
|
3646
3645
|
functionName: "createCryptoDotComPayment",
|
|
3647
3646
|
getCore: () => {
|
|
3648
3647
|
try {
|
|
3649
|
-
return
|
|
3648
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3650
3649
|
} catch {
|
|
3651
3650
|
return;
|
|
3652
3651
|
}
|
|
@@ -3663,9 +3662,9 @@ const __createCryptoDotComPayment_wrapped = require_InvalidParamError.instrument
|
|
|
3663
3662
|
* @returns The created transfer
|
|
3664
3663
|
* @notInstrumented
|
|
3665
3664
|
*/
|
|
3666
|
-
const createKrakenExchangeTransfer = async (transferParams, client =
|
|
3667
|
-
const core =
|
|
3668
|
-
const apiClient =
|
|
3665
|
+
const createKrakenExchangeTransfer = async (transferParams, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3666
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3667
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client);
|
|
3669
3668
|
const { accountId, ...createExchangeTransferRequest } = transferParams;
|
|
3670
3669
|
return await apiClient.postExchangeAccountTransfer({
|
|
3671
3670
|
accountId,
|
|
@@ -3675,12 +3674,12 @@ const createKrakenExchangeTransfer = async (transferParams, client = require_Inv
|
|
|
3675
3674
|
});
|
|
3676
3675
|
};
|
|
3677
3676
|
const __createKrakenExchangeTransfer_impl = createKrakenExchangeTransfer;
|
|
3678
|
-
const __createKrakenExchangeTransfer_wrapped =
|
|
3677
|
+
const __createKrakenExchangeTransfer_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3679
3678
|
fn: __createKrakenExchangeTransfer_impl,
|
|
3680
3679
|
functionName: "createKrakenExchangeTransfer",
|
|
3681
3680
|
getCore: () => {
|
|
3682
3681
|
try {
|
|
3683
|
-
return
|
|
3682
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3684
3683
|
} catch {
|
|
3685
3684
|
return;
|
|
3686
3685
|
}
|
|
@@ -3697,9 +3696,9 @@ const __createKrakenExchangeTransfer_wrapped = require_InvalidParamError.instrum
|
|
|
3697
3696
|
* @returns Array of Kraken accounts with balances
|
|
3698
3697
|
* @notInstrumented
|
|
3699
3698
|
*/
|
|
3700
|
-
const getKrakenAccounts = async (params, client =
|
|
3701
|
-
const core =
|
|
3702
|
-
return await
|
|
3699
|
+
const getKrakenAccounts = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3700
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3701
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getUserAccounts({
|
|
3703
3702
|
chainName: params?.chainName,
|
|
3704
3703
|
environmentId: core.environmentId,
|
|
3705
3704
|
exchangeKey: _dynamic_labs_sdk_api_core.ExchangeKeyEnum.Kraken,
|
|
@@ -3716,9 +3715,9 @@ const getKrakenAccounts = async (params, client = require_InvalidParamError.getD
|
|
|
3716
3715
|
* @returns Transfer destinations response with whitelisted addresses
|
|
3717
3716
|
* @notInstrumented
|
|
3718
3717
|
*/
|
|
3719
|
-
const getKrakenWhitelistedAddresses = async (client =
|
|
3720
|
-
const core =
|
|
3721
|
-
return await
|
|
3718
|
+
const getKrakenWhitelistedAddresses = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3719
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3720
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getExchangeTransferDestinations({
|
|
3722
3721
|
environmentId: core.environmentId,
|
|
3723
3722
|
exchangeKey: _dynamic_labs_sdk_api_core.ExchangeKeyEnum.Kraken
|
|
3724
3723
|
});
|
|
@@ -3736,21 +3735,21 @@ const getKrakenWhitelistedAddresses = async (client = require_InvalidParamError.
|
|
|
3736
3735
|
* @returns An array of supported MoonPay currencies.
|
|
3737
3736
|
* @instrumented
|
|
3738
3737
|
*/
|
|
3739
|
-
const getMoonPayCurrencies = async (params, client =
|
|
3740
|
-
const core =
|
|
3741
|
-
return (await
|
|
3738
|
+
const getMoonPayCurrencies = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3739
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3740
|
+
return (await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getMoonPayCurrencies({
|
|
3742
3741
|
chain: params.chain,
|
|
3743
3742
|
environmentId: core.environmentId,
|
|
3744
3743
|
...params.networkId ? { networkId: params.networkId } : {}
|
|
3745
3744
|
})).currencies ?? [];
|
|
3746
3745
|
};
|
|
3747
3746
|
const __getMoonPayCurrencies_impl = getMoonPayCurrencies;
|
|
3748
|
-
const __getMoonPayCurrencies_wrapped =
|
|
3747
|
+
const __getMoonPayCurrencies_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3749
3748
|
fn: __getMoonPayCurrencies_impl,
|
|
3750
3749
|
functionName: "getMoonPayCurrencies",
|
|
3751
3750
|
getCore: () => {
|
|
3752
3751
|
try {
|
|
3753
|
-
return
|
|
3752
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3754
3753
|
} catch {
|
|
3755
3754
|
return;
|
|
3756
3755
|
}
|
|
@@ -3759,7 +3758,7 @@ const __getMoonPayCurrencies_wrapped = require_InvalidParamError.instrumentFunct
|
|
|
3759
3758
|
|
|
3760
3759
|
//#endregion
|
|
3761
3760
|
//#region src/modules/funding/moonpay/errors/MoonPayInvalidUrlError.ts
|
|
3762
|
-
var MoonPayInvalidUrlError = class extends
|
|
3761
|
+
var MoonPayInvalidUrlError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
3763
3762
|
constructor() {
|
|
3764
3763
|
super({
|
|
3765
3764
|
cause: null,
|
|
@@ -3773,7 +3772,7 @@ var MoonPayInvalidUrlError = class extends require_InvalidParamError.BaseError {
|
|
|
3773
3772
|
|
|
3774
3773
|
//#endregion
|
|
3775
3774
|
//#region src/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.ts
|
|
3776
|
-
var MoonPayProviderNotAvailableError = class extends
|
|
3775
|
+
var MoonPayProviderNotAvailableError = class extends require_updateAuthFromVerifyResponse.BaseError {
|
|
3777
3776
|
constructor() {
|
|
3778
3777
|
super({
|
|
3779
3778
|
cause: null,
|
|
@@ -3802,9 +3801,9 @@ var MoonPayProviderNotAvailableError = class extends require_InvalidParamError.B
|
|
|
3802
3801
|
* return is logged under the synthetic `result` key, which no key-based rule
|
|
3803
3802
|
* covers, so redact the whole event.
|
|
3804
3803
|
*/
|
|
3805
|
-
const getMoonPayUrl = async (params, client =
|
|
3806
|
-
const core =
|
|
3807
|
-
const moonPayProvider = (await
|
|
3804
|
+
const getMoonPayUrl = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3805
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
3806
|
+
const moonPayProvider = (await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).getSupportedOnramps({
|
|
3808
3807
|
chain: params.chain,
|
|
3809
3808
|
currency: params.currency,
|
|
3810
3809
|
environmentId: core.environmentId,
|
|
@@ -3825,12 +3824,12 @@ const getMoonPayUrl = async (params, client = require_InvalidParamError.getDefau
|
|
|
3825
3824
|
return moonPayProvider.url;
|
|
3826
3825
|
};
|
|
3827
3826
|
const __getMoonPayUrl_impl = getMoonPayUrl;
|
|
3828
|
-
const __getMoonPayUrl_wrapped =
|
|
3827
|
+
const __getMoonPayUrl_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3829
3828
|
fn: __getMoonPayUrl_impl,
|
|
3830
3829
|
functionName: "getMoonPayUrl",
|
|
3831
3830
|
getCore: () => {
|
|
3832
3831
|
try {
|
|
3833
|
-
return
|
|
3832
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3834
3833
|
} catch {
|
|
3835
3834
|
return;
|
|
3836
3835
|
}
|
|
@@ -3848,8 +3847,8 @@ const __getMoonPayUrl_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
3848
3847
|
* @notInstrumented
|
|
3849
3848
|
* @noHook Client lifecycle management is not exposed as a hook; use useInitStatus.
|
|
3850
3849
|
*/
|
|
3851
|
-
const waitForClientInitialized = async (client =
|
|
3852
|
-
await
|
|
3850
|
+
const waitForClientInitialized = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3851
|
+
await require_updateAuthFromVerifyResponse.getCore(client).initTrack.waitForAll();
|
|
3853
3852
|
};
|
|
3854
3853
|
|
|
3855
3854
|
//#endregion
|
|
@@ -3862,16 +3861,16 @@ const waitForClientInitialized = async (client = require_InvalidParamError.getDe
|
|
|
3862
3861
|
* normally but emit no telemetry.
|
|
3863
3862
|
* @instrumented
|
|
3864
3863
|
*/
|
|
3865
|
-
const setInstrumentationEnabled = ({ enabled }, client =
|
|
3866
|
-
|
|
3864
|
+
const setInstrumentationEnabled = ({ enabled }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
3865
|
+
require_updateAuthFromVerifyResponse.getCore(client).instrumentation.setEnabled(enabled);
|
|
3867
3866
|
};
|
|
3868
3867
|
const __setInstrumentationEnabled_impl = setInstrumentationEnabled;
|
|
3869
|
-
const __setInstrumentationEnabled_wrapped =
|
|
3868
|
+
const __setInstrumentationEnabled_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
3870
3869
|
fn: __setInstrumentationEnabled_impl,
|
|
3871
3870
|
functionName: "setInstrumentationEnabled",
|
|
3872
3871
|
getCore: () => {
|
|
3873
3872
|
try {
|
|
3874
|
-
return
|
|
3873
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
3875
3874
|
} catch {
|
|
3876
3875
|
return;
|
|
3877
3876
|
}
|
|
@@ -4033,10 +4032,10 @@ const FETCH_TIMEOUT_MS = 3e4;
|
|
|
4033
4032
|
const fetchWithTimeout = async (client) => {
|
|
4034
4033
|
const controller = new AbortController();
|
|
4035
4034
|
const timeoutId = setTimeout(() => controller.abort(), FETCH_TIMEOUT_MS);
|
|
4036
|
-
const core =
|
|
4035
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4037
4036
|
try {
|
|
4038
4037
|
const response = await core.fetch(getWalletBookCdnUrl(), { signal: controller.signal });
|
|
4039
|
-
if (!response.ok) throw new
|
|
4038
|
+
if (!response.ok) throw new require_updateAuthFromVerifyResponse.APIError(`Failed to fetch wallet book: ${response.status} ${response.statusText}`, "wallet_book_fetch_error", response.status);
|
|
4040
4039
|
return await response.json();
|
|
4041
4040
|
} finally {
|
|
4042
4041
|
clearTimeout(timeoutId);
|
|
@@ -4080,7 +4079,7 @@ const RETRY_DELAY_MS = 100;
|
|
|
4080
4079
|
* @notInstrumented
|
|
4081
4080
|
*/
|
|
4082
4081
|
const fetchLegacyWalletBook = async (client) => {
|
|
4083
|
-
const core =
|
|
4082
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4084
4083
|
core.logger.debug("[fetchLegacyWalletBook] Fetching wallet book...");
|
|
4085
4084
|
try {
|
|
4086
4085
|
const walletBook = await require_isMfaRequiredForAction.retryOnFail({
|
|
@@ -4178,7 +4177,7 @@ const shouldFilterWalletForWalletConnect = ({ wallet, walletKey }) => {
|
|
|
4178
4177
|
* @returns The full URL to the sprite icon
|
|
4179
4178
|
* @notInstrumented
|
|
4180
4179
|
*/
|
|
4181
|
-
const getSpriteUrl = ({ spriteId }) => `${
|
|
4180
|
+
const getSpriteUrl = ({ spriteId }) => `${require_updateAuthFromVerifyResponse.DYNAMIC_ICONIC_SPRITE_URL}#${spriteId}`;
|
|
4182
4181
|
|
|
4183
4182
|
//#endregion
|
|
4184
4183
|
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/transformGroup/transformGroup.ts
|
|
@@ -4215,8 +4214,8 @@ const transformGroup = ({ group }) => {
|
|
|
4215
4214
|
*/
|
|
4216
4215
|
const getChainFromWalletBookIdentifier = ({ identifier }) => {
|
|
4217
4216
|
const normalised = identifier.toLowerCase();
|
|
4218
|
-
return Object.keys(
|
|
4219
|
-
const info =
|
|
4217
|
+
return Object.keys(require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP).find((chain) => {
|
|
4218
|
+
const info = require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP[chain];
|
|
4220
4219
|
return info.apiChainName === normalised || info.legacyWalletBookAliases?.includes(normalised) === true;
|
|
4221
4220
|
});
|
|
4222
4221
|
};
|
|
@@ -4248,9 +4247,9 @@ const extractChainPrefix = ({ chainIdentifier }) => {
|
|
|
4248
4247
|
*/
|
|
4249
4248
|
const getChainFromWalletKey = ({ walletKey }) => {
|
|
4250
4249
|
const lowerKey = walletKey.toLowerCase();
|
|
4251
|
-
const chains = Object.keys(
|
|
4250
|
+
const chains = Object.keys(require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP);
|
|
4252
4251
|
for (const chain of chains) {
|
|
4253
|
-
const info =
|
|
4252
|
+
const info = require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP[chain];
|
|
4254
4253
|
if ([info.apiChainName, ...info.legacyWalletBookAliases ?? []].some((pattern) => lowerKey.includes(pattern))) return chain;
|
|
4255
4254
|
}
|
|
4256
4255
|
};
|
|
@@ -4276,7 +4275,7 @@ const getChainFromWalletSchema = ({ wallet, walletKey }) => {
|
|
|
4276
4275
|
const firstChain = wallet.chains[0];
|
|
4277
4276
|
const chainPrefix = extractChainPrefix({ chainIdentifier: firstChain });
|
|
4278
4277
|
try {
|
|
4279
|
-
return
|
|
4278
|
+
return require_updateAuthFromVerifyResponse.getChainFromVerifiedCredentialChain(chainPrefix);
|
|
4280
4279
|
} catch {}
|
|
4281
4280
|
}
|
|
4282
4281
|
if (walletKey) {
|
|
@@ -4356,7 +4355,7 @@ const transformWalletBook = ({ walletBook }) => {
|
|
|
4356
4355
|
* @throws If unable to fetch the wallet book from the API (when both CDN fetch and cache retrieval fail).
|
|
4357
4356
|
* @notInstrumented
|
|
4358
4357
|
*/
|
|
4359
|
-
const getWalletConnectCatalog = async (client =
|
|
4358
|
+
const getWalletConnectCatalog = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4360
4359
|
return transformWalletBook({ walletBook: await fetchLegacyWalletBook(client) });
|
|
4361
4360
|
};
|
|
4362
4361
|
|
|
@@ -4372,7 +4371,7 @@ const getWalletConnectCatalog = async (client = require_InvalidParamError.getDef
|
|
|
4372
4371
|
*/
|
|
4373
4372
|
const extractChainFromNormalizedName = ({ normalizedWalletNameWithChain }) => {
|
|
4374
4373
|
const lowerName = normalizedWalletNameWithChain.toLowerCase();
|
|
4375
|
-
const chainSuffixes = Object.keys(
|
|
4374
|
+
const chainSuffixes = Object.keys(require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP).map((chain) => chain.toLowerCase()).sort((a, b) => b.length - a.length);
|
|
4376
4375
|
for (const suffix of chainSuffixes) if (lowerName.endsWith(suffix)) return suffix.toUpperCase();
|
|
4377
4376
|
};
|
|
4378
4377
|
|
|
@@ -4390,8 +4389,8 @@ const extractChainFromNormalizedName = ({ normalizedWalletNameWithChain }) => {
|
|
|
4390
4389
|
* @returns A promise that resolves to the WalletConnect catalog wallet entry, or undefined if not found.
|
|
4391
4390
|
* @notInstrumented
|
|
4392
4391
|
*/
|
|
4393
|
-
const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProviderKey }, client =
|
|
4394
|
-
const { normalizedWalletNameWithChain } =
|
|
4392
|
+
const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4393
|
+
const { normalizedWalletNameWithChain } = require_updateAuthFromVerifyResponse.splitWalletProviderKey(walletProviderKey);
|
|
4395
4394
|
const chain = extractChainFromNormalizedName({ normalizedWalletNameWithChain });
|
|
4396
4395
|
if (!chain) return;
|
|
4397
4396
|
let walletProviderName = normalizedWalletNameWithChain.toLowerCase();
|
|
@@ -4421,13 +4420,13 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
|
|
|
4421
4420
|
* @instrumented
|
|
4422
4421
|
* @redact-params
|
|
4423
4422
|
*/
|
|
4424
|
-
const updateUser = async ({ userFields }, client =
|
|
4425
|
-
const core =
|
|
4426
|
-
const response = await
|
|
4423
|
+
const updateUser = async ({ userFields }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4424
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4425
|
+
const response = await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).updateSelf({
|
|
4427
4426
|
environmentId: core.environmentId,
|
|
4428
4427
|
userFields
|
|
4429
4428
|
});
|
|
4430
|
-
|
|
4429
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4431
4430
|
if (response.emailVerification) return {
|
|
4432
4431
|
email: response.emailVerification.email,
|
|
4433
4432
|
verificationUUID: response.emailVerification.verificationUUID
|
|
@@ -4440,12 +4439,12 @@ const updateUser = async ({ userFields }, client = require_InvalidParamError.get
|
|
|
4440
4439
|
};
|
|
4441
4440
|
};
|
|
4442
4441
|
const __updateUser_impl = updateUser;
|
|
4443
|
-
const __updateUser_wrapped =
|
|
4442
|
+
const __updateUser_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4444
4443
|
fn: __updateUser_impl,
|
|
4445
4444
|
functionName: "updateUser",
|
|
4446
4445
|
getCore: () => {
|
|
4447
4446
|
try {
|
|
4448
|
-
return
|
|
4447
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4449
4448
|
} catch {
|
|
4450
4449
|
return;
|
|
4451
4450
|
}
|
|
@@ -4465,16 +4464,16 @@ const __updateUser_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
4465
4464
|
* @returns A promise that resolves when the acknowledgment is complete.
|
|
4466
4465
|
* @instrumented
|
|
4467
4466
|
*/
|
|
4468
|
-
const acknowledgeRecoveryCodes = async (client =
|
|
4467
|
+
const acknowledgeRecoveryCodes = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4469
4468
|
return __updateUser_wrapped({ userFields: { mfaBackupCodeAcknowledgement: _dynamic_labs_sdk_api_core.MfaBackupCodeAcknowledgement.Complete } }, client);
|
|
4470
4469
|
};
|
|
4471
4470
|
const __acknowledgeRecoveryCodes_impl = acknowledgeRecoveryCodes;
|
|
4472
|
-
const __acknowledgeRecoveryCodes_wrapped =
|
|
4471
|
+
const __acknowledgeRecoveryCodes_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4473
4472
|
fn: __acknowledgeRecoveryCodes_impl,
|
|
4474
4473
|
functionName: "acknowledgeRecoveryCodes",
|
|
4475
4474
|
getCore: () => {
|
|
4476
4475
|
try {
|
|
4477
|
-
return
|
|
4476
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4478
4477
|
} catch {
|
|
4479
4478
|
return;
|
|
4480
4479
|
}
|
|
@@ -4496,9 +4495,9 @@ const __acknowledgeRecoveryCodes_wrapped = require_InvalidParamError.instrumentF
|
|
|
4496
4495
|
* @returns A promise that resolves to the MFA authentication response.
|
|
4497
4496
|
* @notInstrumented
|
|
4498
4497
|
*/
|
|
4499
|
-
const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, requestedScopes }, client =
|
|
4500
|
-
const core =
|
|
4501
|
-
const apiClient =
|
|
4498
|
+
const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4499
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4500
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4502
4501
|
try {
|
|
4503
4502
|
const response = await apiClient.authMfaRecovery({
|
|
4504
4503
|
environmentId: core.environmentId,
|
|
@@ -4508,14 +4507,14 @@ const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, reques
|
|
|
4508
4507
|
requestedScopes
|
|
4509
4508
|
}
|
|
4510
4509
|
});
|
|
4511
|
-
|
|
4512
|
-
|
|
4510
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4511
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4513
4512
|
args: { mfaToken: response.mfaToken },
|
|
4514
4513
|
event: "mfaCompletionSuccess"
|
|
4515
4514
|
}, client);
|
|
4516
4515
|
return response;
|
|
4517
4516
|
} catch (error) {
|
|
4518
|
-
|
|
4517
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4519
4518
|
args: { error },
|
|
4520
4519
|
event: "mfaCompletionFailure"
|
|
4521
4520
|
}, client);
|
|
@@ -4527,8 +4526,8 @@ const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, reques
|
|
|
4527
4526
|
//#region src/modules/auth/passkeys/getPasskeyAuthenticationOptions/getPasskeyAuthenticationOptions.ts
|
|
4528
4527
|
/** @notInstrumented */
|
|
4529
4528
|
const getPasskeyAuthenticationOptions = async ({ relatedOriginRpId } = {}, client) => {
|
|
4530
|
-
const core =
|
|
4531
|
-
return await
|
|
4529
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4530
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).getPasskeyAuthenticationOptions({
|
|
4532
4531
|
environmentId: core.environmentId,
|
|
4533
4532
|
relatedOriginRpId
|
|
4534
4533
|
});
|
|
@@ -4538,8 +4537,8 @@ const getPasskeyAuthenticationOptions = async ({ relatedOriginRpId } = {}, clien
|
|
|
4538
4537
|
//#region src/modules/auth/passkeys/serverAuthenticatePasskey/serverAuthenticatePasskey.ts
|
|
4539
4538
|
/** @notInstrumented */
|
|
4540
4539
|
const serverAuthenticatePasskey = async ({ authentication, createMfaToken, requestedScopes }, client) => {
|
|
4541
|
-
const core =
|
|
4542
|
-
return await
|
|
4540
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4541
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).authenticateMfaPasskeyDevice({
|
|
4543
4542
|
environmentId: core.environmentId,
|
|
4544
4543
|
passkeyAuthRequest: {
|
|
4545
4544
|
...authentication,
|
|
@@ -4569,8 +4568,8 @@ const serverAuthenticatePasskey = async ({ authentication, createMfaToken, reque
|
|
|
4569
4568
|
* @throws NoPasskeyCredentialsFoundError If no passkey credentials are found.
|
|
4570
4569
|
* @notInstrumented
|
|
4571
4570
|
*/
|
|
4572
|
-
const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, requestedScopes } = {}, client =
|
|
4573
|
-
const core =
|
|
4571
|
+
const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, requestedScopes } = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4572
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4574
4573
|
try {
|
|
4575
4574
|
if (!core.passkey.isSupported()) throw new NoWebAuthNSupportError();
|
|
4576
4575
|
const options = await getPasskeyAuthenticationOptions({ relatedOriginRpId }, client);
|
|
@@ -4588,14 +4587,14 @@ const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, reque
|
|
|
4588
4587
|
createMfaToken,
|
|
4589
4588
|
requestedScopes
|
|
4590
4589
|
}, client);
|
|
4591
|
-
|
|
4592
|
-
|
|
4590
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4591
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4593
4592
|
args: { mfaToken: response.mfaToken },
|
|
4594
4593
|
event: "mfaCompletionSuccess"
|
|
4595
4594
|
}, client);
|
|
4596
4595
|
return response;
|
|
4597
4596
|
} catch (error) {
|
|
4598
|
-
|
|
4597
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4599
4598
|
args: { error },
|
|
4600
4599
|
event: "mfaCompletionFailure"
|
|
4601
4600
|
}, client);
|
|
@@ -4619,9 +4618,9 @@ const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, reque
|
|
|
4619
4618
|
* @returns A promise that resolves to the MFA authentication response.
|
|
4620
4619
|
* @notInstrumented
|
|
4621
4620
|
*/
|
|
4622
|
-
const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions, requestedScopes }, client =
|
|
4623
|
-
const core =
|
|
4624
|
-
const apiClient =
|
|
4621
|
+
const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4622
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4623
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4625
4624
|
try {
|
|
4626
4625
|
const response = await apiClient.authMfaTotpDevice({
|
|
4627
4626
|
environmentId: core.environmentId,
|
|
@@ -4632,8 +4631,8 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4632
4631
|
requestedScopes
|
|
4633
4632
|
}
|
|
4634
4633
|
});
|
|
4635
|
-
|
|
4636
|
-
|
|
4634
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
4635
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4637
4636
|
args: {
|
|
4638
4637
|
deviceId,
|
|
4639
4638
|
mfaToken: response.mfaToken
|
|
@@ -4642,7 +4641,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4642
4641
|
}, client);
|
|
4643
4642
|
return response;
|
|
4644
4643
|
} catch (error) {
|
|
4645
|
-
|
|
4644
|
+
require_updateAuthFromVerifyResponse.emitEvent({
|
|
4646
4645
|
args: {
|
|
4647
4646
|
deviceId,
|
|
4648
4647
|
error
|
|
@@ -4666,17 +4665,17 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4666
4665
|
* @instrumented
|
|
4667
4666
|
* @redact-params
|
|
4668
4667
|
*/
|
|
4669
|
-
const createNewMfaRecoveryCodes = async (client =
|
|
4670
|
-
const core =
|
|
4671
|
-
return
|
|
4668
|
+
const createNewMfaRecoveryCodes = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4669
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4670
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).createNewRecoveryCodes({ environmentId: core.environmentId });
|
|
4672
4671
|
};
|
|
4673
4672
|
const __createNewMfaRecoveryCodes_impl = createNewMfaRecoveryCodes;
|
|
4674
|
-
const __createNewMfaRecoveryCodes_wrapped =
|
|
4673
|
+
const __createNewMfaRecoveryCodes_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4675
4674
|
fn: __createNewMfaRecoveryCodes_impl,
|
|
4676
4675
|
functionName: "createNewMfaRecoveryCodes",
|
|
4677
4676
|
getCore: () => {
|
|
4678
4677
|
try {
|
|
4679
|
-
return
|
|
4678
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4680
4679
|
} catch {
|
|
4681
4680
|
return;
|
|
4682
4681
|
}
|
|
@@ -4700,26 +4699,26 @@ const __createNewMfaRecoveryCodes_wrapped = require_InvalidParamError.instrument
|
|
|
4700
4699
|
* @returns A promise that resolves when the MFA device is successfully deleted.
|
|
4701
4700
|
* @instrumented
|
|
4702
4701
|
*/
|
|
4703
|
-
const deleteMfaDevice = async ({ deviceId, mfaAuthToken }, client =
|
|
4704
|
-
const core =
|
|
4705
|
-
|
|
4706
|
-
if (!
|
|
4702
|
+
const deleteMfaDevice = async ({ deviceId, mfaAuthToken }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4703
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4704
|
+
require_updateAuthFromVerifyResponse.assertDefined(deviceId, "deviceId is required");
|
|
4705
|
+
if (!require_updateAuthFromVerifyResponse.getElevatedAccessToken({
|
|
4707
4706
|
consume: false,
|
|
4708
4707
|
scope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink
|
|
4709
|
-
}, client))
|
|
4710
|
-
return
|
|
4708
|
+
}, client)) require_updateAuthFromVerifyResponse.assertDefined(mfaAuthToken, "mfaAuthToken is required");
|
|
4709
|
+
return require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentialunlink }, client).deleteMfaDevice({
|
|
4711
4710
|
environmentId: core.environmentId,
|
|
4712
4711
|
mfaDeviceId: deviceId,
|
|
4713
4712
|
xMfaAuthToken: mfaAuthToken ?? ""
|
|
4714
4713
|
});
|
|
4715
4714
|
};
|
|
4716
4715
|
const __deleteMfaDevice_impl = deleteMfaDevice;
|
|
4717
|
-
const __deleteMfaDevice_wrapped =
|
|
4716
|
+
const __deleteMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4718
4717
|
fn: __deleteMfaDevice_impl,
|
|
4719
4718
|
functionName: "deleteMfaDevice",
|
|
4720
4719
|
getCore: () => {
|
|
4721
4720
|
try {
|
|
4722
|
-
return
|
|
4721
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4723
4722
|
} catch {
|
|
4724
4723
|
return;
|
|
4725
4724
|
}
|
|
@@ -4738,9 +4737,9 @@ const __deleteMfaDevice_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
4738
4737
|
* @returns A promise that resolves to an array of the user's registered MFA devices.
|
|
4739
4738
|
* @notInstrumented
|
|
4740
4739
|
*/
|
|
4741
|
-
const getMfaDevices = async (client =
|
|
4742
|
-
const core =
|
|
4743
|
-
const { devices } = await
|
|
4740
|
+
const getMfaDevices = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4741
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4742
|
+
const { devices } = await require_updateAuthFromVerifyResponse.createApiClient({}, client).getUserMfaDevices({ environmentId: core.environmentId });
|
|
4744
4743
|
return devices;
|
|
4745
4744
|
};
|
|
4746
4745
|
|
|
@@ -4758,9 +4757,9 @@ const getMfaDevices = async (client = require_InvalidParamError.getDefaultClient
|
|
|
4758
4757
|
* @returns A promise that resolves to the user's MFA recovery codes.
|
|
4759
4758
|
* @notInstrumented
|
|
4760
4759
|
*/
|
|
4761
|
-
const getMfaRecoveryCodes = async (client =
|
|
4762
|
-
const core =
|
|
4763
|
-
return
|
|
4760
|
+
const getMfaRecoveryCodes = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4761
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4762
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getRecoveryCodes({ environmentId: core.environmentId });
|
|
4764
4763
|
};
|
|
4765
4764
|
|
|
4766
4765
|
//#endregion
|
|
@@ -4779,17 +4778,17 @@ const getMfaRecoveryCodes = async (client = require_InvalidParamError.getDefault
|
|
|
4779
4778
|
* and the `uri` (`otpauth://...?secret=...`); redact the whole event so the
|
|
4780
4779
|
* seed never reaches logs via the un-keyed `uri` field.
|
|
4781
4780
|
*/
|
|
4782
|
-
const registerTotpMfaDevice = async (client =
|
|
4783
|
-
const core =
|
|
4784
|
-
return
|
|
4781
|
+
const registerTotpMfaDevice = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4782
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4783
|
+
return require_updateAuthFromVerifyResponse.createApiClient({ elevatedAccessTokenScope: _dynamic_labs_sdk_api_core.TokenScope.Credentiallink }, client).registerTotpMfaDevice({ environmentId: core.environmentId });
|
|
4785
4784
|
};
|
|
4786
4785
|
const __registerTotpMfaDevice_impl = registerTotpMfaDevice;
|
|
4787
|
-
const __registerTotpMfaDevice_wrapped =
|
|
4786
|
+
const __registerTotpMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4788
4787
|
fn: __registerTotpMfaDevice_impl,
|
|
4789
4788
|
functionName: "registerTotpMfaDevice",
|
|
4790
4789
|
getCore: () => {
|
|
4791
4790
|
try {
|
|
4792
|
-
return
|
|
4791
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4793
4792
|
} catch {
|
|
4794
4793
|
return;
|
|
4795
4794
|
}
|
|
@@ -4810,22 +4809,22 @@ const __registerTotpMfaDevice_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
4810
4809
|
* @returns A promise that resolves when the default MFA device is successfully set.
|
|
4811
4810
|
* @instrumented
|
|
4812
4811
|
*/
|
|
4813
|
-
const setDefaultMfaDevice = async ({ deviceId }, client =
|
|
4814
|
-
const core =
|
|
4815
|
-
const apiClient =
|
|
4816
|
-
|
|
4812
|
+
const setDefaultMfaDevice = async ({ deviceId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4813
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4814
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4815
|
+
require_updateAuthFromVerifyResponse.assertDefined(deviceId, "deviceId is required");
|
|
4817
4816
|
return apiClient.updateUserMfaDevice({
|
|
4818
4817
|
environmentId: core.environmentId,
|
|
4819
4818
|
mfaDeviceId: deviceId
|
|
4820
4819
|
});
|
|
4821
4820
|
};
|
|
4822
4821
|
const __setDefaultMfaDevice_impl = setDefaultMfaDevice;
|
|
4823
|
-
const __setDefaultMfaDevice_wrapped =
|
|
4822
|
+
const __setDefaultMfaDevice_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4824
4823
|
fn: __setDefaultMfaDevice_impl,
|
|
4825
4824
|
functionName: "setDefaultMfaDevice",
|
|
4826
4825
|
getCore: () => {
|
|
4827
4826
|
try {
|
|
4828
|
-
return
|
|
4827
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4829
4828
|
} catch {
|
|
4830
4829
|
return;
|
|
4831
4830
|
}
|
|
@@ -4845,9 +4844,9 @@ const __setDefaultMfaDevice_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
4845
4844
|
* @instrumented
|
|
4846
4845
|
* @redact-params
|
|
4847
4846
|
*/
|
|
4848
|
-
const sendEmailOTP = async ({ email }, client =
|
|
4849
|
-
const core =
|
|
4850
|
-
const apiClient =
|
|
4847
|
+
const sendEmailOTP = async ({ email }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
4848
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
4849
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
4851
4850
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
4852
4851
|
const { verificationUUID } = await apiClient.createEmailVerification({
|
|
4853
4852
|
emailVerificationCreateRequest: {
|
|
@@ -4862,12 +4861,12 @@ const sendEmailOTP = async ({ email }, client = require_InvalidParamError.getDef
|
|
|
4862
4861
|
};
|
|
4863
4862
|
};
|
|
4864
4863
|
const __sendEmailOTP_impl = sendEmailOTP;
|
|
4865
|
-
const __sendEmailOTP_wrapped =
|
|
4864
|
+
const __sendEmailOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
4866
4865
|
fn: __sendEmailOTP_impl,
|
|
4867
4866
|
functionName: "sendEmailOTP",
|
|
4868
4867
|
getCore: () => {
|
|
4869
4868
|
try {
|
|
4870
|
-
return
|
|
4869
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
4871
4870
|
} catch {
|
|
4872
4871
|
return;
|
|
4873
4872
|
}
|
|
@@ -5808,9 +5807,9 @@ const supportedCountries = {
|
|
|
5808
5807
|
* @instrumented
|
|
5809
5808
|
* @redact-params
|
|
5810
5809
|
*/
|
|
5811
|
-
const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client =
|
|
5812
|
-
const core =
|
|
5813
|
-
const apiClient =
|
|
5810
|
+
const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5811
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5812
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5814
5813
|
const phoneCountryCode = supportedCountries[isoCountryCode].code;
|
|
5815
5814
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
5816
5815
|
const { verificationUUID } = await apiClient.createSmsVerification({
|
|
@@ -5830,12 +5829,12 @@ const sendSmsOTP = async ({ isoCountryCode, phoneNumber }, client = require_Inva
|
|
|
5830
5829
|
};
|
|
5831
5830
|
};
|
|
5832
5831
|
const __sendSmsOTP_impl = sendSmsOTP;
|
|
5833
|
-
const __sendSmsOTP_wrapped =
|
|
5832
|
+
const __sendSmsOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
5834
5833
|
fn: __sendSmsOTP_impl,
|
|
5835
5834
|
functionName: "sendSmsOTP",
|
|
5836
5835
|
getCore: () => {
|
|
5837
5836
|
try {
|
|
5838
|
-
return
|
|
5837
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
5839
5838
|
} catch {
|
|
5840
5839
|
return;
|
|
5841
5840
|
}
|
|
@@ -5847,8 +5846,8 @@ const __sendSmsOTP_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
5847
5846
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserSignIn/verifyOTPForUserSignIn.ts
|
|
5848
5847
|
/** @notInstrumented */
|
|
5849
5848
|
const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, client) => {
|
|
5850
|
-
const core =
|
|
5851
|
-
const apiClient =
|
|
5849
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5850
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5852
5851
|
const verifyRequest = {
|
|
5853
5852
|
verificationToken,
|
|
5854
5853
|
verificationUUID: otpVerification.verificationUUID
|
|
@@ -5867,8 +5866,8 @@ const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, cl
|
|
|
5867
5866
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.ts
|
|
5868
5867
|
/** @notInstrumented */
|
|
5869
5868
|
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requestedScopes }, client) => {
|
|
5870
|
-
const core =
|
|
5871
|
-
const apiClient =
|
|
5869
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5870
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5872
5871
|
const verifyRequest = {
|
|
5873
5872
|
verificationToken,
|
|
5874
5873
|
verificationUUID: otpVerification.verificationUUID
|
|
@@ -5899,7 +5898,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
5899
5898
|
* @instrumented
|
|
5900
5899
|
* @redact-params
|
|
5901
5900
|
*/
|
|
5902
|
-
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client =
|
|
5901
|
+
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5903
5902
|
require_isUserOnboardingComplete.preconnectWaasIframe(client);
|
|
5904
5903
|
let response;
|
|
5905
5904
|
if (client.user) response = await verifyOTPForUserUpdate({
|
|
@@ -5911,16 +5910,16 @@ const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }
|
|
|
5911
5910
|
otpVerification,
|
|
5912
5911
|
verificationToken
|
|
5913
5912
|
}, client);
|
|
5914
|
-
|
|
5913
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
5915
5914
|
return response;
|
|
5916
5915
|
};
|
|
5917
5916
|
const __verifyOTP_impl = verifyOTP;
|
|
5918
|
-
const __verifyOTP_wrapped =
|
|
5917
|
+
const __verifyOTP_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
5919
5918
|
fn: __verifyOTP_impl,
|
|
5920
5919
|
functionName: "verifyOTP",
|
|
5921
5920
|
getCore: () => {
|
|
5922
5921
|
try {
|
|
5923
|
-
return
|
|
5922
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
5924
5923
|
} catch {
|
|
5925
5924
|
return;
|
|
5926
5925
|
}
|
|
@@ -5938,11 +5937,11 @@ const __verifyOTP_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
5938
5937
|
* @returns The swap quote details. Use the `signingPayload` field to get the transaction data for the wallet to sign.
|
|
5939
5938
|
* @notInstrumented
|
|
5940
5939
|
*/
|
|
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
|
|
5940
|
+
const getSwapQuote = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5941
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5942
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5943
|
+
if (!params.from.amount && !params.to.amount) throw new require_updateAuthFromVerifyResponse.InvalidParamError("Either from.amount or to.amount is required");
|
|
5944
|
+
if (params.from.amount && params.to.amount) throw new require_updateAuthFromVerifyResponse.InvalidParamError("Only one of from.amount or to.amount is allowed");
|
|
5946
5945
|
return await apiClient.swapQuote({
|
|
5947
5946
|
environmentId: core.environmentId,
|
|
5948
5947
|
swapQuoteRequest: {
|
|
@@ -5973,9 +5972,9 @@ const getSwapQuote = async (params, client = require_InvalidParamError.getDefaul
|
|
|
5973
5972
|
* @returns The swap status.
|
|
5974
5973
|
* @notInstrumented
|
|
5975
5974
|
*/
|
|
5976
|
-
const getSwapStatus = async (params, client =
|
|
5977
|
-
const core =
|
|
5978
|
-
const apiClient =
|
|
5975
|
+
const getSwapStatus = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
5976
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
5977
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
5979
5978
|
let from;
|
|
5980
5979
|
if (params.from) from = {
|
|
5981
5980
|
chainId: params.from.networkId,
|
|
@@ -6019,18 +6018,18 @@ const getSwapStatus = async (params, client = require_InvalidParamError.getDefau
|
|
|
6019
6018
|
* @returns A promise that resolves when the user account is successfully deleted.
|
|
6020
6019
|
* @instrumented
|
|
6021
6020
|
*/
|
|
6022
|
-
const deleteUser = async (client =
|
|
6023
|
-
const core =
|
|
6024
|
-
await
|
|
6021
|
+
const deleteUser = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
6022
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
6023
|
+
await require_updateAuthFromVerifyResponse.createApiClient({ includeMfaToken: true }, client).hardDeleteUser({ environmentId: core.environmentId });
|
|
6025
6024
|
await require_isMfaRequiredForAction.__logoutWithReason_wrapped({ reason: "user-deleted" }, client);
|
|
6026
6025
|
};
|
|
6027
6026
|
const __deleteUser_impl = deleteUser;
|
|
6028
|
-
const __deleteUser_wrapped =
|
|
6027
|
+
const __deleteUser_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
6029
6028
|
fn: __deleteUser_impl,
|
|
6030
6029
|
functionName: "deleteUser",
|
|
6031
6030
|
getCore: () => {
|
|
6032
6031
|
try {
|
|
6033
|
-
return
|
|
6032
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
6034
6033
|
} catch {
|
|
6035
6034
|
return;
|
|
6036
6035
|
}
|
|
@@ -6088,8 +6087,8 @@ const findMissingGoogleDriveBackupScopes = (grantedScopes) => GOOGLE_DRIVE_BACKU
|
|
|
6088
6087
|
* @notInstrumented
|
|
6089
6088
|
*/
|
|
6090
6089
|
const fetchGoogleDriveOauthAccess = async ({ oauthAccountId }, client) => {
|
|
6091
|
-
const core =
|
|
6092
|
-
return
|
|
6090
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
6091
|
+
return require_updateAuthFromVerifyResponse.createApiClient({}, client).getEndUserOauthAccessToken({
|
|
6093
6092
|
environmentId: core.environmentId,
|
|
6094
6093
|
oauthAccountId
|
|
6095
6094
|
});
|
|
@@ -6148,7 +6147,7 @@ const findGoogleOauthAccountId = (credentials) => credentials?.find((cred) => cr
|
|
|
6148
6147
|
* @returns The readiness result.
|
|
6149
6148
|
* @instrumented
|
|
6150
6149
|
*/
|
|
6151
|
-
const getGoogleDriveBackupReadiness = async (client =
|
|
6150
|
+
const getGoogleDriveBackupReadiness = async (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
6152
6151
|
const { user } = client;
|
|
6153
6152
|
const oauthAccountId = findGoogleOauthAccountId(user?.verifiedCredentials);
|
|
6154
6153
|
if (!oauthAccountId) return {
|
|
@@ -6174,12 +6173,12 @@ const getGoogleDriveBackupReadiness = async (client = require_InvalidParamError.
|
|
|
6174
6173
|
};
|
|
6175
6174
|
};
|
|
6176
6175
|
const __getGoogleDriveBackupReadiness_impl = getGoogleDriveBackupReadiness;
|
|
6177
|
-
const __getGoogleDriveBackupReadiness_wrapped =
|
|
6176
|
+
const __getGoogleDriveBackupReadiness_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
6178
6177
|
fn: __getGoogleDriveBackupReadiness_impl,
|
|
6179
6178
|
functionName: "getGoogleDriveBackupReadiness",
|
|
6180
6179
|
getCore: () => {
|
|
6181
6180
|
try {
|
|
6182
|
-
return
|
|
6181
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
6183
6182
|
} catch {
|
|
6184
6183
|
return;
|
|
6185
6184
|
}
|
|
@@ -6582,7 +6581,7 @@ const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
|
6582
6581
|
for (const identifier of wallet.chains ?? []) {
|
|
6583
6582
|
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
6584
6583
|
try {
|
|
6585
|
-
const chain =
|
|
6584
|
+
const chain = require_updateAuthFromVerifyResponse.getChainFromVerifiedCredentialChain(prefix);
|
|
6586
6585
|
chains.add(chain);
|
|
6587
6586
|
} catch {}
|
|
6588
6587
|
}
|
|
@@ -6757,9 +6756,9 @@ const hasWalletProviderConnectMethod = ({ walletProvider }) => Boolean(walletPro
|
|
|
6757
6756
|
*/
|
|
6758
6757
|
const classifyWithWalletProviderSource = ({ entry }) => {
|
|
6759
6758
|
const { priority } = entry;
|
|
6760
|
-
if (priority ===
|
|
6761
|
-
if (priority ===
|
|
6762
|
-
if (priority ===
|
|
6759
|
+
if (priority === require_updateAuthFromVerifyResponse.WalletProviderPriority.WALLET_SDK) return "sdk";
|
|
6760
|
+
if (priority === require_updateAuthFromVerifyResponse.WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD) return "selfAnnounced";
|
|
6761
|
+
if (priority === require_updateAuthFromVerifyResponse.WalletProviderPriority.WINDOW_INJECT) return "windowInjected";
|
|
6763
6762
|
};
|
|
6764
6763
|
|
|
6765
6764
|
//#endregion
|
|
@@ -6879,7 +6878,7 @@ const resolveWalletOptionKey = ({ fallback, wallet }) => wallet.group ?? wallet.
|
|
|
6879
6878
|
* @notInstrumented
|
|
6880
6879
|
*/
|
|
6881
6880
|
const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }) => {
|
|
6882
|
-
const { normalizedWalletNameWithChain } =
|
|
6881
|
+
const { normalizedWalletNameWithChain } = require_updateAuthFromVerifyResponse.splitWalletProviderKey(walletProvider.key);
|
|
6883
6882
|
const candidates = [normalizedWalletNameWithChain, stripChainSuffix({
|
|
6884
6883
|
chain,
|
|
6885
6884
|
normalizedName: normalizedWalletNameWithChain
|
|
@@ -6932,7 +6931,7 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
6932
6931
|
if (!hasWalletProviderConnectMethod({ walletProvider: entry.walletProvider })) continue;
|
|
6933
6932
|
const source = classifyWithWalletProviderSource({ entry });
|
|
6934
6933
|
if (!source) {
|
|
6935
|
-
|
|
6934
|
+
require_updateAuthFromVerifyResponse.getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
|
|
6936
6935
|
chain: entry.walletProvider.chain,
|
|
6937
6936
|
displayName: entry.walletProvider.metadata.displayName,
|
|
6938
6937
|
priority: entry.priority,
|
|
@@ -7234,14 +7233,14 @@ const EMPTY_WALLET_BOOK = {
|
|
|
7234
7233
|
* @returns A promise that resolves to the wallet options catalogue.
|
|
7235
7234
|
* @notInstrumented
|
|
7236
7235
|
*/
|
|
7237
|
-
const getWalletOptionsCatalogue = async (params = {}, client =
|
|
7236
|
+
const getWalletOptionsCatalogue = async (params = {}, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7238
7237
|
const includeMobileOptions = params.includeMobileOptions ?? false;
|
|
7239
7238
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
7240
7239
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
7241
7240
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
7242
7241
|
const allConnectionOptions = [];
|
|
7243
7242
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
7244
|
-
const entries =
|
|
7243
|
+
const entries = require_updateAuthFromVerifyResponse.getWalletProviderRegistry(client).listProviderEntries();
|
|
7245
7244
|
allConnectionOptions.push(...buildWithWalletProviderOptions({
|
|
7246
7245
|
entries,
|
|
7247
7246
|
walletBook
|
|
@@ -7291,8 +7290,8 @@ const getWalletOptionsCatalogue = async (params = {}, client = require_InvalidPa
|
|
|
7291
7290
|
* @throws WalletAccountNotSelectedError If the wallet account is not currently selected.
|
|
7292
7291
|
* @notInstrumented
|
|
7293
7292
|
*/
|
|
7294
|
-
const assertWalletAccountSigningAvailability = async ({ walletAccount }, client =
|
|
7295
|
-
const { addresses } = await
|
|
7293
|
+
const assertWalletAccountSigningAvailability = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7294
|
+
const { addresses } = await require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).getConnectedAddresses();
|
|
7296
7295
|
if (addresses.length > 0 && !addresses.includes(walletAccount.address)) throw new WalletAccountNotSelectedError({
|
|
7297
7296
|
expectedAddress: walletAccount.address,
|
|
7298
7297
|
selectedAddress: addresses[0]
|
|
@@ -7315,8 +7314,8 @@ const assertWalletAccountSigningAvailability = async ({ walletAccount }, client
|
|
|
7315
7314
|
* @throws If the wallet provider does not support the confirmTransaction method.
|
|
7316
7315
|
* @instrumented
|
|
7317
7316
|
*/
|
|
7318
|
-
const confirmTransaction = async ({ walletAccount, transactionHash }, client =
|
|
7319
|
-
const walletProvider =
|
|
7317
|
+
const confirmTransaction = async ({ walletAccount, transactionHash }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7318
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7320
7319
|
assertWalletProviderMethodDefined(walletProvider, "confirmTransaction");
|
|
7321
7320
|
await walletProvider.confirmTransaction({
|
|
7322
7321
|
transactionHash,
|
|
@@ -7324,12 +7323,12 @@ const confirmTransaction = async ({ walletAccount, transactionHash }, client = r
|
|
|
7324
7323
|
});
|
|
7325
7324
|
};
|
|
7326
7325
|
const __confirmTransaction_impl = confirmTransaction;
|
|
7327
|
-
const __confirmTransaction_wrapped =
|
|
7326
|
+
const __confirmTransaction_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7328
7327
|
fn: __confirmTransaction_impl,
|
|
7329
7328
|
functionName: "confirmTransaction",
|
|
7330
7329
|
getCore: () => {
|
|
7331
7330
|
try {
|
|
7332
|
-
return
|
|
7331
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7333
7332
|
} catch {
|
|
7334
7333
|
return;
|
|
7335
7334
|
}
|
|
@@ -7361,7 +7360,7 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
7361
7360
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
7362
7361
|
* @instrumented
|
|
7363
7362
|
*/
|
|
7364
|
-
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client =
|
|
7363
|
+
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7365
7364
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
7366
7365
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
7367
7366
|
const { addresses } = await walletProvider.connect();
|
|
@@ -7379,7 +7378,7 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
7379
7378
|
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
7380
7379
|
chain: walletProvider.chain,
|
|
7381
7380
|
hardwareWalletVendor,
|
|
7382
|
-
id:
|
|
7381
|
+
id: require_updateAuthFromVerifyResponse.formatWalletAccountId({
|
|
7383
7382
|
address: mainAddress,
|
|
7384
7383
|
chain: walletProvider.chain,
|
|
7385
7384
|
walletProviderKey
|
|
@@ -7393,12 +7392,12 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
7393
7392
|
return reconciledWalletAccount;
|
|
7394
7393
|
};
|
|
7395
7394
|
const __connectWithWalletProvider_impl = connectWithWalletProvider;
|
|
7396
|
-
const __connectWithWalletProvider_wrapped =
|
|
7395
|
+
const __connectWithWalletProvider_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7397
7396
|
fn: __connectWithWalletProvider_impl,
|
|
7398
7397
|
functionName: "connectWithWalletProvider",
|
|
7399
7398
|
getCore: () => {
|
|
7400
7399
|
try {
|
|
7401
|
-
return
|
|
7400
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7402
7401
|
} catch {
|
|
7403
7402
|
return;
|
|
7404
7403
|
}
|
|
@@ -7457,13 +7456,13 @@ const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
|
7457
7456
|
//#region src/modules/wallets/utils/getSignInMessage/getSignInMessage.ts
|
|
7458
7457
|
/** @notInstrumented */
|
|
7459
7458
|
const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client) => {
|
|
7460
|
-
const core =
|
|
7459
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
7461
7460
|
const { appUniversalLink } = require_getNetworkProviderFromNetworkId.getAppMetadata(client);
|
|
7462
|
-
|
|
7461
|
+
require_updateAuthFromVerifyResponse.assertDefined(appUniversalLink, "Universal link is not set");
|
|
7463
7462
|
const url = new URL(appUniversalLink);
|
|
7464
7463
|
const domain = url.host;
|
|
7465
|
-
const nonce = nonceOverride ?? await
|
|
7466
|
-
const walletProvider =
|
|
7464
|
+
const nonce = nonceOverride ?? await require_updateAuthFromVerifyResponse.getNonce(client);
|
|
7465
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7467
7466
|
if (walletProvider.chain === "STARK")
|
|
7468
7467
|
/**
|
|
7469
7468
|
* Starknet requires the strings to be 31 chars long
|
|
@@ -7477,7 +7476,7 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
7477
7476
|
const statement = require_getNetworkProviderFromNetworkId.createSignInMessageStatement(client);
|
|
7478
7477
|
return await require_getNetworkProviderFromNetworkId.formatSignInMessage({
|
|
7479
7478
|
address: walletAccount.address,
|
|
7480
|
-
blockchainName:
|
|
7479
|
+
blockchainName: require_updateAuthFromVerifyResponse.CHAINS_INFO_MAP[walletProvider.chain].blockchainName,
|
|
7481
7480
|
chainId: await getChainIdForAccountVerification({ walletProvider }),
|
|
7482
7481
|
domain,
|
|
7483
7482
|
issuedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -7501,8 +7500,8 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
7501
7500
|
* @returns A promise that resolves to an object containing the message and signature.
|
|
7502
7501
|
* @instrumented
|
|
7503
7502
|
*/
|
|
7504
|
-
const proveWalletAccountOwnership = async ({ walletAccount }, client =
|
|
7505
|
-
const walletProvider =
|
|
7503
|
+
const proveWalletAccountOwnership = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7504
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7506
7505
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
7507
7506
|
const messageToSign = await getSignInMessage({
|
|
7508
7507
|
nonce: walletProvider.getConnectProofNonce?.(),
|
|
@@ -7518,12 +7517,12 @@ const proveWalletAccountOwnership = async ({ walletAccount }, client = require_I
|
|
|
7518
7517
|
};
|
|
7519
7518
|
};
|
|
7520
7519
|
const __proveWalletAccountOwnership_impl = proveWalletAccountOwnership;
|
|
7521
|
-
const __proveWalletAccountOwnership_wrapped =
|
|
7520
|
+
const __proveWalletAccountOwnership_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7522
7521
|
fn: __proveWalletAccountOwnership_impl,
|
|
7523
7522
|
functionName: "proveWalletAccountOwnership",
|
|
7524
7523
|
getCore: () => {
|
|
7525
7524
|
try {
|
|
7526
|
-
return
|
|
7525
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7527
7526
|
} catch {
|
|
7528
7527
|
return;
|
|
7529
7528
|
}
|
|
@@ -7533,10 +7532,10 @@ const __proveWalletAccountOwnership_wrapped = require_InvalidParamError.instrume
|
|
|
7533
7532
|
//#endregion
|
|
7534
7533
|
//#region src/modules/wallets/utils/isSameAddress/isSameAddress.ts
|
|
7535
7534
|
/** @notInstrumented */
|
|
7536
|
-
const isSameAddress = ({ chain, left, right }) =>
|
|
7535
|
+
const isSameAddress = ({ chain, left, right }) => require_updateAuthFromVerifyResponse.normalizeAddress({
|
|
7537
7536
|
address: left,
|
|
7538
7537
|
chain
|
|
7539
|
-
}) ===
|
|
7538
|
+
}) === require_updateAuthFromVerifyResponse.normalizeAddress({
|
|
7540
7539
|
address: right,
|
|
7541
7540
|
chain
|
|
7542
7541
|
});
|
|
@@ -7546,7 +7545,7 @@ const isSameAddress = ({ chain, left, right }) => require_InvalidParamError.norm
|
|
|
7546
7545
|
/** @notInstrumented */
|
|
7547
7546
|
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
7548
7547
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
7549
|
-
const walletProvider =
|
|
7548
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7550
7549
|
const { messageToSign, signature } = await __proveWalletAccountOwnership_wrapped({ walletAccount }, client);
|
|
7551
7550
|
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
7552
7551
|
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
@@ -7567,30 +7566,30 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
7567
7566
|
}, client);
|
|
7568
7567
|
const response = walletProvider.shouldRetryVerificationOnNetworkError ? await retryOnFetchError({
|
|
7569
7568
|
fn: verify,
|
|
7570
|
-
onRetry: ({ error }) =>
|
|
7569
|
+
onRetry: ({ error }) => require_updateAuthFromVerifyResponse.getCore(client).logger.warn("Retrying wallet verification after network error", error)
|
|
7571
7570
|
}) : await verify();
|
|
7572
7571
|
const walletVerifiedCredential = response.user?.verifiedCredentials.find((verifiedCredential) => isSameAddress({
|
|
7573
7572
|
chain: walletAccount.chain,
|
|
7574
7573
|
left: verifiedCredential.address ?? "",
|
|
7575
7574
|
right: walletAccount.address
|
|
7576
7575
|
}));
|
|
7577
|
-
|
|
7576
|
+
require_updateAuthFromVerifyResponse.assertDefined(walletVerifiedCredential, `After verifying, still unable to find verified wallet credential for wallet account ${walletAccount.address} on chain ${walletAccount.chain}`);
|
|
7578
7577
|
require_getNetworkProviderFromNetworkId.updateWalletProviderKeysForVerifiedCredentials({ keysToUpdate: { [walletVerifiedCredential.id]: walletProvider.key } }, client);
|
|
7579
7578
|
/**
|
|
7580
7579
|
* Adds the user with the new wallet verified credential
|
|
7581
7580
|
* This will add the new verified wallet account to the client`s state
|
|
7582
7581
|
*/
|
|
7583
|
-
|
|
7582
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response }, client);
|
|
7584
7583
|
/**
|
|
7585
7584
|
* Remove the now verified wallet account from the unverified wallet accounts
|
|
7586
7585
|
*/
|
|
7587
7586
|
require_getNetworkProviderFromNetworkId.removeUnverifiedWalletAccount({ unverifiedWalletAccount: walletAccount }, client);
|
|
7588
|
-
const verifiedWalletAccount =
|
|
7587
|
+
const verifiedWalletAccount = require_updateAuthFromVerifyResponse.getWalletAccounts(client).find(({ address }) => isSameAddress({
|
|
7589
7588
|
chain: walletAccount.chain,
|
|
7590
7589
|
left: address,
|
|
7591
7590
|
right: walletAccount.address
|
|
7592
7591
|
}));
|
|
7593
|
-
|
|
7592
|
+
require_updateAuthFromVerifyResponse.assertDefined(verifiedWalletAccount, `Unable to find wallet account ${walletAccount.address} on chain ${walletAccount.chain} for verified credential ${walletVerifiedCredential.id}`);
|
|
7594
7593
|
return verifiedWalletAccount;
|
|
7595
7594
|
};
|
|
7596
7595
|
|
|
@@ -7609,7 +7608,7 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
7609
7608
|
* @throws WalletAlreadyLinkedToAnotherUserError If the wallet is linked to another user.
|
|
7610
7609
|
* @instrumented
|
|
7611
7610
|
*/
|
|
7612
|
-
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client =
|
|
7611
|
+
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7613
7612
|
return verifyWalletAccountForSignInOrTransfer({
|
|
7614
7613
|
isTransfer: false,
|
|
7615
7614
|
requestedScopes,
|
|
@@ -7617,12 +7616,12 @@ const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client =
|
|
|
7617
7616
|
}, client);
|
|
7618
7617
|
};
|
|
7619
7618
|
const __verifyWalletAccount_impl = verifyWalletAccount;
|
|
7620
|
-
const __verifyWalletAccount_wrapped =
|
|
7619
|
+
const __verifyWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7621
7620
|
fn: __verifyWalletAccount_impl,
|
|
7622
7621
|
functionName: "verifyWalletAccount",
|
|
7623
7622
|
getCore: () => {
|
|
7624
7623
|
try {
|
|
7625
|
-
return
|
|
7624
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7626
7625
|
} catch {
|
|
7627
7626
|
return;
|
|
7628
7627
|
}
|
|
@@ -7662,7 +7661,7 @@ const isDeeplinkWalletProvider = ({ walletProvider }) => walletProvider.walletPr
|
|
|
7662
7661
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
7663
7662
|
* @instrumented
|
|
7664
7663
|
*/
|
|
7665
|
-
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client =
|
|
7664
|
+
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7666
7665
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
7667
7666
|
if (isMobile() && isDeeplinkWalletProvider({ walletProvider })) throw new DeeplinkConnectAndVerifyUnsupportedError({ walletProviderKey });
|
|
7668
7667
|
const walletAccount = await __connectWithWalletProvider_wrapped({
|
|
@@ -7678,12 +7677,12 @@ const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareW
|
|
|
7678
7677
|
return walletAccount;
|
|
7679
7678
|
};
|
|
7680
7679
|
const __connectAndVerifyWithWalletProvider_impl = connectAndVerifyWithWalletProvider;
|
|
7681
|
-
const __connectAndVerifyWithWalletProvider_wrapped =
|
|
7680
|
+
const __connectAndVerifyWithWalletProvider_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7682
7681
|
fn: __connectAndVerifyWithWalletProvider_impl,
|
|
7683
7682
|
functionName: "connectAndVerifyWithWalletProvider",
|
|
7684
7683
|
getCore: () => {
|
|
7685
7684
|
try {
|
|
7686
|
-
return
|
|
7685
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7687
7686
|
} catch {
|
|
7688
7687
|
return;
|
|
7689
7688
|
}
|
|
@@ -7703,8 +7702,8 @@ const __connectAndVerifyWithWalletProvider_wrapped = require_InvalidParamError.i
|
|
|
7703
7702
|
* @notInstrumented
|
|
7704
7703
|
* @hook Exposed as a hook so consumers get the reactive list of available wallet providers, updated when wallet providers change.
|
|
7705
7704
|
*/
|
|
7706
|
-
const getAvailableWalletProvidersData = (client =
|
|
7707
|
-
return
|
|
7705
|
+
const getAvailableWalletProvidersData = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7706
|
+
return require_updateAuthFromVerifyResponse.getWalletProviders(client).filter((walletProvider) => hasWalletProviderConnectMethod({ walletProvider })).map((walletProvider) => ({
|
|
7708
7707
|
chain: walletProvider.chain,
|
|
7709
7708
|
groupKey: walletProvider.groupKey,
|
|
7710
7709
|
key: walletProvider.key,
|
|
@@ -7726,17 +7725,17 @@ const getAvailableWalletProvidersData = (client = require_InvalidParamError.getD
|
|
|
7726
7725
|
* @returns An array of connected wallet addresses.
|
|
7727
7726
|
* @notInstrumented
|
|
7728
7727
|
*/
|
|
7729
|
-
const getConnectedAddresses = ({ walletProviderKey }, client =
|
|
7728
|
+
const getConnectedAddresses = ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7730
7729
|
return require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client).getConnectedAddresses();
|
|
7731
7730
|
};
|
|
7732
7731
|
|
|
7733
7732
|
//#endregion
|
|
7734
7733
|
//#region src/modules/wallets/getOwnerWalletAccountForSmartWalletAccount/getOwnerWalletAccountForSmartWalletAccount.ts
|
|
7735
7734
|
/** @notInstrumented */
|
|
7736
|
-
const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client =
|
|
7735
|
+
const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7737
7736
|
const smartWalletVerifiedCredential = require_getWalletProviderByKey.getVerifiedCredentialForWalletAccount({ walletAccount: smartWalletAccount }, client);
|
|
7738
|
-
|
|
7739
|
-
return
|
|
7737
|
+
require_updateAuthFromVerifyResponse.assertDefined(smartWalletVerifiedCredential?.signerRefId, "Invalid smart wallet account");
|
|
7738
|
+
return require_updateAuthFromVerifyResponse.getWalletAccounts(client).find((walletAccount) => walletAccount.verifiedCredentialId === smartWalletVerifiedCredential.signerRefId);
|
|
7740
7739
|
};
|
|
7741
7740
|
|
|
7742
7741
|
//#endregion
|
|
@@ -7756,7 +7755,7 @@ const getWalletAccountAddressByType = ({ type, walletAccount }) => {
|
|
|
7756
7755
|
* @returns The data for the wallet provider.
|
|
7757
7756
|
* @notInstrumented
|
|
7758
7757
|
*/
|
|
7759
|
-
const getWalletProviderDataByKey = ({ walletProviderKey }, client =
|
|
7758
|
+
const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7760
7759
|
const { chain, groupKey, key, metadata, walletProviderType } = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
7761
7760
|
return {
|
|
7762
7761
|
chain,
|
|
@@ -7778,7 +7777,7 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_Inva
|
|
|
7778
7777
|
* @returns Whether the wallet provider supports the specified hardware wallet vendor.
|
|
7779
7778
|
* @notInstrumented
|
|
7780
7779
|
*/
|
|
7781
|
-
const canConnectWithHardwareWallet = ({ walletProviderKey, hardwareWalletVendor }, client =
|
|
7780
|
+
const canConnectWithHardwareWallet = ({ walletProviderKey, hardwareWalletVendor }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7782
7781
|
return require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client).metadata.supportedHardwareWalletVendors?.includes(hardwareWalletVendor) ?? false;
|
|
7783
7782
|
};
|
|
7784
7783
|
|
|
@@ -7807,7 +7806,7 @@ const isHardwareWalletAccount = ({ walletAccount }) => walletAccount.hardwareWal
|
|
|
7807
7806
|
* @returns True if the session has at least one wallet account, false otherwise.
|
|
7808
7807
|
* @notInstrumented
|
|
7809
7808
|
*/
|
|
7810
|
-
const isAnyWalletAccountConnected = (client =
|
|
7809
|
+
const isAnyWalletAccountConnected = (client = require_updateAuthFromVerifyResponse.getDefaultClient()) => require_updateAuthFromVerifyResponse.getWalletAccounts(client).length > 0;
|
|
7811
7810
|
|
|
7812
7811
|
//#endregion
|
|
7813
7812
|
//#region src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.ts
|
|
@@ -7837,7 +7836,7 @@ const isWalletAccountVerified = ({ walletAccount }) => {
|
|
|
7837
7836
|
* @throws NetworkAddingUnavailableError If the wallet provider doesn't support adding networks.
|
|
7838
7837
|
* @instrumented
|
|
7839
7838
|
*/
|
|
7840
|
-
const addNetwork = async ({ networkData, walletAccount }, client =
|
|
7839
|
+
const addNetwork = async ({ networkData, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7841
7840
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey: walletAccount.walletProviderKey }, client);
|
|
7842
7841
|
if (walletProvider.addNetwork === void 0) throw new NetworkAddingUnavailableError({
|
|
7843
7842
|
extraMessages: [`Wallet provider ${walletAccount.walletProviderKey} does not have addNetwork method`],
|
|
@@ -7847,12 +7846,12 @@ const addNetwork = async ({ networkData, walletAccount }, client = require_Inval
|
|
|
7847
7846
|
return walletProvider.addNetwork({ networkData });
|
|
7848
7847
|
};
|
|
7849
7848
|
const __addNetwork_impl = addNetwork;
|
|
7850
|
-
const __addNetwork_wrapped =
|
|
7849
|
+
const __addNetwork_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
7851
7850
|
fn: __addNetwork_impl,
|
|
7852
7851
|
functionName: "addNetwork",
|
|
7853
7852
|
getCore: () => {
|
|
7854
7853
|
try {
|
|
7855
|
-
return
|
|
7854
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
7856
7855
|
} catch {
|
|
7857
7856
|
return;
|
|
7858
7857
|
}
|
|
@@ -7873,8 +7872,8 @@ const __addNetwork_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
7873
7872
|
* @returns A promise that resolves to the network data, or undefined if not found.
|
|
7874
7873
|
* @notInstrumented
|
|
7875
7874
|
*/
|
|
7876
|
-
const getActiveNetworkData = async ({ walletAccount }, client =
|
|
7877
|
-
const walletProvider =
|
|
7875
|
+
const getActiveNetworkData = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7876
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7878
7877
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7879
7878
|
return { networkData: require_getNetworkProviderFromNetworkId.getNetworksData(client).find((data) => data.networkId === networkId && data.chain === walletProvider.chain) };
|
|
7880
7879
|
};
|
|
@@ -7889,8 +7888,8 @@ const getActiveNetworkData = async ({ walletAccount }, client = require_InvalidP
|
|
|
7889
7888
|
* @returns A promise that resolves to the active network ID for the wallet account.
|
|
7890
7889
|
* @notInstrumented
|
|
7891
7890
|
*/
|
|
7892
|
-
const getActiveNetworkId = ({ walletAccount }, client =
|
|
7893
|
-
return
|
|
7891
|
+
const getActiveNetworkId = ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7892
|
+
return require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
7894
7893
|
};
|
|
7895
7894
|
|
|
7896
7895
|
//#endregion
|
|
@@ -7910,8 +7909,8 @@ const getActiveNetworkId = ({ walletAccount }, client = require_InvalidParamErro
|
|
|
7910
7909
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7911
7910
|
* @notInstrumented
|
|
7912
7911
|
*/
|
|
7913
|
-
const getNativeBalance = async ({ walletAccount }, client =
|
|
7914
|
-
const walletProvider =
|
|
7912
|
+
const getNativeBalance = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7913
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7915
7914
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7916
7915
|
return require_getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId({
|
|
7917
7916
|
chain: walletProvider.chain,
|
|
@@ -7930,7 +7929,7 @@ const getNativeBalance = async ({ walletAccount }, client = require_InvalidParam
|
|
|
7930
7929
|
* @notInstrumented
|
|
7931
7930
|
* @noHook Deprecated; the replacement is exposed via its own hook.
|
|
7932
7931
|
*/
|
|
7933
|
-
const getBalance = (params, client =
|
|
7932
|
+
const getBalance = (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => getNativeBalance(params, client);
|
|
7934
7933
|
|
|
7935
7934
|
//#endregion
|
|
7936
7935
|
//#region src/modules/wallets/networks/getBalanceForAddress/getBalanceForAddress.ts
|
|
@@ -7947,12 +7946,12 @@ const getBalance = (params, client = require_InvalidParamError.getDefaultClient(
|
|
|
7947
7946
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7948
7947
|
* @notInstrumented
|
|
7949
7948
|
*/
|
|
7950
|
-
const getBalanceForAddress = async ({ address, chain, networkId }, client =
|
|
7949
|
+
const getBalanceForAddress = async ({ address, chain, networkId }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7951
7950
|
const networkProvider = require_getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId({
|
|
7952
7951
|
chain,
|
|
7953
7952
|
networkId
|
|
7954
7953
|
}, client);
|
|
7955
|
-
|
|
7954
|
+
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
7955
|
return networkProvider.getBalance({ address });
|
|
7957
7956
|
};
|
|
7958
7957
|
|
|
@@ -7974,9 +7973,9 @@ const getBalanceForAddress = async ({ address, chain, networkId }, client = requ
|
|
|
7974
7973
|
* @returns A promise that resolves to the transaction history along with nextOffset for the given wallet address and chain.
|
|
7975
7974
|
* @notInstrumented
|
|
7976
7975
|
*/
|
|
7977
|
-
const getTransactionHistory = async (params, client =
|
|
7978
|
-
const core =
|
|
7979
|
-
return await
|
|
7976
|
+
const getTransactionHistory = async (params, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
7977
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
7978
|
+
return await require_updateAuthFromVerifyResponse.createApiClient({}, client).getWalletTransactions({
|
|
7980
7979
|
address: params.address,
|
|
7981
7980
|
chainName: params.chain,
|
|
7982
7981
|
environmentId: core.environmentId,
|
|
@@ -8000,7 +7999,7 @@ const getTransactionHistory = async (params, client = require_InvalidParamError.
|
|
|
8000
7999
|
* @returns True if programmatic network switching is available, false otherwise.
|
|
8001
8000
|
* @notInstrumented
|
|
8002
8001
|
*/
|
|
8003
|
-
const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client =
|
|
8002
|
+
const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8004
8003
|
return require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey: walletAccount.walletProviderKey }, client).switchActiveNetwork !== void 0;
|
|
8005
8004
|
};
|
|
8006
8005
|
|
|
@@ -8019,7 +8018,7 @@ const isProgrammaticNetworkSwitchAvailable = ({ walletAccount }, client = requir
|
|
|
8019
8018
|
* @throws NetworkSwitchingUnavailableError If the wallet provider doesn't support network switching.
|
|
8020
8019
|
* @instrumented
|
|
8021
8020
|
*/
|
|
8022
|
-
const switchActiveNetwork = async ({ networkId, walletAccount }, client =
|
|
8021
|
+
const switchActiveNetwork = async ({ networkId, walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8023
8022
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey: walletAccount.walletProviderKey }, client);
|
|
8024
8023
|
if (walletProvider.switchActiveNetwork === void 0) throw new NetworkSwitchingUnavailableError({
|
|
8025
8024
|
extraMessages: [`Wallet provider ${walletAccount.walletProviderKey} does not have switchActiveNetwork method`],
|
|
@@ -8029,12 +8028,12 @@ const switchActiveNetwork = async ({ networkId, walletAccount }, client = requir
|
|
|
8029
8028
|
return walletProvider.switchActiveNetwork({ networkId });
|
|
8030
8029
|
};
|
|
8031
8030
|
const __switchActiveNetwork_impl = switchActiveNetwork;
|
|
8032
|
-
const __switchActiveNetwork_wrapped =
|
|
8031
|
+
const __switchActiveNetwork_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8033
8032
|
fn: __switchActiveNetwork_impl,
|
|
8034
8033
|
functionName: "switchActiveNetwork",
|
|
8035
8034
|
getCore: () => {
|
|
8036
8035
|
try {
|
|
8037
|
-
return
|
|
8036
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8038
8037
|
} catch {
|
|
8039
8038
|
return;
|
|
8040
8039
|
}
|
|
@@ -8048,10 +8047,10 @@ const __switchActiveNetwork_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
8048
8047
|
* @instrumented
|
|
8049
8048
|
* @noHook The primary-wallet concept is discouraged and not exposed as a hook.
|
|
8050
8049
|
*/
|
|
8051
|
-
const selectPrimaryWalletAccount = async ({ walletAccount }, client =
|
|
8052
|
-
const core =
|
|
8050
|
+
const selectPrimaryWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8051
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
8053
8052
|
if (getPrimaryWalletAccount(client)?.id === walletAccount.id) return;
|
|
8054
|
-
if (walletAccount.verifiedCredentialId)
|
|
8053
|
+
if (walletAccount.verifiedCredentialId) require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response: await require_updateAuthFromVerifyResponse.createApiClient({}, client).selectUserWallet({
|
|
8055
8054
|
environmentId: core.environmentId,
|
|
8056
8055
|
userWalletSelectionRequest: { walletId: walletAccount.verifiedCredentialId }
|
|
8057
8056
|
}) }, client);
|
|
@@ -8061,12 +8060,12 @@ const selectPrimaryWalletAccount = async ({ walletAccount }, client = require_In
|
|
|
8061
8060
|
}] }, client);
|
|
8062
8061
|
};
|
|
8063
8062
|
const __selectPrimaryWalletAccount_impl = selectPrimaryWalletAccount;
|
|
8064
|
-
const __selectPrimaryWalletAccount_wrapped =
|
|
8063
|
+
const __selectPrimaryWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8065
8064
|
fn: __selectPrimaryWalletAccount_impl,
|
|
8066
8065
|
functionName: "selectPrimaryWalletAccount",
|
|
8067
8066
|
getCore: () => {
|
|
8068
8067
|
try {
|
|
8069
|
-
return
|
|
8068
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8070
8069
|
} catch {
|
|
8071
8070
|
return;
|
|
8072
8071
|
}
|
|
@@ -8084,9 +8083,9 @@ const __selectPrimaryWalletAccount_wrapped = require_InvalidParamError.instrumen
|
|
|
8084
8083
|
*/
|
|
8085
8084
|
const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
8086
8085
|
try {
|
|
8087
|
-
await
|
|
8086
|
+
await require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client).disconnectWalletAccount?.({ walletAccount });
|
|
8088
8087
|
} catch (error) {
|
|
8089
|
-
if (error instanceof
|
|
8088
|
+
if (error instanceof require_updateAuthFromVerifyResponse.NoWalletProviderFoundError) return;
|
|
8090
8089
|
throw error;
|
|
8091
8090
|
}
|
|
8092
8091
|
};
|
|
@@ -8105,26 +8104,26 @@ const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
|
8105
8104
|
* @returns A promise that resolves when the wallet account is successfully removed.
|
|
8106
8105
|
* @instrumented
|
|
8107
8106
|
*/
|
|
8108
|
-
const removeWalletAccount = async ({ walletAccount }, client =
|
|
8109
|
-
const core =
|
|
8110
|
-
const apiClient =
|
|
8107
|
+
const removeWalletAccount = async ({ walletAccount }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8108
|
+
const core = require_updateAuthFromVerifyResponse.getCore(client);
|
|
8109
|
+
const apiClient = require_updateAuthFromVerifyResponse.createApiClient({}, client);
|
|
8111
8110
|
await disconnectWalletAccount({ walletAccount }, client);
|
|
8112
8111
|
if (!walletAccount.verifiedCredentialId) {
|
|
8113
8112
|
require_getNetworkProviderFromNetworkId.removeUnverifiedWalletAccount({ unverifiedWalletAccount: walletAccount }, client);
|
|
8114
8113
|
return;
|
|
8115
8114
|
}
|
|
8116
|
-
|
|
8115
|
+
require_updateAuthFromVerifyResponse.updateAuthFromVerifyResponse({ response: await apiClient.verifyUnlink({
|
|
8117
8116
|
environmentId: core.environmentId,
|
|
8118
8117
|
verifyUnlinkRequest: { walletId: walletAccount.verifiedCredentialId }
|
|
8119
8118
|
}) }, client);
|
|
8120
8119
|
};
|
|
8121
8120
|
const __removeWalletAccount_impl = removeWalletAccount;
|
|
8122
|
-
const __removeWalletAccount_wrapped =
|
|
8121
|
+
const __removeWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8123
8122
|
fn: __removeWalletAccount_impl,
|
|
8124
8123
|
functionName: "removeWalletAccount",
|
|
8125
8124
|
getCore: () => {
|
|
8126
8125
|
try {
|
|
8127
|
-
return
|
|
8126
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8128
8127
|
} catch {
|
|
8129
8128
|
return;
|
|
8130
8129
|
}
|
|
@@ -8145,8 +8144,8 @@ const __removeWalletAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
8145
8144
|
* @returns A promise that resolves to an object containing the signature.
|
|
8146
8145
|
* @instrumented
|
|
8147
8146
|
*/
|
|
8148
|
-
const signMessage = async ({ walletAccount, message }, client =
|
|
8149
|
-
const walletProvider =
|
|
8147
|
+
const signMessage = async ({ walletAccount, message }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8148
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
8150
8149
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
8151
8150
|
const { signature } = await walletProvider.signMessage({
|
|
8152
8151
|
message,
|
|
@@ -8155,12 +8154,12 @@ const signMessage = async ({ walletAccount, message }, client = require_InvalidP
|
|
|
8155
8154
|
return { signature };
|
|
8156
8155
|
};
|
|
8157
8156
|
const __signMessage_impl = signMessage;
|
|
8158
|
-
const __signMessage_wrapped =
|
|
8157
|
+
const __signMessage_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8159
8158
|
fn: __signMessage_impl,
|
|
8160
8159
|
functionName: "signMessage",
|
|
8161
8160
|
getCore: () => {
|
|
8162
8161
|
try {
|
|
8163
|
-
return
|
|
8162
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8164
8163
|
} catch {
|
|
8165
8164
|
return;
|
|
8166
8165
|
}
|
|
@@ -8184,8 +8183,8 @@ const __signMessage_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
8184
8183
|
* @throws If the wallet provider does not support the transfer amount method.
|
|
8185
8184
|
* @instrumented
|
|
8186
8185
|
*/
|
|
8187
|
-
const transferAmount = async ({ walletAccount, amount, recipient, token }, client =
|
|
8188
|
-
const walletProvider =
|
|
8186
|
+
const transferAmount = async ({ walletAccount, amount, recipient, token }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8187
|
+
const walletProvider = require_updateAuthFromVerifyResponse.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
8189
8188
|
assertWalletProviderMethodDefined(walletProvider, "transferAmount");
|
|
8190
8189
|
const { transactionHash } = await walletProvider.transferAmount({
|
|
8191
8190
|
amount,
|
|
@@ -8196,12 +8195,12 @@ const transferAmount = async ({ walletAccount, amount, recipient, token }, clien
|
|
|
8196
8195
|
return { transactionHash };
|
|
8197
8196
|
};
|
|
8198
8197
|
const __transferAmount_impl = transferAmount;
|
|
8199
|
-
const __transferAmount_wrapped =
|
|
8198
|
+
const __transferAmount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8200
8199
|
fn: __transferAmount_impl,
|
|
8201
8200
|
functionName: "transferAmount",
|
|
8202
8201
|
getCore: () => {
|
|
8203
8202
|
try {
|
|
8204
|
-
return
|
|
8203
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8205
8204
|
} catch {
|
|
8206
8205
|
return;
|
|
8207
8206
|
}
|
|
@@ -8221,7 +8220,7 @@ const __transferAmount_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
8221
8220
|
* @returns A promise that resolves to the transferred wallet account.
|
|
8222
8221
|
* @instrumented
|
|
8223
8222
|
*/
|
|
8224
|
-
const transferWalletAccount = async ({ walletProviderKey }, client =
|
|
8223
|
+
const transferWalletAccount = async ({ walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8225
8224
|
return verifyWalletAccountForSignInOrTransfer({
|
|
8226
8225
|
isTransfer: true,
|
|
8227
8226
|
walletAccount: await __connectWithWalletProvider_wrapped({
|
|
@@ -8231,12 +8230,12 @@ const transferWalletAccount = async ({ walletProviderKey }, client = require_Inv
|
|
|
8231
8230
|
}, client);
|
|
8232
8231
|
};
|
|
8233
8232
|
const __transferWalletAccount_impl = transferWalletAccount;
|
|
8234
|
-
const __transferWalletAccount_wrapped =
|
|
8233
|
+
const __transferWalletAccount_wrapped = require_updateAuthFromVerifyResponse.instrumentFunction({
|
|
8235
8234
|
fn: __transferWalletAccount_impl,
|
|
8236
8235
|
functionName: "transferWalletAccount",
|
|
8237
8236
|
getCore: () => {
|
|
8238
8237
|
try {
|
|
8239
|
-
return
|
|
8238
|
+
return require_updateAuthFromVerifyResponse.getCore(require_updateAuthFromVerifyResponse.getDefaultClient());
|
|
8240
8239
|
} catch {
|
|
8241
8240
|
return;
|
|
8242
8241
|
}
|
|
@@ -8257,8 +8256,8 @@ const __transferWalletAccount_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
8257
8256
|
* @returns The matching wallet account, or undefined if not found.
|
|
8258
8257
|
* @notInstrumented
|
|
8259
8258
|
*/
|
|
8260
|
-
const getWalletAccountFromAddress = ({ address, chain }, client =
|
|
8261
|
-
return
|
|
8259
|
+
const getWalletAccountFromAddress = ({ address, chain }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8260
|
+
return require_updateAuthFromVerifyResponse.getWalletAccounts(client).find((walletAccount) => walletAccount.address === address && walletAccount.chain === chain);
|
|
8262
8261
|
};
|
|
8263
8262
|
|
|
8264
8263
|
//#endregion
|
|
@@ -8274,7 +8273,7 @@ const getWalletAccountFromAddress = ({ address, chain }, client = require_Invali
|
|
|
8274
8273
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
8275
8274
|
* @notInstrumented
|
|
8276
8275
|
*/
|
|
8277
|
-
const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
8276
|
+
const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8278
8277
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
8279
8278
|
assertWalletProviderMethodDefined(walletProvider, "events");
|
|
8280
8279
|
walletProvider.events.off(event, callback);
|
|
@@ -8293,7 +8292,7 @@ const offWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
|
8293
8292
|
* @notInstrumented
|
|
8294
8293
|
* @hook Event listeners are error-prone to wire up by hand with useEffect.
|
|
8295
8294
|
*/
|
|
8296
|
-
const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client =
|
|
8295
|
+
const onWalletProviderEvent = ({ callback, event, walletProviderKey }, client = require_updateAuthFromVerifyResponse.getDefaultClient()) => {
|
|
8297
8296
|
const walletProvider = require_getWalletProviderByKey.getWalletProviderByKey({ walletProviderKey }, client);
|
|
8298
8297
|
assertWalletProviderMethodDefined(walletProvider, "events");
|
|
8299
8298
|
walletProvider.events.on(event, callback);
|
|
@@ -8410,10 +8409,10 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
8410
8409
|
|
|
8411
8410
|
//#endregion
|
|
8412
8411
|
//#region src/exports/index.ts
|
|
8413
|
-
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(
|
|
8412
|
+
(0, _dynamic_labs_sdk_assert_package_version.assertPackageVersion)(require_updateAuthFromVerifyResponse.name, require_updateAuthFromVerifyResponse.version);
|
|
8414
8413
|
|
|
8415
8414
|
//#endregion
|
|
8416
|
-
exports.BaseError =
|
|
8415
|
+
exports.BaseError = require_updateAuthFromVerifyResponse.BaseError;
|
|
8417
8416
|
exports.CheckoutSessionTokenMissingError = CheckoutSessionTokenMissingError;
|
|
8418
8417
|
exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
8419
8418
|
exports.DeeplinkConnectAndVerifyUnsupportedError = DeeplinkConnectAndVerifyUnsupportedError;
|
|
@@ -8421,19 +8420,19 @@ exports.FeeEstimationFailedError = FeeEstimationFailedError;
|
|
|
8421
8420
|
exports.FlowSessionTokenMissingError = FlowSessionTokenMissingError;
|
|
8422
8421
|
exports.GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES = GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES;
|
|
8423
8422
|
exports.InvalidDeviceRegistrationRedirectError = InvalidDeviceRegistrationRedirectError;
|
|
8424
|
-
exports.InvalidExternalAuthError =
|
|
8425
|
-
exports.InvalidParamError =
|
|
8423
|
+
exports.InvalidExternalAuthError = require_updateAuthFromVerifyResponse.InvalidExternalAuthError;
|
|
8424
|
+
exports.InvalidParamError = require_updateAuthFromVerifyResponse.InvalidParamError;
|
|
8426
8425
|
exports.InvalidRedirectStorageStateError = InvalidRedirectStorageStateError;
|
|
8427
8426
|
exports.InvalidSocialCallbackOriginError = InvalidSocialCallbackOriginError;
|
|
8428
|
-
exports.LinkCredentialError =
|
|
8427
|
+
exports.LinkCredentialError = require_updateAuthFromVerifyResponse.LinkCredentialError;
|
|
8429
8428
|
Object.defineProperty(exports, 'MFAAction', {
|
|
8430
8429
|
enumerable: true,
|
|
8431
8430
|
get: function () {
|
|
8432
8431
|
return _dynamic_labs_sdk_api_core.MFAAction;
|
|
8433
8432
|
}
|
|
8434
8433
|
});
|
|
8435
|
-
exports.MfaInvalidOtpError =
|
|
8436
|
-
exports.MfaRateLimitedError =
|
|
8434
|
+
exports.MfaInvalidOtpError = require_updateAuthFromVerifyResponse.MfaInvalidOtpError;
|
|
8435
|
+
exports.MfaRateLimitedError = require_updateAuthFromVerifyResponse.MfaRateLimitedError;
|
|
8437
8436
|
exports.MissingRedirectStorageStateError = MissingRedirectStorageStateError;
|
|
8438
8437
|
exports.MissingSocialUrlParamError = MissingSocialUrlParamError;
|
|
8439
8438
|
exports.MissingUserVerificationError = MissingUserVerificationError;
|
|
@@ -8446,10 +8445,10 @@ exports.NoPasskeyCredentialsFoundError = NoPasskeyCredentialsFoundError;
|
|
|
8446
8445
|
exports.NoSmartWalletAccountSignerFoundError = NoSmartWalletAccountSignerFoundError;
|
|
8447
8446
|
exports.NoWebAuthNSupportError = NoWebAuthNSupportError;
|
|
8448
8447
|
exports.NotWaasWalletAccountError = require_isDynamicWaasEnabled.NotWaasWalletAccountError;
|
|
8449
|
-
exports.SandboxMaximumThresholdReachedError =
|
|
8448
|
+
exports.SandboxMaximumThresholdReachedError = require_updateAuthFromVerifyResponse.SandboxMaximumThresholdReachedError;
|
|
8450
8449
|
exports.SimulationFailedError = SimulationFailedError;
|
|
8451
8450
|
exports.TokenSwapError = TokenSwapError;
|
|
8452
|
-
exports.UnauthorizedError =
|
|
8451
|
+
exports.UnauthorizedError = require_updateAuthFromVerifyResponse.UnauthorizedError;
|
|
8453
8452
|
exports.UnavailableInServerSideError = UnavailableInServerSideError;
|
|
8454
8453
|
exports.UnrecognizedNetworkError = UnrecognizedNetworkError;
|
|
8455
8454
|
exports.UserCancelledSocialPopUpError = UserCancelledSocialPopUpError;
|
|
@@ -8511,9 +8510,9 @@ exports.getCheckoutTransaction = getCheckoutTransaction;
|
|
|
8511
8510
|
exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
|
|
8512
8511
|
exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;
|
|
8513
8512
|
exports.getConnectedAddresses = getConnectedAddresses;
|
|
8514
|
-
exports.getDefaultClient =
|
|
8513
|
+
exports.getDefaultClient = require_updateAuthFromVerifyResponse.getDefaultClient;
|
|
8515
8514
|
exports.getDeviceRegistrationTokenFromUrl = getDeviceRegistrationTokenFromUrl;
|
|
8516
|
-
exports.getElevatedAccessToken =
|
|
8515
|
+
exports.getElevatedAccessToken = require_updateAuthFromVerifyResponse.getElevatedAccessToken;
|
|
8517
8516
|
exports.getFlow = getFlow;
|
|
8518
8517
|
exports.getFlowQuote = getFlowQuote;
|
|
8519
8518
|
exports.getGoogleDriveBackupReadiness = __getGoogleDriveBackupReadiness_wrapped;
|
|
@@ -8541,7 +8540,7 @@ exports.getTransactionHistory = getTransactionHistory;
|
|
|
8541
8540
|
exports.getUserSocialAccounts = getUserSocialAccounts;
|
|
8542
8541
|
exports.getWalletAccountAddressByType = getWalletAccountAddressByType;
|
|
8543
8542
|
exports.getWalletAccountFromAddress = getWalletAccountFromAddress;
|
|
8544
|
-
exports.getWalletAccounts =
|
|
8543
|
+
exports.getWalletAccounts = require_updateAuthFromVerifyResponse.getWalletAccounts;
|
|
8545
8544
|
exports.getWalletConnectCatalog = getWalletConnectCatalog;
|
|
8546
8545
|
exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
|
|
8547
8546
|
exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
|
|
@@ -8560,21 +8559,21 @@ exports.isMobile = isMobile;
|
|
|
8560
8559
|
exports.isPendingRecoveryCodesAcknowledgment = require_isUserOnboardingComplete.isPendingRecoveryCodesAcknowledgment;
|
|
8561
8560
|
exports.isProgrammaticNetworkSwitchAvailable = isProgrammaticNetworkSwitchAvailable;
|
|
8562
8561
|
exports.isSignedIn = require_isMfaRequiredForAction.isSignedIn;
|
|
8563
|
-
exports.isUserMissingMfaAuth =
|
|
8562
|
+
exports.isUserMissingMfaAuth = require_updateAuthFromVerifyResponse.isUserMissingMfaAuth;
|
|
8564
8563
|
exports.isUserOnboardingComplete = require_isUserOnboardingComplete.isUserOnboardingComplete;
|
|
8565
8564
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|
|
8566
8565
|
exports.logout = logout;
|
|
8567
8566
|
exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
|
|
8568
|
-
exports.offEvent =
|
|
8567
|
+
exports.offEvent = require_updateAuthFromVerifyResponse.offEvent;
|
|
8569
8568
|
exports.offWalletProviderEvent = offWalletProviderEvent;
|
|
8570
|
-
exports.onEvent =
|
|
8569
|
+
exports.onEvent = require_updateAuthFromVerifyResponse.onEvent;
|
|
8571
8570
|
exports.onWalletProviderEvent = onWalletProviderEvent;
|
|
8572
|
-
exports.onceEvent =
|
|
8571
|
+
exports.onceEvent = require_updateAuthFromVerifyResponse.onceEvent;
|
|
8573
8572
|
exports.parseUserAgent = parseUserAgent;
|
|
8574
8573
|
exports.prepareCheckoutTransaction = __prepareCheckoutTransaction_wrapped;
|
|
8575
8574
|
exports.prepareFlowSigning = __prepareFlowSigning_wrapped;
|
|
8576
8575
|
exports.proveWalletAccountOwnership = __proveWalletAccountOwnership_wrapped;
|
|
8577
|
-
exports.refreshAuth =
|
|
8576
|
+
exports.refreshAuth = require_isDynamicWaasEnabled.__refreshAuth_wrapped;
|
|
8578
8577
|
exports.refreshUser = __refreshUser_wrapped;
|
|
8579
8578
|
exports.registerPasskey = __registerPasskey_wrapped;
|
|
8580
8579
|
exports.registerTotpMfaDevice = __registerTotpMfaDevice_wrapped;
|