@dynamic-labs-sdk/client 1.3.0 → 1.5.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-DQvZQdQ9.cjs → InvalidParamError-DKJhDrK8.cjs} +1056 -110
- package/dist/InvalidParamError-DKJhDrK8.cjs.map +1 -0
- package/dist/{InvalidParamError-Za4cvW7K.esm.js → InvalidParamError-DWjMfOZ5.esm.js} +852 -95
- package/dist/InvalidParamError-DWjMfOZ5.esm.js.map +1 -0
- package/dist/{InvalidParamError-9kQBK3sP.native.esm.js → InvalidParamError-DkAMYJOW.native.esm.js} +885 -95
- package/dist/InvalidParamError-DkAMYJOW.native.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-By3Y4taq.esm.js → NotWaasWalletAccountError-BVrvQzLz.native.esm.js} +7 -5
- package/dist/NotWaasWalletAccountError-BVrvQzLz.native.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-BTMvHTA8.native.esm.js → NotWaasWalletAccountError-C7NUlvvM.esm.js} +7 -5
- package/dist/NotWaasWalletAccountError-C7NUlvvM.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-Ciq7b-Y6.cjs → NotWaasWalletAccountError-CHzpa9kk.cjs} +7 -5
- package/dist/NotWaasWalletAccountError-CHzpa9kk.cjs.map +1 -0
- package/dist/core.cjs +46 -23
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +29 -8
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +27 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/exports/core.d.ts +6 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +14 -1
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BA0CHZzu.cjs → getNetworkProviderFromNetworkId-BJ27N-7S.cjs} +113 -348
- package/dist/getNetworkProviderFromNetworkId-BJ27N-7S.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js → getNetworkProviderFromNetworkId-Bs1kQdWk.native.esm.js} +106 -311
- package/dist/getNetworkProviderFromNetworkId-Bs1kQdWk.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-RWcIZDgC.esm.js → getNetworkProviderFromNetworkId-Cqp9eRSs.esm.js} +110 -282
- package/dist/getNetworkProviderFromNetworkId-Cqp9eRSs.esm.js.map +1 -0
- package/dist/{getSignedSessionId-la6RXITX.esm.js → getSignedSessionId-CDdKrnw6.esm.js} +3 -3
- package/dist/{getSignedSessionId-la6RXITX.esm.js.map → getSignedSessionId-CDdKrnw6.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-BCU987hO.cjs → getSignedSessionId-CHDHr-hY.cjs} +3 -3
- package/dist/{getSignedSessionId-BCU987hO.cjs.map → getSignedSessionId-CHDHr-hY.cjs.map} +1 -1
- package/dist/{getSignedSessionId-DzNCj6g_.native.esm.js → getSignedSessionId-D3KQrN8W.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-DzNCj6g_.native.esm.js.map → getSignedSessionId-D3KQrN8W.native.esm.js.map} +1 -1
- package/dist/getVerifiedCredentialForWalletAccount-BuUCX040.esm.js +269 -0
- package/dist/getVerifiedCredentialForWalletAccount-BuUCX040.esm.js.map +1 -0
- package/dist/getVerifiedCredentialForWalletAccount-Ciac5d5L.native.esm.js +269 -0
- package/dist/getVerifiedCredentialForWalletAccount-Ciac5d5L.native.esm.js.map +1 -0
- package/dist/getVerifiedCredentialForWalletAccount-gCx0smU8.cjs +346 -0
- package/dist/getVerifiedCredentialForWalletAccount-gCx0smU8.cjs.map +1 -0
- package/dist/index.cjs +754 -319
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +687 -260
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +684 -257
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-C1u4Z__n.esm.js → isMfaRequiredForAction-B0xNvBpU.native.esm.js} +5 -3
- package/dist/isMfaRequiredForAction-B0xNvBpU.native.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-CMClgbT0.cjs → isMfaRequiredForAction-CLMvTTwl.cjs} +5 -3
- package/dist/isMfaRequiredForAction-CLMvTTwl.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-DSX-TV2z.native.esm.js → isMfaRequiredForAction-C_QPI1LH.esm.js} +5 -3
- package/dist/isMfaRequiredForAction-C_QPI1LH.esm.js.map +1 -0
- package/dist/modules/apiClient/apiClient.types.d.ts +12 -0
- package/dist/modules/apiClient/apiClient.types.d.ts.map +1 -1
- package/dist/modules/apiClient/createApiClient.d.ts.map +1 -1
- package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts +27 -0
- package/dist/modules/apiClient/utils/sessionExpiryLogoutMiddleware/createSessionExpiryLogoutMiddleware.d.ts.map +1 -0
- package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts +1 -0
- package/dist/modules/auth/externalAuth/requestExternalAuthElevatedToken/requestExternalAuthElevatedToken.d.ts.map +1 -1
- package/dist/modules/auth/isSignedIn/isSignedIn.d.ts +11 -1
- package/dist/modules/auth/isSignedIn/isSignedIn.d.ts.map +1 -1
- package/dist/modules/auth/logoutReason.d.ts +1 -1
- package/dist/modules/auth/logoutReason.d.ts.map +1 -1
- package/dist/modules/auth/logoutWithReason/logoutWithReason.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts +2 -1
- package/dist/modules/auth/passkeys/registerPasskey/registerPasskey.d.ts.map +1 -1
- package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts +1 -0
- package/dist/modules/auth/passkeys/signInWithPasskey/signInWithPasskey.d.ts.map +1 -1
- package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts +2 -1
- package/dist/modules/auth/social/oauth/unlinkSocialAccount/unlinkSocialAccount.d.ts.map +1 -1
- package/dist/modules/balances/getBalances/getBalances.d.ts +9 -45
- package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts +13 -20
- package/dist/modules/balances/getMultichainBalances/getMultichainBalances.d.ts.map +1 -1
- package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts +26 -0
- package/dist/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.d.ts.map +1 -0
- package/dist/modules/balances/getMultichainTokenBalances/index.d.ts +2 -0
- package/dist/modules/balances/getMultichainTokenBalances/index.d.ts.map +1 -0
- package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts +56 -0
- package/dist/modules/balances/getTokenBalances/getTokenBalances.d.ts.map +1 -0
- package/dist/modules/balances/getTokenBalances/index.d.ts +3 -0
- package/dist/modules/balances/getTokenBalances/index.d.ts.map +1 -0
- package/dist/modules/captcha/setCaptchaToken/setCaptchaToken.d.ts +2 -1
- package/dist/modules/captcha/setCaptchaToken/setCaptchaToken.d.ts.map +1 -1
- package/dist/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.d.ts.map +1 -1
- package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts +1 -1
- package/dist/modules/checkout/broadcastCheckoutTransaction/broadcastCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/cancelCheckoutTransaction/cancelCheckoutTransaction.d.ts +1 -1
- package/dist/modules/checkout/cancelCheckoutTransaction/cancelCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts.map +1 -1
- package/dist/modules/checkout/prepareCheckoutTransaction/prepareCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.d.ts +22 -0
- package/dist/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.d.ts.map +1 -0
- package/dist/modules/checkout/utils/clearCheckoutSessionToken/index.d.ts +3 -0
- package/dist/modules/checkout/utils/clearCheckoutSessionToken/index.d.ts.map +1 -0
- package/dist/modules/checkout/utils/subscribeToCheckoutTransaction/subscribeToCheckoutTransaction.d.ts.map +1 -1
- package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/index.d.ts +3 -0
- package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/index.d.ts.map +1 -0
- package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.d.ts +16 -0
- package/dist/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.d.ts.map +1 -0
- package/dist/modules/deviceRegistration/getRegisteredDevices/getRegisteredDevices.d.ts.map +1 -1
- package/dist/modules/funding/moonpay/errors/MoonPayCurrenciesFetchError.d.ts +5 -0
- package/dist/modules/funding/moonpay/errors/MoonPayCurrenciesFetchError.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/errors/MoonPayInvalidUrlError.d.ts +5 -0
- package/dist/modules/funding/moonpay/errors/MoonPayInvalidUrlError.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.d.ts +5 -0
- package/dist/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.d.ts +14 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/index.d.ts +2 -0
- package/dist/modules/funding/moonpay/getMoonPayCurrencies/index.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts +15 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/index.d.ts +2 -0
- package/dist/modules/funding/moonpay/getMoonPayUrl/index.d.ts.map +1 -0
- package/dist/modules/funding/moonpay/moonpay.types.d.ts +26 -0
- package/dist/modules/funding/moonpay/moonpay.types.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts +12 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts.map +1 -1
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.d.ts +26 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.d.ts +18 -0
- package/dist/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/legacyWalletBook.types.d.ts +2 -2
- package/dist/modules/legacyWalletBook/legacyWalletBook.types.d.ts.map +1 -1
- package/dist/modules/mfa/consumeMfaToken/consumeMfaToken.d.ts +2 -1
- package/dist/modules/mfa/consumeMfaToken/consumeMfaToken.d.ts.map +1 -1
- package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts +2 -1
- package/dist/modules/mfa/createNewMfaRecoveryCodes/createNewMfaRecoveryCodes.d.ts.map +1 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts +2 -1
- package/dist/modules/otp/verifyOTP/verifyOTP.d.ts.map +1 -1
- package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts +13 -1
- package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts.map +1 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts +2 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.d.ts +27 -0
- package/dist/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts +8 -5
- package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts +11 -4
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.d.ts +35 -0
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +9 -14
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts +1 -1
- package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts +1 -1
- package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts +1 -1
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +34 -35
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -1
- package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts +1 -1
- package/dist/modules/wallets/connectWithWalletProvider/connectWithWalletProvider.d.ts.map +1 -1
- package/dist/modules/wallets/constants.d.ts +7 -0
- package/dist/modules/wallets/constants.d.ts.map +1 -1
- package/dist/modules/wallets/getAvailableWalletProvidersData/getAvailableWalletProvidersData.d.ts.map +1 -1
- package/dist/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.d.ts +26 -0
- package/dist/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.d.ts.map +1 -0
- package/dist/modules/wallets/hasWalletProviderConnectMethod/index.d.ts +2 -0
- package/dist/modules/wallets/hasWalletProviderConnectMethod/index.d.ts.map +1 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/index.d.ts +2 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/index.d.ts.map +1 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts +14 -0
- package/dist/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts +6 -17
- package/dist/modules/wallets/networks/getBalance/getBalance.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts +24 -0
- package/dist/modules/wallets/networks/getNativeBalance/getNativeBalance.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getNativeBalance/index.d.ts +2 -0
- package/dist/modules/wallets/networks/getNativeBalance/index.d.ts.map +1 -0
- package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/index.d.ts +2 -0
- package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/index.d.ts.map +1 -0
- package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/reconcileWalletAccountsAgainstClient.d.ts +25 -0
- package/dist/modules/wallets/reconcileWalletAccountsAgainstClient/reconcileWalletAccountsAgainstClient.d.ts.map +1 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +10 -0
- package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
- package/dist/services/instrumentation/connectLoggerToInstrumentation/connectLoggerToInstrumentation.d.ts.map +1 -1
- package/dist/services/instrumentation/constants.d.ts +22 -0
- package/dist/services/instrumentation/constants.d.ts.map +1 -1
- package/dist/services/instrumentation/scrubParameters/scrubParameters.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.d.ts +29 -0
- package/dist/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.d.ts.map +1 -0
- package/dist/utils/appendConnectionUriToDeeplink/index.d.ts +2 -0
- package/dist/utils/appendConnectionUriToDeeplink/index.d.ts.map +1 -0
- package/dist/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.d.ts +22 -0
- package/dist/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.d.ts.map +1 -0
- package/dist/utils/getChainFromWalletBookIdentifier/index.d.ts +2 -0
- package/dist/utils/getChainFromWalletBookIdentifier/index.d.ts.map +1 -0
- package/dist/utils/getNativeLinkScheme/getNativeLinkScheme.d.ts +18 -0
- package/dist/utils/getNativeLinkScheme/getNativeLinkScheme.d.ts.map +1 -0
- package/dist/utils/getNativeLinkScheme/index.d.ts +3 -0
- package/dist/utils/getNativeLinkScheme/index.d.ts.map +1 -0
- package/dist/utils/isMobile/isMobile.d.ts +8 -0
- package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
- package/dist/waas.cjs +8 -9
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +3 -3
- package/dist/waasCore.cjs +3 -4
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +3 -3
- package/dist/waasCore.native.esm.js +3 -3
- package/package.json +4 -4
- package/dist/InvalidParamError-9kQBK3sP.native.esm.js.map +0 -1
- package/dist/InvalidParamError-DQvZQdQ9.cjs.map +0 -1
- package/dist/InvalidParamError-Za4cvW7K.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-BTMvHTA8.native.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-By3Y4taq.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-Ciq7b-Y6.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-BA0CHZzu.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-RWcIZDgC.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js +0 -701
- package/dist/getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs +0 -887
- package/dist/getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js +0 -701
- package/dist/getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-C1u4Z__n.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-CMClgbT0.cjs.map +0 -1
- package/dist/isMfaRequiredForAction-DSX-TV2z.native.esm.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-
|
|
5
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_InvalidParamError = require('./InvalidParamError-DKJhDrK8.cjs');
|
|
2
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-BJ27N-7S.cjs');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-gCx0smU8.cjs');
|
|
4
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-CHzpa9kk.cjs');
|
|
5
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-CLMvTTwl.cjs');
|
|
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");
|
|
9
|
-
zod_mini =
|
|
9
|
+
zod_mini = require_InvalidParamError.__toESM(zod_mini);
|
|
10
10
|
let eventemitter3 = require("eventemitter3");
|
|
11
|
-
eventemitter3 =
|
|
11
|
+
eventemitter3 = require_InvalidParamError.__toESM(eventemitter3);
|
|
12
12
|
let _simplewebauthn_browser = require("@simplewebauthn/browser");
|
|
13
13
|
|
|
14
14
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -28,11 +28,33 @@ const stateChangeEvents = {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region src/utils/
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
//#region src/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.ts
|
|
32
|
+
/**
|
|
33
|
+
* Appends a wallet connection URI to a deeplink URL.
|
|
34
|
+
*
|
|
35
|
+
* Generic across URI-deeplink connection options — works for both
|
|
36
|
+
* WalletConnect pairing URIs and MetaMask SDK URIs. Determines the
|
|
37
|
+
* appropriate query parameter separator based on whether the deeplink
|
|
38
|
+
* already contains query parameters.
|
|
39
|
+
*
|
|
40
|
+
* @param params.deeplinkUrl - The base deeplink URL (e.g., `walletapp://wc` or `walletapp://wc?param=value`).
|
|
41
|
+
* @param params.connectionUri - The connection URI to append.
|
|
42
|
+
* @returns The deeplink URL with the connection URI appended as a query parameter.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* appendConnectionUriToDeeplink({ deeplinkUrl: 'walletapp://wc', connectionUri: 'wc:123-456' })
|
|
47
|
+
* // Returns: 'walletapp://wc?uri=wc%3A123-456'
|
|
48
|
+
*
|
|
49
|
+
* appendConnectionUriToDeeplink({ deeplinkUrl: 'walletapp://wc?param=value', connectionUri: 'wc:123-456' })
|
|
50
|
+
* // Returns: 'walletapp://wc?param=value&uri=wc%3A123-456'
|
|
51
|
+
* ```
|
|
52
|
+
* @not-instrumented
|
|
53
|
+
*/
|
|
54
|
+
const appendConnectionUriToDeeplink = ({ connectionUri, deeplinkUrl }) => {
|
|
55
|
+
const url = new URL(deeplinkUrl);
|
|
56
|
+
url.searchParams.set("uri", connectionUri);
|
|
57
|
+
return url.href;
|
|
36
58
|
};
|
|
37
59
|
|
|
38
60
|
//#endregion
|
|
@@ -52,6 +74,14 @@ const createRuntimeServices = () => {
|
|
|
52
74
|
};
|
|
53
75
|
};
|
|
54
76
|
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region src/utils/getNonce/prefetchNoncesIfNeeded/prefetchNoncesIfNeeded.ts
|
|
79
|
+
/** @not-instrumented */
|
|
80
|
+
const prefetchNoncesIfNeeded = async (client) => {
|
|
81
|
+
if (require_InvalidParamError.getCore(client).state.get().prefetchedNonces.length >= require_InvalidParamError.NONCE_POOL_SIZE) return;
|
|
82
|
+
await require_InvalidParamError.fetchAndStoreNonces(client);
|
|
83
|
+
};
|
|
84
|
+
|
|
55
85
|
//#endregion
|
|
56
86
|
//#region src/modules/auth/initializeAuth/setLongTimeout/setLongTimeout.ts
|
|
57
87
|
/**
|
|
@@ -92,7 +122,7 @@ const initializeAuth = (client) => {
|
|
|
92
122
|
const now = /* @__PURE__ */ new Date();
|
|
93
123
|
const timeUntilExpiration = expiration.getTime() - now.getTime();
|
|
94
124
|
if (timeUntilExpiration <= 0) {
|
|
95
|
-
|
|
125
|
+
require_InvalidParamError.__logoutWithReason_wrapped({ reason: "token-expired" }, client);
|
|
96
126
|
return;
|
|
97
127
|
}
|
|
98
128
|
clearExpirationTimeout = setLongTimeout({
|
|
@@ -130,7 +160,7 @@ const setupCrossTabEventSync = (client) => {
|
|
|
130
160
|
};
|
|
131
161
|
core.eventEmitter.on("deviceRegistrationCompleted", handleDeviceRegistrationCompleted);
|
|
132
162
|
const handleCrossTabDeviceRegistrationCompleted = () => {
|
|
133
|
-
|
|
163
|
+
require_InvalidParamError.emitEvent({ event: "deviceRegistrationCompletedInAnotherTab" }, client);
|
|
134
164
|
};
|
|
135
165
|
core.crossTabBroadcast.on("deviceRegistrationCompleted", handleCrossTabDeviceRegistrationCompleted);
|
|
136
166
|
};
|
|
@@ -157,7 +187,7 @@ const walletProviderKeyMapSchema = zod_mini.record(zod_mini.string(), zod_mini.s
|
|
|
157
187
|
|
|
158
188
|
//#endregion
|
|
159
189
|
//#region src/modules/storageSync/schema.ts
|
|
160
|
-
const stateStorageKeySchema =
|
|
190
|
+
const stateStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
161
191
|
key: "state",
|
|
162
192
|
schema: zod_mini.object({
|
|
163
193
|
apiVersion: zod_mini.string(),
|
|
@@ -169,7 +199,7 @@ const stateStorageKeySchema = require_getNetworkProviderFromNetworkId.createStor
|
|
|
169
199
|
walletProviderKeyMap: walletProviderKeyMapSchema
|
|
170
200
|
})
|
|
171
201
|
});
|
|
172
|
-
const sessionStorageKeySchema =
|
|
202
|
+
const sessionStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
173
203
|
config: { storageTier: "secure" },
|
|
174
204
|
key: "session",
|
|
175
205
|
schema: zod_mini.object({
|
|
@@ -263,7 +293,7 @@ const raiseStateEvents = (client) => {
|
|
|
263
293
|
require_InvalidParamError.getCore(client).state.subscribe((value, previous) => {
|
|
264
294
|
Object.entries(stateChangeEvents).forEach(([key, event]) => {
|
|
265
295
|
if (require_getNetworkProviderFromNetworkId.isEqualShallow(value[key], previous[key])) return;
|
|
266
|
-
|
|
296
|
+
require_InvalidParamError.emitEvent({
|
|
267
297
|
args: { [key]: value[key] },
|
|
268
298
|
event
|
|
269
299
|
}, client);
|
|
@@ -429,10 +459,10 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
429
459
|
logger: core.logger,
|
|
430
460
|
state: core.state,
|
|
431
461
|
storage: core.storage
|
|
432
|
-
}).catch(() =>
|
|
433
|
-
if (core.state.get().sessionKeys && !await core.keychain.hasKey("session")) await
|
|
462
|
+
}).catch(() => require_InvalidParamError.__logoutWithReason_wrapped({ reason: "keychain-migration-failed" }, client));
|
|
463
|
+
if (core.state.get().sessionKeys && !await core.keychain.hasKey("session")) await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "keychain-key-missing" }, client);
|
|
434
464
|
}).then(async () => {
|
|
435
|
-
if (!core.state.get().projectSettings) await
|
|
465
|
+
if (!core.state.get().projectSettings) await require_InvalidParamError.fetchProjectSettings(client);
|
|
436
466
|
});
|
|
437
467
|
fetchProjectSettingsPromise.then(() => prefetchNoncesIfNeeded(client)).catch((error) => {
|
|
438
468
|
core.logger.error("Failed to prefetch nonces:", error);
|
|
@@ -441,7 +471,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
441
471
|
* Generate session keys if they don't exist
|
|
442
472
|
*/
|
|
443
473
|
const generateSessionKeysPromise = fetchProjectSettingsPromise.then(async () => {
|
|
444
|
-
if (!core.state.get().sessionKeys) await
|
|
474
|
+
if (!core.state.get().sessionKeys) await require_InvalidParamError.generateSessionKeys(client);
|
|
445
475
|
});
|
|
446
476
|
/**
|
|
447
477
|
* Refresh user state on initialization when cookie is enabled.
|
|
@@ -466,7 +496,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
466
496
|
if (require_InvalidParamError.isCookieEnabled(client)) await require_NotWaasWalletAccountError.__refreshAuth_wrapped(client).catch(async (error) => {
|
|
467
497
|
if (error.status === 401) {
|
|
468
498
|
core.logger.error("Session expired during initialization", error);
|
|
469
|
-
if (client.user) await
|
|
499
|
+
if (client.user) await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "session-refresh-unauthorized" }, client);
|
|
470
500
|
} else throw error;
|
|
471
501
|
});
|
|
472
502
|
});
|
|
@@ -477,7 +507,7 @@ const initializeClient = async (client = require_InvalidParamError.getDefaultCli
|
|
|
477
507
|
*/
|
|
478
508
|
const refreshUserStateFromValidTokenPromise = refreshUserStateFromCookiePromise.then(async () => {
|
|
479
509
|
if (core.state.get().token && !core.state.get().user) await __refreshUser_wrapped(client).catch(async () => {
|
|
480
|
-
await
|
|
510
|
+
await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "user-refresh-failed" }, client);
|
|
481
511
|
});
|
|
482
512
|
});
|
|
483
513
|
core.initTrack.track({
|
|
@@ -628,10 +658,13 @@ const connectLoggerToInstrumentation = ({ environmentId, extensions, instrumenta
|
|
|
628
658
|
const { token, user } = state.get();
|
|
629
659
|
instrumentation.log({
|
|
630
660
|
environmentId,
|
|
631
|
-
parameters: {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
661
|
+
parameters: require_InvalidParamError.scrubParameters({
|
|
662
|
+
piiFields: instrumentation.config.piiFields,
|
|
663
|
+
value: {
|
|
664
|
+
args,
|
|
665
|
+
message
|
|
666
|
+
}
|
|
667
|
+
}),
|
|
635
668
|
registeredExtensionKeys: Array.from(extensions),
|
|
636
669
|
sdkSessionId,
|
|
637
670
|
sdkVersion,
|
|
@@ -1543,6 +1576,7 @@ const __checkStepUpAuth_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1543
1576
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1544
1577
|
* @returns A promise that resolves to the assertion response containing the elevated access token.
|
|
1545
1578
|
* @instrumented
|
|
1579
|
+
* @redact-params
|
|
1546
1580
|
*/
|
|
1547
1581
|
const requestExternalAuthElevatedToken = async ({ externalJwt }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1548
1582
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -1570,7 +1604,8 @@ const __requestExternalAuthElevatedToken_wrapped = require_InvalidParamError.ins
|
|
|
1570
1604
|
} catch {
|
|
1571
1605
|
return;
|
|
1572
1606
|
}
|
|
1573
|
-
}
|
|
1607
|
+
},
|
|
1608
|
+
redactAll: true
|
|
1574
1609
|
});
|
|
1575
1610
|
|
|
1576
1611
|
//#endregion
|
|
@@ -1629,7 +1664,7 @@ const logout = async (client = require_InvalidParamError.getDefaultClient()) =>
|
|
|
1629
1664
|
* `logoutWithReason` — this wrapper is intentionally not instrumented so that
|
|
1630
1665
|
* Datadog sees a single function name per logout regardless of entry point.
|
|
1631
1666
|
*/
|
|
1632
|
-
return
|
|
1667
|
+
return require_InvalidParamError.__logoutWithReason_wrapped({ reason: "user-intent" }, client);
|
|
1633
1668
|
};
|
|
1634
1669
|
|
|
1635
1670
|
//#endregion
|
|
@@ -1722,6 +1757,7 @@ const serverRegisterPasskey = async ({ registration, createMfaToken }, client) =
|
|
|
1722
1757
|
* @returns A promise that resolves to the registration response.
|
|
1723
1758
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1724
1759
|
* @instrumented
|
|
1760
|
+
* @redact-params
|
|
1725
1761
|
*/
|
|
1726
1762
|
const registerPasskey = async ({ createMfaToken } = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1727
1763
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -1744,7 +1780,8 @@ const __registerPasskey_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1744
1780
|
} catch {
|
|
1745
1781
|
return;
|
|
1746
1782
|
}
|
|
1747
|
-
}
|
|
1783
|
+
},
|
|
1784
|
+
redactAll: true
|
|
1748
1785
|
});
|
|
1749
1786
|
|
|
1750
1787
|
//#endregion
|
|
@@ -1789,6 +1826,7 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client) =
|
|
|
1789
1826
|
* @returns A promise that resolves to the authentication response.
|
|
1790
1827
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1791
1828
|
* @instrumented
|
|
1829
|
+
* @redact-params
|
|
1792
1830
|
*/
|
|
1793
1831
|
const signInWithPasskey = async ({ relatedOriginRpId } = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1794
1832
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -1808,7 +1846,8 @@ const __signInWithPasskey_wrapped = require_InvalidParamError.instrumentFunction
|
|
|
1808
1846
|
} catch {
|
|
1809
1847
|
return;
|
|
1810
1848
|
}
|
|
1811
|
-
}
|
|
1849
|
+
},
|
|
1850
|
+
redactAll: true
|
|
1812
1851
|
});
|
|
1813
1852
|
|
|
1814
1853
|
//#endregion
|
|
@@ -1847,7 +1886,7 @@ const removeDynamicOauthParamsFromUrl = (url) => {
|
|
|
1847
1886
|
//#endregion
|
|
1848
1887
|
//#region src/modules/auth/social/oauth/redirectStateStorageSchema/redirectStateStorageSchema.ts
|
|
1849
1888
|
/** The schema to track the state of the OAuth flow. */
|
|
1850
|
-
const redirectStateStorageKeySchema =
|
|
1889
|
+
const redirectStateStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
1851
1890
|
key: "redirectState",
|
|
1852
1891
|
schema: zod_mini.object({
|
|
1853
1892
|
codeVerifier: zod_mini.optional(zod_mini.string()),
|
|
@@ -2235,7 +2274,7 @@ const detectOAuthRedirect = (params, client = require_InvalidParamError.getDefau
|
|
|
2235
2274
|
* @not-instrumented
|
|
2236
2275
|
*/
|
|
2237
2276
|
const getPrimaryWalletAccount = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2238
|
-
const sortedLastSelectedWalletAccounts =
|
|
2277
|
+
const sortedLastSelectedWalletAccounts = require_InvalidParamError.getWalletAccounts(client).filter((walletAccount) => Boolean(walletAccount.lastSelectedAt)).sort((a, b) => b.lastSelectedAt.getTime() - a.lastSelectedAt.getTime());
|
|
2239
2278
|
if (sortedLastSelectedWalletAccounts.length === 0) return null;
|
|
2240
2279
|
const [primaryWalletAccount] = sortedLastSelectedWalletAccounts;
|
|
2241
2280
|
return primaryWalletAccount;
|
|
@@ -2250,6 +2289,7 @@ const getPrimaryWalletAccount = (client = require_InvalidParamError.getDefaultCl
|
|
|
2250
2289
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2251
2290
|
* @returns A promise that resolves to the verify response.
|
|
2252
2291
|
* @instrumented
|
|
2292
|
+
* @redact-params
|
|
2253
2293
|
*/
|
|
2254
2294
|
const unlinkSocialAccount = async ({ verifiedCredentialId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2255
2295
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -2275,26 +2315,34 @@ const __unlinkSocialAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
2275
2315
|
} catch {
|
|
2276
2316
|
return;
|
|
2277
2317
|
}
|
|
2278
|
-
}
|
|
2318
|
+
},
|
|
2319
|
+
redactAll: true
|
|
2279
2320
|
});
|
|
2280
2321
|
|
|
2281
2322
|
//#endregion
|
|
2282
|
-
//#region src/modules/balances/
|
|
2323
|
+
//#region src/modules/balances/getTokenBalances/getTokenBalances.ts
|
|
2283
2324
|
/**
|
|
2284
|
-
* Retrieves the token balances for a wallet account.
|
|
2325
|
+
* Retrieves the token balances for a wallet account on one chain. Fetched
|
|
2326
|
+
* from the Dynamic API.
|
|
2327
|
+
*
|
|
2328
|
+
* Use this for ERC-20-style token balances scoped to a single wallet
|
|
2329
|
+
* account. Supports optional spam filtering, price inclusion, native-token
|
|
2330
|
+
* inclusion, and one-or-many networks within the wallet's chain.
|
|
2285
2331
|
*
|
|
2286
|
-
*
|
|
2332
|
+
* For native-only balance, use {@link getNativeBalance}. For a
|
|
2333
|
+
* multi-chain portfolio across many addresses, use
|
|
2334
|
+
* {@link getMultichainTokenBalances}.
|
|
2287
2335
|
*
|
|
2288
2336
|
* @param params.walletAccount - The wallet account to get the balances for.
|
|
2289
2337
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2290
2338
|
* @returns A promise that resolves to an array of token balances.
|
|
2291
2339
|
* @not-instrumented
|
|
2292
2340
|
*/
|
|
2293
|
-
const
|
|
2341
|
+
const getTokenBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2294
2342
|
const core = require_InvalidParamError.getCore(client);
|
|
2295
2343
|
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
2296
2344
|
if (!networkId && !networkIds) {
|
|
2297
|
-
const activeNetworkId = await
|
|
2345
|
+
const activeNetworkId = await require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
2298
2346
|
networkId = Number(activeNetworkId.networkId);
|
|
2299
2347
|
}
|
|
2300
2348
|
return await apiClient.getAccountBalances({
|
|
@@ -2312,19 +2360,22 @@ const getBalances = async ({ walletAccount, networkId, networkIds, includePrices
|
|
|
2312
2360
|
};
|
|
2313
2361
|
|
|
2314
2362
|
//#endregion
|
|
2315
|
-
//#region src/modules/balances/
|
|
2363
|
+
//#region src/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.ts
|
|
2316
2364
|
/**
|
|
2317
|
-
* Retrieves token balances across multiple
|
|
2365
|
+
* Retrieves token balances across multiple chains, networks, and addresses
|
|
2366
|
+
* in a single batched API request.
|
|
2318
2367
|
*
|
|
2319
|
-
*
|
|
2320
|
-
*
|
|
2368
|
+
* Use this for portfolio-style views that need to render a user's holdings
|
|
2369
|
+
* across their entire multi-chain wallet set. For a single account on one
|
|
2370
|
+
* chain, use {@link getTokenBalances}; for native-only balance, use
|
|
2371
|
+
* {@link getNativeBalance}.
|
|
2321
2372
|
*
|
|
2322
2373
|
* @param params.balanceRequest - The balance request configuration specifying which chains, networks and addresses to query.
|
|
2323
2374
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2324
2375
|
* @returns A promise that resolves to the chain balances across multiple networks.
|
|
2325
2376
|
* @not-instrumented
|
|
2326
2377
|
*/
|
|
2327
|
-
const
|
|
2378
|
+
const getMultichainTokenBalances = async ({ balanceRequest }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2328
2379
|
const core = require_InvalidParamError.getCore(client);
|
|
2329
2380
|
return (await require_InvalidParamError.createApiClient({}, client).postMultichainAccountBalances({
|
|
2330
2381
|
environmentId: core.environmentId,
|
|
@@ -2336,7 +2387,7 @@ const getMultichainBalances = async ({ balanceRequest }, client = require_Invali
|
|
|
2336
2387
|
//#region src/modules/checkout/utils/createCheckoutSessionTokenStorageKey/createCheckoutSessionTokenStorageKey.ts
|
|
2337
2388
|
/** @not-instrumented */
|
|
2338
2389
|
const createCheckoutSessionTokenStorageKey = (transactionId) => {
|
|
2339
|
-
return
|
|
2390
|
+
return require_InvalidParamError.createStorageKeySchema({
|
|
2340
2391
|
key: `checkoutSessionToken:${transactionId}`,
|
|
2341
2392
|
schema: zod_mini.string()
|
|
2342
2393
|
});
|
|
@@ -2357,6 +2408,52 @@ const createCheckoutApiClient = async ({ transactionId }, client) => {
|
|
|
2357
2408
|
};
|
|
2358
2409
|
};
|
|
2359
2410
|
|
|
2411
|
+
//#endregion
|
|
2412
|
+
//#region src/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.ts
|
|
2413
|
+
/**
|
|
2414
|
+
* Removes the locally stored checkout session token for the given transaction.
|
|
2415
|
+
*
|
|
2416
|
+
* The checkout session token is the anonymous credential that authorizes
|
|
2417
|
+
* mutations to a single in-flight checkout transaction. Once the transaction
|
|
2418
|
+
* has reached a terminal state (cancelled, expired, failed, completed) it can
|
|
2419
|
+
* no longer be advanced, and the token is dead weight that should not be
|
|
2420
|
+
* persisted in browser storage — leaving it around lets a later XSS payload
|
|
2421
|
+
* exfiltrate a credential with no further use, and it can also confuse the
|
|
2422
|
+
* SDK on subsequent loads into believing an active session exists.
|
|
2423
|
+
*
|
|
2424
|
+
* The server-side revocation lives in dashboard-api; this is the SDK-side
|
|
2425
|
+
* defense-in-depth.
|
|
2426
|
+
*
|
|
2427
|
+
* @not-instrumented
|
|
2428
|
+
*/
|
|
2429
|
+
const clearCheckoutSessionToken = async ({ transactionId }, client) => {
|
|
2430
|
+
await require_InvalidParamError.getCore(client).storage.removeItem(createCheckoutSessionTokenStorageKey(transactionId));
|
|
2431
|
+
};
|
|
2432
|
+
|
|
2433
|
+
//#endregion
|
|
2434
|
+
//#region src/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.ts
|
|
2435
|
+
/**
|
|
2436
|
+
* Checkout mutation routes are guarded server-side only by session-token
|
|
2437
|
+
* validation, so a 401 means the token is dead (revoked, expired, deleted,
|
|
2438
|
+
* or invalid). Leaving a dead token in `localStorage` widens the XSS
|
|
2439
|
+
* exfiltration surface for no benefit and makes the next SDK load attempt
|
|
2440
|
+
* requests that are guaranteed to fail.
|
|
2441
|
+
*
|
|
2442
|
+
* @not-instrumented
|
|
2443
|
+
*/
|
|
2444
|
+
const withCheckoutSessionTokenCleanupOn401 = async ({ call, transactionId }, client) => {
|
|
2445
|
+
try {
|
|
2446
|
+
return await call();
|
|
2447
|
+
} catch (error) {
|
|
2448
|
+
if (error instanceof require_InvalidParamError.APIError && error.status === 401) try {
|
|
2449
|
+
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2450
|
+
} catch (cleanupError) {
|
|
2451
|
+
require_InvalidParamError.getCore(client).logger.error("Failed to clear checkout session token after 401", cleanupError);
|
|
2452
|
+
}
|
|
2453
|
+
throw error;
|
|
2454
|
+
}
|
|
2455
|
+
};
|
|
2456
|
+
|
|
2360
2457
|
//#endregion
|
|
2361
2458
|
//#region src/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.ts
|
|
2362
2459
|
/**
|
|
@@ -2381,12 +2478,15 @@ const attachCheckoutTransactionSource = async (params, client = require_InvalidP
|
|
|
2381
2478
|
attachSourceRequest.fromChainId = params.fromChainId;
|
|
2382
2479
|
attachSourceRequest.fromChainName = params.fromChainName;
|
|
2383
2480
|
}
|
|
2384
|
-
return
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2481
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2482
|
+
call: () => apiClient.attachSource({
|
|
2483
|
+
attachSourceRequest,
|
|
2484
|
+
environmentId,
|
|
2485
|
+
transactionId,
|
|
2486
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2487
|
+
}),
|
|
2488
|
+
transactionId
|
|
2489
|
+
}, client);
|
|
2390
2490
|
};
|
|
2391
2491
|
const __attachCheckoutTransactionSource_impl = attachCheckoutTransactionSource;
|
|
2392
2492
|
const __attachCheckoutTransactionSource_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -2417,12 +2517,15 @@ const __attachCheckoutTransactionSource_wrapped = require_InvalidParamError.inst
|
|
|
2417
2517
|
*/
|
|
2418
2518
|
const broadcastCheckoutTransaction = async ({ transactionId, txHash }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2419
2519
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2420
|
-
return
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2520
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2521
|
+
call: () => apiClient.recordCheckoutBroadcast({
|
|
2522
|
+
environmentId,
|
|
2523
|
+
recordBroadcastRequest: { txHash },
|
|
2524
|
+
transactionId,
|
|
2525
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2526
|
+
}),
|
|
2527
|
+
transactionId
|
|
2528
|
+
}, client);
|
|
2426
2529
|
};
|
|
2427
2530
|
const __broadcastCheckoutTransaction_impl = broadcastCheckoutTransaction;
|
|
2428
2531
|
const __broadcastCheckoutTransaction_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -2449,12 +2552,15 @@ const __broadcastCheckoutTransaction_wrapped = require_InvalidParamError.instrum
|
|
|
2449
2552
|
*/
|
|
2450
2553
|
const cancelCheckoutTransaction = async ({ transactionId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2451
2554
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2452
|
-
const result = await
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2555
|
+
const result = await withCheckoutSessionTokenCleanupOn401({
|
|
2556
|
+
call: () => apiClient.cancelCheckoutTransaction({
|
|
2557
|
+
environmentId,
|
|
2558
|
+
transactionId,
|
|
2559
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2560
|
+
}),
|
|
2561
|
+
transactionId
|
|
2562
|
+
}, client);
|
|
2563
|
+
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2458
2564
|
return result;
|
|
2459
2565
|
};
|
|
2460
2566
|
const __cancelCheckoutTransaction_impl = cancelCheckoutTransaction;
|
|
@@ -2555,16 +2661,19 @@ const getCheckoutTransaction = async ({ transactionId }, client = require_Invali
|
|
|
2555
2661
|
*/
|
|
2556
2662
|
const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slippage, transactionId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2557
2663
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2558
|
-
return
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2664
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2665
|
+
call: () => apiClient.quoteCheckoutTransaction({
|
|
2666
|
+
environmentId,
|
|
2667
|
+
quoteRequest: {
|
|
2668
|
+
fromChainId,
|
|
2669
|
+
fromTokenAddress,
|
|
2670
|
+
slippage
|
|
2671
|
+
},
|
|
2672
|
+
transactionId,
|
|
2673
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2674
|
+
}),
|
|
2675
|
+
transactionId
|
|
2676
|
+
}, client);
|
|
2568
2677
|
};
|
|
2569
2678
|
|
|
2570
2679
|
//#endregion
|
|
@@ -2581,15 +2690,18 @@ const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slip
|
|
|
2581
2690
|
*/
|
|
2582
2691
|
const prepareCheckoutTransaction = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, transactionId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2583
2692
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2584
|
-
return
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2693
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2694
|
+
call: () => apiClient.prepareCheckoutTransaction({
|
|
2695
|
+
environmentId,
|
|
2696
|
+
prepareSigningRequest: {
|
|
2697
|
+
assertBalanceForGasCost: assertBalanceForGasCost ?? false,
|
|
2698
|
+
assertBalanceForTransferAmount: assertBalanceForTransferAmount ?? false
|
|
2699
|
+
},
|
|
2700
|
+
transactionId,
|
|
2701
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2702
|
+
}),
|
|
2703
|
+
transactionId
|
|
2704
|
+
}, client);
|
|
2593
2705
|
};
|
|
2594
2706
|
const __prepareCheckoutTransaction_impl = prepareCheckoutTransaction;
|
|
2595
2707
|
const __prepareCheckoutTransaction_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -2678,9 +2790,9 @@ const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider },
|
|
|
2678
2790
|
* @returns The transaction hash.
|
|
2679
2791
|
* @instrumented
|
|
2680
2792
|
*/
|
|
2681
|
-
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2793
|
+
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange, sponsorshipMode }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2682
2794
|
if (!SWAP_SUPPORTED_CHAINS.includes(walletAccount.chain)) throw new require_InvalidParamError.InvalidParamError(`Chain ${walletAccount.chain} is not supported for swap transactions`);
|
|
2683
|
-
const walletProvider =
|
|
2795
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
2684
2796
|
assertWalletProviderMethodDefined(walletProvider, "executeSwapTransaction");
|
|
2685
2797
|
await ensureCorrectActiveNetwork({
|
|
2686
2798
|
requiredNetworkId: signingPayload.chainId,
|
|
@@ -2689,6 +2801,7 @@ const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepCha
|
|
|
2689
2801
|
const { transactionHash } = await walletProvider.executeSwapTransaction({
|
|
2690
2802
|
onStepChange,
|
|
2691
2803
|
signingPayload,
|
|
2804
|
+
sponsorshipMode,
|
|
2692
2805
|
walletAccount
|
|
2693
2806
|
});
|
|
2694
2807
|
return { transactionHash };
|
|
@@ -2808,7 +2921,7 @@ const completeDeviceRegistration = async ({ deviceToken }, client = require_Inva
|
|
|
2808
2921
|
const core = require_InvalidParamError.getCore(client);
|
|
2809
2922
|
const response = await require_InvalidParamError.createApiClient({ headers: { [DEVICE_REGISTRATION_TOKEN_HEADER]: deviceToken } }, client).deviceRegistration({ environmentId: core.environmentId });
|
|
2810
2923
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
2811
|
-
|
|
2924
|
+
require_InvalidParamError.emitEvent({ event: "deviceRegistrationCompleted" }, client);
|
|
2812
2925
|
return response;
|
|
2813
2926
|
};
|
|
2814
2927
|
const __completeDeviceRegistration_impl = completeDeviceRegistration;
|
|
@@ -2873,7 +2986,7 @@ const detectDeviceRegistrationRedirect = ({ url }) => {
|
|
|
2873
2986
|
/** @not-instrumented */
|
|
2874
2987
|
const getRegisteredDevices = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2875
2988
|
const core = require_InvalidParamError.getCore(client);
|
|
2876
|
-
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
2989
|
+
const apiClient = require_InvalidParamError.createApiClient({ skipSessionExpiryLogout: true }, client);
|
|
2877
2990
|
try {
|
|
2878
2991
|
return (await apiClient.listDeviceRegistrations({ environmentId: core.environmentId })).deviceRegistrations;
|
|
2879
2992
|
} catch (error) {
|
|
@@ -2906,7 +3019,7 @@ const isDeviceRegistrationRequired = (user) => Boolean(user.scope?.includes("dev
|
|
|
2906
3019
|
const revokeAllRegisteredDevices = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
2907
3020
|
const core = require_InvalidParamError.getCore(client);
|
|
2908
3021
|
await require_InvalidParamError.createApiClient({}, client).deleteAllDeviceRegistrations({ environmentId: core.environmentId });
|
|
2909
|
-
await
|
|
3022
|
+
await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "all-devices-revoked" }, client);
|
|
2910
3023
|
};
|
|
2911
3024
|
const __revokeAllRegisteredDevices_impl = revokeAllRegisteredDevices;
|
|
2912
3025
|
const __revokeAllRegisteredDevices_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -2930,7 +3043,7 @@ const revokeRegisteredDevice = async ({ deviceRegistrationId }, client = require
|
|
|
2930
3043
|
if ((await require_InvalidParamError.createApiClient({}, client).deleteDeviceRegistration({
|
|
2931
3044
|
deviceRegistrationId,
|
|
2932
3045
|
environmentId: core.environmentId
|
|
2933
|
-
})).currentDeviceRevoked) await
|
|
3046
|
+
})).currentDeviceRevoked) await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "device-revoked" }, client);
|
|
2934
3047
|
};
|
|
2935
3048
|
const __revokeRegisteredDevice_impl = revokeRegisteredDevice;
|
|
2936
3049
|
const __revokeRegisteredDevice_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -3152,6 +3265,115 @@ const __createCryptoDotComPayment_wrapped = require_InvalidParamError.instrument
|
|
|
3152
3265
|
}
|
|
3153
3266
|
});
|
|
3154
3267
|
|
|
3268
|
+
//#endregion
|
|
3269
|
+
//#region src/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.ts
|
|
3270
|
+
/**
|
|
3271
|
+
* Fetches the list of crypto currencies supported by MoonPay for the given chain
|
|
3272
|
+
* and network, filtered to active currencies only. Requires a MoonPay publishable
|
|
3273
|
+
* API key to be configured for the environment.
|
|
3274
|
+
*
|
|
3275
|
+
* @param params - The chain and optional network ID to filter currencies by.
|
|
3276
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3277
|
+
* @returns An array of supported MoonPay currencies.
|
|
3278
|
+
* @instrumented
|
|
3279
|
+
*/
|
|
3280
|
+
const getMoonPayCurrencies = async (params, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3281
|
+
const core = require_InvalidParamError.getCore(client);
|
|
3282
|
+
return (await require_InvalidParamError.createApiClient({ includeMfaToken: true }, client).getMoonPayCurrencies({
|
|
3283
|
+
chain: params.chain,
|
|
3284
|
+
environmentId: core.environmentId,
|
|
3285
|
+
...params.networkId ? { networkId: params.networkId } : {}
|
|
3286
|
+
})).currencies ?? [];
|
|
3287
|
+
};
|
|
3288
|
+
const __getMoonPayCurrencies_impl = getMoonPayCurrencies;
|
|
3289
|
+
const __getMoonPayCurrencies_wrapped = require_InvalidParamError.instrumentFunction({
|
|
3290
|
+
fn: __getMoonPayCurrencies_impl,
|
|
3291
|
+
functionName: "getMoonPayCurrencies",
|
|
3292
|
+
getCore: () => {
|
|
3293
|
+
try {
|
|
3294
|
+
return require_InvalidParamError.getCore(require_InvalidParamError.getDefaultClient());
|
|
3295
|
+
} catch {
|
|
3296
|
+
return;
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3299
|
+
});
|
|
3300
|
+
|
|
3301
|
+
//#endregion
|
|
3302
|
+
//#region src/modules/funding/moonpay/errors/MoonPayInvalidUrlError.ts
|
|
3303
|
+
var MoonPayInvalidUrlError = class extends require_InvalidParamError.BaseError {
|
|
3304
|
+
constructor() {
|
|
3305
|
+
super({
|
|
3306
|
+
cause: null,
|
|
3307
|
+
code: "moonpay_invalid_url_error",
|
|
3308
|
+
docsUrl: null,
|
|
3309
|
+
name: "MoonPayInvalidUrlError",
|
|
3310
|
+
shortMessage: "MoonPay is configured but returned an invalid or untrusted URL. This may indicate a misconfiguration — please contact support if the issue persists."
|
|
3311
|
+
});
|
|
3312
|
+
}
|
|
3313
|
+
};
|
|
3314
|
+
|
|
3315
|
+
//#endregion
|
|
3316
|
+
//#region src/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.ts
|
|
3317
|
+
var MoonPayProviderNotAvailableError = class extends require_InvalidParamError.BaseError {
|
|
3318
|
+
constructor() {
|
|
3319
|
+
super({
|
|
3320
|
+
cause: null,
|
|
3321
|
+
code: "moonpay_provider_not_available_error",
|
|
3322
|
+
docsUrl: null,
|
|
3323
|
+
name: "MoonPayProviderNotAvailableError",
|
|
3324
|
+
shortMessage: "MoonPay provider not available. Ensure MoonPay is enabled and a publishable API key is configured in the Dynamic dashboard."
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
};
|
|
3328
|
+
|
|
3329
|
+
//#endregion
|
|
3330
|
+
//#region src/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.ts
|
|
3331
|
+
/**
|
|
3332
|
+
* Returns the signed MoonPay URL for the given wallet and token.
|
|
3333
|
+
*
|
|
3334
|
+
* Uses the Dynamic onramp API to retrieve the pre-signed URL that can be
|
|
3335
|
+
* opened in a browser tab to allow the user to purchase crypto via MoonPay.
|
|
3336
|
+
*
|
|
3337
|
+
* @param params - Parameters including chain, wallet address, and optional token/currency filters.
|
|
3338
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3339
|
+
* @returns The signed MoonPay URL.
|
|
3340
|
+
* @instrumented
|
|
3341
|
+
*/
|
|
3342
|
+
const getMoonPayUrl = async (params, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3343
|
+
const core = require_InvalidParamError.getCore(client);
|
|
3344
|
+
const moonPayProvider = (await require_InvalidParamError.createApiClient({ includeMfaToken: true }, client).getSupportedOnramps({
|
|
3345
|
+
chain: params.chain,
|
|
3346
|
+
currency: params.currency,
|
|
3347
|
+
environmentId: core.environmentId,
|
|
3348
|
+
includeDisabled: true,
|
|
3349
|
+
merchantName: params.merchantName,
|
|
3350
|
+
networkId: params.networkId,
|
|
3351
|
+
token: params.token,
|
|
3352
|
+
tokenAmount: params.tokenAmount,
|
|
3353
|
+
walletAddress: params.walletAddress
|
|
3354
|
+
})).onramps?.find((provider) => provider.provider === _dynamic_labs_sdk_api_core.ProviderEnum.MoonPay);
|
|
3355
|
+
if (!moonPayProvider?.url) throw new MoonPayProviderNotAvailableError();
|
|
3356
|
+
const parsedUrl = new URL(moonPayProvider.url);
|
|
3357
|
+
const isValidHost = parsedUrl.hostname === "moonpay.com" || parsedUrl.hostname.endsWith(".moonpay.com");
|
|
3358
|
+
if (parsedUrl.protocol !== "https:" || !isValidHost) {
|
|
3359
|
+
core.logger.error("[getMoonPayUrl] Invalid URL returned by onramp API", { url: moonPayProvider.url });
|
|
3360
|
+
throw new MoonPayInvalidUrlError();
|
|
3361
|
+
}
|
|
3362
|
+
return moonPayProvider.url;
|
|
3363
|
+
};
|
|
3364
|
+
const __getMoonPayUrl_impl = getMoonPayUrl;
|
|
3365
|
+
const __getMoonPayUrl_wrapped = require_InvalidParamError.instrumentFunction({
|
|
3366
|
+
fn: __getMoonPayUrl_impl,
|
|
3367
|
+
functionName: "getMoonPayUrl",
|
|
3368
|
+
getCore: () => {
|
|
3369
|
+
try {
|
|
3370
|
+
return require_InvalidParamError.getCore(require_InvalidParamError.getDefaultClient());
|
|
3371
|
+
} catch {
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
});
|
|
3376
|
+
|
|
3155
3377
|
//#endregion
|
|
3156
3378
|
//#region src/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.ts
|
|
3157
3379
|
/**
|
|
@@ -3320,7 +3542,7 @@ const fetchWithTimeout = async (client) => {
|
|
|
3320
3542
|
/**
|
|
3321
3543
|
* The schema to store the cached wallet book data.
|
|
3322
3544
|
*/
|
|
3323
|
-
const walletBookCacheStorageKeySchema =
|
|
3545
|
+
const walletBookCacheStorageKeySchema = require_InvalidParamError.createStorageKeySchema({
|
|
3324
3546
|
key: "legacyWalletBookCache",
|
|
3325
3547
|
schema: zod_mini.object({
|
|
3326
3548
|
groups: zod_mini.record(zod_mini.string(), zod_mini.any()),
|
|
@@ -3355,7 +3577,7 @@ const fetchLegacyWalletBook = async (client) => {
|
|
|
3355
3577
|
const core = require_InvalidParamError.getCore(client);
|
|
3356
3578
|
core.logger.debug("[fetchLegacyWalletBook] Fetching wallet book...");
|
|
3357
3579
|
try {
|
|
3358
|
-
const walletBook = await
|
|
3580
|
+
const walletBook = await require_InvalidParamError.retryOnFail({
|
|
3359
3581
|
delay: RETRY_DELAY_MS,
|
|
3360
3582
|
fn: async () => fetchWithTimeout(client),
|
|
3361
3583
|
maxRetries: MAX_RETRIES
|
|
@@ -3469,30 +3691,39 @@ const transformGroup = ({ group }) => {
|
|
|
3469
3691
|
};
|
|
3470
3692
|
|
|
3471
3693
|
//#endregion
|
|
3472
|
-
//#region src/
|
|
3694
|
+
//#region src/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.ts
|
|
3473
3695
|
/**
|
|
3474
|
-
*
|
|
3696
|
+
* Resolves a wallet-book chain identifier (as found in
|
|
3697
|
+
* `injectedConfig[].chain` or as an alias embedded in a wallet key) to a
|
|
3698
|
+
* {@link Chain}. Looks up by `apiChainName` first, then by any
|
|
3699
|
+
* `legacyWalletBookAliases` declared on the corresponding `CHAINS_INFO_MAP`
|
|
3700
|
+
* entry.
|
|
3701
|
+
*
|
|
3702
|
+
* Returns `undefined` when the identifier doesn't match any known chain,
|
|
3703
|
+
* letting the caller pick its own fallback (e.g. defaulting to EVM, or
|
|
3704
|
+
* trying a different lookup strategy).
|
|
3705
|
+
*
|
|
3706
|
+
* Centralised here rather than in `legacyWalletBook` so all chain naming
|
|
3707
|
+
* knowledge stays alongside `CHAINS_INFO_MAP`.
|
|
3475
3708
|
* @not-instrumented
|
|
3476
3709
|
*/
|
|
3477
|
-
const
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
eclipse: "ECLIPSE",
|
|
3484
|
-
evm: "EVM",
|
|
3485
|
-
flow: "FLOW",
|
|
3486
|
-
sol: "SOL",
|
|
3487
|
-
spark: "SPARK",
|
|
3488
|
-
starknet: "STARK",
|
|
3489
|
-
sui: "SUI",
|
|
3490
|
-
ton: "TON",
|
|
3491
|
-
tron: "TRON"
|
|
3710
|
+
const getChainFromWalletBookIdentifier = ({ identifier }) => {
|
|
3711
|
+
const normalised = identifier.toLowerCase();
|
|
3712
|
+
return Object.keys(require_InvalidParamError.CHAINS_INFO_MAP).find((chain) => {
|
|
3713
|
+
const info = require_InvalidParamError.CHAINS_INFO_MAP[chain];
|
|
3714
|
+
return info.apiChainName === normalised || info.legacyWalletBookAliases?.includes(normalised) === true;
|
|
3715
|
+
});
|
|
3492
3716
|
};
|
|
3717
|
+
|
|
3718
|
+
//#endregion
|
|
3719
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.ts
|
|
3493
3720
|
/**
|
|
3494
3721
|
* Extracts the chain prefix from a chain identifier string.
|
|
3495
3722
|
* For example, "eip155:1" -> "eip155", "solana:..." -> "solana"
|
|
3723
|
+
*
|
|
3724
|
+
* Exported so {@link getChainsFromWalletSchema} can apply the same
|
|
3725
|
+
* parsing to its multi-chain pass without duplicating the logic.
|
|
3726
|
+
* @not-instrumented
|
|
3496
3727
|
*/
|
|
3497
3728
|
const extractChainPrefix = ({ chainIdentifier }) => {
|
|
3498
3729
|
const colonIndex = chainIdentifier.indexOf(":");
|
|
@@ -3500,80 +3731,22 @@ const extractChainPrefix = ({ chainIdentifier }) => {
|
|
|
3500
3731
|
return chainIdentifier.substring(0, colonIndex);
|
|
3501
3732
|
};
|
|
3502
3733
|
/**
|
|
3503
|
-
*
|
|
3504
|
-
*
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
chain: "SOL",
|
|
3509
|
-
pattern: "sol"
|
|
3510
|
-
},
|
|
3511
|
-
{
|
|
3512
|
-
chain: "SOL",
|
|
3513
|
-
pattern: "solana"
|
|
3514
|
-
},
|
|
3515
|
-
{
|
|
3516
|
-
chain: "BTC",
|
|
3517
|
-
pattern: "btc"
|
|
3518
|
-
},
|
|
3519
|
-
{
|
|
3520
|
-
chain: "BTC",
|
|
3521
|
-
pattern: "bitcoin"
|
|
3522
|
-
},
|
|
3523
|
-
{
|
|
3524
|
-
chain: "STARK",
|
|
3525
|
-
pattern: "stark"
|
|
3526
|
-
},
|
|
3527
|
-
{
|
|
3528
|
-
chain: "STARK",
|
|
3529
|
-
pattern: "starknet"
|
|
3530
|
-
},
|
|
3531
|
-
{
|
|
3532
|
-
chain: "SUI",
|
|
3533
|
-
pattern: "sui"
|
|
3534
|
-
},
|
|
3535
|
-
{
|
|
3536
|
-
chain: "APTOS",
|
|
3537
|
-
pattern: "aptos"
|
|
3538
|
-
},
|
|
3539
|
-
{
|
|
3540
|
-
chain: "COSMOS",
|
|
3541
|
-
pattern: "cosmos"
|
|
3542
|
-
},
|
|
3543
|
-
{
|
|
3544
|
-
chain: "FLOW",
|
|
3545
|
-
pattern: "flow"
|
|
3546
|
-
},
|
|
3547
|
-
{
|
|
3548
|
-
chain: "ALGO",
|
|
3549
|
-
pattern: "algo"
|
|
3550
|
-
},
|
|
3551
|
-
{
|
|
3552
|
-
chain: "TRON",
|
|
3553
|
-
pattern: "tron"
|
|
3554
|
-
},
|
|
3555
|
-
{
|
|
3556
|
-
chain: "TON",
|
|
3557
|
-
pattern: "ton"
|
|
3558
|
-
},
|
|
3559
|
-
{
|
|
3560
|
-
chain: "SPARK",
|
|
3561
|
-
pattern: "spark"
|
|
3562
|
-
},
|
|
3563
|
-
{
|
|
3564
|
-
chain: "ECLIPSE",
|
|
3565
|
-
pattern: "eclipse"
|
|
3566
|
-
}
|
|
3567
|
-
];
|
|
3568
|
-
/**
|
|
3569
|
-
* Attempts to extract the chain from a wallet key by looking for embedded chain identifiers.
|
|
3734
|
+
* Attempts to extract the chain from a wallet key by looking for embedded
|
|
3735
|
+
* chain identifiers (apiChainName + legacyWalletBookAliases from CHAINS_INFO_MAP).
|
|
3736
|
+
*
|
|
3737
|
+
* Derives patterns dynamically so adding a chain in `CHAINS_INFO_MAP`
|
|
3738
|
+
* picks it up here — no parallel hardcoded list.
|
|
3570
3739
|
*
|
|
3571
3740
|
* @param params.walletKey - The wallet key identifier.
|
|
3572
3741
|
* @returns The chain type if found, undefined otherwise.
|
|
3573
3742
|
*/
|
|
3574
3743
|
const getChainFromWalletKey = ({ walletKey }) => {
|
|
3575
3744
|
const lowerKey = walletKey.toLowerCase();
|
|
3576
|
-
|
|
3745
|
+
const chains = Object.keys(require_InvalidParamError.CHAINS_INFO_MAP);
|
|
3746
|
+
for (const chain of chains) {
|
|
3747
|
+
const info = require_InvalidParamError.CHAINS_INFO_MAP[chain];
|
|
3748
|
+
if ([info.apiChainName, ...info.legacyWalletBookAliases ?? []].some((pattern) => lowerKey.includes(pattern))) return chain;
|
|
3749
|
+
}
|
|
3577
3750
|
};
|
|
3578
3751
|
/**
|
|
3579
3752
|
* Gets the chain from a wallet book entry.
|
|
@@ -3587,8 +3760,11 @@ const getChainFromWalletKey = ({ walletKey }) => {
|
|
|
3587
3760
|
*/
|
|
3588
3761
|
const getChainFromWalletSchema = ({ wallet, walletKey }) => {
|
|
3589
3762
|
if (wallet.injectedConfig && wallet.injectedConfig.length > 0) {
|
|
3590
|
-
const injectedChain = wallet.injectedConfig[0].chain
|
|
3591
|
-
if (injectedChain
|
|
3763
|
+
const injectedChain = wallet.injectedConfig[0].chain;
|
|
3764
|
+
if (injectedChain) {
|
|
3765
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: injectedChain });
|
|
3766
|
+
if (chain) return chain;
|
|
3767
|
+
}
|
|
3592
3768
|
}
|
|
3593
3769
|
if (wallet.chains && wallet.chains.length > 0) {
|
|
3594
3770
|
const firstChain = wallet.chains[0];
|
|
@@ -3821,7 +3997,7 @@ const extractChainFromNormalizedName = ({ normalizedWalletNameWithChain }) => {
|
|
|
3821
3997
|
* @not-instrumented
|
|
3822
3998
|
*/
|
|
3823
3999
|
const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProviderKey }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
3824
|
-
const { normalizedWalletNameWithChain } =
|
|
4000
|
+
const { normalizedWalletNameWithChain } = require_InvalidParamError.splitWalletProviderKey(walletProviderKey);
|
|
3825
4001
|
const chain = extractChainFromNormalizedName({ normalizedWalletNameWithChain });
|
|
3826
4002
|
if (!chain) return;
|
|
3827
4003
|
let walletProviderName = normalizedWalletNameWithChain.toLowerCase();
|
|
@@ -3836,11 +4012,111 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
|
|
|
3836
4012
|
}
|
|
3837
4013
|
};
|
|
3838
4014
|
|
|
4015
|
+
//#endregion
|
|
4016
|
+
//#region src/utils/isMobile/isMobile.ts
|
|
4017
|
+
/**
|
|
4018
|
+
* Sourced from http://detectmobilebrowsers.com/
|
|
4019
|
+
* @not-instrumented
|
|
4020
|
+
*/
|
|
4021
|
+
const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ios|ipad|playbook|silk/i;
|
|
4022
|
+
const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
|
|
4023
|
+
/** @not-instrumented */
|
|
4024
|
+
const isMobile = (maxTouchPointsOverride) => {
|
|
4025
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4026
|
+
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
4027
|
+
};
|
|
4028
|
+
/** @not-instrumented */
|
|
4029
|
+
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
4030
|
+
/**
|
|
4031
|
+
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
4032
|
+
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
4033
|
+
* to mock it
|
|
4034
|
+
* @not-instrumented
|
|
4035
|
+
*/
|
|
4036
|
+
const isIPad = (maxTouchPointsOverride) => {
|
|
4037
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4038
|
+
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
4039
|
+
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
4040
|
+
};
|
|
4041
|
+
/** @not-instrumented */
|
|
4042
|
+
const isIOS = (maxTouchPointsOverride) => {
|
|
4043
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4044
|
+
return isIPhone() || isIPad(maxTouchPointsOverride);
|
|
4045
|
+
};
|
|
4046
|
+
/** @not-instrumented */
|
|
4047
|
+
const isAndroid = () => isMobile() && !isIOS();
|
|
4048
|
+
/** @not-instrumented */
|
|
4049
|
+
const isSafariBrowser = () => {
|
|
4050
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4051
|
+
const { userAgent } = navigator;
|
|
4052
|
+
return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
|
|
4053
|
+
};
|
|
4054
|
+
/** @not-instrumented */
|
|
4055
|
+
const isEdgeBrowser = () => {
|
|
4056
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4057
|
+
return /\bEdg\//.test(navigator.userAgent);
|
|
4058
|
+
};
|
|
4059
|
+
/** @not-instrumented */
|
|
4060
|
+
const isOperaBrowser = () => {
|
|
4061
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4062
|
+
return /\b(OPR|Opera)\//.test(navigator.userAgent);
|
|
4063
|
+
};
|
|
4064
|
+
/** @not-instrumented */
|
|
4065
|
+
const isFirefoxBrowser = () => {
|
|
4066
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4067
|
+
return /\bFirefox\//.test(navigator.userAgent);
|
|
4068
|
+
};
|
|
4069
|
+
/** @not-instrumented */
|
|
4070
|
+
const isChromeBrowser = () => {
|
|
4071
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4072
|
+
return /\bChrome\//.test(navigator.userAgent) && !isEdgeBrowser() && !isOperaBrowser();
|
|
4073
|
+
};
|
|
4074
|
+
|
|
4075
|
+
//#endregion
|
|
4076
|
+
//#region src/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.ts
|
|
4077
|
+
/**
|
|
4078
|
+
* Resolves the {@link InstallationUrls} field that matches the platform
|
|
4079
|
+
* the SDK is currently running on:
|
|
4080
|
+
*
|
|
4081
|
+
* - iOS → `ios`
|
|
4082
|
+
* - Android → `android`
|
|
4083
|
+
* - Edge → `edge`
|
|
4084
|
+
* - Opera → `opera`
|
|
4085
|
+
* - Firefox → `firefox`
|
|
4086
|
+
* - Safari → `safari`
|
|
4087
|
+
* - Chrome (or other Chromium-based browsers) → `chrome`
|
|
4088
|
+
*
|
|
4089
|
+
* Returns `undefined` when no entry exists for the detected platform —
|
|
4090
|
+
* callers typically render a "not available on this device" affordance
|
|
4091
|
+
* in that case rather than offering a download targeted at a different
|
|
4092
|
+
* browser/OS.
|
|
4093
|
+
*
|
|
4094
|
+
* Each branch returns exactly the field for the detected platform — no
|
|
4095
|
+
* fallback to a different browser's URL. If you'd rather surface every
|
|
4096
|
+
* link a wallet's manifest publishes so the user can pick where to
|
|
4097
|
+
* install, read `installationUrls` directly instead of going through
|
|
4098
|
+
* this helper.
|
|
4099
|
+
*
|
|
4100
|
+
* @param params.installationUrls - The wallet option's `installationUrls`
|
|
4101
|
+
* record (from `getWalletOptionsCatalogue`).
|
|
4102
|
+
* @returns The install URL for the detected platform, or `undefined`.
|
|
4103
|
+
* @not-instrumented
|
|
4104
|
+
*/
|
|
4105
|
+
const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
4106
|
+
if (isIOS()) return installationUrls.ios;
|
|
4107
|
+
if (isAndroid()) return installationUrls.android;
|
|
4108
|
+
if (isEdgeBrowser()) return installationUrls.edge;
|
|
4109
|
+
if (isOperaBrowser()) return installationUrls.opera;
|
|
4110
|
+
if (isFirefoxBrowser()) return installationUrls.firefox;
|
|
4111
|
+
if (isSafariBrowser()) return installationUrls.safari;
|
|
4112
|
+
if (isChromeBrowser()) return installationUrls.chrome;
|
|
4113
|
+
};
|
|
4114
|
+
|
|
3839
4115
|
//#endregion
|
|
3840
4116
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
3841
4117
|
/**
|
|
3842
4118
|
* Resolves which wallet option (group) a wallet book entry belongs to. Used
|
|
3843
|
-
* by the catalogue's wallet-book-driven transformers (
|
|
4119
|
+
* by the catalogue's wallet-book-driven transformers (URI deeplink,
|
|
3844
4120
|
* `inAppBrowser`, `installation`) to bucket their emitted options.
|
|
3845
4121
|
*
|
|
3846
4122
|
* Wallet book entries inconsistently use `group` / `chainGroup` /
|
|
@@ -3995,24 +4271,150 @@ const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
|
3995
4271
|
};
|
|
3996
4272
|
|
|
3997
4273
|
//#endregion
|
|
3998
|
-
//#region src/modules/
|
|
4274
|
+
//#region src/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.ts
|
|
3999
4275
|
/**
|
|
4000
|
-
*
|
|
4001
|
-
*
|
|
4002
|
-
*
|
|
4003
|
-
*
|
|
4276
|
+
* Whether a wallet book entry exposes at least one mobile deeplink the
|
|
4277
|
+
* catalogue can drive — either a native scheme (`metamask://`) or a
|
|
4278
|
+
* universal link (`https://metamask.app.link`). Used by the URI-deeplink
|
|
4279
|
+
* builders (`buildWalletConnectOptions`, `buildMetaMaskSdkUriOptions`)
|
|
4280
|
+
* to skip wallets that have no app to launch.
|
|
4281
|
+
*
|
|
4282
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
4283
|
+
* @returns True when the wallet has a native or universal mobile link.
|
|
4284
|
+
* @not-instrumented
|
|
4004
4285
|
*/
|
|
4005
4286
|
const hasUsableDeeplink = ({ wallet }) => Boolean(wallet.mobile?.native || wallet.mobile?.universal);
|
|
4287
|
+
|
|
4288
|
+
//#endregion
|
|
4289
|
+
//#region src/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.ts
|
|
4290
|
+
/**
|
|
4291
|
+
* Wallet option key the MetaMask SDK URI extension targets.
|
|
4292
|
+
*/
|
|
4293
|
+
const METAMASK_WALLET_OPTION_KEY = "metamask";
|
|
4294
|
+
/**
|
|
4295
|
+
* Chains the MetaMask SDK URI pairing supports.
|
|
4296
|
+
*
|
|
4297
|
+
* Unlike WalletConnect — whose per-wallet chain support is read from the
|
|
4298
|
+
* wallet book — the MetaMask SDK URI is a single Dynamic integration whose
|
|
4299
|
+
* chain coverage is defined by which `connectWithMetaMaskUri<Chain>`
|
|
4300
|
+
* primitives the SDK ships (EVM + SOL). The MetaMask wallet-book entry only
|
|
4301
|
+
* advertises its EVM (`eip155`) chains, so deriving the chain from the book
|
|
4302
|
+
* would never surface the Solana pairing; the SDK's own capabilities are
|
|
4303
|
+
* listed explicitly instead.
|
|
4304
|
+
*/
|
|
4305
|
+
const METAMASK_SDK_URI_SUPPORTED_CHAINS = ["EVM", "SOL"];
|
|
4306
|
+
/**
|
|
4307
|
+
* Builds the `metamaskSdkUri`-discriminator catalogue options from a
|
|
4308
|
+
* fetched wallet book. The MetaMask SDK URI extension only targets the
|
|
4309
|
+
* MetaMask wallet, so the builder iterates the book looking for the
|
|
4310
|
+
* entry whose resolved wallet option key is `'metamask'`.
|
|
4311
|
+
*
|
|
4312
|
+
* Applies the generic `shouldFilterWallet` rules (drops embedded keys +
|
|
4313
|
+
* injected-only-without-links entries). Crucially does NOT require WC
|
|
4314
|
+
* `sign_v2` support — MetaMask SDK URI is a different protocol from
|
|
4315
|
+
* WalletConnect, so the WC-specific filter does not apply here.
|
|
4316
|
+
*
|
|
4317
|
+
* Emits one `metamaskSdkUri` option per chain the MetaMask SDK URI pairing
|
|
4318
|
+
* supports (see {@link METAMASK_SDK_URI_SUPPORTED_CHAINS}) so the picker can
|
|
4319
|
+
* offer both the EVM and Solana pairings for the single MetaMask entry.
|
|
4320
|
+
*
|
|
4321
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4322
|
+
* @returns Tagged `metamaskSdkUri` options for MetaMask if eligible, otherwise an empty array.
|
|
4323
|
+
* @not-instrumented
|
|
4324
|
+
*/
|
|
4325
|
+
const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
4326
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
4327
|
+
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
4328
|
+
wallet,
|
|
4329
|
+
walletKey
|
|
4330
|
+
});
|
|
4331
|
+
if (walletOptionKey !== METAMASK_WALLET_OPTION_KEY) continue;
|
|
4332
|
+
if (shouldFilterWallet({
|
|
4333
|
+
wallet,
|
|
4334
|
+
walletKey
|
|
4335
|
+
})) continue;
|
|
4336
|
+
if (!hasUsableDeeplink({ wallet })) continue;
|
|
4337
|
+
const deeplinks = {
|
|
4338
|
+
native: wallet.mobile?.native,
|
|
4339
|
+
universal: wallet.mobile?.universal
|
|
4340
|
+
};
|
|
4341
|
+
return METAMASK_SDK_URI_SUPPORTED_CHAINS.map((chain) => ({
|
|
4342
|
+
option: {
|
|
4343
|
+
chain,
|
|
4344
|
+
deeplinks,
|
|
4345
|
+
type: "metamaskSdkUri"
|
|
4346
|
+
},
|
|
4347
|
+
walletOptionKey
|
|
4348
|
+
}));
|
|
4349
|
+
}
|
|
4350
|
+
return [];
|
|
4351
|
+
};
|
|
4352
|
+
|
|
4353
|
+
//#endregion
|
|
4354
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
4006
4355
|
/**
|
|
4007
|
-
*
|
|
4008
|
-
*
|
|
4356
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
4357
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
4358
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
4359
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
4360
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
4361
|
+
*
|
|
4362
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
4363
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
4364
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
4365
|
+
* one option.
|
|
4366
|
+
*
|
|
4367
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
4368
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
4369
|
+
* @returns Ordered, deduped array of Chains.
|
|
4370
|
+
* @not-instrumented
|
|
4371
|
+
*/
|
|
4372
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
4373
|
+
const chains = /* @__PURE__ */ new Set();
|
|
4374
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
4375
|
+
if (!entry.chain) continue;
|
|
4376
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
4377
|
+
if (chain) chains.add(chain);
|
|
4378
|
+
}
|
|
4379
|
+
for (const identifier of wallet.chains ?? []) {
|
|
4380
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
4381
|
+
try {
|
|
4382
|
+
const chain = require_InvalidParamError.getChainFromVerifiedCredentialChain(prefix);
|
|
4383
|
+
chains.add(chain);
|
|
4384
|
+
} catch {}
|
|
4385
|
+
}
|
|
4386
|
+
if (chains.size === 0) {
|
|
4387
|
+
const chain = getChainFromWalletSchema({
|
|
4388
|
+
wallet,
|
|
4389
|
+
walletKey
|
|
4390
|
+
});
|
|
4391
|
+
chains.add(chain);
|
|
4392
|
+
}
|
|
4393
|
+
return Array.from(chains);
|
|
4394
|
+
};
|
|
4395
|
+
|
|
4396
|
+
//#endregion
|
|
4397
|
+
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
4398
|
+
/**
|
|
4399
|
+
* Chains Dynamic ships a WalletConnect extension for. Anything else a
|
|
4400
|
+
* wallet book entry advertises (Cosmos, BTC, …) gets filtered out — the
|
|
4401
|
+
* catalogue should not surface a chain the SDK has no `connectWithWalletConnect<Chain>`
|
|
4402
|
+
* primitive for.
|
|
4403
|
+
*/
|
|
4404
|
+
const WALLETCONNECT_SUPPORTED_CHAINS = new Set(["EVM", "SOL"]);
|
|
4405
|
+
/**
|
|
4406
|
+
* Builds the `walletConnect`-discriminator catalogue options from a fetched
|
|
4407
|
+
* wallet book. Applies the WalletConnect-specific eligibility filter
|
|
4009
4408
|
* (`shouldFilterWalletForWalletConnect`) so embedded wallets and entries
|
|
4010
4409
|
* without `sign_v2` support are excluded — same surface as
|
|
4011
4410
|
* `getWalletConnectCatalog`.
|
|
4012
4411
|
*
|
|
4013
|
-
*
|
|
4014
|
-
*
|
|
4015
|
-
*
|
|
4412
|
+
* Skips the MetaMask wallet entry: MetaMask is steered to its own URI
|
|
4413
|
+
* connection extension via `buildMetaMaskSdkUriOptions`. Keeping the two
|
|
4414
|
+
* builders separate means each protocol owns its own eligibility rules
|
|
4415
|
+
* (WC needs `sign_v2`; MM SDK URI does not), so excluding one
|
|
4416
|
+
* discriminator via `excludedConnectionOptionTypes` doesn't accidentally
|
|
4417
|
+
* gate the other.
|
|
4016
4418
|
*
|
|
4017
4419
|
* @param params.walletBook - The fetched wallet book.
|
|
4018
4420
|
* @returns Tagged `walletConnect` options paired with their wallet option keys.
|
|
@@ -4030,11 +4432,12 @@ const buildWalletConnectOptions = ({ walletBook }) => {
|
|
|
4030
4432
|
wallet,
|
|
4031
4433
|
walletKey
|
|
4032
4434
|
});
|
|
4033
|
-
|
|
4435
|
+
if (walletOptionKey === "metamask") continue;
|
|
4436
|
+
const chains = getChainsFromWalletSchema({
|
|
4034
4437
|
wallet,
|
|
4035
4438
|
walletKey
|
|
4036
|
-
});
|
|
4037
|
-
result.push({
|
|
4439
|
+
}).filter((chain) => WALLETCONNECT_SUPPORTED_CHAINS.has(chain));
|
|
4440
|
+
for (const chain of chains) result.push({
|
|
4038
4441
|
option: {
|
|
4039
4442
|
chain,
|
|
4040
4443
|
deeplinks: {
|
|
@@ -4058,12 +4461,19 @@ const buildWalletConnectOptions = ({ walletBook }) => {
|
|
|
4058
4461
|
*
|
|
4059
4462
|
* Display merge rules (provider self-announced metadata wins where set):
|
|
4060
4463
|
*
|
|
4061
|
-
* - `name`: `displayOverride.name` ?? wallet book group name ??
|
|
4062
|
-
*
|
|
4063
|
-
* - `
|
|
4064
|
-
*
|
|
4464
|
+
* - `name`: `displayOverride.name` ?? wallet book group name ?? wallet
|
|
4465
|
+
* book wallet name ?? bare key.
|
|
4466
|
+
* - `iconUrl`: `displayOverride.iconUrl` ?? wallet book group sprite URL
|
|
4467
|
+
* ?? wallet book wallet sprite URL ?? `''`.
|
|
4468
|
+
* - `primaryColor`: wallet book group brand color ?? wallet book wallet
|
|
4469
|
+
* brand color (providers do not ship a primary color in their
|
|
4470
|
+
* announcement metadata).
|
|
4065
4471
|
* - `installationUrls`: copied through if present.
|
|
4066
4472
|
*
|
|
4473
|
+
* The per-wallet fallback handles wallets that exist as individual entries
|
|
4474
|
+
* in the book (e.g. Rainbow) rather than as members of a multi-wallet group
|
|
4475
|
+
* — those don't get a `walletBook.groups[…]` shell.
|
|
4476
|
+
*
|
|
4067
4477
|
* Why provider precedence: a registered wallet provider knows its own
|
|
4068
4478
|
* brand best (EIP-6963 / Wallet Standard / vendor SDK announcement is the
|
|
4069
4479
|
* wallet authoring its own identity). The wallet book fills in fields the
|
|
@@ -4081,16 +4491,42 @@ const buildWalletOption = ({ connectionOptions, displayOverride, installationUrl
|
|
|
4081
4491
|
const group = walletBook.groups[walletOptionKey];
|
|
4082
4492
|
const groupSpriteId = group?.brand?.spriteId;
|
|
4083
4493
|
const groupIconUrl = groupSpriteId ? getSpriteUrl({ spriteId: groupSpriteId }) : void 0;
|
|
4494
|
+
const walletEntry = walletBook.wallets[walletOptionKey];
|
|
4495
|
+
const walletSpriteId = walletEntry?.brand?.spriteId;
|
|
4496
|
+
const walletIconUrl = walletSpriteId ? getSpriteUrl({ spriteId: walletSpriteId }) : void 0;
|
|
4084
4497
|
return {
|
|
4085
4498
|
connectionOptions,
|
|
4086
|
-
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? "",
|
|
4499
|
+
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? walletIconUrl ?? "",
|
|
4087
4500
|
installationUrls,
|
|
4088
4501
|
key: walletOptionKey,
|
|
4089
|
-
name: displayOverride?.name ?? group?.name ?? walletOptionKey,
|
|
4090
|
-
primaryColor: group?.brand?.primaryColor
|
|
4502
|
+
name: displayOverride?.name ?? group?.name ?? walletEntry?.name ?? walletOptionKey,
|
|
4503
|
+
primaryColor: group?.brand?.primaryColor ?? walletEntry?.brand?.primaryColor
|
|
4091
4504
|
};
|
|
4092
4505
|
};
|
|
4093
4506
|
|
|
4507
|
+
//#endregion
|
|
4508
|
+
//#region src/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.ts
|
|
4509
|
+
/**
|
|
4510
|
+
* Returns true when the given wallet provider exposes a `connect` method,
|
|
4511
|
+
* which is the signal we use to decide whether it belongs in the external
|
|
4512
|
+
* wallet picker as an `available provider`.
|
|
4513
|
+
*
|
|
4514
|
+
* Providers that don't expose `connect` (embedded wallets,
|
|
4515
|
+
* account-abstraction wrappers, MetaMask SDK / WalletConnect-backed
|
|
4516
|
+
* providers) are still sign-in capable, but via different SDK entry
|
|
4517
|
+
* points — they should not appear in the external picker as a
|
|
4518
|
+
* `withWalletProvider`-style option.
|
|
4519
|
+
*
|
|
4520
|
+
* Centralizing the predicate means future tweaks (e.g. a registry of
|
|
4521
|
+
* provider keys to exclude) land in one place and every consumer stays
|
|
4522
|
+
* in lockstep.
|
|
4523
|
+
*
|
|
4524
|
+
* @param params.walletProvider - The wallet provider to test.
|
|
4525
|
+
* @returns True when the provider exposes a `connect` method.
|
|
4526
|
+
* @not-instrumented
|
|
4527
|
+
*/
|
|
4528
|
+
const hasWalletProviderConnectMethod = ({ walletProvider }) => Boolean(walletProvider.connect);
|
|
4529
|
+
|
|
4094
4530
|
//#endregion
|
|
4095
4531
|
//#region src/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.ts
|
|
4096
4532
|
/**
|
|
@@ -4118,9 +4554,9 @@ const buildWalletOption = ({ connectionOptions, displayOverride, installationUrl
|
|
|
4118
4554
|
*/
|
|
4119
4555
|
const classifyWithWalletProviderSource = ({ entry }) => {
|
|
4120
4556
|
const { priority } = entry;
|
|
4121
|
-
if (priority ===
|
|
4122
|
-
if (priority ===
|
|
4123
|
-
if (priority ===
|
|
4557
|
+
if (priority === require_InvalidParamError.WalletProviderPriority.WALLET_SDK) return "sdk";
|
|
4558
|
+
if (priority === require_InvalidParamError.WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD) return "selfAnnounced";
|
|
4559
|
+
if (priority === require_InvalidParamError.WalletProviderPriority.WINDOW_INJECT) return "windowInjected";
|
|
4124
4560
|
};
|
|
4125
4561
|
|
|
4126
4562
|
//#endregion
|
|
@@ -4170,7 +4606,7 @@ const normalizeWalletDisplayName = (displayName) => displayName.toLowerCase().re
|
|
|
4170
4606
|
|
|
4171
4607
|
//#endregion
|
|
4172
4608
|
//#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.ts
|
|
4173
|
-
const normalize = (value) => value.toLowerCase().replace(/\s+/g, "");
|
|
4609
|
+
const normalize = (value) => value === void 0 ? void 0 : value.toLowerCase().replace(/\s+/g, "");
|
|
4174
4610
|
/**
|
|
4175
4611
|
* Looks for a wallet book entry whose `name` or `shortName` normalizes to
|
|
4176
4612
|
* the same string as `candidate`. Used as a fallback by
|
|
@@ -4240,7 +4676,7 @@ const resolveWalletOptionKey = ({ fallback, wallet }) => wallet.group ?? wallet.
|
|
|
4240
4676
|
* @not-instrumented
|
|
4241
4677
|
*/
|
|
4242
4678
|
const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }) => {
|
|
4243
|
-
const { normalizedWalletNameWithChain } =
|
|
4679
|
+
const { normalizedWalletNameWithChain } = require_InvalidParamError.splitWalletProviderKey(walletProvider.key);
|
|
4244
4680
|
const candidates = [normalizedWalletNameWithChain, stripChainSuffix({
|
|
4245
4681
|
chain,
|
|
4246
4682
|
normalizedName: normalizedWalletNameWithChain
|
|
@@ -4290,6 +4726,7 @@ const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }
|
|
|
4290
4726
|
const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
4291
4727
|
const result = [];
|
|
4292
4728
|
for (const entry of entries) {
|
|
4729
|
+
if (!hasWalletProviderConnectMethod({ walletProvider: entry.walletProvider })) continue;
|
|
4293
4730
|
const source = classifyWithWalletProviderSource({ entry });
|
|
4294
4731
|
if (!source) {
|
|
4295
4732
|
require_InvalidParamError.getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
|
|
@@ -4382,10 +4819,11 @@ const groupOptionsByWalletOption = ({ options }) => {
|
|
|
4382
4819
|
* wallet-option list is ordered — that's controlled by
|
|
4383
4820
|
* `WalletOptionOrdering`.
|
|
4384
4821
|
*
|
|
4385
|
-
* `withWalletProvider > walletConnect > inAppBrowser`
|
|
4822
|
+
* `withWalletProvider > walletConnect / metamaskSdkUri > inAppBrowser`
|
|
4386
4823
|
*/
|
|
4387
4824
|
const CONNECTION_OPTION_PRIORITY = {
|
|
4388
4825
|
inAppBrowser: 2,
|
|
4826
|
+
metamaskSdkUri: 1,
|
|
4389
4827
|
walletConnect: 1,
|
|
4390
4828
|
withWalletProvider: 0
|
|
4391
4829
|
};
|
|
@@ -4404,7 +4842,7 @@ const getConnectionOptionPriority = ({ option }) => CONNECTION_OPTION_PRIORITY[o
|
|
|
4404
4842
|
/**
|
|
4405
4843
|
* Sorts a wallet option's `connectionOptions` so the most preferred option lands at
|
|
4406
4844
|
* index 0. Primary sort is by option-type priority
|
|
4407
|
-
* (`withWalletProvider` >
|
|
4845
|
+
* (`withWalletProvider` > URI deeplink > `inAppBrowser`);
|
|
4408
4846
|
* within a type, ties break alphabetically by `chain` for deterministic
|
|
4409
4847
|
* output across calls.
|
|
4410
4848
|
*
|
|
@@ -4528,7 +4966,7 @@ const hasInstalledProvider = ({ walletOption }) => walletOption.connectionOption
|
|
|
4528
4966
|
* this order:
|
|
4529
4967
|
* 1. **Installed provider** — user already has the wallet available
|
|
4530
4968
|
* (`withWalletProvider` at index 0).
|
|
4531
|
-
* 2. **Connectable** — has at least one connection (
|
|
4969
|
+
* 2. **Connectable** — has at least one connection (URI deeplink
|
|
4532
4970
|
* or `inAppBrowser`) but no installed provider.
|
|
4533
4971
|
* 3. **Install-only** — no connection at all; only `installationUrls`.
|
|
4534
4972
|
* Within each tier, rank by the hand-curated {@link PRIORITY_WALLET_KEYS}
|
|
@@ -4578,45 +5016,40 @@ const EMPTY_WALLET_BOOK = {
|
|
|
4578
5016
|
wallets: {}
|
|
4579
5017
|
};
|
|
4580
5018
|
/**
|
|
4581
|
-
* Returns
|
|
4582
|
-
* with through this client.
|
|
4583
|
-
* `
|
|
4584
|
-
*
|
|
4585
|
-
* any matching connections are omitted.
|
|
4586
|
-
*
|
|
4587
|
-
* `includeWithWalletProvider` defaults to `true`; all other inclusion flags
|
|
4588
|
-
* are opt-in. `walletOptionOrdering` defaults to `'relevance'` (Dynamic's
|
|
4589
|
-
* recommended order); pass `'alphabetical'` to sort by wallet option name
|
|
4590
|
-
* within each option-priority tier.
|
|
5019
|
+
* Returns the catalogue of external wallet options a user can sign in
|
|
5020
|
+
* with through this client. Always includes installed wallet providers;
|
|
5021
|
+
* pass `includeMobileOptions: true` to additionally surface
|
|
5022
|
+
* WalletConnect, in-app-browser, and install links.
|
|
4591
5023
|
*
|
|
4592
|
-
*
|
|
4593
|
-
* (
|
|
4594
|
-
*
|
|
5024
|
+
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
5025
|
+
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
5026
|
+
* only connection was an excluded type fall through to the install-only
|
|
5027
|
+
* tier of the relevance ordering.
|
|
4595
5028
|
*
|
|
4596
|
-
* @param [params] - Inclusion
|
|
5029
|
+
* @param [params] - Inclusion flag + ordering preference + exclusions.
|
|
4597
5030
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4598
5031
|
* @returns A promise that resolves to the wallet options catalogue.
|
|
4599
5032
|
* @not-instrumented
|
|
4600
5033
|
*/
|
|
4601
5034
|
const getWalletOptionsCatalogue = async (params = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4602
|
-
const
|
|
4603
|
-
const includeWalletConnect = params.includeWalletConnect ?? false;
|
|
4604
|
-
const includeInAppBrowser = params.includeInAppBrowser ?? false;
|
|
4605
|
-
const includeInstallation = params.includeInstallation ?? false;
|
|
5035
|
+
const includeMobileOptions = params.includeMobileOptions ?? false;
|
|
4606
5036
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
4607
|
-
|
|
4608
|
-
const walletBook =
|
|
5037
|
+
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
5038
|
+
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
4609
5039
|
const allConnectionOptions = [];
|
|
4610
|
-
if (
|
|
4611
|
-
const entries =
|
|
5040
|
+
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
5041
|
+
const entries = require_InvalidParamError.getWalletProviderRegistry(client).listProviderEntries();
|
|
4612
5042
|
allConnectionOptions.push(...buildWithWalletProviderOptions({
|
|
4613
5043
|
entries,
|
|
4614
5044
|
walletBook
|
|
4615
5045
|
}, client));
|
|
4616
5046
|
}
|
|
4617
|
-
if (
|
|
4618
|
-
|
|
4619
|
-
|
|
5047
|
+
if (includeMobileOptions) {
|
|
5048
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) allConnectionOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
5049
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) allConnectionOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
5050
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) allConnectionOptions.push(...buildInAppBrowserOptions({ walletBook }));
|
|
5051
|
+
}
|
|
5052
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({ walletBook }) : /* @__PURE__ */ new Map();
|
|
4620
5053
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
4621
5054
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
4622
5055
|
const walletOptions = [];
|
|
@@ -4741,13 +5174,13 @@ const authenticateMfaRecoveryCode = async ({ code, createMfaTokenOptions, reques
|
|
|
4741
5174
|
}
|
|
4742
5175
|
});
|
|
4743
5176
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
4744
|
-
|
|
5177
|
+
require_InvalidParamError.emitEvent({
|
|
4745
5178
|
args: { mfaToken: response.mfaToken },
|
|
4746
5179
|
event: "mfaCompletionSuccess"
|
|
4747
5180
|
}, client);
|
|
4748
5181
|
return response;
|
|
4749
5182
|
} catch (error) {
|
|
4750
|
-
|
|
5183
|
+
require_InvalidParamError.emitEvent({
|
|
4751
5184
|
args: { error },
|
|
4752
5185
|
event: "mfaCompletionFailure"
|
|
4753
5186
|
}, client);
|
|
@@ -4821,13 +5254,13 @@ const authenticatePasskeyMFA = async ({ createMfaToken, relatedOriginRpId, reque
|
|
|
4821
5254
|
requestedScopes
|
|
4822
5255
|
}, client);
|
|
4823
5256
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
4824
|
-
|
|
5257
|
+
require_InvalidParamError.emitEvent({
|
|
4825
5258
|
args: { mfaToken: response.mfaToken },
|
|
4826
5259
|
event: "mfaCompletionSuccess"
|
|
4827
5260
|
}, client);
|
|
4828
5261
|
return response;
|
|
4829
5262
|
} catch (error) {
|
|
4830
|
-
|
|
5263
|
+
require_InvalidParamError.emitEvent({
|
|
4831
5264
|
args: { error },
|
|
4832
5265
|
event: "mfaCompletionFailure"
|
|
4833
5266
|
}, client);
|
|
@@ -4865,7 +5298,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4865
5298
|
}
|
|
4866
5299
|
});
|
|
4867
5300
|
require_getVerifiedCredentialForWalletAccount.updateAuthFromVerifyResponse({ response }, client);
|
|
4868
|
-
|
|
5301
|
+
require_InvalidParamError.emitEvent({
|
|
4869
5302
|
args: {
|
|
4870
5303
|
deviceId,
|
|
4871
5304
|
mfaToken: response.mfaToken
|
|
@@ -4874,7 +5307,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4874
5307
|
}, client);
|
|
4875
5308
|
return response;
|
|
4876
5309
|
} catch (error) {
|
|
4877
|
-
|
|
5310
|
+
require_InvalidParamError.emitEvent({
|
|
4878
5311
|
args: {
|
|
4879
5312
|
deviceId,
|
|
4880
5313
|
error
|
|
@@ -4896,6 +5329,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4896
5329
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4897
5330
|
* @returns A promise that resolves to the newly generated recovery codes.
|
|
4898
5331
|
* @instrumented
|
|
5332
|
+
* @redact-params
|
|
4899
5333
|
*/
|
|
4900
5334
|
const createNewMfaRecoveryCodes = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
4901
5335
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -4911,7 +5345,8 @@ const __createNewMfaRecoveryCodes_wrapped = require_InvalidParamError.instrument
|
|
|
4911
5345
|
} catch {
|
|
4912
5346
|
return;
|
|
4913
5347
|
}
|
|
4914
|
-
}
|
|
5348
|
+
},
|
|
5349
|
+
redactAll: true
|
|
4915
5350
|
});
|
|
4916
5351
|
|
|
4917
5352
|
//#endregion
|
|
@@ -6138,6 +6573,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
6138
6573
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6139
6574
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
6140
6575
|
* @instrumented
|
|
6576
|
+
* @redact-params
|
|
6141
6577
|
*/
|
|
6142
6578
|
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6143
6579
|
let response;
|
|
@@ -6163,7 +6599,8 @@ const __verifyOTP_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
6163
6599
|
} catch {
|
|
6164
6600
|
return;
|
|
6165
6601
|
}
|
|
6166
|
-
}
|
|
6602
|
+
},
|
|
6603
|
+
redactAll: true
|
|
6167
6604
|
});
|
|
6168
6605
|
|
|
6169
6606
|
//#endregion
|
|
@@ -6260,7 +6697,7 @@ const getSwapStatus = async (params, client = require_InvalidParamError.getDefau
|
|
|
6260
6697
|
const deleteUser = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
6261
6698
|
const core = require_InvalidParamError.getCore(client);
|
|
6262
6699
|
await require_InvalidParamError.createApiClient({ includeMfaToken: true }, client).hardDeleteUser({ environmentId: core.environmentId });
|
|
6263
|
-
await
|
|
6700
|
+
await require_InvalidParamError.__logoutWithReason_wrapped({ reason: "user-deleted" }, client);
|
|
6264
6701
|
};
|
|
6265
6702
|
const __deleteUser_impl = deleteUser;
|
|
6266
6703
|
const __deleteUser_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -6493,7 +6930,7 @@ const isInsufficientGoogleDriveScopesError = (err) => err instanceof Error && er
|
|
|
6493
6930
|
* @not-instrumented
|
|
6494
6931
|
*/
|
|
6495
6932
|
const assertWalletAccountSigningAvailability = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6496
|
-
const { addresses } = await
|
|
6933
|
+
const { addresses } = await require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).getConnectedAddresses();
|
|
6497
6934
|
if (addresses.length > 0 && !addresses.includes(walletAccount.address)) throw new WalletAccountNotSelectedError({
|
|
6498
6935
|
expectedAddress: walletAccount.address,
|
|
6499
6936
|
selectedAddress: addresses[0]
|
|
@@ -6517,7 +6954,7 @@ const assertWalletAccountSigningAvailability = async ({ walletAccount }, client
|
|
|
6517
6954
|
* @instrumented
|
|
6518
6955
|
*/
|
|
6519
6956
|
const confirmTransaction = async ({ walletAccount, transactionHash }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6520
|
-
const walletProvider =
|
|
6957
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6521
6958
|
assertWalletProviderMethodDefined(walletProvider, "confirmTransaction");
|
|
6522
6959
|
await walletProvider.confirmTransaction({
|
|
6523
6960
|
transactionHash,
|
|
@@ -6537,33 +6974,6 @@ const __confirmTransaction_wrapped = require_InvalidParamError.instrumentFunctio
|
|
|
6537
6974
|
}
|
|
6538
6975
|
});
|
|
6539
6976
|
|
|
6540
|
-
//#endregion
|
|
6541
|
-
//#region src/utils/isMobile/isMobile.ts
|
|
6542
|
-
/**
|
|
6543
|
-
* Sourced from http://detectmobilebrowsers.com/
|
|
6544
|
-
* @not-instrumented
|
|
6545
|
-
*/
|
|
6546
|
-
const userAgentRegex1 = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ios|ipad|playbook|silk/i;
|
|
6547
|
-
const userAgentRegex2 = /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;
|
|
6548
|
-
/** @not-instrumented */
|
|
6549
|
-
const isMobile = (maxTouchPointsOverride) => {
|
|
6550
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
6551
|
-
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
6552
|
-
};
|
|
6553
|
-
/** @not-instrumented */
|
|
6554
|
-
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
6555
|
-
/**
|
|
6556
|
-
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
6557
|
-
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
6558
|
-
* to mock it
|
|
6559
|
-
* @not-instrumented
|
|
6560
|
-
*/
|
|
6561
|
-
const isIPad = (maxTouchPointsOverride) => {
|
|
6562
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
6563
|
-
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
6564
|
-
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
6565
|
-
};
|
|
6566
|
-
|
|
6567
6977
|
//#endregion
|
|
6568
6978
|
//#region src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.ts
|
|
6569
6979
|
/** @not-instrumented */
|
|
@@ -6587,13 +6997,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
6587
6997
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6588
6998
|
* @returns A promise that resolves to the connected wallet account.
|
|
6589
6999
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
6590
|
-
*
|
|
7000
|
+
* @instrumented
|
|
6591
7001
|
*/
|
|
6592
7002
|
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6593
7003
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderByKey({ walletProviderKey }, client);
|
|
6594
7004
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
6595
7005
|
const { addresses } = await walletProvider.connect();
|
|
6596
|
-
const currentAddresses = require_getVerifiedCredentialForWalletAccount.getWalletAccounts(client).map(({ address }) => address);
|
|
6597
7006
|
const mainAddress = addresses?.length ? addresses[0].address : null;
|
|
6598
7007
|
/**
|
|
6599
7008
|
* This error is thrown in case the wallet has no addresses connected
|
|
@@ -6601,27 +7010,25 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
6601
7010
|
* user on the next steps.
|
|
6602
7011
|
*/
|
|
6603
7012
|
if (!mainAddress) throw new NoAddressFoundError();
|
|
6604
|
-
const
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
chain: walletProvider.chain,
|
|
6608
|
-
hardwareWalletVendor,
|
|
6609
|
-
id: require_getVerifiedCredentialForWalletAccount.formatWalletAccountId({
|
|
7013
|
+
const [reconciledWalletAccount] = require_getNetworkProviderFromNetworkId.reconcileWalletAccountsAgainstClient({
|
|
7014
|
+
addToDynamicWalletAccounts,
|
|
7015
|
+
walletAccounts: [{
|
|
6610
7016
|
address: mainAddress,
|
|
7017
|
+
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
6611
7018
|
chain: walletProvider.chain,
|
|
7019
|
+
hardwareWalletVendor,
|
|
7020
|
+
id: require_InvalidParamError.formatWalletAccountId({
|
|
7021
|
+
address: mainAddress,
|
|
7022
|
+
chain: walletProvider.chain,
|
|
7023
|
+
walletProviderKey
|
|
7024
|
+
}),
|
|
7025
|
+
lastSelectedAt: null,
|
|
7026
|
+
verifiedCredentialId: null,
|
|
6612
7027
|
walletProviderKey
|
|
6613
|
-
}
|
|
6614
|
-
lastSelectedAt: null,
|
|
6615
|
-
verifiedCredentialId: null,
|
|
7028
|
+
}],
|
|
6616
7029
|
walletProviderKey
|
|
6617
|
-
};
|
|
6618
|
-
|
|
6619
|
-
if (addToDynamicWalletAccounts) {
|
|
6620
|
-
require_getNetworkProviderFromNetworkId.setUnverifiedWalletAccounts({ unverifiedWalletAccountsToUpdate: [walletAccount] }, client);
|
|
6621
|
-
require_getVerifiedCredentialForWalletAccount.emitWalletAccountsChangedEvent(client);
|
|
6622
|
-
require_getNetworkProviderFromNetworkId.createVisit({ walletAccount }, client);
|
|
6623
|
-
}
|
|
6624
|
-
return walletAccount;
|
|
7030
|
+
}, client);
|
|
7031
|
+
return reconciledWalletAccount;
|
|
6625
7032
|
};
|
|
6626
7033
|
const __connectWithWalletProvider_impl = connectWithWalletProvider;
|
|
6627
7034
|
const __connectWithWalletProvider_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -6672,7 +7079,7 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
6672
7079
|
const url = new URL(appUniversalLink);
|
|
6673
7080
|
const domain = url.host;
|
|
6674
7081
|
const nonce = nonceOverride ?? await require_InvalidParamError.getNonce(client);
|
|
6675
|
-
const walletProvider =
|
|
7082
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6676
7083
|
if (walletProvider.chain === "STARK")
|
|
6677
7084
|
/**
|
|
6678
7085
|
* Starknet requires the strings to be 31 chars long
|
|
@@ -6711,7 +7118,7 @@ const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client)
|
|
|
6711
7118
|
* @instrumented
|
|
6712
7119
|
*/
|
|
6713
7120
|
const proveWalletAccountOwnership = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6714
|
-
const walletProvider =
|
|
7121
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6715
7122
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
6716
7123
|
const messageToSign = await getSignInMessage({
|
|
6717
7124
|
nonce: walletProvider.getConnectProofNonce?.(),
|
|
@@ -6742,10 +7149,10 @@ const __proveWalletAccountOwnership_wrapped = require_InvalidParamError.instrume
|
|
|
6742
7149
|
//#endregion
|
|
6743
7150
|
//#region src/modules/wallets/utils/isSameAddress/isSameAddress.ts
|
|
6744
7151
|
/** @not-instrumented */
|
|
6745
|
-
const isSameAddress = ({ chain, left, right }) =>
|
|
7152
|
+
const isSameAddress = ({ chain, left, right }) => require_InvalidParamError.normalizeAddress({
|
|
6746
7153
|
address: left,
|
|
6747
7154
|
chain
|
|
6748
|
-
}) ===
|
|
7155
|
+
}) === require_InvalidParamError.normalizeAddress({
|
|
6749
7156
|
address: right,
|
|
6750
7157
|
chain
|
|
6751
7158
|
});
|
|
@@ -6755,7 +7162,7 @@ const isSameAddress = ({ chain, left, right }) => require_getVerifiedCredentialF
|
|
|
6755
7162
|
/** @not-instrumented */
|
|
6756
7163
|
const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfer, requestedScopes }, client) => {
|
|
6757
7164
|
if (walletAccount.verifiedCredentialId) throw new WalletAccountAlreadyVerifiedError(walletAccount.address);
|
|
6758
|
-
const walletProvider =
|
|
7165
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
6759
7166
|
const { messageToSign, signature } = await __proveWalletAccountOwnership_wrapped({ walletAccount }, client);
|
|
6760
7167
|
const formattedSignature = walletAccount.hardwareWalletVendor ? formatSignatureForHardwareWallet({
|
|
6761
7168
|
hardwareWalletVendor: walletAccount.hardwareWalletVendor,
|
|
@@ -6790,7 +7197,7 @@ const verifyWalletAccountForSignInOrTransfer = async ({ walletAccount, isTransfe
|
|
|
6790
7197
|
* Remove the now verified wallet account from the unverified wallet accounts
|
|
6791
7198
|
*/
|
|
6792
7199
|
require_getNetworkProviderFromNetworkId.removeUnverifiedWalletAccount({ unverifiedWalletAccount: walletAccount }, client);
|
|
6793
|
-
const verifiedWalletAccount =
|
|
7200
|
+
const verifiedWalletAccount = require_InvalidParamError.getWalletAccounts(client).find(({ address }) => isSameAddress({
|
|
6794
7201
|
chain: walletAccount.chain,
|
|
6795
7202
|
left: address,
|
|
6796
7203
|
right: walletAccount.address
|
|
@@ -6908,7 +7315,7 @@ const __connectAndVerifyWithWalletProvider_wrapped = require_InvalidParamError.i
|
|
|
6908
7315
|
* @not-instrumented
|
|
6909
7316
|
*/
|
|
6910
7317
|
const getAvailableWalletProvidersData = (client = require_InvalidParamError.getDefaultClient()) => {
|
|
6911
|
-
return require_getVerifiedCredentialForWalletAccount.getWalletProviders(client).filter((walletProvider) =>
|
|
7318
|
+
return require_getVerifiedCredentialForWalletAccount.getWalletProviders(client).filter((walletProvider) => hasWalletProviderConnectMethod({ walletProvider })).map((walletProvider) => ({
|
|
6912
7319
|
chain: walletProvider.chain,
|
|
6913
7320
|
groupKey: walletProvider.groupKey,
|
|
6914
7321
|
key: walletProvider.key,
|
|
@@ -6940,7 +7347,7 @@ const getConnectedAddresses = ({ walletProviderKey }, client = require_InvalidPa
|
|
|
6940
7347
|
const getOwnerWalletAccountForSmartWalletAccount = ({ smartWalletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
6941
7348
|
const smartWalletVerifiedCredential = require_getVerifiedCredentialForWalletAccount.getVerifiedCredentialForWalletAccount({ walletAccount: smartWalletAccount }, client);
|
|
6942
7349
|
require_InvalidParamError.assertDefined(smartWalletVerifiedCredential?.signerRefId, "Invalid smart wallet account");
|
|
6943
|
-
return
|
|
7350
|
+
return require_InvalidParamError.getWalletAccounts(client).find((walletAccount) => walletAccount.verifiedCredentialId === smartWalletVerifiedCredential.signerRefId);
|
|
6944
7351
|
};
|
|
6945
7352
|
|
|
6946
7353
|
//#endregion
|
|
@@ -6971,6 +7378,22 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = require_Inva
|
|
|
6971
7378
|
};
|
|
6972
7379
|
};
|
|
6973
7380
|
|
|
7381
|
+
//#endregion
|
|
7382
|
+
//#region src/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.ts
|
|
7383
|
+
/**
|
|
7384
|
+
* Checks whether the session has at least one connected wallet account.
|
|
7385
|
+
*
|
|
7386
|
+
* Both verified and unverified wallet accounts count as connected. This is a
|
|
7387
|
+
* single building block for a custom signed-in check — combine it with whatever
|
|
7388
|
+
* else your app considers "signed in" (e.g. `client.user`, completed onboarding,
|
|
7389
|
+
* a required embedded wallet, …).
|
|
7390
|
+
*
|
|
7391
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7392
|
+
* @returns True if the session has at least one wallet account, false otherwise.
|
|
7393
|
+
* @not-instrumented
|
|
7394
|
+
*/
|
|
7395
|
+
const isAnyWalletAccountConnected = (client = require_InvalidParamError.getDefaultClient()) => require_InvalidParamError.getWalletAccounts(client).length > 0;
|
|
7396
|
+
|
|
6974
7397
|
//#endregion
|
|
6975
7398
|
//#region src/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.ts
|
|
6976
7399
|
/**
|
|
@@ -7062,7 +7485,7 @@ const __addNetwork_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
7062
7485
|
* @not-instrumented
|
|
7063
7486
|
*/
|
|
7064
7487
|
const getActiveNetworkData = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7065
|
-
const walletProvider =
|
|
7488
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7066
7489
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7067
7490
|
return { networkData: require_getNetworkProviderFromNetworkId.getNetworksData(client).find((data) => data.networkId === networkId && data.chain === walletProvider.chain) };
|
|
7068
7491
|
};
|
|
@@ -7078,24 +7501,28 @@ const getActiveNetworkData = async ({ walletAccount }, client = require_InvalidP
|
|
|
7078
7501
|
* @not-instrumented
|
|
7079
7502
|
*/
|
|
7080
7503
|
const getActiveNetworkId = ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7081
|
-
return
|
|
7504
|
+
return require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
7082
7505
|
};
|
|
7083
7506
|
|
|
7084
7507
|
//#endregion
|
|
7085
|
-
//#region src/modules/wallets/networks/
|
|
7508
|
+
//#region src/modules/wallets/networks/getNativeBalance/getNativeBalance.ts
|
|
7086
7509
|
/**
|
|
7087
|
-
* Retrieves the native token balance for a wallet account
|
|
7510
|
+
* Retrieves the native token balance for a wallet account on its active
|
|
7511
|
+
* network. Reads directly from the chain's network provider (RPC), not
|
|
7512
|
+
* the Dynamic API.
|
|
7088
7513
|
*
|
|
7089
|
-
*
|
|
7090
|
-
* (
|
|
7514
|
+
* Use this when you only need the user's gas / native-currency balance
|
|
7515
|
+
* (ETH, SOL, BTC, etc.). For token balances, use
|
|
7516
|
+
* {@link getTokenBalances}; for a multi-chain portfolio snapshot, use
|
|
7517
|
+
* {@link getMultichainTokenBalances}.
|
|
7091
7518
|
*
|
|
7092
7519
|
* @param params.walletAccount - The wallet account to get the balance for.
|
|
7093
7520
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7094
7521
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7095
7522
|
* @not-instrumented
|
|
7096
7523
|
*/
|
|
7097
|
-
const
|
|
7098
|
-
const walletProvider =
|
|
7524
|
+
const getNativeBalance = async ({ walletAccount }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7525
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7099
7526
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7100
7527
|
return require_getNetworkProviderFromNetworkId.getNetworkProviderFromNetworkId({
|
|
7101
7528
|
chain: walletProvider.chain,
|
|
@@ -7254,9 +7681,9 @@ const __selectPrimaryWalletAccount_wrapped = require_InvalidParamError.instrumen
|
|
|
7254
7681
|
*/
|
|
7255
7682
|
const disconnectWalletAccount = async ({ walletAccount }, client) => {
|
|
7256
7683
|
try {
|
|
7257
|
-
await
|
|
7684
|
+
await require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client).disconnectWalletAccount?.({ walletAccount });
|
|
7258
7685
|
} catch (error) {
|
|
7259
|
-
if (error instanceof
|
|
7686
|
+
if (error instanceof require_InvalidParamError.NoWalletProviderFoundError) return;
|
|
7260
7687
|
throw error;
|
|
7261
7688
|
}
|
|
7262
7689
|
};
|
|
@@ -7316,7 +7743,7 @@ const __removeWalletAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
7316
7743
|
* @instrumented
|
|
7317
7744
|
*/
|
|
7318
7745
|
const signMessage = async ({ walletAccount, message }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7319
|
-
const walletProvider =
|
|
7746
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7320
7747
|
assertWalletProviderMethodDefined(walletProvider, "signMessage");
|
|
7321
7748
|
const { signature } = await walletProvider.signMessage({
|
|
7322
7749
|
message,
|
|
@@ -7355,7 +7782,7 @@ const __signMessage_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
7355
7782
|
* @instrumented
|
|
7356
7783
|
*/
|
|
7357
7784
|
const transferAmount = async ({ walletAccount, amount, recipient, token }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7358
|
-
const walletProvider =
|
|
7785
|
+
const walletProvider = require_InvalidParamError.getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7359
7786
|
assertWalletProviderMethodDefined(walletProvider, "transferAmount");
|
|
7360
7787
|
const { transactionHash } = await walletProvider.transferAmount({
|
|
7361
7788
|
amount,
|
|
@@ -7428,7 +7855,7 @@ const __transferWalletAccount_wrapped = require_InvalidParamError.instrumentFunc
|
|
|
7428
7855
|
* @not-instrumented
|
|
7429
7856
|
*/
|
|
7430
7857
|
const getWalletAccountFromAddress = ({ address, chain }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
7431
|
-
return
|
|
7858
|
+
return require_InvalidParamError.getWalletAccounts(client).find((walletAccount) => walletAccount.address === address && walletAccount.chain === chain);
|
|
7432
7859
|
};
|
|
7433
7860
|
|
|
7434
7861
|
//#endregion
|
|
@@ -7600,6 +8027,7 @@ exports.WalletProviderMethodUnavailableError = WalletProviderMethodUnavailableEr
|
|
|
7600
8027
|
exports.acknowledgeRecoveryCodes = __acknowledgeRecoveryCodes_wrapped;
|
|
7601
8028
|
exports.addCoinbaseOnrampOrderEventListener = addCoinbaseOnrampOrderEventListener;
|
|
7602
8029
|
exports.addNetwork = __addNetwork_wrapped;
|
|
8030
|
+
exports.appendConnectionUriToDeeplink = appendConnectionUriToDeeplink;
|
|
7603
8031
|
exports.assertWalletAccountSigningAvailability = assertWalletAccountSigningAvailability;
|
|
7604
8032
|
exports.assertWalletProviderMethodDefined = assertWalletProviderMethodDefined;
|
|
7605
8033
|
exports.attachCheckoutTransactionSource = __attachCheckoutTransactionSource_wrapped;
|
|
@@ -7632,14 +8060,14 @@ exports.detectOAuthRedirect = detectOAuthRedirect;
|
|
|
7632
8060
|
exports.detectSocialRedirectUrl = detectSocialRedirectUrl;
|
|
7633
8061
|
exports.excludeInstalledFromCatalog = excludeInstalledFromCatalog;
|
|
7634
8062
|
exports.executeSwapTransaction = __executeSwapTransaction_wrapped;
|
|
7635
|
-
exports.fetchProjectSettings =
|
|
8063
|
+
exports.fetchProjectSettings = require_InvalidParamError.fetchProjectSettings;
|
|
7636
8064
|
exports.findMissingGoogleDriveBackupScopes = findMissingGoogleDriveBackupScopes;
|
|
7637
8065
|
exports.getActiveNetworkData = getActiveNetworkData;
|
|
7638
8066
|
exports.getActiveNetworkId = getActiveNetworkId;
|
|
7639
8067
|
exports.getAvailableWalletProvidersData = getAvailableWalletProvidersData;
|
|
7640
|
-
exports.getBalance =
|
|
8068
|
+
exports.getBalance = getNativeBalance;
|
|
7641
8069
|
exports.getBalanceForAddress = getBalanceForAddress;
|
|
7642
|
-
exports.getBalances =
|
|
8070
|
+
exports.getBalances = getTokenBalances;
|
|
7643
8071
|
exports.getCheckoutTransaction = getCheckoutTransaction;
|
|
7644
8072
|
exports.getCheckoutTransactionQuote = getCheckoutTransactionQuote;
|
|
7645
8073
|
exports.getCoinbaseBuyUrl = getCoinbaseBuyUrl;
|
|
@@ -7648,13 +8076,18 @@ exports.getDefaultClient = require_InvalidParamError.getDefaultClient;
|
|
|
7648
8076
|
exports.getDeviceRegistrationTokenFromUrl = getDeviceRegistrationTokenFromUrl;
|
|
7649
8077
|
exports.getElevatedAccessToken = require_InvalidParamError.__getElevatedAccessToken_wrapped;
|
|
7650
8078
|
exports.getGoogleDriveBackupReadiness = __getGoogleDriveBackupReadiness_wrapped;
|
|
8079
|
+
exports.getInstallationLinkForCurrentPlatform = getInstallationLinkForCurrentPlatform;
|
|
7651
8080
|
exports.getKrakenAccounts = getKrakenAccounts;
|
|
7652
8081
|
exports.getKrakenWhitelistedAddresses = getKrakenWhitelistedAddresses;
|
|
7653
8082
|
exports.getMfaDevices = getMfaDevices;
|
|
7654
8083
|
exports.getMfaMethods = require_isMfaRequiredForAction.getMfaMethods;
|
|
7655
8084
|
exports.getMfaRecoveryCodes = getMfaRecoveryCodes;
|
|
7656
8085
|
exports.getMissingVerificationForCoinbaseOnrampOrder = getMissingVerificationForCoinbaseOnrampOrder;
|
|
7657
|
-
exports.
|
|
8086
|
+
exports.getMoonPayCurrencies = __getMoonPayCurrencies_wrapped;
|
|
8087
|
+
exports.getMoonPayUrl = __getMoonPayUrl_wrapped;
|
|
8088
|
+
exports.getMultichainBalances = getMultichainTokenBalances;
|
|
8089
|
+
exports.getMultichainTokenBalances = getMultichainTokenBalances;
|
|
8090
|
+
exports.getNativeBalance = getNativeBalance;
|
|
7658
8091
|
exports.getNetworksData = require_getNetworkProviderFromNetworkId.getNetworksData;
|
|
7659
8092
|
exports.getOwnerWalletAccountForSmartWalletAccount = getOwnerWalletAccountForSmartWalletAccount;
|
|
7660
8093
|
exports.getPasskeys = getPasskeys;
|
|
@@ -7662,11 +8095,12 @@ exports.getPrimaryWalletAccount = getPrimaryWalletAccount;
|
|
|
7662
8095
|
exports.getRegisteredDevices = getRegisteredDevices;
|
|
7663
8096
|
exports.getSwapQuote = getSwapQuote;
|
|
7664
8097
|
exports.getSwapStatus = getSwapStatus;
|
|
8098
|
+
exports.getTokenBalances = getTokenBalances;
|
|
7665
8099
|
exports.getTransactionHistory = getTransactionHistory;
|
|
7666
8100
|
exports.getUserSocialAccounts = getUserSocialAccounts;
|
|
7667
8101
|
exports.getWalletAccountAddressByType = getWalletAccountAddressByType;
|
|
7668
8102
|
exports.getWalletAccountFromAddress = getWalletAccountFromAddress;
|
|
7669
|
-
exports.getWalletAccounts =
|
|
8103
|
+
exports.getWalletAccounts = require_InvalidParamError.getWalletAccounts;
|
|
7670
8104
|
exports.getWalletConnectCatalog = getWalletConnectCatalog;
|
|
7671
8105
|
exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
|
|
7672
8106
|
exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
|
|
@@ -7674,6 +8108,7 @@ exports.getWalletProviderDataByKey = getWalletProviderDataByKey;
|
|
|
7674
8108
|
exports.hasAllGoogleDriveBackupScopes = hasAllGoogleDriveBackupScopes;
|
|
7675
8109
|
exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|
|
7676
8110
|
exports.initializeClient = __initializeClient_wrapped;
|
|
8111
|
+
exports.isAnyWalletAccountConnected = isAnyWalletAccountConnected;
|
|
7677
8112
|
exports.isCaptchaRequired = require_getNetworkProviderFromNetworkId.isCaptchaRequired;
|
|
7678
8113
|
exports.isDeeplinkWalletProvider = isDeeplinkWalletProvider;
|
|
7679
8114
|
exports.isDeviceRegistrationRequired = isDeviceRegistrationRequired;
|
|
@@ -7683,17 +8118,17 @@ exports.isMfaRequiredForAction = require_isMfaRequiredForAction.isMfaRequiredFor
|
|
|
7683
8118
|
exports.isMobile = isMobile;
|
|
7684
8119
|
exports.isPendingRecoveryCodesAcknowledgment = isPendingRecoveryCodesAcknowledgment;
|
|
7685
8120
|
exports.isProgrammaticNetworkSwitchAvailable = isProgrammaticNetworkSwitchAvailable;
|
|
7686
|
-
exports.isSignedIn =
|
|
8121
|
+
exports.isSignedIn = require_InvalidParamError.isSignedIn;
|
|
7687
8122
|
exports.isUserMissingMfaAuth = require_getVerifiedCredentialForWalletAccount.isUserMissingMfaAuth;
|
|
7688
8123
|
exports.isUserOnboardingComplete = isUserOnboardingComplete;
|
|
7689
8124
|
exports.isWalletAccountVerified = isWalletAccountVerified;
|
|
7690
8125
|
exports.logout = logout;
|
|
7691
8126
|
exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
|
|
7692
|
-
exports.offEvent =
|
|
8127
|
+
exports.offEvent = require_InvalidParamError.offEvent;
|
|
7693
8128
|
exports.offWalletProviderEvent = offWalletProviderEvent;
|
|
7694
|
-
exports.onEvent =
|
|
8129
|
+
exports.onEvent = require_InvalidParamError.onEvent;
|
|
7695
8130
|
exports.onWalletProviderEvent = onWalletProviderEvent;
|
|
7696
|
-
exports.onceEvent =
|
|
8131
|
+
exports.onceEvent = require_InvalidParamError.onceEvent;
|
|
7697
8132
|
exports.parseUserAgent = parseUserAgent;
|
|
7698
8133
|
exports.prepareCheckoutTransaction = __prepareCheckoutTransaction_wrapped;
|
|
7699
8134
|
exports.proveWalletAccountOwnership = __proveWalletAccountOwnership_wrapped;
|