@dynamic-labs-sdk/client 0.9.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InvalidParamError-DMz6QY8e.esm.js → InvalidParamError-DNXaHtXP.esm.js} +3 -3
- package/dist/{InvalidParamError-DMz6QY8e.esm.js.map → InvalidParamError-DNXaHtXP.esm.js.map} +1 -1
- package/dist/{InvalidParamError-D1yNl3r1.cjs.js → InvalidParamError-Dj1fpM2M.cjs.js} +4 -4
- package/dist/{InvalidParamError-D1yNl3r1.cjs.js.map → InvalidParamError-Dj1fpM2M.cjs.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-s2J7fQHr.cjs.js → NotWaasWalletAccountError-Cy_46Mkg.cjs.js} +3 -3
- package/dist/{NotWaasWalletAccountError-s2J7fQHr.cjs.js.map → NotWaasWalletAccountError-Cy_46Mkg.cjs.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-Cp3qfAxw.esm.js → NotWaasWalletAccountError-DVph5-w8.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-Cp3qfAxw.esm.js.map → NotWaasWalletAccountError-DVph5-w8.esm.js.map} +1 -1
- package/dist/core.cjs.js +6 -5
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +8 -8
- package/dist/core.esm.js.map +1 -1
- package/dist/errors/FeeEstimationFailedError.d.ts +8 -0
- package/dist/errors/FeeEstimationFailedError.d.ts.map +1 -0
- package/dist/errors/SimulationFailedError.d.ts +8 -0
- package/dist/errors/SimulationFailedError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +9 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CmLsKY7E.esm.js → getNetworkProviderFromNetworkId-27Zwy4je.esm.js} +10 -8
- package/dist/{getNetworkProviderFromNetworkId-CmLsKY7E.esm.js.map → getNetworkProviderFromNetworkId-27Zwy4je.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js → getNetworkProviderFromNetworkId-Dvi65YCc.cjs.js} +7 -5
- package/dist/{getNetworkProviderFromNetworkId-BXGwNlcZ.cjs.js.map → getNetworkProviderFromNetworkId-Dvi65YCc.cjs.js.map} +1 -1
- package/dist/{getSignedSessionId-BO9omMlI.cjs.js → getSignedSessionId-1yP68jni.cjs.js} +24 -7
- package/dist/getSignedSessionId-1yP68jni.cjs.js.map +1 -0
- package/dist/{getSignedSessionId-BvQ4i928.esm.js → getSignedSessionId-BEjBh8ML.esm.js} +24 -7
- package/dist/getSignedSessionId-BEjBh8ML.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js → getVerifiedCredentialForWalletAccount-CnHwYXVQ.cjs.js} +11 -8
- package/dist/getVerifiedCredentialForWalletAccount-CnHwYXVQ.cjs.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js → getVerifiedCredentialForWalletAccount-DsCAOgMb.esm.js} +10 -7
- package/dist/getVerifiedCredentialForWalletAccount-DsCAOgMb.esm.js.map +1 -0
- package/dist/index.cjs.js +162 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +160 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-DIvUT6_k.esm.js → isMfaRequiredForAction-BG_7iYqV.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DIvUT6_k.esm.js.map → isMfaRequiredForAction-BG_7iYqV.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DmYvEIJH.cjs.js → isMfaRequiredForAction-zmF7uoM7.cjs.js} +2 -2
- package/dist/{isMfaRequiredForAction-DmYvEIJH.cjs.js.map → isMfaRequiredForAction-zmF7uoM7.cjs.js.map} +1 -1
- package/dist/modules/auth/decodeJwt/decodeJwt.d.ts +4 -4
- package/dist/modules/auth/decodeJwt/decodeJwt.d.ts.map +1 -1
- package/dist/modules/auth/logout/logout.d.ts.map +1 -1
- package/dist/modules/auth/state.d.ts +1 -1
- package/dist/modules/auth/state.d.ts.map +1 -1
- package/dist/modules/auth/updateAuthFromVerifyResponse/elevatedAccessTokens/parseElevatedAccessToken/parseElevatedAccessToken.d.ts.map +1 -1
- package/dist/modules/auth/updateAuthFromVerifyResponse/updateAuthFromVerifyResponse.d.ts.map +1 -1
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts +8 -2
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts.map +1 -1
- package/dist/modules/crossTabEventSync/index.d.ts +2 -0
- package/dist/modules/crossTabEventSync/index.d.ts.map +1 -0
- package/dist/modules/crossTabEventSync/setupCrossTabEventSync/index.d.ts +2 -0
- package/dist/modules/crossTabEventSync/setupCrossTabEventSync/index.d.ts.map +1 -0
- package/dist/modules/crossTabEventSync/setupCrossTabEventSync/setupCrossTabEventSync.d.ts +19 -0
- package/dist/modules/crossTabEventSync/setupCrossTabEventSync/setupCrossTabEventSync.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts +7 -0
- package/dist/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/completeDeviceRegistration/index.d.ts +2 -0
- package/dist/modules/deviceRegistration/completeDeviceRegistration/index.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/events.d.ts +21 -0
- package/dist/modules/deviceRegistration/events.d.ts.map +1 -0
- package/dist/modules/initializeClient/initializeClient.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +3 -2
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.d.ts +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.d.ts.map +1 -1
- package/dist/modules/sessionKeys/generateNonceSignature/generateNonceSignature.d.ts +9 -0
- package/dist/modules/sessionKeys/generateNonceSignature/generateNonceSignature.d.ts.map +1 -0
- package/dist/modules/sessionKeys/generateNonceSignature/index.d.ts +2 -0
- package/dist/modules/sessionKeys/generateNonceSignature/index.d.ts.map +1 -0
- package/dist/modules/sessionKeys/getSignedSessionId/getSignedSessionId.d.ts.map +1 -1
- package/dist/modules/simulation/simulation.types.d.ts +75 -0
- package/dist/modules/simulation/simulation.types.d.ts.map +1 -0
- package/dist/modules/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.d.ts.map +1 -1
- package/dist/modules/storageSync/schema.d.ts +7 -0
- package/dist/modules/storageSync/schema.d.ts.map +1 -1
- package/dist/modules/storageSync/syncStateWithStorage/syncStateWithStorage.d.ts.map +1 -1
- package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts +4 -1
- package/dist/modules/wallets/connectAndVerifyWithWalletProvider/connectAndVerifyWithWalletProvider.d.ts.map +1 -1
- package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts +4 -1
- package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts.map +1 -1
- package/dist/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.d.ts +16 -0
- package/dist/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.d.ts.map +1 -0
- package/dist/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/index.d.ts +2 -0
- package/dist/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/index.d.ts.map +1 -0
- package/dist/modules/wallets/hardwareWallet/formatSignatureForHardwareWallet/formatSignatureForHardwareWallet.d.ts +15 -0
- package/dist/modules/wallets/hardwareWallet/formatSignatureForHardwareWallet/formatSignatureForHardwareWallet.d.ts.map +1 -0
- package/dist/modules/wallets/hardwareWallet/formatSignatureForHardwareWallet/index.d.ts +2 -0
- package/dist/modules/wallets/hardwareWallet/formatSignatureForHardwareWallet/index.d.ts.map +1 -0
- package/dist/modules/wallets/hardwareWallet/hardwareWallet.types.d.ts +5 -0
- package/dist/modules/wallets/hardwareWallet/hardwareWallet.types.d.ts.map +1 -0
- package/dist/modules/wallets/hardwareWallet/isHardwareWalletAccount/index.d.ts +2 -0
- package/dist/modules/wallets/hardwareWallet/isHardwareWalletAccount/index.d.ts.map +1 -0
- package/dist/modules/wallets/hardwareWallet/isHardwareWalletAccount/isHardwareWalletAccount.d.ts +13 -0
- package/dist/modules/wallets/hardwareWallet/isHardwareWalletAccount/isHardwareWalletAccount.d.ts.map +1 -0
- package/dist/modules/wallets/unverifiedWalletAccounts/schema.d.ts +1 -0
- package/dist/modules/wallets/unverifiedWalletAccounts/schema.d.ts.map +1 -1
- package/dist/modules/wallets/utils/convertVerifiedCredentialToWalletAccount/convertVerifiedCredentialToWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts +3 -2
- package/dist/modules/wallets/verifyMessageSignatureOwnership/verifyMessageSignatureOwnership.d.ts.map +1 -1
- package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts +3 -1
- package/dist/modules/wallets/verifyWalletAccount/verifyWalletAccount.d.ts.map +1 -1
- package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts +3 -1
- package/dist/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.d.ts.map +1 -1
- package/dist/modules/wallets/walletAccount/walletAccount.types.d.ts +2 -0
- package/dist/modules/wallets/walletAccount/walletAccount.types.d.ts.map +1 -1
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +5 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/waas.cjs.js +4 -4
- package/dist/waas.esm.js +3 -3
- package/dist/waasCore.cjs.js +4 -4
- package/dist/waasCore.esm.js +3 -3
- package/package.json +3 -3
- package/dist/getSignedSessionId-BO9omMlI.cjs.js.map +0 -1
- package/dist/getSignedSessionId-BvQ4i928.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-54lCppnJ.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-BW8iluei.cjs.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
2
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
3
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
5
|
-
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-
|
|
1
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-Dvi65YCc.cjs.js');
|
|
2
|
+
const require_InvalidParamError = require('./InvalidParamError-Dj1fpM2M.cjs.js');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-CnHwYXVQ.cjs.js');
|
|
4
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-zmF7uoM7.cjs.js');
|
|
5
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-Cy_46Mkg.cjs.js');
|
|
6
6
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
7
7
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
8
8
|
let zod_mini = require("zod/mini");
|
|
@@ -261,6 +261,7 @@ const logout = async (client = require_InvalidParamError.getDefaultClient()) =>
|
|
|
261
261
|
}
|
|
262
262
|
core.state.set({
|
|
263
263
|
captchaToken: null,
|
|
264
|
+
elevatedAccessTokens: [],
|
|
264
265
|
legacyToken: null,
|
|
265
266
|
mfaToken: null,
|
|
266
267
|
sessionExpiresAt: null,
|
|
@@ -321,6 +322,36 @@ const initializeAuth = (client) => {
|
|
|
321
322
|
checkExpiration();
|
|
322
323
|
};
|
|
323
324
|
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region src/modules/crossTabEventSync/setupCrossTabEventSync/setupCrossTabEventSync.ts
|
|
327
|
+
/**
|
|
328
|
+
* Sets up bidirectional event synchronization between the core event emitter
|
|
329
|
+
* and the CrossTabBroadcast service.
|
|
330
|
+
*
|
|
331
|
+
* This enables events fired in one tab to be received in other tabs.
|
|
332
|
+
*
|
|
333
|
+
* **Local → Cross-Tab (Forwarding)**
|
|
334
|
+
* - Listens to specific events on core.eventEmitter
|
|
335
|
+
* - Forwards them to other tabs via core.crossTabBroadcast.send()
|
|
336
|
+
*
|
|
337
|
+
* **Cross-Tab → Local (Receiving)**
|
|
338
|
+
* - Listens to cross-tab events via core.crossTabBroadcast.on()
|
|
339
|
+
* - Emits corresponding "*InAnotherTab" events on core.eventEmitter
|
|
340
|
+
*
|
|
341
|
+
* @param client - The Dynamic client instance
|
|
342
|
+
*/
|
|
343
|
+
const setupCrossTabEventSync = (client) => {
|
|
344
|
+
const core = require_InvalidParamError.getCore(client);
|
|
345
|
+
const handleDeviceRegistrationCompleted = () => {
|
|
346
|
+
core.crossTabBroadcast.send({ event: "deviceRegistrationCompleted" });
|
|
347
|
+
};
|
|
348
|
+
core.eventEmitter.on("deviceRegistrationCompleted", handleDeviceRegistrationCompleted);
|
|
349
|
+
const handleCrossTabDeviceRegistrationCompleted = () => {
|
|
350
|
+
require_getVerifiedCredentialForWalletAccount.emitEvent({ event: "deviceRegistrationCompletedInAnotherTab" }, client);
|
|
351
|
+
};
|
|
352
|
+
core.crossTabBroadcast.on("deviceRegistrationCompleted", handleCrossTabDeviceRegistrationCompleted);
|
|
353
|
+
};
|
|
354
|
+
|
|
324
355
|
//#endregion
|
|
325
356
|
//#region src/modules/state/raiseStateEvents/raiseStateEvents.ts
|
|
326
357
|
const raiseStateEvents = (client) => {
|
|
@@ -345,6 +376,7 @@ const unverifiedWalletAccountSchema = zod_mini.object({
|
|
|
345
376
|
type: zod_mini.custom((val) => typeof val === "string")
|
|
346
377
|
}))),
|
|
347
378
|
chain: zod_mini.custom((val) => typeof val === "string"),
|
|
379
|
+
hardwareWalletVendor: zod_mini.optional(zod_mini.custom((val) => typeof val === "string")),
|
|
348
380
|
id: zod_mini.string(),
|
|
349
381
|
lastSelectedAt: zod_mini.nullable(zod_mini.date()),
|
|
350
382
|
walletProviderKey: zod_mini.string()
|
|
@@ -370,6 +402,12 @@ const sessionStorageKeySchema = require_getNetworkProviderFromNetworkId.createSt
|
|
|
370
402
|
key: "session",
|
|
371
403
|
schema: zod_mini.object({
|
|
372
404
|
captchaToken: zod_mini.nullable(zod_mini.string()),
|
|
405
|
+
elevatedAccessTokens: zod_mini.array(zod_mini.object({
|
|
406
|
+
expiresAt: zod_mini.number(),
|
|
407
|
+
scopes: zod_mini.array(zod_mini.string()),
|
|
408
|
+
singleUse: zod_mini.nullable(zod_mini.boolean()),
|
|
409
|
+
token: zod_mini.string()
|
|
410
|
+
})),
|
|
373
411
|
legacyToken: zod_mini.nullable(zod_mini.string()),
|
|
374
412
|
mfaToken: zod_mini.nullable(zod_mini.string()),
|
|
375
413
|
sessionExpiration: zod_mini.number(),
|
|
@@ -391,6 +429,12 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
391
429
|
stateChanges.legacyToken = session.legacyToken;
|
|
392
430
|
stateChanges.sessionExpiresAt = new Date(session.sessionExpiration);
|
|
393
431
|
stateChanges.mfaToken = session.mfaToken;
|
|
432
|
+
stateChanges.elevatedAccessTokens = session.elevatedAccessTokens.map((token) => ({
|
|
433
|
+
expiresAt: new Date(token.expiresAt),
|
|
434
|
+
scopes: token.scopes,
|
|
435
|
+
singleUse: token.singleUse ?? false,
|
|
436
|
+
token: token.token
|
|
437
|
+
}));
|
|
394
438
|
stateChanges.captchaToken = session.captchaToken;
|
|
395
439
|
stateChanges.sessionKeys = session.sessionKeys;
|
|
396
440
|
}
|
|
@@ -413,6 +457,12 @@ const syncStateWithStorage = (client) => {
|
|
|
413
457
|
if (state.sessionExpiresAt === null) core.storage.removeItem(sessionStorageKeySchema);
|
|
414
458
|
else core.storage.setItem(sessionStorageKeySchema, {
|
|
415
459
|
captchaToken: state.captchaToken,
|
|
460
|
+
elevatedAccessTokens: (state.elevatedAccessTokens || []).map((token) => ({
|
|
461
|
+
expiresAt: token.expiresAt.getTime(),
|
|
462
|
+
scopes: token.scopes,
|
|
463
|
+
singleUse: token.singleUse ?? null,
|
|
464
|
+
token: token.token
|
|
465
|
+
})),
|
|
416
466
|
legacyToken: state.legacyToken,
|
|
417
467
|
mfaToken: state.mfaToken,
|
|
418
468
|
sessionExpiration: state.sessionExpiresAt.getTime(),
|
|
@@ -472,6 +522,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
472
522
|
core.state.set({ initStatus: "in-progress" });
|
|
473
523
|
initializeAuth(client);
|
|
474
524
|
raiseStateEvents(client);
|
|
525
|
+
setupCrossTabEventSync(client);
|
|
475
526
|
const initializeStorageSyncPromise = initializeStorageSync(client);
|
|
476
527
|
const fetchProjectSettingsPromise = initializeStorageSyncPromise.then(async () => {
|
|
477
528
|
if (!core.state.get().projectSettings) await fetchProjectSettings(client);
|
|
@@ -901,6 +952,20 @@ const createDynamicClient = (config) => {
|
|
|
901
952
|
return client;
|
|
902
953
|
};
|
|
903
954
|
|
|
955
|
+
//#endregion
|
|
956
|
+
//#region src/errors/FeeEstimationFailedError.ts
|
|
957
|
+
var FeeEstimationFailedError = class extends require_InvalidParamError.BaseError {
|
|
958
|
+
constructor(params) {
|
|
959
|
+
super({
|
|
960
|
+
cause: params.cause || null,
|
|
961
|
+
code: "fee_estimation_failed_error",
|
|
962
|
+
docsUrl: null,
|
|
963
|
+
name: "FeeEstimationFailedError",
|
|
964
|
+
shortMessage: params.message
|
|
965
|
+
});
|
|
966
|
+
}
|
|
967
|
+
};
|
|
968
|
+
|
|
904
969
|
//#endregion
|
|
905
970
|
//#region src/errors/InvalidDeviceRegistrationRedirectError.ts
|
|
906
971
|
var InvalidDeviceRegistrationRedirectError = class extends require_InvalidParamError.BaseError {
|
|
@@ -1085,6 +1150,20 @@ var NoWebAuthNSupportError = class extends require_InvalidParamError.BaseError {
|
|
|
1085
1150
|
}
|
|
1086
1151
|
};
|
|
1087
1152
|
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region src/errors/SimulationFailedError.ts
|
|
1155
|
+
var SimulationFailedError = class extends require_InvalidParamError.BaseError {
|
|
1156
|
+
constructor(params) {
|
|
1157
|
+
super({
|
|
1158
|
+
cause: params.cause || null,
|
|
1159
|
+
code: "simulation_failed_error",
|
|
1160
|
+
docsUrl: null,
|
|
1161
|
+
name: "SimulationFailedError",
|
|
1162
|
+
shortMessage: params.message
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
};
|
|
1166
|
+
|
|
1088
1167
|
//#endregion
|
|
1089
1168
|
//#region src/errors/UnrecognizedNetworkError.ts
|
|
1090
1169
|
var UnrecognizedNetworkError = class extends require_InvalidParamError.BaseError {
|
|
@@ -1685,6 +1764,18 @@ const getMultichainBalances = async ({ balanceRequest }, client = require_Invali
|
|
|
1685
1764
|
})).chainBalances;
|
|
1686
1765
|
};
|
|
1687
1766
|
|
|
1767
|
+
//#endregion
|
|
1768
|
+
//#region src/modules/deviceRegistration/completeDeviceRegistration/completeDeviceRegistration.ts
|
|
1769
|
+
const DEVICE_REGISTRATION_TOKEN_HEADER = "x-dynamic-device-registration-token";
|
|
1770
|
+
const completeDeviceRegistration = async ({ deviceToken }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1771
|
+
require_InvalidParamError.assertDefined(deviceToken, "deviceToken is required");
|
|
1772
|
+
const core = require_InvalidParamError.getCore(client);
|
|
1773
|
+
const response = await require_InvalidParamError.createApiClient({ headers: { [DEVICE_REGISTRATION_TOKEN_HEADER]: deviceToken } }, client).deviceRegistration({ environmentId: core.environmentId });
|
|
1774
|
+
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
1775
|
+
require_getVerifiedCredentialForWalletAccount.emitEvent({ event: "deviceRegistrationCompleted" }, client);
|
|
1776
|
+
return response;
|
|
1777
|
+
};
|
|
1778
|
+
|
|
1688
1779
|
//#endregion
|
|
1689
1780
|
//#region src/modules/deviceRegistration/getDeviceRegistrationTokenFromUrl/getDeviceRegistrationTokenFromUrl.ts
|
|
1690
1781
|
/**
|
|
@@ -3755,13 +3846,14 @@ const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, cl
|
|
|
3755
3846
|
|
|
3756
3847
|
//#endregion
|
|
3757
3848
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.ts
|
|
3758
|
-
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, client) => {
|
|
3849
|
+
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requestedScopes }, client) => {
|
|
3759
3850
|
const core = require_InvalidParamError.getCore(client);
|
|
3760
3851
|
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
3761
3852
|
const verifyRequest = {
|
|
3762
3853
|
verificationToken,
|
|
3763
3854
|
verificationUUID: otpVerification.verificationUUID
|
|
3764
3855
|
};
|
|
3856
|
+
if (requestedScopes) verifyRequest.requestedScopes = requestedScopes;
|
|
3765
3857
|
if (otpVerification.email) return apiClient.verifyEmailVerification({
|
|
3766
3858
|
emailVerificationVerifyRequest: verifyRequest,
|
|
3767
3859
|
environmentId: core.environmentId
|
|
@@ -3785,8 +3877,14 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
|
|
|
3785
3877
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3786
3878
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
3787
3879
|
*/
|
|
3788
|
-
const verifyOTP = async ({ otpVerification, verificationToken }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3789
|
-
|
|
3880
|
+
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3881
|
+
let response;
|
|
3882
|
+
if (client.user) response = await verifyOTPForUserUpdate({
|
|
3883
|
+
otpVerification,
|
|
3884
|
+
requestedScopes,
|
|
3885
|
+
verificationToken
|
|
3886
|
+
}, client);
|
|
3887
|
+
else response = await verifyOTPForUserSignIn({
|
|
3790
3888
|
otpVerification,
|
|
3791
3889
|
verificationToken
|
|
3792
3890
|
}, client);
|
|
@@ -3920,11 +4018,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
3920
4018
|
*
|
|
3921
4019
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to (e.g. 'metamaskevm', 'phantomsol').
|
|
3922
4020
|
* @param [params.addToDynamicWalletAccounts] - Whether to add the connected wallet account to the user's wallet accounts. Defaults to true.
|
|
4021
|
+
* @param [params.hardwareWalletVendor] - The hardware wallet vendor, if connecting via a hardware wallet (e.g. 'ledger').
|
|
3923
4022
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3924
4023
|
* @returns A promise that resolves to the connected wallet account.
|
|
3925
4024
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
3926
4025
|
*/
|
|
3927
|
-
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4026
|
+
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3928
4027
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderByKey({ walletProviderKey }, client);
|
|
3929
4028
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
3930
4029
|
const { addresses } = await walletProvider.connect();
|
|
@@ -3940,6 +4039,7 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
3940
4039
|
address: mainAddress,
|
|
3941
4040
|
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
3942
4041
|
chain: walletProvider.chain,
|
|
4042
|
+
hardwareWalletVendor,
|
|
3943
4043
|
id: require_getVerifiedCredentialForWalletAccount.formatWalletAccountId({
|
|
3944
4044
|
address: mainAddress,
|
|
3945
4045
|
chain: walletProvider.chain,
|
|
@@ -3958,6 +4058,17 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
3958
4058
|
return walletAccount;
|
|
3959
4059
|
};
|
|
3960
4060
|
|
|
4061
|
+
//#endregion
|
|
4062
|
+
//#region src/modules/wallets/hardwareWallet/formatSignatureForHardwareWallet/formatSignatureForHardwareWallet.ts
|
|
4063
|
+
/**
|
|
4064
|
+
* Wraps a raw signature in the JSON format expected by the backend for hardware wallet verification.
|
|
4065
|
+
*
|
|
4066
|
+
* @param params.hardwareWalletVendor - The hardware wallet vendor that produced the signature.
|
|
4067
|
+
* @param params.signature - The raw signature string to wrap.
|
|
4068
|
+
* @returns The signature wrapped in `{ signedTransaction: { data } }` JSON format.
|
|
4069
|
+
*/
|
|
4070
|
+
const formatSignatureForHardwareWallet = ({ signature, hardwareWalletVendor: _ }) => JSON.stringify({ signedTransaction: { data: signature } });
|
|
4071
|
+
|
|
3961
4072
|
//#endregion
|
|
3962
4073
|
//#region src/modules/wallets/utils/getChainIdForAccountVerification/getChainIdForAccountVerification.ts
|
|
3963
4074
|
const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
@@ -4039,10 +4150,14 @@ const isSameAddress = (left, right, chain) => require_getVerifiedCredentialForWa
|
|
|
4039
4150
|
|
|
4040
4151
|
//#endregion
|
|
4041
4152
|
//#region src/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.ts
|
|
4042
|
-
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer }, client) => {
|
|
4153
|
+
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
4043
4154
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
4044
4155
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
4045
4156
|
const { messageToSign, signature } = await proveWalletAccountOwnership({ walletAccount }, client);
|
|
4157
|
+
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
4158
|
+
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
4159
|
+
signature
|
|
4160
|
+
}) : signature;
|
|
4046
4161
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
4047
4162
|
const response = await require_getNetworkProviderFromNetworkId.verifyMessageSignatureOwnership({
|
|
4048
4163
|
addressesWithTypes: walletAccount.addressesWithTypes,
|
|
@@ -4050,7 +4165,8 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
4050
4165
|
isTransfer,
|
|
4051
4166
|
messageToSign,
|
|
4052
4167
|
networkId,
|
|
4053
|
-
|
|
4168
|
+
requestedScopes,
|
|
4169
|
+
signature: formattedSignature,
|
|
4054
4170
|
walletAddress: walletAccount.address,
|
|
4055
4171
|
walletDisplayName: walletProvider.metadata.displayName,
|
|
4056
4172
|
walletProviderType: walletProvider.walletProviderType
|
|
@@ -4086,9 +4202,10 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
4086
4202
|
* @throws WalletAccountAlreadyVerifiedError If the wallet is already verified.
|
|
4087
4203
|
* @throws WalletAlreadyLinkedToAnotherUserError If the wallet is linked to another user.
|
|
4088
4204
|
*/
|
|
4089
|
-
const verifyWalletAccount = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4205
|
+
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4090
4206
|
return verifyWalletAccountForSignInOrTransfer({
|
|
4091
4207
|
isTransfer: false,
|
|
4208
|
+
requestedScopes,
|
|
4092
4209
|
walletAccount
|
|
4093
4210
|
}, client);
|
|
4094
4211
|
};
|
|
@@ -4103,12 +4220,14 @@ const verifyWalletAccount = async ({ walletAccount }, client = require_InvalidPa
|
|
|
4103
4220
|
* the wallet account is added to their profile.
|
|
4104
4221
|
*
|
|
4105
4222
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to.
|
|
4223
|
+
* @param [params.hardwareWalletVendor] - The hardware wallet vendor, if connecting via a hardware wallet (e.g. 'ledger').
|
|
4106
4224
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4107
4225
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
4108
4226
|
*/
|
|
4109
|
-
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4227
|
+
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4110
4228
|
const walletAccount = await connectWithWalletProvider({
|
|
4111
4229
|
addToDynamicWalletAccounts: false,
|
|
4230
|
+
hardwareWalletVendor,
|
|
4112
4231
|
walletProviderKey
|
|
4113
4232
|
}, client);
|
|
4114
4233
|
await verifyWalletAccount({ walletAccount }, client);
|
|
@@ -4190,6 +4309,30 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_Inva
|
|
|
4190
4309
|
};
|
|
4191
4310
|
};
|
|
4192
4311
|
|
|
4312
|
+
//#endregion
|
|
4313
|
+
//#region src/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.ts
|
|
4314
|
+
/**
|
|
4315
|
+
* Checks whether a wallet provider supports connecting with a specific hardware wallet vendor.
|
|
4316
|
+
*
|
|
4317
|
+
* @param params.walletProviderKey - The key of the wallet provider to check.
|
|
4318
|
+
* @param params.hardwareWalletVendor - The hardware wallet vendor to check for.
|
|
4319
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4320
|
+
* @returns Whether the wallet provider supports the specified hardware wallet vendor.
|
|
4321
|
+
*/
|
|
4322
|
+
const canConnectWithHardwareWallet = ({ walletProviderKey, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4323
|
+
return require_getVerifiedCredentialForWalletAccount.getWalletProviderByKey({ walletProviderKey }, client).metadata.supportedHardwareWalletVendors?.includes(hardwareWalletVendor) ?? false;
|
|
4324
|
+
};
|
|
4325
|
+
|
|
4326
|
+
//#endregion
|
|
4327
|
+
//#region src/modules/wallets/hardwareWallet/isHardwareWalletAccount/isHardwareWalletAccount.ts
|
|
4328
|
+
/**
|
|
4329
|
+
* Checks whether a wallet account was connected via a hardware wallet.
|
|
4330
|
+
*
|
|
4331
|
+
* @param params.walletAccount - The wallet account to check.
|
|
4332
|
+
* @returns Whether the wallet account has a hardware wallet vendor set.
|
|
4333
|
+
*/
|
|
4334
|
+
const isHardwareWalletAccount = ({ walletAccount }) => walletAccount.hardwareWalletVendor !== void 0;
|
|
4335
|
+
|
|
4193
4336
|
//#endregion
|
|
4194
4337
|
//#region src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.ts
|
|
4195
4338
|
/**
|
|
@@ -4560,6 +4703,7 @@ const isIPad = (maxTouchPointsOverride) => {
|
|
|
4560
4703
|
//#endregion
|
|
4561
4704
|
exports.BaseError = require_InvalidParamError.BaseError;
|
|
4562
4705
|
exports.ClientAlreadyInitializedError = ClientAlreadyInitializedError;
|
|
4706
|
+
exports.FeeEstimationFailedError = FeeEstimationFailedError;
|
|
4563
4707
|
exports.InvalidDeviceRegistrationRedirectError = InvalidDeviceRegistrationRedirectError;
|
|
4564
4708
|
exports.InvalidExternalAuthError = require_InvalidParamError.InvalidExternalAuthError;
|
|
4565
4709
|
exports.InvalidParamError = require_InvalidParamError.InvalidParamError;
|
|
@@ -4586,6 +4730,7 @@ exports.NoSmartWalletAccountSignerFoundError = NoSmartWalletAccountSignerFoundEr
|
|
|
4586
4730
|
exports.NoWebAuthNSupportError = NoWebAuthNSupportError;
|
|
4587
4731
|
exports.NotWaasWalletAccountError = require_NotWaasWalletAccountError.NotWaasWalletAccountError;
|
|
4588
4732
|
exports.SandboxMaximumThresholdReachedError = require_InvalidParamError.SandboxMaximumThresholdReachedError;
|
|
4733
|
+
exports.SimulationFailedError = SimulationFailedError;
|
|
4589
4734
|
exports.UnavailableInServerSideError = UnavailableInServerSideError;
|
|
4590
4735
|
exports.UnrecognizedNetworkError = UnrecognizedNetworkError;
|
|
4591
4736
|
exports.UserNotAuthenticatedError = UserNotAuthenticatedError;
|
|
@@ -4603,6 +4748,8 @@ exports.authenticateMfaRecoveryCode = authenticateMfaRecoveryCode;
|
|
|
4603
4748
|
exports.authenticatePasskeyMFA = authenticatePasskeyMFA;
|
|
4604
4749
|
exports.authenticateTotpMfaDevice = authenticateTotpMfaDevice;
|
|
4605
4750
|
exports.authenticateWithSocial = authenticateWithSocial;
|
|
4751
|
+
exports.canConnectWithHardwareWallet = canConnectWithHardwareWallet;
|
|
4752
|
+
exports.completeDeviceRegistration = completeDeviceRegistration;
|
|
4606
4753
|
exports.completeSocialAuthentication = completeSocialAuthentication;
|
|
4607
4754
|
exports.connectAndVerifyWithWalletProvider = connectAndVerifyWithWalletProvider;
|
|
4608
4755
|
exports.connectWithWalletProvider = connectWithWalletProvider;
|
|
@@ -4651,6 +4798,7 @@ exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|
|
|
4651
4798
|
exports.initializeClient = initializeClient;
|
|
4652
4799
|
exports.isCaptchaRequired = require_getNetworkProviderFromNetworkId.isCaptchaRequired;
|
|
4653
4800
|
exports.isDeviceRegistrationRequired = isDeviceRegistrationRequired;
|
|
4801
|
+
exports.isHardwareWalletAccount = isHardwareWalletAccount;
|
|
4654
4802
|
exports.isMfaRequiredForAction = require_isMfaRequiredForAction.isMfaRequiredForAction;
|
|
4655
4803
|
exports.isMobile = isMobile;
|
|
4656
4804
|
exports.isPendingRecoveryCodesAcknowledgment = isPendingRecoveryCodesAcknowledgment;
|
|
@@ -4679,6 +4827,7 @@ exports.setDefaultMfaDevice = setDefaultMfaDevice;
|
|
|
4679
4827
|
exports.signInWithExternalJwt = signInWithExternalJwt;
|
|
4680
4828
|
exports.signInWithPasskey = signInWithPasskey;
|
|
4681
4829
|
exports.signMessage = signMessage;
|
|
4830
|
+
exports.supportedCountries = supportedCountries;
|
|
4682
4831
|
exports.switchActiveNetwork = switchActiveNetwork;
|
|
4683
4832
|
exports.transferWalletAccount = transferWalletAccount;
|
|
4684
4833
|
exports.unlinkSocialAccount = unlinkSocialAccount;
|