@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.esm.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { A as
|
|
3
|
-
import {
|
|
4
|
-
import { n as __refreshAuth_wrapped, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-
|
|
5
|
-
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
1
|
+
import { $ as scrubParameters, B as getNonce, D as formatWalletAccountId, E as CHAINS_INFO_MAP, F as onceEvent, G as InvalidExternalAuthError, H as MfaRateLimitedError, J as isCookieEnabled, K as APIError, M as emitEvent, N as offEvent, O as normalizeAddress, P as onEvent, Q as instrumentFunction, T as getChainFromVerifiedCredentialChain, U as MfaInvalidOtpError, V as SandboxMaximumThresholdReachedError, W as LinkCredentialError, X as ValueMustBeDefinedError, Y as assertDefined, Z as __getElevatedAccessToken_wrapped, _ as generateSessionKeys, a as DYNAMIC_ICONIC_SPRITE_URL, b as isSignedIn, c as createApiClient, ct as setDefaultClient, dt as getCore, et as DEFAULT_PII_FIELDS, f as getWalletProviderFromWalletAccount, ft as name, g as NoWalletProviderFoundError, j as retryOnFail, k as splitWalletProviderKey, l as UnauthorizedError, m as getWalletProviderRegistry, nt as extractSessionId, o as SDK_API_CORE_VERSION, ot as NONCE_POOL_SIZE, p as WalletProviderPriority, pt as version, rt as randomString, s as fetchAndStoreNonces, st as getDefaultClient, t as InvalidParamError, tt as getUserAgent, u as __logoutWithReason_wrapped, ut as BaseError, v as fetchProjectSettings, x as getWalletAccounts, y as createStorageKeySchema } from "./InvalidParamError-DWjMfOZ5.esm.js";
|
|
2
|
+
import { A as GENERATE_SESSION_KEYS_TRACKER_KEY, B as createLocalStorageAdapter, C as createKeychainService, D as CannotTrackError, F as getBuffer, I as subscribeWithSelector, L as isEqualShallow, M as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, N as REFRESH_USER_STATE_FROM_VALID_TOKEN_TRACKER_KEY, O as createDeferredPromise, P as isServerSideRendering, R as createStorage, S as createRealtimeService, T as createCrossTabBroadcast, _ as isCaptchaRequired, a as verifyMessageSignatureOwnership, b as NoNetworkProvidersError, c as formatSignInMessage, d as updateWalletProviderKeysForVerifiedCredentials, f as setUnverifiedWalletAccounts, g as consumeCaptchaToken, h as __setCaptchaToken_wrapped, i as getNetworksData, j as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, k as FETCH_PROJECT_SETTINGS_TRACKER_KEY, l as getAppMetadata, m as hasExtension, o as removeUnverifiedWalletAccount, p as createVisit, s as createSignInMessageStatement, t as getNetworkProviderFromNetworkId, u as reconcileWalletAccountsAgainstClient, v as MethodNotImplementedError, w as createLogger, x as getKeychainIndexedDBName, y as WalletAlreadyLinkedToAnotherUserError } from "./getNetworkProviderFromNetworkId-Cqp9eRSs.esm.js";
|
|
3
|
+
import { a as parseElevatedAccessToken, d as isUserMissingMfaAuth, f as checkAndRaiseWalletAccountsChangedEvent, i as upsertElevatedAccessToken, n as getWalletProviderByKey, o as restoreUserSharesForAllWalletAccounts, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as getWalletProviders } from "./getVerifiedCredentialForWalletAccount-BuUCX040.esm.js";
|
|
4
|
+
import { n as __refreshAuth_wrapped, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-C7NUlvvM.esm.js";
|
|
5
|
+
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-C_QPI1LH.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { AuthModeEnum, ExchangeKeyEnum, JwtVerifiedCredentialFormatEnum, MFAAction, MfaBackupCodeAcknowledgement, ProviderEnum, TokenScope, WaasBackupOptionsEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
import * as z from "zod/mini";
|
|
9
|
-
import EventEmitter, { EventEmitter
|
|
9
|
+
import EventEmitter$1, { EventEmitter } from "eventemitter3";
|
|
10
10
|
import { browserSupportsWebAuthn, startAuthentication, startRegistration } from "@simplewebauthn/browser";
|
|
11
11
|
|
|
12
12
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -26,11 +26,33 @@ const stateChangeEvents = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region src/utils/
|
|
30
|
-
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
//#region src/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.ts
|
|
30
|
+
/**
|
|
31
|
+
* Appends a wallet connection URI to a deeplink URL.
|
|
32
|
+
*
|
|
33
|
+
* Generic across URI-deeplink connection options — works for both
|
|
34
|
+
* WalletConnect pairing URIs and MetaMask SDK URIs. Determines the
|
|
35
|
+
* appropriate query parameter separator based on whether the deeplink
|
|
36
|
+
* already contains query parameters.
|
|
37
|
+
*
|
|
38
|
+
* @param params.deeplinkUrl - The base deeplink URL (e.g., `walletapp://wc` or `walletapp://wc?param=value`).
|
|
39
|
+
* @param params.connectionUri - The connection URI to append.
|
|
40
|
+
* @returns The deeplink URL with the connection URI appended as a query parameter.
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* appendConnectionUriToDeeplink({ deeplinkUrl: 'walletapp://wc', connectionUri: 'wc:123-456' })
|
|
45
|
+
* // Returns: 'walletapp://wc?uri=wc%3A123-456'
|
|
46
|
+
*
|
|
47
|
+
* appendConnectionUriToDeeplink({ deeplinkUrl: 'walletapp://wc?param=value', connectionUri: 'wc:123-456' })
|
|
48
|
+
* // Returns: 'walletapp://wc?param=value&uri=wc%3A123-456'
|
|
49
|
+
* ```
|
|
50
|
+
* @not-instrumented
|
|
51
|
+
*/
|
|
52
|
+
const appendConnectionUriToDeeplink = ({ connectionUri, deeplinkUrl }) => {
|
|
53
|
+
const url = new URL(deeplinkUrl);
|
|
54
|
+
url.searchParams.set("uri", connectionUri);
|
|
55
|
+
return url.href;
|
|
34
56
|
};
|
|
35
57
|
|
|
36
58
|
//#endregion
|
|
@@ -50,6 +72,14 @@ const createRuntimeServices = () => {
|
|
|
50
72
|
};
|
|
51
73
|
};
|
|
52
74
|
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/utils/getNonce/prefetchNoncesIfNeeded/prefetchNoncesIfNeeded.ts
|
|
77
|
+
/** @not-instrumented */
|
|
78
|
+
const prefetchNoncesIfNeeded = async (client) => {
|
|
79
|
+
if (getCore(client).state.get().prefetchedNonces.length >= NONCE_POOL_SIZE) return;
|
|
80
|
+
await fetchAndStoreNonces(client);
|
|
81
|
+
};
|
|
82
|
+
|
|
53
83
|
//#endregion
|
|
54
84
|
//#region src/modules/auth/initializeAuth/setLongTimeout/setLongTimeout.ts
|
|
55
85
|
/**
|
|
@@ -535,7 +565,7 @@ const createAsyncTrack = () => {
|
|
|
535
565
|
* This ensures no process is missed (as it would throw when tracked on a different node tick).
|
|
536
566
|
*/
|
|
537
567
|
let isTrackEnabled = true;
|
|
538
|
-
const eventEmitter = new EventEmitter
|
|
568
|
+
const eventEmitter = new EventEmitter();
|
|
539
569
|
const allSettledPromise = createDeferredPromise();
|
|
540
570
|
const tracker = /* @__PURE__ */ new Map();
|
|
541
571
|
/**
|
|
@@ -582,7 +612,7 @@ const createAsyncTrack = () => {
|
|
|
582
612
|
//#endregion
|
|
583
613
|
//#region src/services/eventEmitter/createEventEmitter.ts
|
|
584
614
|
/** @not-instrumented */
|
|
585
|
-
const createEventEmitter = () => new EventEmitter();
|
|
615
|
+
const createEventEmitter = () => new EventEmitter$1();
|
|
586
616
|
|
|
587
617
|
//#endregion
|
|
588
618
|
//#region src/errors/UnavailableInServerSideError.ts
|
|
@@ -626,10 +656,13 @@ const connectLoggerToInstrumentation = ({ environmentId, extensions, instrumenta
|
|
|
626
656
|
const { token, user } = state.get();
|
|
627
657
|
instrumentation.log({
|
|
628
658
|
environmentId,
|
|
629
|
-
parameters: {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
659
|
+
parameters: scrubParameters({
|
|
660
|
+
piiFields: instrumentation.config.piiFields,
|
|
661
|
+
value: {
|
|
662
|
+
args,
|
|
663
|
+
message
|
|
664
|
+
}
|
|
665
|
+
}),
|
|
633
666
|
registeredExtensionKeys: Array.from(extensions),
|
|
634
667
|
sdkSessionId,
|
|
635
668
|
sdkVersion,
|
|
@@ -1541,6 +1574,7 @@ const __checkStepUpAuth_wrapped = instrumentFunction({
|
|
|
1541
1574
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1542
1575
|
* @returns A promise that resolves to the assertion response containing the elevated access token.
|
|
1543
1576
|
* @instrumented
|
|
1577
|
+
* @redact-params
|
|
1544
1578
|
*/
|
|
1545
1579
|
const requestExternalAuthElevatedToken = async ({ externalJwt }, client = getDefaultClient()) => {
|
|
1546
1580
|
const core = getCore(client);
|
|
@@ -1568,7 +1602,8 @@ const __requestExternalAuthElevatedToken_wrapped = instrumentFunction({
|
|
|
1568
1602
|
} catch {
|
|
1569
1603
|
return;
|
|
1570
1604
|
}
|
|
1571
|
-
}
|
|
1605
|
+
},
|
|
1606
|
+
redactAll: true
|
|
1572
1607
|
});
|
|
1573
1608
|
|
|
1574
1609
|
//#endregion
|
|
@@ -1720,6 +1755,7 @@ const serverRegisterPasskey = async ({ registration, createMfaToken }, client) =
|
|
|
1720
1755
|
* @returns A promise that resolves to the registration response.
|
|
1721
1756
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1722
1757
|
* @instrumented
|
|
1758
|
+
* @redact-params
|
|
1723
1759
|
*/
|
|
1724
1760
|
const registerPasskey = async ({ createMfaToken } = {}, client = getDefaultClient()) => {
|
|
1725
1761
|
const core = getCore(client);
|
|
@@ -1742,7 +1778,8 @@ const __registerPasskey_wrapped = instrumentFunction({
|
|
|
1742
1778
|
} catch {
|
|
1743
1779
|
return;
|
|
1744
1780
|
}
|
|
1745
|
-
}
|
|
1781
|
+
},
|
|
1782
|
+
redactAll: true
|
|
1746
1783
|
});
|
|
1747
1784
|
|
|
1748
1785
|
//#endregion
|
|
@@ -1787,6 +1824,7 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client) =
|
|
|
1787
1824
|
* @returns A promise that resolves to the authentication response.
|
|
1788
1825
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1789
1826
|
* @instrumented
|
|
1827
|
+
* @redact-params
|
|
1790
1828
|
*/
|
|
1791
1829
|
const signInWithPasskey = async ({ relatedOriginRpId } = {}, client = getDefaultClient()) => {
|
|
1792
1830
|
const core = getCore(client);
|
|
@@ -1806,7 +1844,8 @@ const __signInWithPasskey_wrapped = instrumentFunction({
|
|
|
1806
1844
|
} catch {
|
|
1807
1845
|
return;
|
|
1808
1846
|
}
|
|
1809
|
-
}
|
|
1847
|
+
},
|
|
1848
|
+
redactAll: true
|
|
1810
1849
|
});
|
|
1811
1850
|
|
|
1812
1851
|
//#endregion
|
|
@@ -2248,6 +2287,7 @@ const getPrimaryWalletAccount = (client = getDefaultClient()) => {
|
|
|
2248
2287
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2249
2288
|
* @returns A promise that resolves to the verify response.
|
|
2250
2289
|
* @instrumented
|
|
2290
|
+
* @redact-params
|
|
2251
2291
|
*/
|
|
2252
2292
|
const unlinkSocialAccount = async ({ verifiedCredentialId }, client = getDefaultClient()) => {
|
|
2253
2293
|
const core = getCore(client);
|
|
@@ -2273,22 +2313,30 @@ const __unlinkSocialAccount_wrapped = instrumentFunction({
|
|
|
2273
2313
|
} catch {
|
|
2274
2314
|
return;
|
|
2275
2315
|
}
|
|
2276
|
-
}
|
|
2316
|
+
},
|
|
2317
|
+
redactAll: true
|
|
2277
2318
|
});
|
|
2278
2319
|
|
|
2279
2320
|
//#endregion
|
|
2280
|
-
//#region src/modules/balances/
|
|
2321
|
+
//#region src/modules/balances/getTokenBalances/getTokenBalances.ts
|
|
2281
2322
|
/**
|
|
2282
|
-
* Retrieves the token balances for a wallet account.
|
|
2323
|
+
* Retrieves the token balances for a wallet account on one chain. Fetched
|
|
2324
|
+
* from the Dynamic API.
|
|
2325
|
+
*
|
|
2326
|
+
* Use this for ERC-20-style token balances scoped to a single wallet
|
|
2327
|
+
* account. Supports optional spam filtering, price inclusion, native-token
|
|
2328
|
+
* inclusion, and one-or-many networks within the wallet's chain.
|
|
2283
2329
|
*
|
|
2284
|
-
*
|
|
2330
|
+
* For native-only balance, use {@link getNativeBalance}. For a
|
|
2331
|
+
* multi-chain portfolio across many addresses, use
|
|
2332
|
+
* {@link getMultichainTokenBalances}.
|
|
2285
2333
|
*
|
|
2286
2334
|
* @param params.walletAccount - The wallet account to get the balances for.
|
|
2287
2335
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2288
2336
|
* @returns A promise that resolves to an array of token balances.
|
|
2289
2337
|
* @not-instrumented
|
|
2290
2338
|
*/
|
|
2291
|
-
const
|
|
2339
|
+
const getTokenBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = getDefaultClient()) => {
|
|
2292
2340
|
const core = getCore(client);
|
|
2293
2341
|
const apiClient = createApiClient({}, client);
|
|
2294
2342
|
if (!networkId && !networkIds) {
|
|
@@ -2310,19 +2358,22 @@ const getBalances = async ({ walletAccount, networkId, networkIds, includePrices
|
|
|
2310
2358
|
};
|
|
2311
2359
|
|
|
2312
2360
|
//#endregion
|
|
2313
|
-
//#region src/modules/balances/
|
|
2361
|
+
//#region src/modules/balances/getMultichainTokenBalances/getMultichainTokenBalances.ts
|
|
2314
2362
|
/**
|
|
2315
|
-
* Retrieves token balances across multiple
|
|
2363
|
+
* Retrieves token balances across multiple chains, networks, and addresses
|
|
2364
|
+
* in a single batched API request.
|
|
2316
2365
|
*
|
|
2317
|
-
*
|
|
2318
|
-
*
|
|
2366
|
+
* Use this for portfolio-style views that need to render a user's holdings
|
|
2367
|
+
* across their entire multi-chain wallet set. For a single account on one
|
|
2368
|
+
* chain, use {@link getTokenBalances}; for native-only balance, use
|
|
2369
|
+
* {@link getNativeBalance}.
|
|
2319
2370
|
*
|
|
2320
2371
|
* @param params.balanceRequest - The balance request configuration specifying which chains, networks and addresses to query.
|
|
2321
2372
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2322
2373
|
* @returns A promise that resolves to the chain balances across multiple networks.
|
|
2323
2374
|
* @not-instrumented
|
|
2324
2375
|
*/
|
|
2325
|
-
const
|
|
2376
|
+
const getMultichainTokenBalances = async ({ balanceRequest }, client = getDefaultClient()) => {
|
|
2326
2377
|
const core = getCore(client);
|
|
2327
2378
|
return (await createApiClient({}, client).postMultichainAccountBalances({
|
|
2328
2379
|
environmentId: core.environmentId,
|
|
@@ -2355,6 +2406,52 @@ const createCheckoutApiClient = async ({ transactionId }, client) => {
|
|
|
2355
2406
|
};
|
|
2356
2407
|
};
|
|
2357
2408
|
|
|
2409
|
+
//#endregion
|
|
2410
|
+
//#region src/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.ts
|
|
2411
|
+
/**
|
|
2412
|
+
* Removes the locally stored checkout session token for the given transaction.
|
|
2413
|
+
*
|
|
2414
|
+
* The checkout session token is the anonymous credential that authorizes
|
|
2415
|
+
* mutations to a single in-flight checkout transaction. Once the transaction
|
|
2416
|
+
* has reached a terminal state (cancelled, expired, failed, completed) it can
|
|
2417
|
+
* no longer be advanced, and the token is dead weight that should not be
|
|
2418
|
+
* persisted in browser storage — leaving it around lets a later XSS payload
|
|
2419
|
+
* exfiltrate a credential with no further use, and it can also confuse the
|
|
2420
|
+
* SDK on subsequent loads into believing an active session exists.
|
|
2421
|
+
*
|
|
2422
|
+
* The server-side revocation lives in dashboard-api; this is the SDK-side
|
|
2423
|
+
* defense-in-depth.
|
|
2424
|
+
*
|
|
2425
|
+
* @not-instrumented
|
|
2426
|
+
*/
|
|
2427
|
+
const clearCheckoutSessionToken = async ({ transactionId }, client) => {
|
|
2428
|
+
await getCore(client).storage.removeItem(createCheckoutSessionTokenStorageKey(transactionId));
|
|
2429
|
+
};
|
|
2430
|
+
|
|
2431
|
+
//#endregion
|
|
2432
|
+
//#region src/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.ts
|
|
2433
|
+
/**
|
|
2434
|
+
* Checkout mutation routes are guarded server-side only by session-token
|
|
2435
|
+
* validation, so a 401 means the token is dead (revoked, expired, deleted,
|
|
2436
|
+
* or invalid). Leaving a dead token in `localStorage` widens the XSS
|
|
2437
|
+
* exfiltration surface for no benefit and makes the next SDK load attempt
|
|
2438
|
+
* requests that are guaranteed to fail.
|
|
2439
|
+
*
|
|
2440
|
+
* @not-instrumented
|
|
2441
|
+
*/
|
|
2442
|
+
const withCheckoutSessionTokenCleanupOn401 = async ({ call, transactionId }, client) => {
|
|
2443
|
+
try {
|
|
2444
|
+
return await call();
|
|
2445
|
+
} catch (error) {
|
|
2446
|
+
if (error instanceof APIError && error.status === 401) try {
|
|
2447
|
+
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2448
|
+
} catch (cleanupError) {
|
|
2449
|
+
getCore(client).logger.error("Failed to clear checkout session token after 401", cleanupError);
|
|
2450
|
+
}
|
|
2451
|
+
throw error;
|
|
2452
|
+
}
|
|
2453
|
+
};
|
|
2454
|
+
|
|
2358
2455
|
//#endregion
|
|
2359
2456
|
//#region src/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.ts
|
|
2360
2457
|
/**
|
|
@@ -2379,12 +2476,15 @@ const attachCheckoutTransactionSource = async (params, client = getDefaultClient
|
|
|
2379
2476
|
attachSourceRequest.fromChainId = params.fromChainId;
|
|
2380
2477
|
attachSourceRequest.fromChainName = params.fromChainName;
|
|
2381
2478
|
}
|
|
2382
|
-
return
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2479
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2480
|
+
call: () => apiClient.attachSource({
|
|
2481
|
+
attachSourceRequest,
|
|
2482
|
+
environmentId,
|
|
2483
|
+
transactionId,
|
|
2484
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2485
|
+
}),
|
|
2486
|
+
transactionId
|
|
2487
|
+
}, client);
|
|
2388
2488
|
};
|
|
2389
2489
|
const __attachCheckoutTransactionSource_impl = attachCheckoutTransactionSource;
|
|
2390
2490
|
const __attachCheckoutTransactionSource_wrapped = instrumentFunction({
|
|
@@ -2415,12 +2515,15 @@ const __attachCheckoutTransactionSource_wrapped = instrumentFunction({
|
|
|
2415
2515
|
*/
|
|
2416
2516
|
const broadcastCheckoutTransaction = async ({ transactionId, txHash }, client = getDefaultClient()) => {
|
|
2417
2517
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2418
|
-
return
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2518
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2519
|
+
call: () => apiClient.recordCheckoutBroadcast({
|
|
2520
|
+
environmentId,
|
|
2521
|
+
recordBroadcastRequest: { txHash },
|
|
2522
|
+
transactionId,
|
|
2523
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2524
|
+
}),
|
|
2525
|
+
transactionId
|
|
2526
|
+
}, client);
|
|
2424
2527
|
};
|
|
2425
2528
|
const __broadcastCheckoutTransaction_impl = broadcastCheckoutTransaction;
|
|
2426
2529
|
const __broadcastCheckoutTransaction_wrapped = instrumentFunction({
|
|
@@ -2447,12 +2550,15 @@ const __broadcastCheckoutTransaction_wrapped = instrumentFunction({
|
|
|
2447
2550
|
*/
|
|
2448
2551
|
const cancelCheckoutTransaction = async ({ transactionId }, client = getDefaultClient()) => {
|
|
2449
2552
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2450
|
-
const result = await
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2553
|
+
const result = await withCheckoutSessionTokenCleanupOn401({
|
|
2554
|
+
call: () => apiClient.cancelCheckoutTransaction({
|
|
2555
|
+
environmentId,
|
|
2556
|
+
transactionId,
|
|
2557
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2558
|
+
}),
|
|
2559
|
+
transactionId
|
|
2560
|
+
}, client);
|
|
2561
|
+
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2456
2562
|
return result;
|
|
2457
2563
|
};
|
|
2458
2564
|
const __cancelCheckoutTransaction_impl = cancelCheckoutTransaction;
|
|
@@ -2553,16 +2659,19 @@ const getCheckoutTransaction = async ({ transactionId }, client = getDefaultClie
|
|
|
2553
2659
|
*/
|
|
2554
2660
|
const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slippage, transactionId }, client = getDefaultClient()) => {
|
|
2555
2661
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2556
|
-
return
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2662
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2663
|
+
call: () => apiClient.quoteCheckoutTransaction({
|
|
2664
|
+
environmentId,
|
|
2665
|
+
quoteRequest: {
|
|
2666
|
+
fromChainId,
|
|
2667
|
+
fromTokenAddress,
|
|
2668
|
+
slippage
|
|
2669
|
+
},
|
|
2670
|
+
transactionId,
|
|
2671
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2672
|
+
}),
|
|
2673
|
+
transactionId
|
|
2674
|
+
}, client);
|
|
2566
2675
|
};
|
|
2567
2676
|
|
|
2568
2677
|
//#endregion
|
|
@@ -2579,15 +2688,18 @@ const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slip
|
|
|
2579
2688
|
*/
|
|
2580
2689
|
const prepareCheckoutTransaction = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, transactionId }, client = getDefaultClient()) => {
|
|
2581
2690
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2582
|
-
return
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2691
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2692
|
+
call: () => apiClient.prepareCheckoutTransaction({
|
|
2693
|
+
environmentId,
|
|
2694
|
+
prepareSigningRequest: {
|
|
2695
|
+
assertBalanceForGasCost: assertBalanceForGasCost ?? false,
|
|
2696
|
+
assertBalanceForTransferAmount: assertBalanceForTransferAmount ?? false
|
|
2697
|
+
},
|
|
2698
|
+
transactionId,
|
|
2699
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2700
|
+
}),
|
|
2701
|
+
transactionId
|
|
2702
|
+
}, client);
|
|
2591
2703
|
};
|
|
2592
2704
|
const __prepareCheckoutTransaction_impl = prepareCheckoutTransaction;
|
|
2593
2705
|
const __prepareCheckoutTransaction_wrapped = instrumentFunction({
|
|
@@ -2676,7 +2788,7 @@ const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider },
|
|
|
2676
2788
|
* @returns The transaction hash.
|
|
2677
2789
|
* @instrumented
|
|
2678
2790
|
*/
|
|
2679
|
-
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange }, client = getDefaultClient()) => {
|
|
2791
|
+
const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepChange, sponsorshipMode }, client = getDefaultClient()) => {
|
|
2680
2792
|
if (!SWAP_SUPPORTED_CHAINS.includes(walletAccount.chain)) throw new InvalidParamError(`Chain ${walletAccount.chain} is not supported for swap transactions`);
|
|
2681
2793
|
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
2682
2794
|
assertWalletProviderMethodDefined(walletProvider, "executeSwapTransaction");
|
|
@@ -2687,6 +2799,7 @@ const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepCha
|
|
|
2687
2799
|
const { transactionHash } = await walletProvider.executeSwapTransaction({
|
|
2688
2800
|
onStepChange,
|
|
2689
2801
|
signingPayload,
|
|
2802
|
+
sponsorshipMode,
|
|
2690
2803
|
walletAccount
|
|
2691
2804
|
});
|
|
2692
2805
|
return { transactionHash };
|
|
@@ -2871,7 +2984,7 @@ const detectDeviceRegistrationRedirect = ({ url }) => {
|
|
|
2871
2984
|
/** @not-instrumented */
|
|
2872
2985
|
const getRegisteredDevices = async (client = getDefaultClient()) => {
|
|
2873
2986
|
const core = getCore(client);
|
|
2874
|
-
const apiClient = createApiClient({}, client);
|
|
2987
|
+
const apiClient = createApiClient({ skipSessionExpiryLogout: true }, client);
|
|
2875
2988
|
try {
|
|
2876
2989
|
return (await apiClient.listDeviceRegistrations({ environmentId: core.environmentId })).deviceRegistrations;
|
|
2877
2990
|
} catch (error) {
|
|
@@ -3150,6 +3263,115 @@ const __createCryptoDotComPayment_wrapped = instrumentFunction({
|
|
|
3150
3263
|
}
|
|
3151
3264
|
});
|
|
3152
3265
|
|
|
3266
|
+
//#endregion
|
|
3267
|
+
//#region src/modules/funding/moonpay/getMoonPayCurrencies/getMoonPayCurrencies.ts
|
|
3268
|
+
/**
|
|
3269
|
+
* Fetches the list of crypto currencies supported by MoonPay for the given chain
|
|
3270
|
+
* and network, filtered to active currencies only. Requires a MoonPay publishable
|
|
3271
|
+
* API key to be configured for the environment.
|
|
3272
|
+
*
|
|
3273
|
+
* @param params - The chain and optional network ID to filter currencies by.
|
|
3274
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3275
|
+
* @returns An array of supported MoonPay currencies.
|
|
3276
|
+
* @instrumented
|
|
3277
|
+
*/
|
|
3278
|
+
const getMoonPayCurrencies = async (params, client = getDefaultClient()) => {
|
|
3279
|
+
const core = getCore(client);
|
|
3280
|
+
return (await createApiClient({ includeMfaToken: true }, client).getMoonPayCurrencies({
|
|
3281
|
+
chain: params.chain,
|
|
3282
|
+
environmentId: core.environmentId,
|
|
3283
|
+
...params.networkId ? { networkId: params.networkId } : {}
|
|
3284
|
+
})).currencies ?? [];
|
|
3285
|
+
};
|
|
3286
|
+
const __getMoonPayCurrencies_impl = getMoonPayCurrencies;
|
|
3287
|
+
const __getMoonPayCurrencies_wrapped = instrumentFunction({
|
|
3288
|
+
fn: __getMoonPayCurrencies_impl,
|
|
3289
|
+
functionName: "getMoonPayCurrencies",
|
|
3290
|
+
getCore: () => {
|
|
3291
|
+
try {
|
|
3292
|
+
return getCore(getDefaultClient());
|
|
3293
|
+
} catch {
|
|
3294
|
+
return;
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
});
|
|
3298
|
+
|
|
3299
|
+
//#endregion
|
|
3300
|
+
//#region src/modules/funding/moonpay/errors/MoonPayInvalidUrlError.ts
|
|
3301
|
+
var MoonPayInvalidUrlError = class extends BaseError {
|
|
3302
|
+
constructor() {
|
|
3303
|
+
super({
|
|
3304
|
+
cause: null,
|
|
3305
|
+
code: "moonpay_invalid_url_error",
|
|
3306
|
+
docsUrl: null,
|
|
3307
|
+
name: "MoonPayInvalidUrlError",
|
|
3308
|
+
shortMessage: "MoonPay is configured but returned an invalid or untrusted URL. This may indicate a misconfiguration — please contact support if the issue persists."
|
|
3309
|
+
});
|
|
3310
|
+
}
|
|
3311
|
+
};
|
|
3312
|
+
|
|
3313
|
+
//#endregion
|
|
3314
|
+
//#region src/modules/funding/moonpay/errors/MoonPayProviderNotAvailableError.ts
|
|
3315
|
+
var MoonPayProviderNotAvailableError = class extends BaseError {
|
|
3316
|
+
constructor() {
|
|
3317
|
+
super({
|
|
3318
|
+
cause: null,
|
|
3319
|
+
code: "moonpay_provider_not_available_error",
|
|
3320
|
+
docsUrl: null,
|
|
3321
|
+
name: "MoonPayProviderNotAvailableError",
|
|
3322
|
+
shortMessage: "MoonPay provider not available. Ensure MoonPay is enabled and a publishable API key is configured in the Dynamic dashboard."
|
|
3323
|
+
});
|
|
3324
|
+
}
|
|
3325
|
+
};
|
|
3326
|
+
|
|
3327
|
+
//#endregion
|
|
3328
|
+
//#region src/modules/funding/moonpay/getMoonPayUrl/getMoonPayUrl.ts
|
|
3329
|
+
/**
|
|
3330
|
+
* Returns the signed MoonPay URL for the given wallet and token.
|
|
3331
|
+
*
|
|
3332
|
+
* Uses the Dynamic onramp API to retrieve the pre-signed URL that can be
|
|
3333
|
+
* opened in a browser tab to allow the user to purchase crypto via MoonPay.
|
|
3334
|
+
*
|
|
3335
|
+
* @param params - Parameters including chain, wallet address, and optional token/currency filters.
|
|
3336
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
3337
|
+
* @returns The signed MoonPay URL.
|
|
3338
|
+
* @instrumented
|
|
3339
|
+
*/
|
|
3340
|
+
const getMoonPayUrl = async (params, client = getDefaultClient()) => {
|
|
3341
|
+
const core = getCore(client);
|
|
3342
|
+
const moonPayProvider = (await createApiClient({ includeMfaToken: true }, client).getSupportedOnramps({
|
|
3343
|
+
chain: params.chain,
|
|
3344
|
+
currency: params.currency,
|
|
3345
|
+
environmentId: core.environmentId,
|
|
3346
|
+
includeDisabled: true,
|
|
3347
|
+
merchantName: params.merchantName,
|
|
3348
|
+
networkId: params.networkId,
|
|
3349
|
+
token: params.token,
|
|
3350
|
+
tokenAmount: params.tokenAmount,
|
|
3351
|
+
walletAddress: params.walletAddress
|
|
3352
|
+
})).onramps?.find((provider) => provider.provider === ProviderEnum.MoonPay);
|
|
3353
|
+
if (!moonPayProvider?.url) throw new MoonPayProviderNotAvailableError();
|
|
3354
|
+
const parsedUrl = new URL(moonPayProvider.url);
|
|
3355
|
+
const isValidHost = parsedUrl.hostname === "moonpay.com" || parsedUrl.hostname.endsWith(".moonpay.com");
|
|
3356
|
+
if (parsedUrl.protocol !== "https:" || !isValidHost) {
|
|
3357
|
+
core.logger.error("[getMoonPayUrl] Invalid URL returned by onramp API", { url: moonPayProvider.url });
|
|
3358
|
+
throw new MoonPayInvalidUrlError();
|
|
3359
|
+
}
|
|
3360
|
+
return moonPayProvider.url;
|
|
3361
|
+
};
|
|
3362
|
+
const __getMoonPayUrl_impl = getMoonPayUrl;
|
|
3363
|
+
const __getMoonPayUrl_wrapped = instrumentFunction({
|
|
3364
|
+
fn: __getMoonPayUrl_impl,
|
|
3365
|
+
functionName: "getMoonPayUrl",
|
|
3366
|
+
getCore: () => {
|
|
3367
|
+
try {
|
|
3368
|
+
return getCore(getDefaultClient());
|
|
3369
|
+
} catch {
|
|
3370
|
+
return;
|
|
3371
|
+
}
|
|
3372
|
+
}
|
|
3373
|
+
});
|
|
3374
|
+
|
|
3153
3375
|
//#endregion
|
|
3154
3376
|
//#region src/modules/funding/kraken/createKrakenExchangeTransfer/createKrakenExchangeTransfer.ts
|
|
3155
3377
|
/**
|
|
@@ -3467,30 +3689,39 @@ const transformGroup = ({ group }) => {
|
|
|
3467
3689
|
};
|
|
3468
3690
|
|
|
3469
3691
|
//#endregion
|
|
3470
|
-
//#region src/
|
|
3692
|
+
//#region src/utils/getChainFromWalletBookIdentifier/getChainFromWalletBookIdentifier.ts
|
|
3471
3693
|
/**
|
|
3472
|
-
*
|
|
3694
|
+
* Resolves a wallet-book chain identifier (as found in
|
|
3695
|
+
* `injectedConfig[].chain` or as an alias embedded in a wallet key) to a
|
|
3696
|
+
* {@link Chain}. Looks up by `apiChainName` first, then by any
|
|
3697
|
+
* `legacyWalletBookAliases` declared on the corresponding `CHAINS_INFO_MAP`
|
|
3698
|
+
* entry.
|
|
3699
|
+
*
|
|
3700
|
+
* Returns `undefined` when the identifier doesn't match any known chain,
|
|
3701
|
+
* letting the caller pick its own fallback (e.g. defaulting to EVM, or
|
|
3702
|
+
* trying a different lookup strategy).
|
|
3703
|
+
*
|
|
3704
|
+
* Centralised here rather than in `legacyWalletBook` so all chain naming
|
|
3705
|
+
* knowledge stays alongside `CHAINS_INFO_MAP`.
|
|
3473
3706
|
* @not-instrumented
|
|
3474
3707
|
*/
|
|
3475
|
-
const
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
eclipse: "ECLIPSE",
|
|
3482
|
-
evm: "EVM",
|
|
3483
|
-
flow: "FLOW",
|
|
3484
|
-
sol: "SOL",
|
|
3485
|
-
spark: "SPARK",
|
|
3486
|
-
starknet: "STARK",
|
|
3487
|
-
sui: "SUI",
|
|
3488
|
-
ton: "TON",
|
|
3489
|
-
tron: "TRON"
|
|
3708
|
+
const getChainFromWalletBookIdentifier = ({ identifier }) => {
|
|
3709
|
+
const normalised = identifier.toLowerCase();
|
|
3710
|
+
return Object.keys(CHAINS_INFO_MAP).find((chain) => {
|
|
3711
|
+
const info = CHAINS_INFO_MAP[chain];
|
|
3712
|
+
return info.apiChainName === normalised || info.legacyWalletBookAliases?.includes(normalised) === true;
|
|
3713
|
+
});
|
|
3490
3714
|
};
|
|
3715
|
+
|
|
3716
|
+
//#endregion
|
|
3717
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.ts
|
|
3491
3718
|
/**
|
|
3492
3719
|
* Extracts the chain prefix from a chain identifier string.
|
|
3493
3720
|
* For example, "eip155:1" -> "eip155", "solana:..." -> "solana"
|
|
3721
|
+
*
|
|
3722
|
+
* Exported so {@link getChainsFromWalletSchema} can apply the same
|
|
3723
|
+
* parsing to its multi-chain pass without duplicating the logic.
|
|
3724
|
+
* @not-instrumented
|
|
3494
3725
|
*/
|
|
3495
3726
|
const extractChainPrefix = ({ chainIdentifier }) => {
|
|
3496
3727
|
const colonIndex = chainIdentifier.indexOf(":");
|
|
@@ -3498,80 +3729,22 @@ const extractChainPrefix = ({ chainIdentifier }) => {
|
|
|
3498
3729
|
return chainIdentifier.substring(0, colonIndex);
|
|
3499
3730
|
};
|
|
3500
3731
|
/**
|
|
3501
|
-
*
|
|
3502
|
-
*
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
chain: "SOL",
|
|
3507
|
-
pattern: "sol"
|
|
3508
|
-
},
|
|
3509
|
-
{
|
|
3510
|
-
chain: "SOL",
|
|
3511
|
-
pattern: "solana"
|
|
3512
|
-
},
|
|
3513
|
-
{
|
|
3514
|
-
chain: "BTC",
|
|
3515
|
-
pattern: "btc"
|
|
3516
|
-
},
|
|
3517
|
-
{
|
|
3518
|
-
chain: "BTC",
|
|
3519
|
-
pattern: "bitcoin"
|
|
3520
|
-
},
|
|
3521
|
-
{
|
|
3522
|
-
chain: "STARK",
|
|
3523
|
-
pattern: "stark"
|
|
3524
|
-
},
|
|
3525
|
-
{
|
|
3526
|
-
chain: "STARK",
|
|
3527
|
-
pattern: "starknet"
|
|
3528
|
-
},
|
|
3529
|
-
{
|
|
3530
|
-
chain: "SUI",
|
|
3531
|
-
pattern: "sui"
|
|
3532
|
-
},
|
|
3533
|
-
{
|
|
3534
|
-
chain: "APTOS",
|
|
3535
|
-
pattern: "aptos"
|
|
3536
|
-
},
|
|
3537
|
-
{
|
|
3538
|
-
chain: "COSMOS",
|
|
3539
|
-
pattern: "cosmos"
|
|
3540
|
-
},
|
|
3541
|
-
{
|
|
3542
|
-
chain: "FLOW",
|
|
3543
|
-
pattern: "flow"
|
|
3544
|
-
},
|
|
3545
|
-
{
|
|
3546
|
-
chain: "ALGO",
|
|
3547
|
-
pattern: "algo"
|
|
3548
|
-
},
|
|
3549
|
-
{
|
|
3550
|
-
chain: "TRON",
|
|
3551
|
-
pattern: "tron"
|
|
3552
|
-
},
|
|
3553
|
-
{
|
|
3554
|
-
chain: "TON",
|
|
3555
|
-
pattern: "ton"
|
|
3556
|
-
},
|
|
3557
|
-
{
|
|
3558
|
-
chain: "SPARK",
|
|
3559
|
-
pattern: "spark"
|
|
3560
|
-
},
|
|
3561
|
-
{
|
|
3562
|
-
chain: "ECLIPSE",
|
|
3563
|
-
pattern: "eclipse"
|
|
3564
|
-
}
|
|
3565
|
-
];
|
|
3566
|
-
/**
|
|
3567
|
-
* Attempts to extract the chain from a wallet key by looking for embedded chain identifiers.
|
|
3732
|
+
* Attempts to extract the chain from a wallet key by looking for embedded
|
|
3733
|
+
* chain identifiers (apiChainName + legacyWalletBookAliases from CHAINS_INFO_MAP).
|
|
3734
|
+
*
|
|
3735
|
+
* Derives patterns dynamically so adding a chain in `CHAINS_INFO_MAP`
|
|
3736
|
+
* picks it up here — no parallel hardcoded list.
|
|
3568
3737
|
*
|
|
3569
3738
|
* @param params.walletKey - The wallet key identifier.
|
|
3570
3739
|
* @returns The chain type if found, undefined otherwise.
|
|
3571
3740
|
*/
|
|
3572
3741
|
const getChainFromWalletKey = ({ walletKey }) => {
|
|
3573
3742
|
const lowerKey = walletKey.toLowerCase();
|
|
3574
|
-
|
|
3743
|
+
const chains = Object.keys(CHAINS_INFO_MAP);
|
|
3744
|
+
for (const chain of chains) {
|
|
3745
|
+
const info = CHAINS_INFO_MAP[chain];
|
|
3746
|
+
if ([info.apiChainName, ...info.legacyWalletBookAliases ?? []].some((pattern) => lowerKey.includes(pattern))) return chain;
|
|
3747
|
+
}
|
|
3575
3748
|
};
|
|
3576
3749
|
/**
|
|
3577
3750
|
* Gets the chain from a wallet book entry.
|
|
@@ -3585,8 +3758,11 @@ const getChainFromWalletKey = ({ walletKey }) => {
|
|
|
3585
3758
|
*/
|
|
3586
3759
|
const getChainFromWalletSchema = ({ wallet, walletKey }) => {
|
|
3587
3760
|
if (wallet.injectedConfig && wallet.injectedConfig.length > 0) {
|
|
3588
|
-
const injectedChain = wallet.injectedConfig[0].chain
|
|
3589
|
-
if (injectedChain
|
|
3761
|
+
const injectedChain = wallet.injectedConfig[0].chain;
|
|
3762
|
+
if (injectedChain) {
|
|
3763
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: injectedChain });
|
|
3764
|
+
if (chain) return chain;
|
|
3765
|
+
}
|
|
3590
3766
|
}
|
|
3591
3767
|
if (wallet.chains && wallet.chains.length > 0) {
|
|
3592
3768
|
const firstChain = wallet.chains[0];
|
|
@@ -3834,11 +4010,111 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
|
|
|
3834
4010
|
}
|
|
3835
4011
|
};
|
|
3836
4012
|
|
|
4013
|
+
//#endregion
|
|
4014
|
+
//#region src/utils/isMobile/isMobile.ts
|
|
4015
|
+
/**
|
|
4016
|
+
* Sourced from http://detectmobilebrowsers.com/
|
|
4017
|
+
* @not-instrumented
|
|
4018
|
+
*/
|
|
4019
|
+
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;
|
|
4020
|
+
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;
|
|
4021
|
+
/** @not-instrumented */
|
|
4022
|
+
const isMobile = (maxTouchPointsOverride) => {
|
|
4023
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4024
|
+
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
4025
|
+
};
|
|
4026
|
+
/** @not-instrumented */
|
|
4027
|
+
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
4028
|
+
/**
|
|
4029
|
+
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
4030
|
+
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
4031
|
+
* to mock it
|
|
4032
|
+
* @not-instrumented
|
|
4033
|
+
*/
|
|
4034
|
+
const isIPad = (maxTouchPointsOverride) => {
|
|
4035
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4036
|
+
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
4037
|
+
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
4038
|
+
};
|
|
4039
|
+
/** @not-instrumented */
|
|
4040
|
+
const isIOS = (maxTouchPointsOverride) => {
|
|
4041
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4042
|
+
return isIPhone() || isIPad(maxTouchPointsOverride);
|
|
4043
|
+
};
|
|
4044
|
+
/** @not-instrumented */
|
|
4045
|
+
const isAndroid = () => isMobile() && !isIOS();
|
|
4046
|
+
/** @not-instrumented */
|
|
4047
|
+
const isSafariBrowser = () => {
|
|
4048
|
+
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
4049
|
+
const { userAgent } = navigator;
|
|
4050
|
+
return userAgent.includes("Safari") && !userAgent.includes("Chrome") && !userAgent.includes("Chromium");
|
|
4051
|
+
};
|
|
4052
|
+
/** @not-instrumented */
|
|
4053
|
+
const isEdgeBrowser = () => {
|
|
4054
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4055
|
+
return /\bEdg\//.test(navigator.userAgent);
|
|
4056
|
+
};
|
|
4057
|
+
/** @not-instrumented */
|
|
4058
|
+
const isOperaBrowser = () => {
|
|
4059
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4060
|
+
return /\b(OPR|Opera)\//.test(navigator.userAgent);
|
|
4061
|
+
};
|
|
4062
|
+
/** @not-instrumented */
|
|
4063
|
+
const isFirefoxBrowser = () => {
|
|
4064
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4065
|
+
return /\bFirefox\//.test(navigator.userAgent);
|
|
4066
|
+
};
|
|
4067
|
+
/** @not-instrumented */
|
|
4068
|
+
const isChromeBrowser = () => {
|
|
4069
|
+
if (globalThis.window === void 0 || globalThis.navigator === void 0) return false;
|
|
4070
|
+
return /\bChrome\//.test(navigator.userAgent) && !isEdgeBrowser() && !isOperaBrowser();
|
|
4071
|
+
};
|
|
4072
|
+
|
|
4073
|
+
//#endregion
|
|
4074
|
+
//#region src/modules/walletOptionsCatalogue/getInstallationLinkForCurrentPlatform/getInstallationLinkForCurrentPlatform.ts
|
|
4075
|
+
/**
|
|
4076
|
+
* Resolves the {@link InstallationUrls} field that matches the platform
|
|
4077
|
+
* the SDK is currently running on:
|
|
4078
|
+
*
|
|
4079
|
+
* - iOS → `ios`
|
|
4080
|
+
* - Android → `android`
|
|
4081
|
+
* - Edge → `edge`
|
|
4082
|
+
* - Opera → `opera`
|
|
4083
|
+
* - Firefox → `firefox`
|
|
4084
|
+
* - Safari → `safari`
|
|
4085
|
+
* - Chrome (or other Chromium-based browsers) → `chrome`
|
|
4086
|
+
*
|
|
4087
|
+
* Returns `undefined` when no entry exists for the detected platform —
|
|
4088
|
+
* callers typically render a "not available on this device" affordance
|
|
4089
|
+
* in that case rather than offering a download targeted at a different
|
|
4090
|
+
* browser/OS.
|
|
4091
|
+
*
|
|
4092
|
+
* Each branch returns exactly the field for the detected platform — no
|
|
4093
|
+
* fallback to a different browser's URL. If you'd rather surface every
|
|
4094
|
+
* link a wallet's manifest publishes so the user can pick where to
|
|
4095
|
+
* install, read `installationUrls` directly instead of going through
|
|
4096
|
+
* this helper.
|
|
4097
|
+
*
|
|
4098
|
+
* @param params.installationUrls - The wallet option's `installationUrls`
|
|
4099
|
+
* record (from `getWalletOptionsCatalogue`).
|
|
4100
|
+
* @returns The install URL for the detected platform, or `undefined`.
|
|
4101
|
+
* @not-instrumented
|
|
4102
|
+
*/
|
|
4103
|
+
const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
4104
|
+
if (isIOS()) return installationUrls.ios;
|
|
4105
|
+
if (isAndroid()) return installationUrls.android;
|
|
4106
|
+
if (isEdgeBrowser()) return installationUrls.edge;
|
|
4107
|
+
if (isOperaBrowser()) return installationUrls.opera;
|
|
4108
|
+
if (isFirefoxBrowser()) return installationUrls.firefox;
|
|
4109
|
+
if (isSafariBrowser()) return installationUrls.safari;
|
|
4110
|
+
if (isChromeBrowser()) return installationUrls.chrome;
|
|
4111
|
+
};
|
|
4112
|
+
|
|
3837
4113
|
//#endregion
|
|
3838
4114
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
3839
4115
|
/**
|
|
3840
4116
|
* Resolves which wallet option (group) a wallet book entry belongs to. Used
|
|
3841
|
-
* by the catalogue's wallet-book-driven transformers (
|
|
4117
|
+
* by the catalogue's wallet-book-driven transformers (URI deeplink,
|
|
3842
4118
|
* `inAppBrowser`, `installation`) to bucket their emitted options.
|
|
3843
4119
|
*
|
|
3844
4120
|
* Wallet book entries inconsistently use `group` / `chainGroup` /
|
|
@@ -3993,24 +4269,150 @@ const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
|
3993
4269
|
};
|
|
3994
4270
|
|
|
3995
4271
|
//#endregion
|
|
3996
|
-
//#region src/modules/
|
|
4272
|
+
//#region src/modules/legacyWalletBook/hasUsableDeeplink/hasUsableDeeplink.ts
|
|
3997
4273
|
/**
|
|
3998
|
-
*
|
|
3999
|
-
*
|
|
4000
|
-
*
|
|
4001
|
-
*
|
|
4274
|
+
* Whether a wallet book entry exposes at least one mobile deeplink the
|
|
4275
|
+
* catalogue can drive — either a native scheme (`metamask://`) or a
|
|
4276
|
+
* universal link (`https://metamask.app.link`). Used by the URI-deeplink
|
|
4277
|
+
* builders (`buildWalletConnectOptions`, `buildMetaMaskSdkUriOptions`)
|
|
4278
|
+
* to skip wallets that have no app to launch.
|
|
4279
|
+
*
|
|
4280
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
4281
|
+
* @returns True when the wallet has a native or universal mobile link.
|
|
4282
|
+
* @not-instrumented
|
|
4002
4283
|
*/
|
|
4003
4284
|
const hasUsableDeeplink = ({ wallet }) => Boolean(wallet.mobile?.native || wallet.mobile?.universal);
|
|
4285
|
+
|
|
4286
|
+
//#endregion
|
|
4287
|
+
//#region src/modules/walletOptionsCatalogue/buildMetaMaskSdkUriOptions/buildMetaMaskSdkUriOptions.ts
|
|
4288
|
+
/**
|
|
4289
|
+
* Wallet option key the MetaMask SDK URI extension targets.
|
|
4290
|
+
*/
|
|
4291
|
+
const METAMASK_WALLET_OPTION_KEY = "metamask";
|
|
4292
|
+
/**
|
|
4293
|
+
* Chains the MetaMask SDK URI pairing supports.
|
|
4294
|
+
*
|
|
4295
|
+
* Unlike WalletConnect — whose per-wallet chain support is read from the
|
|
4296
|
+
* wallet book — the MetaMask SDK URI is a single Dynamic integration whose
|
|
4297
|
+
* chain coverage is defined by which `connectWithMetaMaskUri<Chain>`
|
|
4298
|
+
* primitives the SDK ships (EVM + SOL). The MetaMask wallet-book entry only
|
|
4299
|
+
* advertises its EVM (`eip155`) chains, so deriving the chain from the book
|
|
4300
|
+
* would never surface the Solana pairing; the SDK's own capabilities are
|
|
4301
|
+
* listed explicitly instead.
|
|
4302
|
+
*/
|
|
4303
|
+
const METAMASK_SDK_URI_SUPPORTED_CHAINS = ["EVM", "SOL"];
|
|
4304
|
+
/**
|
|
4305
|
+
* Builds the `metamaskSdkUri`-discriminator catalogue options from a
|
|
4306
|
+
* fetched wallet book. The MetaMask SDK URI extension only targets the
|
|
4307
|
+
* MetaMask wallet, so the builder iterates the book looking for the
|
|
4308
|
+
* entry whose resolved wallet option key is `'metamask'`.
|
|
4309
|
+
*
|
|
4310
|
+
* Applies the generic `shouldFilterWallet` rules (drops embedded keys +
|
|
4311
|
+
* injected-only-without-links entries). Crucially does NOT require WC
|
|
4312
|
+
* `sign_v2` support — MetaMask SDK URI is a different protocol from
|
|
4313
|
+
* WalletConnect, so the WC-specific filter does not apply here.
|
|
4314
|
+
*
|
|
4315
|
+
* Emits one `metamaskSdkUri` option per chain the MetaMask SDK URI pairing
|
|
4316
|
+
* supports (see {@link METAMASK_SDK_URI_SUPPORTED_CHAINS}) so the picker can
|
|
4317
|
+
* offer both the EVM and Solana pairings for the single MetaMask entry.
|
|
4318
|
+
*
|
|
4319
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4320
|
+
* @returns Tagged `metamaskSdkUri` options for MetaMask if eligible, otherwise an empty array.
|
|
4321
|
+
* @not-instrumented
|
|
4322
|
+
*/
|
|
4323
|
+
const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
4324
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
4325
|
+
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
4326
|
+
wallet,
|
|
4327
|
+
walletKey
|
|
4328
|
+
});
|
|
4329
|
+
if (walletOptionKey !== METAMASK_WALLET_OPTION_KEY) continue;
|
|
4330
|
+
if (shouldFilterWallet({
|
|
4331
|
+
wallet,
|
|
4332
|
+
walletKey
|
|
4333
|
+
})) continue;
|
|
4334
|
+
if (!hasUsableDeeplink({ wallet })) continue;
|
|
4335
|
+
const deeplinks = {
|
|
4336
|
+
native: wallet.mobile?.native,
|
|
4337
|
+
universal: wallet.mobile?.universal
|
|
4338
|
+
};
|
|
4339
|
+
return METAMASK_SDK_URI_SUPPORTED_CHAINS.map((chain) => ({
|
|
4340
|
+
option: {
|
|
4341
|
+
chain,
|
|
4342
|
+
deeplinks,
|
|
4343
|
+
type: "metamaskSdkUri"
|
|
4344
|
+
},
|
|
4345
|
+
walletOptionKey
|
|
4346
|
+
}));
|
|
4347
|
+
}
|
|
4348
|
+
return [];
|
|
4349
|
+
};
|
|
4350
|
+
|
|
4351
|
+
//#endregion
|
|
4352
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
4004
4353
|
/**
|
|
4005
|
-
*
|
|
4006
|
-
*
|
|
4354
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
4355
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
4356
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
4357
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
4358
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
4359
|
+
*
|
|
4360
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
4361
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
4362
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
4363
|
+
* one option.
|
|
4364
|
+
*
|
|
4365
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
4366
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
4367
|
+
* @returns Ordered, deduped array of Chains.
|
|
4368
|
+
* @not-instrumented
|
|
4369
|
+
*/
|
|
4370
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
4371
|
+
const chains = /* @__PURE__ */ new Set();
|
|
4372
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
4373
|
+
if (!entry.chain) continue;
|
|
4374
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
4375
|
+
if (chain) chains.add(chain);
|
|
4376
|
+
}
|
|
4377
|
+
for (const identifier of wallet.chains ?? []) {
|
|
4378
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
4379
|
+
try {
|
|
4380
|
+
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
4381
|
+
chains.add(chain);
|
|
4382
|
+
} catch {}
|
|
4383
|
+
}
|
|
4384
|
+
if (chains.size === 0) {
|
|
4385
|
+
const chain = getChainFromWalletSchema({
|
|
4386
|
+
wallet,
|
|
4387
|
+
walletKey
|
|
4388
|
+
});
|
|
4389
|
+
chains.add(chain);
|
|
4390
|
+
}
|
|
4391
|
+
return Array.from(chains);
|
|
4392
|
+
};
|
|
4393
|
+
|
|
4394
|
+
//#endregion
|
|
4395
|
+
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
4396
|
+
/**
|
|
4397
|
+
* Chains Dynamic ships a WalletConnect extension for. Anything else a
|
|
4398
|
+
* wallet book entry advertises (Cosmos, BTC, …) gets filtered out — the
|
|
4399
|
+
* catalogue should not surface a chain the SDK has no `connectWithWalletConnect<Chain>`
|
|
4400
|
+
* primitive for.
|
|
4401
|
+
*/
|
|
4402
|
+
const WALLETCONNECT_SUPPORTED_CHAINS = new Set(["EVM", "SOL"]);
|
|
4403
|
+
/**
|
|
4404
|
+
* Builds the `walletConnect`-discriminator catalogue options from a fetched
|
|
4405
|
+
* wallet book. Applies the WalletConnect-specific eligibility filter
|
|
4007
4406
|
* (`shouldFilterWalletForWalletConnect`) so embedded wallets and entries
|
|
4008
4407
|
* without `sign_v2` support are excluded — same surface as
|
|
4009
4408
|
* `getWalletConnectCatalog`.
|
|
4010
4409
|
*
|
|
4011
|
-
*
|
|
4012
|
-
*
|
|
4013
|
-
*
|
|
4410
|
+
* Skips the MetaMask wallet entry: MetaMask is steered to its own URI
|
|
4411
|
+
* connection extension via `buildMetaMaskSdkUriOptions`. Keeping the two
|
|
4412
|
+
* builders separate means each protocol owns its own eligibility rules
|
|
4413
|
+
* (WC needs `sign_v2`; MM SDK URI does not), so excluding one
|
|
4414
|
+
* discriminator via `excludedConnectionOptionTypes` doesn't accidentally
|
|
4415
|
+
* gate the other.
|
|
4014
4416
|
*
|
|
4015
4417
|
* @param params.walletBook - The fetched wallet book.
|
|
4016
4418
|
* @returns Tagged `walletConnect` options paired with their wallet option keys.
|
|
@@ -4028,11 +4430,12 @@ const buildWalletConnectOptions = ({ walletBook }) => {
|
|
|
4028
4430
|
wallet,
|
|
4029
4431
|
walletKey
|
|
4030
4432
|
});
|
|
4031
|
-
|
|
4433
|
+
if (walletOptionKey === "metamask") continue;
|
|
4434
|
+
const chains = getChainsFromWalletSchema({
|
|
4032
4435
|
wallet,
|
|
4033
4436
|
walletKey
|
|
4034
|
-
});
|
|
4035
|
-
result.push({
|
|
4437
|
+
}).filter((chain) => WALLETCONNECT_SUPPORTED_CHAINS.has(chain));
|
|
4438
|
+
for (const chain of chains) result.push({
|
|
4036
4439
|
option: {
|
|
4037
4440
|
chain,
|
|
4038
4441
|
deeplinks: {
|
|
@@ -4056,12 +4459,19 @@ const buildWalletConnectOptions = ({ walletBook }) => {
|
|
|
4056
4459
|
*
|
|
4057
4460
|
* Display merge rules (provider self-announced metadata wins where set):
|
|
4058
4461
|
*
|
|
4059
|
-
* - `name`: `displayOverride.name` ?? wallet book group name ??
|
|
4060
|
-
*
|
|
4061
|
-
* - `
|
|
4062
|
-
*
|
|
4462
|
+
* - `name`: `displayOverride.name` ?? wallet book group name ?? wallet
|
|
4463
|
+
* book wallet name ?? bare key.
|
|
4464
|
+
* - `iconUrl`: `displayOverride.iconUrl` ?? wallet book group sprite URL
|
|
4465
|
+
* ?? wallet book wallet sprite URL ?? `''`.
|
|
4466
|
+
* - `primaryColor`: wallet book group brand color ?? wallet book wallet
|
|
4467
|
+
* brand color (providers do not ship a primary color in their
|
|
4468
|
+
* announcement metadata).
|
|
4063
4469
|
* - `installationUrls`: copied through if present.
|
|
4064
4470
|
*
|
|
4471
|
+
* The per-wallet fallback handles wallets that exist as individual entries
|
|
4472
|
+
* in the book (e.g. Rainbow) rather than as members of a multi-wallet group
|
|
4473
|
+
* — those don't get a `walletBook.groups[…]` shell.
|
|
4474
|
+
*
|
|
4065
4475
|
* Why provider precedence: a registered wallet provider knows its own
|
|
4066
4476
|
* brand best (EIP-6963 / Wallet Standard / vendor SDK announcement is the
|
|
4067
4477
|
* wallet authoring its own identity). The wallet book fills in fields the
|
|
@@ -4079,16 +4489,42 @@ const buildWalletOption = ({ connectionOptions, displayOverride, installationUrl
|
|
|
4079
4489
|
const group = walletBook.groups[walletOptionKey];
|
|
4080
4490
|
const groupSpriteId = group?.brand?.spriteId;
|
|
4081
4491
|
const groupIconUrl = groupSpriteId ? getSpriteUrl({ spriteId: groupSpriteId }) : void 0;
|
|
4492
|
+
const walletEntry = walletBook.wallets[walletOptionKey];
|
|
4493
|
+
const walletSpriteId = walletEntry?.brand?.spriteId;
|
|
4494
|
+
const walletIconUrl = walletSpriteId ? getSpriteUrl({ spriteId: walletSpriteId }) : void 0;
|
|
4082
4495
|
return {
|
|
4083
4496
|
connectionOptions,
|
|
4084
|
-
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? "",
|
|
4497
|
+
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? walletIconUrl ?? "",
|
|
4085
4498
|
installationUrls,
|
|
4086
4499
|
key: walletOptionKey,
|
|
4087
|
-
name: displayOverride?.name ?? group?.name ?? walletOptionKey,
|
|
4088
|
-
primaryColor: group?.brand?.primaryColor
|
|
4500
|
+
name: displayOverride?.name ?? group?.name ?? walletEntry?.name ?? walletOptionKey,
|
|
4501
|
+
primaryColor: group?.brand?.primaryColor ?? walletEntry?.brand?.primaryColor
|
|
4089
4502
|
};
|
|
4090
4503
|
};
|
|
4091
4504
|
|
|
4505
|
+
//#endregion
|
|
4506
|
+
//#region src/modules/wallets/hasWalletProviderConnectMethod/hasWalletProviderConnectMethod.ts
|
|
4507
|
+
/**
|
|
4508
|
+
* Returns true when the given wallet provider exposes a `connect` method,
|
|
4509
|
+
* which is the signal we use to decide whether it belongs in the external
|
|
4510
|
+
* wallet picker as an `available provider`.
|
|
4511
|
+
*
|
|
4512
|
+
* Providers that don't expose `connect` (embedded wallets,
|
|
4513
|
+
* account-abstraction wrappers, MetaMask SDK / WalletConnect-backed
|
|
4514
|
+
* providers) are still sign-in capable, but via different SDK entry
|
|
4515
|
+
* points — they should not appear in the external picker as a
|
|
4516
|
+
* `withWalletProvider`-style option.
|
|
4517
|
+
*
|
|
4518
|
+
* Centralizing the predicate means future tweaks (e.g. a registry of
|
|
4519
|
+
* provider keys to exclude) land in one place and every consumer stays
|
|
4520
|
+
* in lockstep.
|
|
4521
|
+
*
|
|
4522
|
+
* @param params.walletProvider - The wallet provider to test.
|
|
4523
|
+
* @returns True when the provider exposes a `connect` method.
|
|
4524
|
+
* @not-instrumented
|
|
4525
|
+
*/
|
|
4526
|
+
const hasWalletProviderConnectMethod = ({ walletProvider }) => Boolean(walletProvider.connect);
|
|
4527
|
+
|
|
4092
4528
|
//#endregion
|
|
4093
4529
|
//#region src/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.ts
|
|
4094
4530
|
/**
|
|
@@ -4168,7 +4604,7 @@ const normalizeWalletDisplayName = (displayName) => displayName.toLowerCase().re
|
|
|
4168
4604
|
|
|
4169
4605
|
//#endregion
|
|
4170
4606
|
//#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.ts
|
|
4171
|
-
const normalize = (value) => value.toLowerCase().replace(/\s+/g, "");
|
|
4607
|
+
const normalize = (value) => value === void 0 ? void 0 : value.toLowerCase().replace(/\s+/g, "");
|
|
4172
4608
|
/**
|
|
4173
4609
|
* Looks for a wallet book entry whose `name` or `shortName` normalizes to
|
|
4174
4610
|
* the same string as `candidate`. Used as a fallback by
|
|
@@ -4288,6 +4724,7 @@ const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }
|
|
|
4288
4724
|
const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
4289
4725
|
const result = [];
|
|
4290
4726
|
for (const entry of entries) {
|
|
4727
|
+
if (!hasWalletProviderConnectMethod({ walletProvider: entry.walletProvider })) continue;
|
|
4291
4728
|
const source = classifyWithWalletProviderSource({ entry });
|
|
4292
4729
|
if (!source) {
|
|
4293
4730
|
getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
|
|
@@ -4380,10 +4817,11 @@ const groupOptionsByWalletOption = ({ options }) => {
|
|
|
4380
4817
|
* wallet-option list is ordered — that's controlled by
|
|
4381
4818
|
* `WalletOptionOrdering`.
|
|
4382
4819
|
*
|
|
4383
|
-
* `withWalletProvider > walletConnect > inAppBrowser`
|
|
4820
|
+
* `withWalletProvider > walletConnect / metamaskSdkUri > inAppBrowser`
|
|
4384
4821
|
*/
|
|
4385
4822
|
const CONNECTION_OPTION_PRIORITY = {
|
|
4386
4823
|
inAppBrowser: 2,
|
|
4824
|
+
metamaskSdkUri: 1,
|
|
4387
4825
|
walletConnect: 1,
|
|
4388
4826
|
withWalletProvider: 0
|
|
4389
4827
|
};
|
|
@@ -4402,7 +4840,7 @@ const getConnectionOptionPriority = ({ option }) => CONNECTION_OPTION_PRIORITY[o
|
|
|
4402
4840
|
/**
|
|
4403
4841
|
* Sorts a wallet option's `connectionOptions` so the most preferred option lands at
|
|
4404
4842
|
* index 0. Primary sort is by option-type priority
|
|
4405
|
-
* (`withWalletProvider` >
|
|
4843
|
+
* (`withWalletProvider` > URI deeplink > `inAppBrowser`);
|
|
4406
4844
|
* within a type, ties break alphabetically by `chain` for deterministic
|
|
4407
4845
|
* output across calls.
|
|
4408
4846
|
*
|
|
@@ -4526,7 +4964,7 @@ const hasInstalledProvider = ({ walletOption }) => walletOption.connectionOption
|
|
|
4526
4964
|
* this order:
|
|
4527
4965
|
* 1. **Installed provider** — user already has the wallet available
|
|
4528
4966
|
* (`withWalletProvider` at index 0).
|
|
4529
|
-
* 2. **Connectable** — has at least one connection (
|
|
4967
|
+
* 2. **Connectable** — has at least one connection (URI deeplink
|
|
4530
4968
|
* or `inAppBrowser`) but no installed provider.
|
|
4531
4969
|
* 3. **Install-only** — no connection at all; only `installationUrls`.
|
|
4532
4970
|
* Within each tier, rank by the hand-curated {@link PRIORITY_WALLET_KEYS}
|
|
@@ -4576,45 +5014,40 @@ const EMPTY_WALLET_BOOK = {
|
|
|
4576
5014
|
wallets: {}
|
|
4577
5015
|
};
|
|
4578
5016
|
/**
|
|
4579
|
-
* Returns
|
|
4580
|
-
* with through this client.
|
|
4581
|
-
* `
|
|
4582
|
-
*
|
|
4583
|
-
* any matching connections are omitted.
|
|
4584
|
-
*
|
|
4585
|
-
* `includeWithWalletProvider` defaults to `true`; all other inclusion flags
|
|
4586
|
-
* are opt-in. `walletOptionOrdering` defaults to `'relevance'` (Dynamic's
|
|
4587
|
-
* recommended order); pass `'alphabetical'` to sort by wallet option name
|
|
4588
|
-
* within each option-priority tier.
|
|
5017
|
+
* Returns the catalogue of external wallet options a user can sign in
|
|
5018
|
+
* with through this client. Always includes installed wallet providers;
|
|
5019
|
+
* pass `includeMobileOptions: true` to additionally surface
|
|
5020
|
+
* WalletConnect, in-app-browser, and install links.
|
|
4589
5021
|
*
|
|
4590
|
-
*
|
|
4591
|
-
* (
|
|
4592
|
-
*
|
|
5022
|
+
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
5023
|
+
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
5024
|
+
* only connection was an excluded type fall through to the install-only
|
|
5025
|
+
* tier of the relevance ordering.
|
|
4593
5026
|
*
|
|
4594
|
-
* @param [params] - Inclusion
|
|
5027
|
+
* @param [params] - Inclusion flag + ordering preference + exclusions.
|
|
4595
5028
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4596
5029
|
* @returns A promise that resolves to the wallet options catalogue.
|
|
4597
5030
|
* @not-instrumented
|
|
4598
5031
|
*/
|
|
4599
5032
|
const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient()) => {
|
|
4600
|
-
const
|
|
4601
|
-
const includeWalletConnect = params.includeWalletConnect ?? false;
|
|
4602
|
-
const includeInAppBrowser = params.includeInAppBrowser ?? false;
|
|
4603
|
-
const includeInstallation = params.includeInstallation ?? false;
|
|
5033
|
+
const includeMobileOptions = params.includeMobileOptions ?? false;
|
|
4604
5034
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
4605
|
-
|
|
4606
|
-
const walletBook =
|
|
5035
|
+
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
5036
|
+
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
4607
5037
|
const allConnectionOptions = [];
|
|
4608
|
-
if (
|
|
5038
|
+
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
4609
5039
|
const entries = getWalletProviderRegistry(client).listProviderEntries();
|
|
4610
5040
|
allConnectionOptions.push(...buildWithWalletProviderOptions({
|
|
4611
5041
|
entries,
|
|
4612
5042
|
walletBook
|
|
4613
5043
|
}, client));
|
|
4614
5044
|
}
|
|
4615
|
-
if (
|
|
4616
|
-
|
|
4617
|
-
|
|
5045
|
+
if (includeMobileOptions) {
|
|
5046
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) allConnectionOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
5047
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) allConnectionOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
5048
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) allConnectionOptions.push(...buildInAppBrowserOptions({ walletBook }));
|
|
5049
|
+
}
|
|
5050
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({ walletBook }) : /* @__PURE__ */ new Map();
|
|
4618
5051
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
4619
5052
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
4620
5053
|
const walletOptions = [];
|
|
@@ -4894,6 +5327,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4894
5327
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4895
5328
|
* @returns A promise that resolves to the newly generated recovery codes.
|
|
4896
5329
|
* @instrumented
|
|
5330
|
+
* @redact-params
|
|
4897
5331
|
*/
|
|
4898
5332
|
const createNewMfaRecoveryCodes = async (client = getDefaultClient()) => {
|
|
4899
5333
|
const core = getCore(client);
|
|
@@ -4909,7 +5343,8 @@ const __createNewMfaRecoveryCodes_wrapped = instrumentFunction({
|
|
|
4909
5343
|
} catch {
|
|
4910
5344
|
return;
|
|
4911
5345
|
}
|
|
4912
|
-
}
|
|
5346
|
+
},
|
|
5347
|
+
redactAll: true
|
|
4913
5348
|
});
|
|
4914
5349
|
|
|
4915
5350
|
//#endregion
|
|
@@ -6136,6 +6571,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
6136
6571
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6137
6572
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
6138
6573
|
* @instrumented
|
|
6574
|
+
* @redact-params
|
|
6139
6575
|
*/
|
|
6140
6576
|
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = getDefaultClient()) => {
|
|
6141
6577
|
let response;
|
|
@@ -6161,7 +6597,8 @@ const __verifyOTP_wrapped = instrumentFunction({
|
|
|
6161
6597
|
} catch {
|
|
6162
6598
|
return;
|
|
6163
6599
|
}
|
|
6164
|
-
}
|
|
6600
|
+
},
|
|
6601
|
+
redactAll: true
|
|
6165
6602
|
});
|
|
6166
6603
|
|
|
6167
6604
|
//#endregion
|
|
@@ -6535,33 +6972,6 @@ const __confirmTransaction_wrapped = instrumentFunction({
|
|
|
6535
6972
|
}
|
|
6536
6973
|
});
|
|
6537
6974
|
|
|
6538
|
-
//#endregion
|
|
6539
|
-
//#region src/utils/isMobile/isMobile.ts
|
|
6540
|
-
/**
|
|
6541
|
-
* Sourced from http://detectmobilebrowsers.com/
|
|
6542
|
-
* @not-instrumented
|
|
6543
|
-
*/
|
|
6544
|
-
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;
|
|
6545
|
-
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;
|
|
6546
|
-
/** @not-instrumented */
|
|
6547
|
-
const isMobile = (maxTouchPointsOverride) => {
|
|
6548
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
6549
|
-
return userAgentRegex1.test(navigator.userAgent) || userAgentRegex2.test(navigator.userAgent.substring(0, 4)) || isIPad(maxTouchPointsOverride) || isIPhone();
|
|
6550
|
-
};
|
|
6551
|
-
/** @not-instrumented */
|
|
6552
|
-
const isIPhone = () => typeof window === "undefined" || typeof navigator === "undefined" ? false : /iPhone|ios/.test(navigator.userAgent);
|
|
6553
|
-
/**
|
|
6554
|
-
* @param [optional] maxTouchPointsOverride - this is used for testing since
|
|
6555
|
-
* it seems that JSDOM doesn't support maxTouchPoints, so it was impossible
|
|
6556
|
-
* to mock it
|
|
6557
|
-
* @not-instrumented
|
|
6558
|
-
*/
|
|
6559
|
-
const isIPad = (maxTouchPointsOverride) => {
|
|
6560
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return false;
|
|
6561
|
-
const maxTouchPoints = maxTouchPointsOverride || navigator.maxTouchPoints;
|
|
6562
|
-
return /iPad/.test(navigator.userAgent) || /Mac/.test(navigator.userAgent) && maxTouchPoints === 5;
|
|
6563
|
-
};
|
|
6564
|
-
|
|
6565
6975
|
//#endregion
|
|
6566
6976
|
//#region src/modules/wallets/utils/getAddressesWithTypesFromConnectionResult/getAddressesWithTypesFromConnectionResult.ts
|
|
6567
6977
|
/** @not-instrumented */
|
|
@@ -6585,13 +6995,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
6585
6995
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
6586
6996
|
* @returns A promise that resolves to the connected wallet account.
|
|
6587
6997
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
6588
|
-
*
|
|
6998
|
+
* @instrumented
|
|
6589
6999
|
*/
|
|
6590
7000
|
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = getDefaultClient()) => {
|
|
6591
7001
|
const walletProvider = getWalletProviderByKey({ walletProviderKey }, client);
|
|
6592
7002
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
6593
7003
|
const { addresses } = await walletProvider.connect();
|
|
6594
|
-
const currentAddresses = getWalletAccounts(client).map(({ address }) => address);
|
|
6595
7004
|
const mainAddress = addresses?.length ? addresses[0].address : null;
|
|
6596
7005
|
/**
|
|
6597
7006
|
* This error is thrown in case the wallet has no addresses connected
|
|
@@ -6599,27 +7008,25 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
6599
7008
|
* user on the next steps.
|
|
6600
7009
|
*/
|
|
6601
7010
|
if (!mainAddress) throw new NoAddressFoundError();
|
|
6602
|
-
const
|
|
6603
|
-
|
|
6604
|
-
|
|
6605
|
-
chain: walletProvider.chain,
|
|
6606
|
-
hardwareWalletVendor,
|
|
6607
|
-
id: formatWalletAccountId({
|
|
7011
|
+
const [reconciledWalletAccount] = reconcileWalletAccountsAgainstClient({
|
|
7012
|
+
addToDynamicWalletAccounts,
|
|
7013
|
+
walletAccounts: [{
|
|
6608
7014
|
address: mainAddress,
|
|
7015
|
+
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
6609
7016
|
chain: walletProvider.chain,
|
|
7017
|
+
hardwareWalletVendor,
|
|
7018
|
+
id: formatWalletAccountId({
|
|
7019
|
+
address: mainAddress,
|
|
7020
|
+
chain: walletProvider.chain,
|
|
7021
|
+
walletProviderKey
|
|
7022
|
+
}),
|
|
7023
|
+
lastSelectedAt: null,
|
|
7024
|
+
verifiedCredentialId: null,
|
|
6610
7025
|
walletProviderKey
|
|
6611
|
-
}
|
|
6612
|
-
lastSelectedAt: null,
|
|
6613
|
-
verifiedCredentialId: null,
|
|
7026
|
+
}],
|
|
6614
7027
|
walletProviderKey
|
|
6615
|
-
};
|
|
6616
|
-
|
|
6617
|
-
if (addToDynamicWalletAccounts) {
|
|
6618
|
-
setUnverifiedWalletAccounts({ unverifiedWalletAccountsToUpdate: [walletAccount] }, client);
|
|
6619
|
-
emitWalletAccountsChangedEvent(client);
|
|
6620
|
-
createVisit({ walletAccount }, client);
|
|
6621
|
-
}
|
|
6622
|
-
return walletAccount;
|
|
7028
|
+
}, client);
|
|
7029
|
+
return reconciledWalletAccount;
|
|
6623
7030
|
};
|
|
6624
7031
|
const __connectWithWalletProvider_impl = connectWithWalletProvider;
|
|
6625
7032
|
const __connectWithWalletProvider_wrapped = instrumentFunction({
|
|
@@ -6906,7 +7313,7 @@ const __connectAndVerifyWithWalletProvider_wrapped = instrumentFunction({
|
|
|
6906
7313
|
* @not-instrumented
|
|
6907
7314
|
*/
|
|
6908
7315
|
const getAvailableWalletProvidersData = (client = getDefaultClient()) => {
|
|
6909
|
-
return getWalletProviders(client).filter((walletProvider) =>
|
|
7316
|
+
return getWalletProviders(client).filter((walletProvider) => hasWalletProviderConnectMethod({ walletProvider })).map((walletProvider) => ({
|
|
6910
7317
|
chain: walletProvider.chain,
|
|
6911
7318
|
groupKey: walletProvider.groupKey,
|
|
6912
7319
|
key: walletProvider.key,
|
|
@@ -6969,6 +7376,22 @@ const getWalletProviderDataByKey = ({ walletProviderKey }, client = getDefaultCl
|
|
|
6969
7376
|
};
|
|
6970
7377
|
};
|
|
6971
7378
|
|
|
7379
|
+
//#endregion
|
|
7380
|
+
//#region src/modules/wallets/isAnyWalletAccountConnected/isAnyWalletAccountConnected.ts
|
|
7381
|
+
/**
|
|
7382
|
+
* Checks whether the session has at least one connected wallet account.
|
|
7383
|
+
*
|
|
7384
|
+
* Both verified and unverified wallet accounts count as connected. This is a
|
|
7385
|
+
* single building block for a custom signed-in check — combine it with whatever
|
|
7386
|
+
* else your app considers "signed in" (e.g. `client.user`, completed onboarding,
|
|
7387
|
+
* a required embedded wallet, …).
|
|
7388
|
+
*
|
|
7389
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7390
|
+
* @returns True if the session has at least one wallet account, false otherwise.
|
|
7391
|
+
* @not-instrumented
|
|
7392
|
+
*/
|
|
7393
|
+
const isAnyWalletAccountConnected = (client = getDefaultClient()) => getWalletAccounts(client).length > 0;
|
|
7394
|
+
|
|
6972
7395
|
//#endregion
|
|
6973
7396
|
//#region src/modules/wallets/hardwareWallet/canConnectWithHardwareWallet/canConnectWithHardwareWallet.ts
|
|
6974
7397
|
/**
|
|
@@ -7080,19 +7503,23 @@ const getActiveNetworkId = ({ walletAccount }, client = getDefaultClient()) => {
|
|
|
7080
7503
|
};
|
|
7081
7504
|
|
|
7082
7505
|
//#endregion
|
|
7083
|
-
//#region src/modules/wallets/networks/
|
|
7506
|
+
//#region src/modules/wallets/networks/getNativeBalance/getNativeBalance.ts
|
|
7084
7507
|
/**
|
|
7085
|
-
* Retrieves the native token balance for a wallet account
|
|
7508
|
+
* Retrieves the native token balance for a wallet account on its active
|
|
7509
|
+
* network. Reads directly from the chain's network provider (RPC), not
|
|
7510
|
+
* the Dynamic API.
|
|
7086
7511
|
*
|
|
7087
|
-
*
|
|
7088
|
-
* (
|
|
7512
|
+
* Use this when you only need the user's gas / native-currency balance
|
|
7513
|
+
* (ETH, SOL, BTC, etc.). For token balances, use
|
|
7514
|
+
* {@link getTokenBalances}; for a multi-chain portfolio snapshot, use
|
|
7515
|
+
* {@link getMultichainTokenBalances}.
|
|
7089
7516
|
*
|
|
7090
7517
|
* @param params.walletAccount - The wallet account to get the balance for.
|
|
7091
7518
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
7092
7519
|
* @returns A promise that resolves to an object containing the balance as a string or null.
|
|
7093
7520
|
* @not-instrumented
|
|
7094
7521
|
*/
|
|
7095
|
-
const
|
|
7522
|
+
const getNativeBalance = async ({ walletAccount }, client = getDefaultClient()) => {
|
|
7096
7523
|
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
7097
7524
|
const { networkId } = await walletProvider.getActiveNetworkId();
|
|
7098
7525
|
return getNetworkProviderFromNetworkId({
|
|
@@ -7550,5 +7977,5 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
7550
7977
|
assertPackageVersion(name, version);
|
|
7551
7978
|
|
|
7552
7979
|
//#endregion
|
|
7553
|
-
export { BaseError, CheckoutSessionTokenMissingError, ClientAlreadyInitializedError, DeeplinkConnectAndVerifyUnsupportedError, FeeEstimationFailedError, GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, InvalidSocialCallbackOriginError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, TokenSwapError, UnauthorizedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserCancelledSocialPopUpError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, __acknowledgeRecoveryCodes_wrapped as acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, __addNetwork_wrapped as addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, __attachCheckoutTransactionSource_wrapped as attachCheckoutTransactionSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, __authenticateWithSocial_wrapped as authenticateWithSocial, __broadcastCheckoutTransaction_wrapped as broadcastCheckoutTransaction, canConnectWithHardwareWallet, __cancelCheckoutTransaction_wrapped as cancelCheckoutTransaction, __checkStepUpAuth_wrapped as checkStepUpAuth, __completeDeviceRegistration_wrapped as completeDeviceRegistration, __completeSocialAuthentication_wrapped as completeSocialAuthentication, __completeSocialRedirect_wrapped as completeSocialRedirect, __confirmTransaction_wrapped as confirmTransaction, __connectAndVerifyWithWalletProvider_wrapped as connectAndVerifyWithWalletProvider, __connectWithWalletProvider_wrapped as connectWithWalletProvider, __consumeMfaToken_wrapped as consumeMfaToken, __createCheckoutTransaction_wrapped as createCheckoutTransaction, __createCoinbaseOnrampOrder_wrapped as createCoinbaseOnrampOrder, __createCryptoDotComPayment_wrapped as createCryptoDotComPayment, __createDynamicClient_wrapped as createDynamicClient, __createKrakenExchangeTransfer_wrapped as createKrakenExchangeTransfer, __createNewMfaRecoveryCodes_wrapped as createNewMfaRecoveryCodes, __deleteMfaDevice_wrapped as deleteMfaDevice, __deletePasskey_wrapped as deletePasskey, __deleteUser_wrapped as deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, detectSocialRedirectUrl, excludeInstalledFromCatalog, __executeSwapTransaction_wrapped as executeSwapTransaction, fetchProjectSettings, findMissingGoogleDriveBackupScopes, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getBalances, getCheckoutTransaction, getCheckoutTransactionQuote, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, __getElevatedAccessToken_wrapped as getElevatedAccessToken, __getGoogleDriveBackupReadiness_wrapped as getGoogleDriveBackupReadiness, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getRegisteredDevices, getSwapQuote, getSwapStatus, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletOptionsCatalogue, getWalletProviderDataByKey, hasAllGoogleDriveBackupScopes, hasExtension, __initializeClient_wrapped as initializeClient, isCaptchaRequired, isDeeplinkWalletProvider, isDeviceRegistrationRequired, isHardwareWalletAccount, isInsufficientGoogleDriveScopesError, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, matchWalletProvidersToCatalogGroup, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, parseUserAgent, __prepareCheckoutTransaction_wrapped as prepareCheckoutTransaction, __proveWalletAccountOwnership_wrapped as proveWalletAccountOwnership, __refreshAuth_wrapped as refreshAuth, __refreshUser_wrapped as refreshUser, __registerPasskey_wrapped as registerPasskey, __registerTotpMfaDevice_wrapped as registerTotpMfaDevice, __removeWalletAccount_wrapped as removeWalletAccount, __requestExternalAuthElevatedToken_wrapped as requestExternalAuthElevatedToken, requiresConversion, __revokeAllRegisteredDevices_wrapped as revokeAllRegisteredDevices, __revokeRegisteredDevice_wrapped as revokeRegisteredDevice, __selectPrimaryWalletAccount_wrapped as selectPrimaryWalletAccount, __sendEmailOTP_wrapped as sendEmailOTP, __sendSmsOTP_wrapped as sendSmsOTP, __setCaptchaToken_wrapped as setCaptchaToken, __setDefaultMfaDevice_wrapped as setDefaultMfaDevice, __setInstrumentationEnabled_wrapped as setInstrumentationEnabled, __signInWithExternalJwt_wrapped as signInWithExternalJwt, __signInWithPasskey_wrapped as signInWithPasskey, __signInWithSocialPopUp_wrapped as signInWithSocialPopUp, __signInWithSocialRedirect_wrapped as signInWithSocialRedirect, __signMessage_wrapped as signMessage, __submitCheckoutTransaction_wrapped as submitCheckoutTransaction, supportedCountries, __switchActiveNetwork_wrapped as switchActiveNetwork, trackCheckoutTransaction, __transferAmount_wrapped as transferAmount, __transferWalletAccount_wrapped as transferWalletAccount, __unlinkSocialAccount_wrapped as unlinkSocialAccount, __updateUser_wrapped as updateUser, __verifyOTP_wrapped as verifyOTP, __verifyWalletAccount_wrapped as verifyWalletAccount, waitForClientInitialized };
|
|
7980
|
+
export { BaseError, CheckoutSessionTokenMissingError, ClientAlreadyInitializedError, DeeplinkConnectAndVerifyUnsupportedError, FeeEstimationFailedError, GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, InvalidSocialCallbackOriginError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, TokenSwapError, UnauthorizedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserCancelledSocialPopUpError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, __acknowledgeRecoveryCodes_wrapped as acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, __addNetwork_wrapped as addNetwork, appendConnectionUriToDeeplink, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, __attachCheckoutTransactionSource_wrapped as attachCheckoutTransactionSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, __authenticateWithSocial_wrapped as authenticateWithSocial, __broadcastCheckoutTransaction_wrapped as broadcastCheckoutTransaction, canConnectWithHardwareWallet, __cancelCheckoutTransaction_wrapped as cancelCheckoutTransaction, __checkStepUpAuth_wrapped as checkStepUpAuth, __completeDeviceRegistration_wrapped as completeDeviceRegistration, __completeSocialAuthentication_wrapped as completeSocialAuthentication, __completeSocialRedirect_wrapped as completeSocialRedirect, __confirmTransaction_wrapped as confirmTransaction, __connectAndVerifyWithWalletProvider_wrapped as connectAndVerifyWithWalletProvider, __connectWithWalletProvider_wrapped as connectWithWalletProvider, __consumeMfaToken_wrapped as consumeMfaToken, __createCheckoutTransaction_wrapped as createCheckoutTransaction, __createCoinbaseOnrampOrder_wrapped as createCoinbaseOnrampOrder, __createCryptoDotComPayment_wrapped as createCryptoDotComPayment, __createDynamicClient_wrapped as createDynamicClient, __createKrakenExchangeTransfer_wrapped as createKrakenExchangeTransfer, __createNewMfaRecoveryCodes_wrapped as createNewMfaRecoveryCodes, __deleteMfaDevice_wrapped as deleteMfaDevice, __deletePasskey_wrapped as deletePasskey, __deleteUser_wrapped as deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, detectSocialRedirectUrl, excludeInstalledFromCatalog, __executeSwapTransaction_wrapped as executeSwapTransaction, fetchProjectSettings, findMissingGoogleDriveBackupScopes, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getNativeBalance as getBalance, getNativeBalance, getBalanceForAddress, getTokenBalances as getBalances, getTokenBalances, getCheckoutTransaction, getCheckoutTransactionQuote, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, __getElevatedAccessToken_wrapped as getElevatedAccessToken, __getGoogleDriveBackupReadiness_wrapped as getGoogleDriveBackupReadiness, getInstallationLinkForCurrentPlatform, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, __getMoonPayCurrencies_wrapped as getMoonPayCurrencies, __getMoonPayUrl_wrapped as getMoonPayUrl, getMultichainTokenBalances as getMultichainBalances, getMultichainTokenBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getRegisteredDevices, getSwapQuote, getSwapStatus, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletOptionsCatalogue, getWalletProviderDataByKey, hasAllGoogleDriveBackupScopes, hasExtension, __initializeClient_wrapped as initializeClient, isAnyWalletAccountConnected, isCaptchaRequired, isDeeplinkWalletProvider, isDeviceRegistrationRequired, isHardwareWalletAccount, isInsufficientGoogleDriveScopesError, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, matchWalletProvidersToCatalogGroup, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, parseUserAgent, __prepareCheckoutTransaction_wrapped as prepareCheckoutTransaction, __proveWalletAccountOwnership_wrapped as proveWalletAccountOwnership, __refreshAuth_wrapped as refreshAuth, __refreshUser_wrapped as refreshUser, __registerPasskey_wrapped as registerPasskey, __registerTotpMfaDevice_wrapped as registerTotpMfaDevice, __removeWalletAccount_wrapped as removeWalletAccount, __requestExternalAuthElevatedToken_wrapped as requestExternalAuthElevatedToken, requiresConversion, __revokeAllRegisteredDevices_wrapped as revokeAllRegisteredDevices, __revokeRegisteredDevice_wrapped as revokeRegisteredDevice, __selectPrimaryWalletAccount_wrapped as selectPrimaryWalletAccount, __sendEmailOTP_wrapped as sendEmailOTP, __sendSmsOTP_wrapped as sendSmsOTP, __setCaptchaToken_wrapped as setCaptchaToken, __setDefaultMfaDevice_wrapped as setDefaultMfaDevice, __setInstrumentationEnabled_wrapped as setInstrumentationEnabled, __signInWithExternalJwt_wrapped as signInWithExternalJwt, __signInWithPasskey_wrapped as signInWithPasskey, __signInWithSocialPopUp_wrapped as signInWithSocialPopUp, __signInWithSocialRedirect_wrapped as signInWithSocialRedirect, __signMessage_wrapped as signMessage, __submitCheckoutTransaction_wrapped as submitCheckoutTransaction, supportedCountries, __switchActiveNetwork_wrapped as switchActiveNetwork, trackCheckoutTransaction, __transferAmount_wrapped as transferAmount, __transferWalletAccount_wrapped as transferWalletAccount, __unlinkSocialAccount_wrapped as unlinkSocialAccount, __updateUser_wrapped as updateUser, __verifyOTP_wrapped as verifyOTP, __verifyWalletAccount_wrapped as verifyWalletAccount, waitForClientInitialized };
|
|
7554
7981
|
//# sourceMappingURL=index.esm.js.map
|