@dynamic-labs-sdk/client 0.10.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{InvalidParamError-C-bDIPAn.cjs.js → InvalidParamError-B83QXOQl.cjs.js} +4 -4
- package/dist/{InvalidParamError-C-bDIPAn.cjs.js.map → InvalidParamError-B83QXOQl.cjs.js.map} +1 -1
- package/dist/{InvalidParamError-DwBXt02M.esm.js → InvalidParamError-Dyhydv4X.esm.js} +3 -3
- package/dist/{InvalidParamError-DwBXt02M.esm.js.map → InvalidParamError-Dyhydv4X.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-Y7BwUjKU.esm.js → NotWaasWalletAccountError-By6DOi1X.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-Y7BwUjKU.esm.js.map → NotWaasWalletAccountError-By6DOi1X.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-Yd5uZ0f5.cjs.js → NotWaasWalletAccountError-C_XzpX9u.cjs.js} +3 -3
- package/dist/{NotWaasWalletAccountError-Yd5uZ0f5.cjs.js.map → NotWaasWalletAccountError-C_XzpX9u.cjs.js.map} +1 -1
- package/dist/core.cjs.js +6 -5
- package/dist/core.cjs.js.map +1 -1
- package/dist/core.esm.js +6 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +6 -2
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-uv3gDI3_.cjs.js → getNetworkProviderFromNetworkId-BRin5Ty5.cjs.js} +7 -5
- package/dist/{getNetworkProviderFromNetworkId-uv3gDI3_.cjs.js.map → getNetworkProviderFromNetworkId-BRin5Ty5.cjs.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-Bxzhboto.esm.js → getNetworkProviderFromNetworkId-D2FjIIXH.esm.js} +7 -5
- package/dist/{getNetworkProviderFromNetworkId-Bxzhboto.esm.js.map → getNetworkProviderFromNetworkId-D2FjIIXH.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-rUbe9Ob0.esm.js → getSignedSessionId-BE84R-V_.esm.js} +24 -7
- package/dist/getSignedSessionId-BE84R-V_.esm.js.map +1 -0
- package/dist/{getSignedSessionId-Cseb1HzZ.cjs.js → getSignedSessionId-DqowqxuJ.cjs.js} +24 -7
- package/dist/getSignedSessionId-DqowqxuJ.cjs.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-DKSlfaeh.esm.js → getVerifiedCredentialForWalletAccount-B5WBFgF2.esm.js} +10 -7
- package/dist/getVerifiedCredentialForWalletAccount-B5WBFgF2.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-CKl95diA.cjs.js → getVerifiedCredentialForWalletAccount-CsHHUt3-.cjs.js} +11 -8
- package/dist/getVerifiedCredentialForWalletAccount-CsHHUt3-.cjs.js.map +1 -0
- package/dist/index.cjs.js +116 -41
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +114 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BJfSYQN8.esm.js → isMfaRequiredForAction-BHmylnPq.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BJfSYQN8.esm.js.map → isMfaRequiredForAction-BHmylnPq.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-Dz3vNayT.cjs.js → isMfaRequiredForAction-BzWbWDdR.cjs.js} +2 -2
- package/dist/{isMfaRequiredForAction-Dz3vNayT.cjs.js.map → isMfaRequiredForAction-BzWbWDdR.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/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/storageSync/hydrateStateWithStorage/hydrateStateWithStorage.d.ts.map +1 -1
- package/dist/modules/storageSync/schema.d.ts +8 -1
- 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 +2 -1
- 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-Cseb1HzZ.cjs.js.map +0 -1
- package/dist/getSignedSessionId-rUbe9Ob0.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-CKl95diA.cjs.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-DKSlfaeh.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as version, D as BaseError, O as getCore, S as CLIENT_SDK_NAME, T as setDefaultClient, _ as getBuffer, a as DYNAMIC_ICONIC_SPRITE_URL, b as ValueMustBeDefinedError, c as CHAINS_INFO_MAP, d as MfaRateLimitedError, f as MfaInvalidOtpError, h as APIError, k as name, l as createApiClient, m as InvalidExternalAuthError, o as SDK_API_CORE_VERSION, p as LinkCredentialError, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as SandboxMaximumThresholdReachedError, v as isCookieEnabled, w as getDefaultClient, x as randomString, y as assertDefined } from "./InvalidParamError-
|
|
2
|
-
import { C as isServerSideRendering, D as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, E as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, M as subscribeWithSelector, N as isEqualShallow, O as createStorageKeySchema, S as createDeferredPromise, T as GENERATE_SESSION_KEYS_TRACKER_KEY, _ as NoNetworkProvidersError, a as updateWalletProviderKeysForVerifiedCredentials, c as createSignInMessageStatement, d as createVisit, f as hasExtension, g as WalletAlreadyLinkedToAnotherUserError, h as isCaptchaRequired, i as getNetworksData, j as createLocalStorageAdapter, k as createStorage, l as formatSignInMessage, m as consumeCaptchaToken, o as verifyMessageSignatureOwnership, p as setCaptchaToken, s as removeUnverifiedWalletAccount, t as getNetworkProviderFromNetworkId, u as setUnverifiedWalletAccounts, v as createLogger, w as FETCH_PROJECT_SETTINGS_TRACKER_KEY, x as CannotTrackError, y as createCrossTabBroadcast } from "./getNetworkProviderFromNetworkId-
|
|
3
|
-
import { D as onceEvent, E as onEvent, O as setCookie, S as splitWalletProviderKey, T as offEvent, _ as getWalletAccounts, b as formatWalletAccountId, c as getWalletProviders, d as DYNAMIC_AUTH_COOKIE_NAME, f as getWalletProviderFromWalletAccount, g as NoWalletProviderFoundError, i as restoreUserSharesForAllWalletAccounts, l as checkAndRaiseWalletAccountsChangedEvent, n as getWalletProviderByKey, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as emitWalletAccountsChangedEvent, w as emitEvent, x as normalizeAddress } from "./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
import { i as bufferToHex, n as getMfaMethods, r as consumeMfaToken, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
5
|
-
import { n as refreshAuth, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-
|
|
1
|
+
import { A as version, D as BaseError, O as getCore, S as CLIENT_SDK_NAME, T as setDefaultClient, _ as getBuffer, a as DYNAMIC_ICONIC_SPRITE_URL, b as ValueMustBeDefinedError, c as CHAINS_INFO_MAP, d as MfaRateLimitedError, f as MfaInvalidOtpError, h as APIError, k as name, l as createApiClient, m as InvalidExternalAuthError, o as SDK_API_CORE_VERSION, p as LinkCredentialError, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as SandboxMaximumThresholdReachedError, v as isCookieEnabled, w as getDefaultClient, x as randomString, y as assertDefined } from "./InvalidParamError-Dyhydv4X.esm.js";
|
|
2
|
+
import { C as isServerSideRendering, D as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, E as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, M as subscribeWithSelector, N as isEqualShallow, O as createStorageKeySchema, S as createDeferredPromise, T as GENERATE_SESSION_KEYS_TRACKER_KEY, _ as NoNetworkProvidersError, a as updateWalletProviderKeysForVerifiedCredentials, c as createSignInMessageStatement, d as createVisit, f as hasExtension, g as WalletAlreadyLinkedToAnotherUserError, h as isCaptchaRequired, i as getNetworksData, j as createLocalStorageAdapter, k as createStorage, l as formatSignInMessage, m as consumeCaptchaToken, o as verifyMessageSignatureOwnership, p as setCaptchaToken, s as removeUnverifiedWalletAccount, t as getNetworkProviderFromNetworkId, u as setUnverifiedWalletAccounts, v as createLogger, w as FETCH_PROJECT_SETTINGS_TRACKER_KEY, x as CannotTrackError, y as createCrossTabBroadcast } from "./getNetworkProviderFromNetworkId-D2FjIIXH.esm.js";
|
|
3
|
+
import { D as onceEvent, E as onEvent, O as setCookie, S as splitWalletProviderKey, T as offEvent, _ as getWalletAccounts, b as formatWalletAccountId, c as getWalletProviders, d as DYNAMIC_AUTH_COOKIE_NAME, f as getWalletProviderFromWalletAccount, g as NoWalletProviderFoundError, i as restoreUserSharesForAllWalletAccounts, l as checkAndRaiseWalletAccountsChangedEvent, n as getWalletProviderByKey, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as emitWalletAccountsChangedEvent, w as emitEvent, x as normalizeAddress } from "./getVerifiedCredentialForWalletAccount-B5WBFgF2.esm.js";
|
|
4
|
+
import { i as bufferToHex, n as getMfaMethods, r as consumeMfaToken, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-BHmylnPq.esm.js";
|
|
5
|
+
import { n as refreshAuth, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-By6DOi1X.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { AuthModeEnum, ExchangeKeyEnum, JwtVerifiedCredentialFormatEnum, MFAAction, MfaBackupCodeAcknowledgement, ProviderEnum, WaasBackupOptionsEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
import * as z from "zod/mini";
|
|
@@ -259,6 +259,7 @@ const logout = async (client = getDefaultClient()) => {
|
|
|
259
259
|
}
|
|
260
260
|
core.state.set({
|
|
261
261
|
captchaToken: null,
|
|
262
|
+
elevatedAccessTokens: [],
|
|
262
263
|
legacyToken: null,
|
|
263
264
|
mfaToken: null,
|
|
264
265
|
sessionExpiresAt: null,
|
|
@@ -373,6 +374,7 @@ const unverifiedWalletAccountSchema = z.object({
|
|
|
373
374
|
type: z.custom((val) => typeof val === "string")
|
|
374
375
|
}))),
|
|
375
376
|
chain: z.custom((val) => typeof val === "string"),
|
|
377
|
+
hardwareWalletVendor: z.optional(z.custom((val) => typeof val === "string")),
|
|
376
378
|
id: z.string(),
|
|
377
379
|
lastSelectedAt: z.nullable(z.date()),
|
|
378
380
|
walletProviderKey: z.string()
|
|
@@ -398,6 +400,12 @@ const sessionStorageKeySchema = createStorageKeySchema({
|
|
|
398
400
|
key: "session",
|
|
399
401
|
schema: z.object({
|
|
400
402
|
captchaToken: z.nullable(z.string()),
|
|
403
|
+
elevatedAccessTokens: z.array(z.object({
|
|
404
|
+
expiresAt: z.number(),
|
|
405
|
+
scopes: z.array(z.string()),
|
|
406
|
+
singleUse: z.nullable(z.boolean()),
|
|
407
|
+
token: z.string()
|
|
408
|
+
})),
|
|
401
409
|
legacyToken: z.nullable(z.string()),
|
|
402
410
|
mfaToken: z.nullable(z.string()),
|
|
403
411
|
sessionExpiration: z.number(),
|
|
@@ -419,6 +427,12 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
419
427
|
stateChanges.legacyToken = session.legacyToken;
|
|
420
428
|
stateChanges.sessionExpiresAt = new Date(session.sessionExpiration);
|
|
421
429
|
stateChanges.mfaToken = session.mfaToken;
|
|
430
|
+
stateChanges.elevatedAccessTokens = session.elevatedAccessTokens.map((token) => ({
|
|
431
|
+
expiresAt: new Date(token.expiresAt),
|
|
432
|
+
scopes: token.scopes,
|
|
433
|
+
singleUse: token.singleUse ?? false,
|
|
434
|
+
token: token.token
|
|
435
|
+
}));
|
|
422
436
|
stateChanges.captchaToken = session.captchaToken;
|
|
423
437
|
stateChanges.sessionKeys = session.sessionKeys;
|
|
424
438
|
}
|
|
@@ -441,6 +455,12 @@ const syncStateWithStorage = (client) => {
|
|
|
441
455
|
if (state.sessionExpiresAt === null) core.storage.removeItem(sessionStorageKeySchema);
|
|
442
456
|
else core.storage.setItem(sessionStorageKeySchema, {
|
|
443
457
|
captchaToken: state.captchaToken,
|
|
458
|
+
elevatedAccessTokens: (state.elevatedAccessTokens || []).map((token) => ({
|
|
459
|
+
expiresAt: token.expiresAt.getTime(),
|
|
460
|
+
scopes: token.scopes,
|
|
461
|
+
singleUse: token.singleUse ?? null,
|
|
462
|
+
token: token.token
|
|
463
|
+
})),
|
|
444
464
|
legacyToken: state.legacyToken,
|
|
445
465
|
mfaToken: state.mfaToken,
|
|
446
466
|
sessionExpiration: state.sessionExpiresAt.getTime(),
|
|
@@ -930,6 +950,20 @@ const createDynamicClient = (config) => {
|
|
|
930
950
|
return client;
|
|
931
951
|
};
|
|
932
952
|
|
|
953
|
+
//#endregion
|
|
954
|
+
//#region src/errors/FeeEstimationFailedError.ts
|
|
955
|
+
var FeeEstimationFailedError = class extends BaseError {
|
|
956
|
+
constructor(params) {
|
|
957
|
+
super({
|
|
958
|
+
cause: params.cause || null,
|
|
959
|
+
code: "fee_estimation_failed_error",
|
|
960
|
+
docsUrl: null,
|
|
961
|
+
name: "FeeEstimationFailedError",
|
|
962
|
+
shortMessage: params.message
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
};
|
|
966
|
+
|
|
933
967
|
//#endregion
|
|
934
968
|
//#region src/errors/InvalidDeviceRegistrationRedirectError.ts
|
|
935
969
|
var InvalidDeviceRegistrationRedirectError = class extends BaseError {
|
|
@@ -1114,6 +1148,20 @@ var NoWebAuthNSupportError = class extends BaseError {
|
|
|
1114
1148
|
}
|
|
1115
1149
|
};
|
|
1116
1150
|
|
|
1151
|
+
//#endregion
|
|
1152
|
+
//#region src/errors/SimulationFailedError.ts
|
|
1153
|
+
var SimulationFailedError = class extends BaseError {
|
|
1154
|
+
constructor(params) {
|
|
1155
|
+
super({
|
|
1156
|
+
cause: params.cause || null,
|
|
1157
|
+
code: "simulation_failed_error",
|
|
1158
|
+
docsUrl: null,
|
|
1159
|
+
name: "SimulationFailedError",
|
|
1160
|
+
shortMessage: params.message
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1117
1165
|
//#endregion
|
|
1118
1166
|
//#region src/errors/UnrecognizedNetworkError.ts
|
|
1119
1167
|
var UnrecognizedNetworkError = class extends BaseError {
|
|
@@ -3796,13 +3844,14 @@ const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, cl
|
|
|
3796
3844
|
|
|
3797
3845
|
//#endregion
|
|
3798
3846
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.ts
|
|
3799
|
-
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, client) => {
|
|
3847
|
+
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requestedScopes }, client) => {
|
|
3800
3848
|
const core = getCore(client);
|
|
3801
3849
|
const apiClient = createApiClient({}, client);
|
|
3802
3850
|
const verifyRequest = {
|
|
3803
3851
|
verificationToken,
|
|
3804
3852
|
verificationUUID: otpVerification.verificationUUID
|
|
3805
3853
|
};
|
|
3854
|
+
if (requestedScopes) verifyRequest.requestedScopes = requestedScopes;
|
|
3806
3855
|
if (otpVerification.email) return apiClient.verifyEmailVerification({
|
|
3807
3856
|
emailVerificationVerifyRequest: verifyRequest,
|
|
3808
3857
|
environmentId: core.environmentId
|
|
@@ -3826,8 +3875,14 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
|
|
|
3826
3875
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3827
3876
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
3828
3877
|
*/
|
|
3829
|
-
const verifyOTP = async ({ otpVerification, verificationToken }, client = getDefaultClient()) => {
|
|
3830
|
-
|
|
3878
|
+
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = getDefaultClient()) => {
|
|
3879
|
+
let response;
|
|
3880
|
+
if (client.user) response = await verifyOTPForUserUpdate({
|
|
3881
|
+
otpVerification,
|
|
3882
|
+
requestedScopes,
|
|
3883
|
+
verificationToken
|
|
3884
|
+
}, client);
|
|
3885
|
+
else response = await verifyOTPForUserSignIn({
|
|
3831
3886
|
otpVerification,
|
|
3832
3887
|
verificationToken
|
|
3833
3888
|
}, client);
|
|
@@ -3835,34 +3890,6 @@ const verifyOTP = async ({ otpVerification, verificationToken }, client = getDef
|
|
|
3835
3890
|
return response;
|
|
3836
3891
|
};
|
|
3837
3892
|
|
|
3838
|
-
//#endregion
|
|
3839
|
-
//#region src/errors/FeeEstimationFailedError.ts
|
|
3840
|
-
var FeeEstimationFailedError = class extends BaseError {
|
|
3841
|
-
constructor(params) {
|
|
3842
|
-
super({
|
|
3843
|
-
cause: params.cause || null,
|
|
3844
|
-
code: "fee_estimation_failed_error",
|
|
3845
|
-
docsUrl: null,
|
|
3846
|
-
name: "FeeEstimationFailedError",
|
|
3847
|
-
shortMessage: params.message
|
|
3848
|
-
});
|
|
3849
|
-
}
|
|
3850
|
-
};
|
|
3851
|
-
|
|
3852
|
-
//#endregion
|
|
3853
|
-
//#region src/errors/SimulationFailedError.ts
|
|
3854
|
-
var SimulationFailedError = class extends BaseError {
|
|
3855
|
-
constructor(params) {
|
|
3856
|
-
super({
|
|
3857
|
-
cause: params.cause || null,
|
|
3858
|
-
code: "simulation_failed_error",
|
|
3859
|
-
docsUrl: null,
|
|
3860
|
-
name: "SimulationFailedError",
|
|
3861
|
-
shortMessage: params.message
|
|
3862
|
-
});
|
|
3863
|
-
}
|
|
3864
|
-
};
|
|
3865
|
-
|
|
3866
3893
|
//#endregion
|
|
3867
3894
|
//#region src/modules/user/deleteUser/deleteUser.ts
|
|
3868
3895
|
/**
|
|
@@ -3989,11 +4016,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
3989
4016
|
*
|
|
3990
4017
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to (e.g. 'metamaskevm', 'phantomsol').
|
|
3991
4018
|
* @param [params.addToDynamicWalletAccounts] - Whether to add the connected wallet account to the user's wallet accounts. Defaults to true.
|
|
4019
|
+
* @param [params.hardwareWalletVendor] - The hardware wallet vendor, if connecting via a hardware wallet (e.g. 'ledger').
|
|
3992
4020
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3993
4021
|
* @returns A promise that resolves to the connected wallet account.
|
|
3994
4022
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
3995
4023
|
*/
|
|
3996
|
-
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true }, client = getDefaultClient()) => {
|
|
4024
|
+
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = getDefaultClient()) => {
|
|
3997
4025
|
const walletProvider = getWalletProviderByKey({ walletProviderKey }, client);
|
|
3998
4026
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
3999
4027
|
const { addresses } = await walletProvider.connect();
|
|
@@ -4009,6 +4037,7 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
4009
4037
|
address: mainAddress,
|
|
4010
4038
|
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
4011
4039
|
chain: walletProvider.chain,
|
|
4040
|
+
hardwareWalletVendor,
|
|
4012
4041
|
id: formatWalletAccountId({
|
|
4013
4042
|
address: mainAddress,
|
|
4014
4043
|
chain: walletProvider.chain,
|
|
@@ -4027,6 +4056,17 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
4027
4056
|
return walletAccount;
|
|
4028
4057
|
};
|
|
4029
4058
|
|
|
4059
|
+
//#endregion
|
|
4060
|
+
//#region src/modules/wallets/hardwareWallet/formatSignatureForHardwareWallet/formatSignatureForHardwareWallet.ts
|
|
4061
|
+
/**
|
|
4062
|
+
* Wraps a raw signature in the JSON format expected by the backend for hardware wallet verification.
|
|
4063
|
+
*
|
|
4064
|
+
* @param params.hardwareWalletVendor - The hardware wallet vendor that produced the signature.
|
|
4065
|
+
* @param params.signature - The raw signature string to wrap.
|
|
4066
|
+
* @returns The signature wrapped in `{ signedTransaction: { data } }` JSON format.
|
|
4067
|
+
*/
|
|
4068
|
+
const formatSignatureForHardwareWallet = ({ signature, hardwareWalletVendor: _ }) => JSON.stringify({ signedTransaction: { data: signature } });
|
|
4069
|
+
|
|
4030
4070
|
//#endregion
|
|
4031
4071
|
//#region src/modules/wallets/utils/getChainIdForAccountVerification/getChainIdForAccountVerification.ts
|
|
4032
4072
|
const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
@@ -4108,10 +4148,14 @@ const isSameAddress = (left, right, chain) => normalizeAddress(left, chain) ===
|
|
|
4108
4148
|
|
|
4109
4149
|
//#endregion
|
|
4110
4150
|
//#region src/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.ts
|
|
4111
|
-
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer }, client) => {
|
|
4151
|
+
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
4112
4152
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
4113
4153
|
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
4114
4154
|
const { messageToSign, signature } = await proveWalletAccountOwnership({ walletAccount }, client);
|
|
4155
|
+
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
4156
|
+
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
4157
|
+
signature
|
|
4158
|
+
}) : signature;
|
|
4115
4159
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
4116
4160
|
const response = await verifyMessageSignatureOwnership({
|
|
4117
4161
|
addressesWithTypes: walletAccount.addressesWithTypes,
|
|
@@ -4119,7 +4163,8 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
4119
4163
|
isTransfer,
|
|
4120
4164
|
messageToSign,
|
|
4121
4165
|
networkId,
|
|
4122
|
-
|
|
4166
|
+
requestedScopes,
|
|
4167
|
+
signature: formattedSignature,
|
|
4123
4168
|
walletAddress: walletAccount.address,
|
|
4124
4169
|
walletDisplayName: walletProvider.metadata.displayName,
|
|
4125
4170
|
walletProviderType: walletProvider.walletProviderType
|
|
@@ -4155,9 +4200,10 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
4155
4200
|
* @throws WalletAccountAlreadyVerifiedError If the wallet is already verified.
|
|
4156
4201
|
* @throws WalletAlreadyLinkedToAnotherUserError If the wallet is linked to another user.
|
|
4157
4202
|
*/
|
|
4158
|
-
const verifyWalletAccount = async ({ walletAccount }, client = getDefaultClient()) => {
|
|
4203
|
+
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client = getDefaultClient()) => {
|
|
4159
4204
|
return verifyWalletAccountForSignInOrTransfer({
|
|
4160
4205
|
isTransfer: false,
|
|
4206
|
+
requestedScopes,
|
|
4161
4207
|
walletAccount
|
|
4162
4208
|
}, client);
|
|
4163
4209
|
};
|
|
@@ -4172,12 +4218,14 @@ const verifyWalletAccount = async ({ walletAccount }, client = getDefaultClient(
|
|
|
4172
4218
|
* the wallet account is added to their profile.
|
|
4173
4219
|
*
|
|
4174
4220
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to.
|
|
4221
|
+
* @param [params.hardwareWalletVendor] - The hardware wallet vendor, if connecting via a hardware wallet (e.g. 'ledger').
|
|
4175
4222
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4176
4223
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
4177
4224
|
*/
|
|
4178
|
-
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey }, client = getDefaultClient()) => {
|
|
4225
|
+
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = getDefaultClient()) => {
|
|
4179
4226
|
const walletAccount = await connectWithWalletProvider({
|
|
4180
4227
|
addToDynamicWalletAccounts: false,
|
|
4228
|
+
hardwareWalletVendor,
|
|
4181
4229
|
walletProviderKey
|
|
4182
4230
|
}, client);
|
|
4183
4231
|
await verifyWalletAccount({ walletAccount }, client);
|
|
@@ -4259,6 +4307,30 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = getDefaultCl
|
|
|
4259
4307
|
};
|
|
4260
4308
|
};
|
|
4261
4309
|
|
|
4310
|
+
//#endregion
|
|
4311
|
+
//#region src/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.ts
|
|
4312
|
+
/**
|
|
4313
|
+
* Checks whether a wallet provider supports connecting with a specific hardware wallet vendor.
|
|
4314
|
+
*
|
|
4315
|
+
* @param params.walletProviderKey - The key of the wallet provider to check.
|
|
4316
|
+
* @param params.hardwareWalletVendor - The hardware wallet vendor to check for.
|
|
4317
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4318
|
+
* @returns Whether the wallet provider supports the specified hardware wallet vendor.
|
|
4319
|
+
*/
|
|
4320
|
+
const canConnectWithHardwareWallet = ({ walletProviderKey, hardwareWalletVendor }, client = getDefaultClient()) => {
|
|
4321
|
+
return getWalletProviderByKey({ walletProviderKey }, client).metadata.supportedHardwareWalletVendors?.includes(hardwareWalletVendor) ?? false;
|
|
4322
|
+
};
|
|
4323
|
+
|
|
4324
|
+
//#endregion
|
|
4325
|
+
//#region src/modules/wallets/hardwareWallet/isHardwareWalletAccount/isHardwareWalletAccount.ts
|
|
4326
|
+
/**
|
|
4327
|
+
* Checks whether a wallet account was connected via a hardware wallet.
|
|
4328
|
+
*
|
|
4329
|
+
* @param params.walletAccount - The wallet account to check.
|
|
4330
|
+
* @returns Whether the wallet account has a hardware wallet vendor set.
|
|
4331
|
+
*/
|
|
4332
|
+
const isHardwareWalletAccount = ({ walletAccount }) => walletAccount.hardwareWalletVendor !== void 0;
|
|
4333
|
+
|
|
4262
4334
|
//#endregion
|
|
4263
4335
|
//#region src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.ts
|
|
4264
4336
|
/**
|
|
@@ -4627,5 +4699,5 @@ const isIPad = (maxTouchPointsOverride) => {
|
|
|
4627
4699
|
assertPackageVersion(name, version);
|
|
4628
4700
|
|
|
4629
4701
|
//#endregion
|
|
4630
|
-
export { BaseError, ClientAlreadyInitializedError, FeeEstimationFailedError, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, authenticateWithSocial, completeDeviceRegistration, completeSocialAuthentication, connectAndVerifyWithWalletProvider, connectWithWalletProvider, consumeMfaToken, createCoinbaseOnrampOrder, createCryptoDotComPayment, createDynamicClient, createKrakenExchangeTransfer, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, fetchProjectSettings, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, getElevatedAccessToken, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletProviderDataByKey, hasExtension, initializeClient, isCaptchaRequired, isDeviceRegistrationRequired, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, proveWalletAccountOwnership, refreshAuth, refreshUser, registerPasskey, registerTotpMfaDevice, removeWalletAccount, selectPrimaryWalletAccount, sendEmailOTP, sendSmsOTP, setCaptchaToken, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signMessage, switchActiveNetwork, transferWalletAccount, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized };
|
|
4702
|
+
export { BaseError, ClientAlreadyInitializedError, FeeEstimationFailedError, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, authenticateWithSocial, canConnectWithHardwareWallet, completeDeviceRegistration, completeSocialAuthentication, connectAndVerifyWithWalletProvider, connectWithWalletProvider, consumeMfaToken, createCoinbaseOnrampOrder, createCryptoDotComPayment, createDynamicClient, createKrakenExchangeTransfer, createNewMfaRecoveryCodes, deleteMfaDevice, deletePasskey, deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, fetchProjectSettings, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, getElevatedAccessToken, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletProviderDataByKey, hasExtension, initializeClient, isCaptchaRequired, isDeviceRegistrationRequired, isHardwareWalletAccount, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, proveWalletAccountOwnership, refreshAuth, refreshUser, registerPasskey, registerTotpMfaDevice, removeWalletAccount, selectPrimaryWalletAccount, sendEmailOTP, sendSmsOTP, setCaptchaToken, setDefaultMfaDevice, signInWithExternalJwt, signInWithPasskey, signMessage, supportedCountries, switchActiveNetwork, transferWalletAccount, unlinkSocialAccount, updateUser, verifyOTP, verifyWalletAccount, waitForClientInitialized };
|
|
4631
4703
|
//# sourceMappingURL=index.esm.js.map
|