@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.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-BRin5Ty5.cjs.js');
|
|
2
|
+
const require_InvalidParamError = require('./InvalidParamError-B83QXOQl.cjs.js');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-CsHHUt3-.cjs.js');
|
|
4
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-BzWbWDdR.cjs.js');
|
|
5
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-C_XzpX9u.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,
|
|
@@ -375,6 +376,7 @@ const unverifiedWalletAccountSchema = zod_mini.object({
|
|
|
375
376
|
type: zod_mini.custom((val) => typeof val === "string")
|
|
376
377
|
}))),
|
|
377
378
|
chain: zod_mini.custom((val) => typeof val === "string"),
|
|
379
|
+
hardwareWalletVendor: zod_mini.optional(zod_mini.custom((val) => typeof val === "string")),
|
|
378
380
|
id: zod_mini.string(),
|
|
379
381
|
lastSelectedAt: zod_mini.nullable(zod_mini.date()),
|
|
380
382
|
walletProviderKey: zod_mini.string()
|
|
@@ -400,6 +402,12 @@ const sessionStorageKeySchema = require_getNetworkProviderFromNetworkId.createSt
|
|
|
400
402
|
key: "session",
|
|
401
403
|
schema: zod_mini.object({
|
|
402
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
|
+
})),
|
|
403
411
|
legacyToken: zod_mini.nullable(zod_mini.string()),
|
|
404
412
|
mfaToken: zod_mini.nullable(zod_mini.string()),
|
|
405
413
|
sessionExpiration: zod_mini.number(),
|
|
@@ -421,6 +429,12 @@ const hydrateStateWithStorage = async (client) => {
|
|
|
421
429
|
stateChanges.legacyToken = session.legacyToken;
|
|
422
430
|
stateChanges.sessionExpiresAt = new Date(session.sessionExpiration);
|
|
423
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
|
+
}));
|
|
424
438
|
stateChanges.captchaToken = session.captchaToken;
|
|
425
439
|
stateChanges.sessionKeys = session.sessionKeys;
|
|
426
440
|
}
|
|
@@ -443,6 +457,12 @@ const syncStateWithStorage = (client) => {
|
|
|
443
457
|
if (state.sessionExpiresAt === null) core.storage.removeItem(sessionStorageKeySchema);
|
|
444
458
|
else core.storage.setItem(sessionStorageKeySchema, {
|
|
445
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
|
+
})),
|
|
446
466
|
legacyToken: state.legacyToken,
|
|
447
467
|
mfaToken: state.mfaToken,
|
|
448
468
|
sessionExpiration: state.sessionExpiresAt.getTime(),
|
|
@@ -932,6 +952,20 @@ const createDynamicClient = (config) => {
|
|
|
932
952
|
return client;
|
|
933
953
|
};
|
|
934
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
|
+
|
|
935
969
|
//#endregion
|
|
936
970
|
//#region src/errors/InvalidDeviceRegistrationRedirectError.ts
|
|
937
971
|
var InvalidDeviceRegistrationRedirectError = class extends require_InvalidParamError.BaseError {
|
|
@@ -1116,6 +1150,20 @@ var NoWebAuthNSupportError = class extends require_InvalidParamError.BaseError {
|
|
|
1116
1150
|
}
|
|
1117
1151
|
};
|
|
1118
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
|
+
|
|
1119
1167
|
//#endregion
|
|
1120
1168
|
//#region src/errors/UnrecognizedNetworkError.ts
|
|
1121
1169
|
var UnrecognizedNetworkError = class extends require_InvalidParamError.BaseError {
|
|
@@ -3798,13 +3846,14 @@ const verifyOTPForUserSignIn = async ({ otpVerification, verificationToken }, cl
|
|
|
3798
3846
|
|
|
3799
3847
|
//#endregion
|
|
3800
3848
|
//#region src/modules/otp/verifyOTP/verifyOTPForUserUpdate/verifyOTPForUserUpdate.ts
|
|
3801
|
-
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, client) => {
|
|
3849
|
+
const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requestedScopes }, client) => {
|
|
3802
3850
|
const core = require_InvalidParamError.getCore(client);
|
|
3803
3851
|
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
3804
3852
|
const verifyRequest = {
|
|
3805
3853
|
verificationToken,
|
|
3806
3854
|
verificationUUID: otpVerification.verificationUUID
|
|
3807
3855
|
};
|
|
3856
|
+
if (requestedScopes) verifyRequest.requestedScopes = requestedScopes;
|
|
3808
3857
|
if (otpVerification.email) return apiClient.verifyEmailVerification({
|
|
3809
3858
|
emailVerificationVerifyRequest: verifyRequest,
|
|
3810
3859
|
environmentId: core.environmentId
|
|
@@ -3828,8 +3877,14 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken }, cl
|
|
|
3828
3877
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3829
3878
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
3830
3879
|
*/
|
|
3831
|
-
const verifyOTP = async ({ otpVerification, verificationToken }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3832
|
-
|
|
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({
|
|
3833
3888
|
otpVerification,
|
|
3834
3889
|
verificationToken
|
|
3835
3890
|
}, client);
|
|
@@ -3837,34 +3892,6 @@ const verifyOTP = async ({ otpVerification, verificationToken }, client = requir
|
|
|
3837
3892
|
return response;
|
|
3838
3893
|
};
|
|
3839
3894
|
|
|
3840
|
-
//#endregion
|
|
3841
|
-
//#region src/errors/FeeEstimationFailedError.ts
|
|
3842
|
-
var FeeEstimationFailedError = class extends require_InvalidParamError.BaseError {
|
|
3843
|
-
constructor(params) {
|
|
3844
|
-
super({
|
|
3845
|
-
cause: params.cause || null,
|
|
3846
|
-
code: "fee_estimation_failed_error",
|
|
3847
|
-
docsUrl: null,
|
|
3848
|
-
name: "FeeEstimationFailedError",
|
|
3849
|
-
shortMessage: params.message
|
|
3850
|
-
});
|
|
3851
|
-
}
|
|
3852
|
-
};
|
|
3853
|
-
|
|
3854
|
-
//#endregion
|
|
3855
|
-
//#region src/errors/SimulationFailedError.ts
|
|
3856
|
-
var SimulationFailedError = class extends require_InvalidParamError.BaseError {
|
|
3857
|
-
constructor(params) {
|
|
3858
|
-
super({
|
|
3859
|
-
cause: params.cause || null,
|
|
3860
|
-
code: "simulation_failed_error",
|
|
3861
|
-
docsUrl: null,
|
|
3862
|
-
name: "SimulationFailedError",
|
|
3863
|
-
shortMessage: params.message
|
|
3864
|
-
});
|
|
3865
|
-
}
|
|
3866
|
-
};
|
|
3867
|
-
|
|
3868
3895
|
//#endregion
|
|
3869
3896
|
//#region src/modules/user/deleteUser/deleteUser.ts
|
|
3870
3897
|
/**
|
|
@@ -3991,11 +4018,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
3991
4018
|
*
|
|
3992
4019
|
* @param params.walletProviderKey - The unique key identifying the wallet provider to connect to (e.g. 'metamaskevm', 'phantomsol').
|
|
3993
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').
|
|
3994
4022
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3995
4023
|
* @returns A promise that resolves to the connected wallet account.
|
|
3996
4024
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
3997
4025
|
*/
|
|
3998
|
-
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4026
|
+
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3999
4027
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderByKey({ walletProviderKey }, client);
|
|
4000
4028
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
4001
4029
|
const { addresses } = await walletProvider.connect();
|
|
@@ -4011,6 +4039,7 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
4011
4039
|
address: mainAddress,
|
|
4012
4040
|
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
4013
4041
|
chain: walletProvider.chain,
|
|
4042
|
+
hardwareWalletVendor,
|
|
4014
4043
|
id: require_getVerifiedCredentialForWalletAccount.formatWalletAccountId({
|
|
4015
4044
|
address: mainAddress,
|
|
4016
4045
|
chain: walletProvider.chain,
|
|
@@ -4029,6 +4058,17 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
4029
4058
|
return walletAccount;
|
|
4030
4059
|
};
|
|
4031
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
|
+
|
|
4032
4072
|
//#endregion
|
|
4033
4073
|
//#region src/modules/wallets/utils/getChainIdForAccountVerification/getChainIdForAccountVerification.ts
|
|
4034
4074
|
const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
@@ -4110,10 +4150,14 @@ const isSameAddress = (left, right, chain) => require_getVerifiedCredentialForWa
|
|
|
4110
4150
|
|
|
4111
4151
|
//#endregion
|
|
4112
4152
|
//#region src/modules/wallets/verifyWalletAccountForSignInOrTransfer/verifyWalletAccountForSignInOrTransfer.ts
|
|
4113
|
-
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer }, client) => {
|
|
4153
|
+
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
4114
4154
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
4115
4155
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
4116
4156
|
const { messageToSign, signature } = await proveWalletAccountOwnership({ walletAccount }, client);
|
|
4157
|
+
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
4158
|
+
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
4159
|
+
signature
|
|
4160
|
+
}) : signature;
|
|
4117
4161
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
4118
4162
|
const response = await require_getNetworkProviderFromNetworkId.verifyMessageSignatureOwnership({
|
|
4119
4163
|
addressesWithTypes: walletAccount.addressesWithTypes,
|
|
@@ -4121,7 +4165,8 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
4121
4165
|
isTransfer,
|
|
4122
4166
|
messageToSign,
|
|
4123
4167
|
networkId,
|
|
4124
|
-
|
|
4168
|
+
requestedScopes,
|
|
4169
|
+
signature: formattedSignature,
|
|
4125
4170
|
walletAddress: walletAccount.address,
|
|
4126
4171
|
walletDisplayName: walletProvider.metadata.displayName,
|
|
4127
4172
|
walletProviderType: walletProvider.walletProviderType
|
|
@@ -4157,9 +4202,10 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
4157
4202
|
* @throws WalletAccountAlreadyVerifiedError If the wallet is already verified.
|
|
4158
4203
|
* @throws WalletAlreadyLinkedToAnotherUserError If the wallet is linked to another user.
|
|
4159
4204
|
*/
|
|
4160
|
-
const verifyWalletAccount = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4205
|
+
const verifyWalletAccount = async ({ walletAccount, requestedScopes }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4161
4206
|
return verifyWalletAccountForSignInOrTransfer({
|
|
4162
4207
|
isTransfer: false,
|
|
4208
|
+
requestedScopes,
|
|
4163
4209
|
walletAccount
|
|
4164
4210
|
}, client);
|
|
4165
4211
|
};
|
|
@@ -4174,12 +4220,14 @@ const verifyWalletAccount = async ({ walletAccount }, client = require_InvalidPa
|
|
|
4174
4220
|
* the wallet account is added to their profile.
|
|
4175
4221
|
*
|
|
4176
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').
|
|
4177
4224
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4178
4225
|
* @returns A promise that resolves to the connected and verified wallet account.
|
|
4179
4226
|
*/
|
|
4180
|
-
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4227
|
+
const connectAndVerifyWithWalletProvider = async ({ walletProviderKey, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4181
4228
|
const walletAccount = await connectWithWalletProvider({
|
|
4182
4229
|
addToDynamicWalletAccounts: false,
|
|
4230
|
+
hardwareWalletVendor,
|
|
4183
4231
|
walletProviderKey
|
|
4184
4232
|
}, client);
|
|
4185
4233
|
await verifyWalletAccount({ walletAccount }, client);
|
|
@@ -4261,6 +4309,30 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_Inva
|
|
|
4261
4309
|
};
|
|
4262
4310
|
};
|
|
4263
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
|
+
|
|
4264
4336
|
//#endregion
|
|
4265
4337
|
//#region src/modules/wallets/isWalletAccountVerified/isWalletAccountVerified.ts
|
|
4266
4338
|
/**
|
|
@@ -4676,6 +4748,7 @@ exports.authenticateMfaRecoveryCode = authenticateMfaRecoveryCode;
|
|
|
4676
4748
|
exports.authenticatePasskeyMFA = authenticatePasskeyMFA;
|
|
4677
4749
|
exports.authenticateTotpMfaDevice = authenticateTotpMfaDevice;
|
|
4678
4750
|
exports.authenticateWithSocial = authenticateWithSocial;
|
|
4751
|
+
exports.canConnectWithHardwareWallet = canConnectWithHardwareWallet;
|
|
4679
4752
|
exports.completeDeviceRegistration = completeDeviceRegistration;
|
|
4680
4753
|
exports.completeSocialAuthentication = completeSocialAuthentication;
|
|
4681
4754
|
exports.connectAndVerifyWithWalletProvider = connectAndVerifyWithWalletProvider;
|
|
@@ -4725,6 +4798,7 @@ exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|
|
|
4725
4798
|
exports.initializeClient = initializeClient;
|
|
4726
4799
|
exports.isCaptchaRequired = require_getNetworkProviderFromNetworkId.isCaptchaRequired;
|
|
4727
4800
|
exports.isDeviceRegistrationRequired = isDeviceRegistrationRequired;
|
|
4801
|
+
exports.isHardwareWalletAccount = isHardwareWalletAccount;
|
|
4728
4802
|
exports.isMfaRequiredForAction = require_isMfaRequiredForAction.isMfaRequiredForAction;
|
|
4729
4803
|
exports.isMobile = isMobile;
|
|
4730
4804
|
exports.isPendingRecoveryCodesAcknowledgment = isPendingRecoveryCodesAcknowledgment;
|
|
@@ -4753,6 +4827,7 @@ exports.setDefaultMfaDevice = setDefaultMfaDevice;
|
|
|
4753
4827
|
exports.signInWithExternalJwt = signInWithExternalJwt;
|
|
4754
4828
|
exports.signInWithPasskey = signInWithPasskey;
|
|
4755
4829
|
exports.signMessage = signMessage;
|
|
4830
|
+
exports.supportedCountries = supportedCountries;
|
|
4756
4831
|
exports.switchActiveNetwork = switchActiveNetwork;
|
|
4757
4832
|
exports.transferWalletAccount = transferWalletAccount;
|
|
4758
4833
|
exports.unlinkSocialAccount = unlinkSocialAccount;
|