@dynamic-labs-sdk/client 1.2.1 → 1.4.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-uluG140m.esm.js → InvalidParamError-BPMi0iWC.esm.js} +55 -6
- package/dist/InvalidParamError-BPMi0iWC.esm.js.map +1 -0
- package/dist/{InvalidParamError-BYnLW_9s.native.esm.js → InvalidParamError-CDmVW2DS.native.esm.js} +55 -6
- package/dist/InvalidParamError-CDmVW2DS.native.esm.js.map +1 -0
- package/dist/{InvalidParamError-CEykJlaG.cjs → InvalidParamError-DEmLKJKZ.cjs} +61 -6
- package/dist/InvalidParamError-DEmLKJKZ.cjs.map +1 -0
- package/dist/{NotWaasWalletAccountError-BNdbbGX7.cjs → NotWaasWalletAccountError-BZsBHRQe.cjs} +6 -4
- package/dist/NotWaasWalletAccountError-BZsBHRQe.cjs.map +1 -0
- package/dist/{NotWaasWalletAccountError-DmlwWvy0.esm.js → NotWaasWalletAccountError-Chpne8_Q.native.esm.js} +6 -4
- package/dist/NotWaasWalletAccountError-Chpne8_Q.native.esm.js.map +1 -0
- package/dist/{NotWaasWalletAccountError-33QOxTKa.native.esm.js → NotWaasWalletAccountError-Cntietge.esm.js} +6 -4
- package/dist/NotWaasWalletAccountError-Cntietge.esm.js.map +1 -0
- package/dist/core.cjs +6 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +6 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +6 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/exports/core.d.ts +2 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +4 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-CS1GXEp6.esm.js → getNetworkProviderFromNetworkId-CEeFL-gV.esm.js} +72 -16
- package/dist/getNetworkProviderFromNetworkId-CEeFL-gV.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-a0atbFHU.native.esm.js → getNetworkProviderFromNetworkId-JGrKwBj7.native.esm.js} +72 -16
- package/dist/getNetworkProviderFromNetworkId-JGrKwBj7.native.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BOCwNNMm.cjs → getNetworkProviderFromNetworkId-szJOsbQN.cjs} +77 -15
- package/dist/getNetworkProviderFromNetworkId-szJOsbQN.cjs.map +1 -0
- package/dist/{getSignedSessionId-zHtJOVpY.native.esm.js → getSignedSessionId-B5DikCap.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-zHtJOVpY.native.esm.js.map → getSignedSessionId-B5DikCap.native.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-D1Oh4604.esm.js → getSignedSessionId-BOx1nFt_.esm.js} +3 -3
- package/dist/{getSignedSessionId-D1Oh4604.esm.js.map → getSignedSessionId-BOx1nFt_.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-B42gT4xk.cjs → getSignedSessionId-BxOK-Tdo.cjs} +3 -3
- package/dist/{getSignedSessionId-B42gT4xk.cjs.map → getSignedSessionId-BxOK-Tdo.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-B-IhZJuM.cjs → getVerifiedCredentialForWalletAccount-B46O0B48.cjs} +4 -3
- package/dist/getVerifiedCredentialForWalletAccount-B46O0B48.cjs.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-CEvtJ3xW.native.esm.js → getVerifiedCredentialForWalletAccount-CyykSi-M.native.esm.js} +3 -2
- package/dist/getVerifiedCredentialForWalletAccount-CyykSi-M.native.esm.js.map +1 -0
- package/dist/{getVerifiedCredentialForWalletAccount-BkaECPL_.esm.js → getVerifiedCredentialForWalletAccount-DzwIoeHm.esm.js} +3 -2
- package/dist/getVerifiedCredentialForWalletAccount-DzwIoeHm.esm.js.map +1 -0
- package/dist/index.cjs +1028 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +1027 -86
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +1027 -86
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-CJvFP4oN.cjs → isMfaRequiredForAction-6N6JB7wa.cjs} +5 -3
- package/dist/isMfaRequiredForAction-6N6JB7wa.cjs.map +1 -0
- package/dist/{isMfaRequiredForAction-G7SXCZ5L.esm.js → isMfaRequiredForAction-D9p_du8C.esm.js} +5 -3
- package/dist/isMfaRequiredForAction-D9p_du8C.esm.js.map +1 -0
- package/dist/{isMfaRequiredForAction-BfabCDxI.native.esm.js → isMfaRequiredForAction-DUvZEpjA.native.esm.js} +5 -3
- package/dist/isMfaRequiredForAction-DUvZEpjA.native.esm.js.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/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 +22 -10
- package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
- 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 +6 -2
- 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/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/{shouldFilterWallet → shouldFilterWalletForWalletConnect}/index.d.ts.map +1 -1
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.d.ts +13 -0
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.d.ts +10 -0
- package/dist/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/index.d.ts +3 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.d.ts +34 -0
- package/dist/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.d.ts.map +1 -0
- 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/user/refreshAuth/refreshAuth.d.ts +2 -1
- package/dist/modules/user/refreshAuth/refreshAuth.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts +22 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.d.ts +21 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts +27 -0
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/buildUriDeeplinkOptions.d.ts +28 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/buildUriDeeplinkOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/resolveUriConnectionType.d.ts +17 -0
- package/dist/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/resolveUriConnectionType.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts +39 -0
- package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts +54 -0
- package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.d.ts +31 -0
- package/dist/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.d.ts +15 -0
- package/dist/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.d.ts +21 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.d.ts +44 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.d.ts +20 -0
- package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts +15 -0
- package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.d.ts +16 -0
- package/dist/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +14 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.d.ts +49 -0
- package/dist/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts +18 -0
- package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.d.ts +23 -0
- package/dist/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts +22 -0
- package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts +20 -0
- package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts +34 -0
- package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +152 -0
- package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -0
- 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/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/utils/stripChainSuffix/stripChainSuffix.d.ts +20 -0
- package/dist/modules/wallets/utils/stripChainSuffix/stripChainSuffix.d.ts.map +1 -0
- package/dist/modules/wallets/walletProviderRegistry/createWalletProviderRegistry/createWalletProviderRegistry.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts +1 -1
- package/dist/modules/wallets/walletProviderRegistry/index.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts +19 -0
- package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts.map +1 -1
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts +23 -0
- package/dist/modules/wallets/walletProviderUriConnection.types.d.ts.map +1 -0
- 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/waas.cjs +6 -5
- package/dist/waas.cjs.map +1 -1
- package/dist/waas.esm.js +5 -4
- package/dist/waas.esm.js.map +1 -1
- package/dist/waas.native.esm.js +5 -4
- package/dist/waas.native.esm.js.map +1 -1
- package/dist/waasCore.cjs +4 -4
- package/dist/waasCore.esm.js +3 -3
- package/dist/waasCore.native.esm.js +3 -3
- package/package.json +3 -3
- package/dist/InvalidParamError-BYnLW_9s.native.esm.js.map +0 -1
- package/dist/InvalidParamError-CEykJlaG.cjs.map +0 -1
- package/dist/InvalidParamError-uluG140m.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-33QOxTKa.native.esm.js.map +0 -1
- package/dist/NotWaasWalletAccountError-BNdbbGX7.cjs.map +0 -1
- package/dist/NotWaasWalletAccountError-DmlwWvy0.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-BOCwNNMm.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CS1GXEp6.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-a0atbFHU.native.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-B-IhZJuM.cjs.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-BkaECPL_.esm.js.map +0 -1
- package/dist/getVerifiedCredentialForWalletAccount-CEvtJ3xW.native.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-BfabCDxI.native.esm.js.map +0 -1
- package/dist/isMfaRequiredForAction-CJvFP4oN.cjs.map +0 -1
- package/dist/isMfaRequiredForAction-G7SXCZ5L.esm.js.map +0 -1
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/index.d.ts +0 -2
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/shouldFilterWallet.d.ts +0 -21
- package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/shouldFilterWallet.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
2
|
-
const require_InvalidParamError = require('./InvalidParamError-
|
|
3
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-
|
|
5
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-szJOsbQN.cjs');
|
|
2
|
+
const require_InvalidParamError = require('./InvalidParamError-DEmLKJKZ.cjs');
|
|
3
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-B46O0B48.cjs');
|
|
4
|
+
const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-BZsBHRQe.cjs');
|
|
5
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-6N6JB7wa.cjs');
|
|
6
6
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
7
7
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
8
8
|
let zod_mini = require("zod/mini");
|
|
@@ -27,6 +27,36 @@ const stateChangeEvents = {
|
|
|
27
27
|
user: "userChanged"
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/utils/appendConnectionUriToDeeplink/appendConnectionUriToDeeplink.ts
|
|
32
|
+
/**
|
|
33
|
+
* Appends a wallet connection URI to a deeplink URL.
|
|
34
|
+
*
|
|
35
|
+
* Generic across URI-deeplink connection options — works for both
|
|
36
|
+
* WalletConnect pairing URIs and MetaMask SDK URIs. Determines the
|
|
37
|
+
* appropriate query parameter separator based on whether the deeplink
|
|
38
|
+
* already contains query parameters.
|
|
39
|
+
*
|
|
40
|
+
* @param params.deeplinkUrl - The base deeplink URL (e.g., `walletapp://wc` or `walletapp://wc?param=value`).
|
|
41
|
+
* @param params.connectionUri - The connection URI to append.
|
|
42
|
+
* @returns The deeplink URL with the connection URI appended as a query parameter.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* appendConnectionUriToDeeplink({ deeplinkUrl: 'walletapp://wc', connectionUri: 'wc:123-456' })
|
|
47
|
+
* // Returns: 'walletapp://wc?uri=wc%3A123-456'
|
|
48
|
+
*
|
|
49
|
+
* appendConnectionUriToDeeplink({ deeplinkUrl: 'walletapp://wc?param=value', connectionUri: 'wc:123-456' })
|
|
50
|
+
* // Returns: 'walletapp://wc?param=value&uri=wc%3A123-456'
|
|
51
|
+
* ```
|
|
52
|
+
* @not-instrumented
|
|
53
|
+
*/
|
|
54
|
+
const appendConnectionUriToDeeplink = ({ connectionUri, deeplinkUrl }) => {
|
|
55
|
+
const url = new URL(deeplinkUrl);
|
|
56
|
+
url.searchParams.set("uri", connectionUri);
|
|
57
|
+
return url.href;
|
|
58
|
+
};
|
|
59
|
+
|
|
30
60
|
//#endregion
|
|
31
61
|
//#region src/utils/getNonce/prefetchNoncesIfNeeded/prefetchNoncesIfNeeded.ts
|
|
32
62
|
/** @not-instrumented */
|
|
@@ -628,10 +658,13 @@ const connectLoggerToInstrumentation = ({ environmentId, extensions, instrumenta
|
|
|
628
658
|
const { token, user } = state.get();
|
|
629
659
|
instrumentation.log({
|
|
630
660
|
environmentId,
|
|
631
|
-
parameters: {
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
661
|
+
parameters: require_InvalidParamError.scrubParameters({
|
|
662
|
+
piiFields: instrumentation.config.piiFields,
|
|
663
|
+
value: {
|
|
664
|
+
args,
|
|
665
|
+
message
|
|
666
|
+
}
|
|
667
|
+
}),
|
|
635
668
|
registeredExtensionKeys: Array.from(extensions),
|
|
636
669
|
sdkSessionId,
|
|
637
670
|
sdkVersion,
|
|
@@ -1543,6 +1576,7 @@ const __checkStepUpAuth_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1543
1576
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
1544
1577
|
* @returns A promise that resolves to the assertion response containing the elevated access token.
|
|
1545
1578
|
* @instrumented
|
|
1579
|
+
* @redact-params
|
|
1546
1580
|
*/
|
|
1547
1581
|
const requestExternalAuthElevatedToken = async ({ externalJwt }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1548
1582
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -1570,7 +1604,8 @@ const __requestExternalAuthElevatedToken_wrapped = require_InvalidParamError.ins
|
|
|
1570
1604
|
} catch {
|
|
1571
1605
|
return;
|
|
1572
1606
|
}
|
|
1573
|
-
}
|
|
1607
|
+
},
|
|
1608
|
+
redactAll: true
|
|
1574
1609
|
});
|
|
1575
1610
|
|
|
1576
1611
|
//#endregion
|
|
@@ -1722,6 +1757,7 @@ const serverRegisterPasskey = async ({ registration, createMfaToken }, client) =
|
|
|
1722
1757
|
* @returns A promise that resolves to the registration response.
|
|
1723
1758
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1724
1759
|
* @instrumented
|
|
1760
|
+
* @redact-params
|
|
1725
1761
|
*/
|
|
1726
1762
|
const registerPasskey = async ({ createMfaToken } = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1727
1763
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -1744,7 +1780,8 @@ const __registerPasskey_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
1744
1780
|
} catch {
|
|
1745
1781
|
return;
|
|
1746
1782
|
}
|
|
1747
|
-
}
|
|
1783
|
+
},
|
|
1784
|
+
redactAll: true
|
|
1748
1785
|
});
|
|
1749
1786
|
|
|
1750
1787
|
//#endregion
|
|
@@ -1789,6 +1826,7 @@ const serverSigninPasskey = async ({ authentication, createMfaToken }, client) =
|
|
|
1789
1826
|
* @returns A promise that resolves to the authentication response.
|
|
1790
1827
|
* @throws NoWebAuthNSupportError If WebAuthn is not supported by the browser.
|
|
1791
1828
|
* @instrumented
|
|
1829
|
+
* @redact-params
|
|
1792
1830
|
*/
|
|
1793
1831
|
const signInWithPasskey = async ({ relatedOriginRpId } = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
1794
1832
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -1808,7 +1846,8 @@ const __signInWithPasskey_wrapped = require_InvalidParamError.instrumentFunction
|
|
|
1808
1846
|
} catch {
|
|
1809
1847
|
return;
|
|
1810
1848
|
}
|
|
1811
|
-
}
|
|
1849
|
+
},
|
|
1850
|
+
redactAll: true
|
|
1812
1851
|
});
|
|
1813
1852
|
|
|
1814
1853
|
//#endregion
|
|
@@ -2250,6 +2289,7 @@ const getPrimaryWalletAccount = (client = require_InvalidParamError.getDefaultCl
|
|
|
2250
2289
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
2251
2290
|
* @returns A promise that resolves to the verify response.
|
|
2252
2291
|
* @instrumented
|
|
2292
|
+
* @redact-params
|
|
2253
2293
|
*/
|
|
2254
2294
|
const unlinkSocialAccount = async ({ verifiedCredentialId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2255
2295
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -2275,7 +2315,8 @@ const __unlinkSocialAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
2275
2315
|
} catch {
|
|
2276
2316
|
return;
|
|
2277
2317
|
}
|
|
2278
|
-
}
|
|
2318
|
+
},
|
|
2319
|
+
redactAll: true
|
|
2279
2320
|
});
|
|
2280
2321
|
|
|
2281
2322
|
//#endregion
|
|
@@ -2290,10 +2331,10 @@ const __unlinkSocialAccount_wrapped = require_InvalidParamError.instrumentFuncti
|
|
|
2290
2331
|
* @returns A promise that resolves to an array of token balances.
|
|
2291
2332
|
* @not-instrumented
|
|
2292
2333
|
*/
|
|
2293
|
-
const getBalances = async ({ walletAccount, networkId, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2334
|
+
const getBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2294
2335
|
const core = require_InvalidParamError.getCore(client);
|
|
2295
2336
|
const apiClient = require_InvalidParamError.createApiClient({}, client);
|
|
2296
|
-
if (!networkId) {
|
|
2337
|
+
if (!networkId && !networkIds) {
|
|
2297
2338
|
const activeNetworkId = await require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
|
|
2298
2339
|
networkId = Number(activeNetworkId.networkId);
|
|
2299
2340
|
}
|
|
@@ -2306,6 +2347,7 @@ const getBalances = async ({ walletAccount, networkId, includePrices, includeNat
|
|
|
2306
2347
|
includeNative,
|
|
2307
2348
|
includePrices,
|
|
2308
2349
|
networkId,
|
|
2350
|
+
networkIds,
|
|
2309
2351
|
whitelistedContracts
|
|
2310
2352
|
});
|
|
2311
2353
|
};
|
|
@@ -2356,6 +2398,52 @@ const createCheckoutApiClient = async ({ transactionId }, client) => {
|
|
|
2356
2398
|
};
|
|
2357
2399
|
};
|
|
2358
2400
|
|
|
2401
|
+
//#endregion
|
|
2402
|
+
//#region src/modules/checkout/utils/clearCheckoutSessionToken/clearCheckoutSessionToken.ts
|
|
2403
|
+
/**
|
|
2404
|
+
* Removes the locally stored checkout session token for the given transaction.
|
|
2405
|
+
*
|
|
2406
|
+
* The checkout session token is the anonymous credential that authorizes
|
|
2407
|
+
* mutations to a single in-flight checkout transaction. Once the transaction
|
|
2408
|
+
* has reached a terminal state (cancelled, expired, failed, completed) it can
|
|
2409
|
+
* no longer be advanced, and the token is dead weight that should not be
|
|
2410
|
+
* persisted in browser storage — leaving it around lets a later XSS payload
|
|
2411
|
+
* exfiltrate a credential with no further use, and it can also confuse the
|
|
2412
|
+
* SDK on subsequent loads into believing an active session exists.
|
|
2413
|
+
*
|
|
2414
|
+
* The server-side revocation lives in dashboard-api; this is the SDK-side
|
|
2415
|
+
* defense-in-depth.
|
|
2416
|
+
*
|
|
2417
|
+
* @not-instrumented
|
|
2418
|
+
*/
|
|
2419
|
+
const clearCheckoutSessionToken = async ({ transactionId }, client) => {
|
|
2420
|
+
await require_InvalidParamError.getCore(client).storage.removeItem(createCheckoutSessionTokenStorageKey(transactionId));
|
|
2421
|
+
};
|
|
2422
|
+
|
|
2423
|
+
//#endregion
|
|
2424
|
+
//#region src/modules/checkout/utils/withCheckoutSessionTokenCleanupOn401/withCheckoutSessionTokenCleanupOn401.ts
|
|
2425
|
+
/**
|
|
2426
|
+
* Checkout mutation routes are guarded server-side only by session-token
|
|
2427
|
+
* validation, so a 401 means the token is dead (revoked, expired, deleted,
|
|
2428
|
+
* or invalid). Leaving a dead token in `localStorage` widens the XSS
|
|
2429
|
+
* exfiltration surface for no benefit and makes the next SDK load attempt
|
|
2430
|
+
* requests that are guaranteed to fail.
|
|
2431
|
+
*
|
|
2432
|
+
* @not-instrumented
|
|
2433
|
+
*/
|
|
2434
|
+
const withCheckoutSessionTokenCleanupOn401 = async ({ call, transactionId }, client) => {
|
|
2435
|
+
try {
|
|
2436
|
+
return await call();
|
|
2437
|
+
} catch (error) {
|
|
2438
|
+
if (error instanceof require_InvalidParamError.APIError && error.status === 401) try {
|
|
2439
|
+
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2440
|
+
} catch (cleanupError) {
|
|
2441
|
+
require_InvalidParamError.getCore(client).logger.error("Failed to clear checkout session token after 401", cleanupError);
|
|
2442
|
+
}
|
|
2443
|
+
throw error;
|
|
2444
|
+
}
|
|
2445
|
+
};
|
|
2446
|
+
|
|
2359
2447
|
//#endregion
|
|
2360
2448
|
//#region src/modules/checkout/attachCheckoutTransactionSource/attachCheckoutTransactionSource.ts
|
|
2361
2449
|
/**
|
|
@@ -2380,12 +2468,15 @@ const attachCheckoutTransactionSource = async (params, client = require_InvalidP
|
|
|
2380
2468
|
attachSourceRequest.fromChainId = params.fromChainId;
|
|
2381
2469
|
attachSourceRequest.fromChainName = params.fromChainName;
|
|
2382
2470
|
}
|
|
2383
|
-
return
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2471
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2472
|
+
call: () => apiClient.attachSource({
|
|
2473
|
+
attachSourceRequest,
|
|
2474
|
+
environmentId,
|
|
2475
|
+
transactionId,
|
|
2476
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2477
|
+
}),
|
|
2478
|
+
transactionId
|
|
2479
|
+
}, client);
|
|
2389
2480
|
};
|
|
2390
2481
|
const __attachCheckoutTransactionSource_impl = attachCheckoutTransactionSource;
|
|
2391
2482
|
const __attachCheckoutTransactionSource_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -2416,12 +2507,15 @@ const __attachCheckoutTransactionSource_wrapped = require_InvalidParamError.inst
|
|
|
2416
2507
|
*/
|
|
2417
2508
|
const broadcastCheckoutTransaction = async ({ transactionId, txHash }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2418
2509
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2419
|
-
return
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2510
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2511
|
+
call: () => apiClient.recordCheckoutBroadcast({
|
|
2512
|
+
environmentId,
|
|
2513
|
+
recordBroadcastRequest: { txHash },
|
|
2514
|
+
transactionId,
|
|
2515
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2516
|
+
}),
|
|
2517
|
+
transactionId
|
|
2518
|
+
}, client);
|
|
2425
2519
|
};
|
|
2426
2520
|
const __broadcastCheckoutTransaction_impl = broadcastCheckoutTransaction;
|
|
2427
2521
|
const __broadcastCheckoutTransaction_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -2448,12 +2542,15 @@ const __broadcastCheckoutTransaction_wrapped = require_InvalidParamError.instrum
|
|
|
2448
2542
|
*/
|
|
2449
2543
|
const cancelCheckoutTransaction = async ({ transactionId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2450
2544
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2451
|
-
const result = await
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2545
|
+
const result = await withCheckoutSessionTokenCleanupOn401({
|
|
2546
|
+
call: () => apiClient.cancelCheckoutTransaction({
|
|
2547
|
+
environmentId,
|
|
2548
|
+
transactionId,
|
|
2549
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2550
|
+
}),
|
|
2551
|
+
transactionId
|
|
2552
|
+
}, client);
|
|
2553
|
+
await clearCheckoutSessionToken({ transactionId }, client);
|
|
2457
2554
|
return result;
|
|
2458
2555
|
};
|
|
2459
2556
|
const __cancelCheckoutTransaction_impl = cancelCheckoutTransaction;
|
|
@@ -2554,16 +2651,19 @@ const getCheckoutTransaction = async ({ transactionId }, client = require_Invali
|
|
|
2554
2651
|
*/
|
|
2555
2652
|
const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slippage, transactionId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2556
2653
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2557
|
-
return
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2654
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2655
|
+
call: () => apiClient.quoteCheckoutTransaction({
|
|
2656
|
+
environmentId,
|
|
2657
|
+
quoteRequest: {
|
|
2658
|
+
fromChainId,
|
|
2659
|
+
fromTokenAddress,
|
|
2660
|
+
slippage
|
|
2661
|
+
},
|
|
2662
|
+
transactionId,
|
|
2663
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2664
|
+
}),
|
|
2665
|
+
transactionId
|
|
2666
|
+
}, client);
|
|
2567
2667
|
};
|
|
2568
2668
|
|
|
2569
2669
|
//#endregion
|
|
@@ -2580,15 +2680,18 @@ const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slip
|
|
|
2580
2680
|
*/
|
|
2581
2681
|
const prepareCheckoutTransaction = async ({ assertBalanceForGasCost, assertBalanceForTransferAmount, transactionId }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
2582
2682
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2583
|
-
return
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2683
|
+
return withCheckoutSessionTokenCleanupOn401({
|
|
2684
|
+
call: () => apiClient.prepareCheckoutTransaction({
|
|
2685
|
+
environmentId,
|
|
2686
|
+
prepareSigningRequest: {
|
|
2687
|
+
assertBalanceForGasCost: assertBalanceForGasCost ?? false,
|
|
2688
|
+
assertBalanceForTransferAmount: assertBalanceForTransferAmount ?? false
|
|
2689
|
+
},
|
|
2690
|
+
transactionId,
|
|
2691
|
+
xDynamicCheckoutSessionToken: sessionToken
|
|
2692
|
+
}),
|
|
2693
|
+
transactionId
|
|
2694
|
+
}, client);
|
|
2592
2695
|
};
|
|
2593
2696
|
const __prepareCheckoutTransaction_impl = prepareCheckoutTransaction;
|
|
2594
2697
|
const __prepareCheckoutTransaction_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -3375,10 +3478,12 @@ const fetchLegacyWalletBook = async (client) => {
|
|
|
3375
3478
|
};
|
|
3376
3479
|
|
|
3377
3480
|
//#endregion
|
|
3378
|
-
//#region src/modules/legacyWalletBook/
|
|
3481
|
+
//#region src/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.ts
|
|
3379
3482
|
/**
|
|
3380
|
-
* Embedded wallet keys that should be filtered out from
|
|
3381
|
-
* These wallets are not
|
|
3483
|
+
* Embedded wallet keys that should be filtered out from any external-wallet
|
|
3484
|
+
* catalogue. These wallets are not products the user "connects" to from the
|
|
3485
|
+
* wallet selection list — they are embedded sign-in methods that live behind
|
|
3486
|
+
* different SDK entry points.
|
|
3382
3487
|
* @not-instrumented
|
|
3383
3488
|
*/
|
|
3384
3489
|
const EMBEDDED_WALLET_KEYS = [
|
|
@@ -3394,19 +3499,48 @@ const EMBEDDED_WALLET_KEYS = [
|
|
|
3394
3499
|
"mpcwallet"
|
|
3395
3500
|
];
|
|
3396
3501
|
/**
|
|
3397
|
-
*
|
|
3502
|
+
* Generic "is this wallet eligible for an external-wallet catalogue" check.
|
|
3503
|
+
* Filters out:
|
|
3504
|
+
*
|
|
3505
|
+
* 1. Embedded sign-in methods (see {@link EMBEDDED_WALLET_KEYS}).
|
|
3506
|
+
* 2. Wallets that only ship a browser-extension injection (`injectedConfig`)
|
|
3507
|
+
* with no mobile or desktop links — these have no surface a customer
|
|
3508
|
+
* catalogue UI can drive to.
|
|
3509
|
+
*
|
|
3510
|
+
* Channel-specific eligibility (WalletConnect support, in-app browser URL,
|
|
3511
|
+
* installation links, …) is the caller's responsibility — wrap this helper
|
|
3512
|
+
* with an additional check, e.g.
|
|
3513
|
+
* {@link shouldFilterWalletForWalletConnect}.
|
|
3398
3514
|
*
|
|
3399
3515
|
* @returns True if the wallet should be filtered out, false otherwise.
|
|
3400
3516
|
* @not-instrumented
|
|
3401
3517
|
*/
|
|
3402
3518
|
const shouldFilterWallet = ({ wallet, walletKey }) => {
|
|
3403
3519
|
if (EMBEDDED_WALLET_KEYS.includes(walletKey)) return true;
|
|
3404
|
-
if (!wallet.walletConnect || !wallet.walletConnect.sdks.includes("sign_v2")) return true;
|
|
3405
3520
|
const hasInjectedConfig = wallet.injectedConfig && wallet.injectedConfig.length > 0;
|
|
3406
3521
|
const hasMobileLinks = Boolean(wallet.mobile?.androidId || wallet.mobile?.iosId || wallet.mobile?.native || wallet.mobile?.universal);
|
|
3407
3522
|
const hasDesktopLinks = Boolean(wallet.desktop?.chromeId || wallet.desktop?.edgeId || wallet.desktop?.firefoxId || wallet.desktop?.operaId || wallet.desktop?.safariId || wallet.desktop?.universal);
|
|
3408
|
-
|
|
3409
|
-
|
|
3523
|
+
return Boolean(hasInjectedConfig && !hasMobileLinks && !hasDesktopLinks);
|
|
3524
|
+
};
|
|
3525
|
+
|
|
3526
|
+
//#endregion
|
|
3527
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.ts
|
|
3528
|
+
/**
|
|
3529
|
+
* WalletConnect-specific filter. Applies the generic
|
|
3530
|
+
* {@link shouldFilterWallet} eligibility rules and additionally drops
|
|
3531
|
+
* wallets that do not advertise WalletConnect `sign_v2` support — the
|
|
3532
|
+
* protocol version Dynamic pairs against.
|
|
3533
|
+
*
|
|
3534
|
+
* @returns True if the wallet should be excluded from the WalletConnect
|
|
3535
|
+
* catalog, false otherwise.
|
|
3536
|
+
* @not-instrumented
|
|
3537
|
+
*/
|
|
3538
|
+
const shouldFilterWalletForWalletConnect = ({ wallet, walletKey }) => {
|
|
3539
|
+
if (shouldFilterWallet({
|
|
3540
|
+
wallet,
|
|
3541
|
+
walletKey
|
|
3542
|
+
})) return true;
|
|
3543
|
+
return !wallet.walletConnect?.sdks.includes("sign_v2");
|
|
3410
3544
|
};
|
|
3411
3545
|
|
|
3412
3546
|
//#endregion
|
|
@@ -3614,7 +3748,7 @@ const transformWalletBook = ({ walletBook }) => {
|
|
|
3614
3748
|
for (const [groupKey, group] of Object.entries(walletBook.groups)) groups[groupKey] = transformGroup({ group });
|
|
3615
3749
|
const wallets = {};
|
|
3616
3750
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
3617
|
-
if (
|
|
3751
|
+
if (shouldFilterWalletForWalletConnect({
|
|
3618
3752
|
wallet,
|
|
3619
3753
|
walletKey
|
|
3620
3754
|
})) continue;
|
|
@@ -3648,7 +3782,7 @@ const getWalletConnectCatalog = async (client = require_InvalidParamError.getDef
|
|
|
3648
3782
|
|
|
3649
3783
|
//#endregion
|
|
3650
3784
|
//#region src/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.ts
|
|
3651
|
-
const normalize = (value) => value.toLowerCase().replace(/\s+/g, "").replace(/wallet/g, "");
|
|
3785
|
+
const normalize$1 = (value) => value.toLowerCase().replace(/\s+/g, "").replace(/wallet/g, "");
|
|
3652
3786
|
/**
|
|
3653
3787
|
* Returns the wallet providers that belong to the same wallet group as the
|
|
3654
3788
|
* given WalletConnect catalog entry. Useful for de-duplicating "installed"
|
|
@@ -3667,10 +3801,10 @@ const normalize = (value) => value.toLowerCase().replace(/\s+/g, "").replace(/wa
|
|
|
3667
3801
|
* @not-instrumented
|
|
3668
3802
|
*/
|
|
3669
3803
|
const matchWalletProvidersToCatalogGroup = ({ catalogGroupKey, catalogGroupName, walletProviders }) => {
|
|
3670
|
-
const targets = new Set([normalize(catalogGroupKey)]);
|
|
3671
|
-
if (catalogGroupName) targets.add(normalize(catalogGroupName));
|
|
3804
|
+
const targets = new Set([normalize$1(catalogGroupKey)]);
|
|
3805
|
+
if (catalogGroupName) targets.add(normalize$1(catalogGroupName));
|
|
3672
3806
|
return walletProviders.filter((provider) => {
|
|
3673
|
-
return [normalize(provider.groupKey), normalize(provider.metadata.displayName)].some((candidate) => targets.has(candidate));
|
|
3807
|
+
return [normalize$1(provider.groupKey), normalize$1(provider.metadata.displayName)].some((candidate) => targets.has(candidate));
|
|
3674
3808
|
});
|
|
3675
3809
|
};
|
|
3676
3810
|
|
|
@@ -3804,6 +3938,812 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
|
|
|
3804
3938
|
}
|
|
3805
3939
|
};
|
|
3806
3940
|
|
|
3941
|
+
//#endregion
|
|
3942
|
+
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
3943
|
+
/**
|
|
3944
|
+
* Resolves which wallet option (group) a wallet book entry belongs to. Used
|
|
3945
|
+
* by the catalogue's wallet-book-driven transformers (URI deeplink,
|
|
3946
|
+
* `inAppBrowser`, `installation`) to bucket their emitted options.
|
|
3947
|
+
*
|
|
3948
|
+
* Wallet book entries inconsistently use `group` / `chainGroup` /
|
|
3949
|
+
* `walletGroup` for the same idea. The wallet key itself acts as the wallet
|
|
3950
|
+
* option key when no group field is set.
|
|
3951
|
+
*
|
|
3952
|
+
* @param params.wallet - The wallet entry.
|
|
3953
|
+
* @param params.walletKey - The wallet's key in `walletBook.wallets`.
|
|
3954
|
+
* @returns The wallet option key.
|
|
3955
|
+
* @not-instrumented
|
|
3956
|
+
*/
|
|
3957
|
+
const resolveWalletBookWalletOptionKey = ({ wallet, walletKey }) => wallet.group ?? wallet.chainGroup ?? wallet.walletGroup ?? walletKey;
|
|
3958
|
+
|
|
3959
|
+
//#endregion
|
|
3960
|
+
//#region src/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.ts
|
|
3961
|
+
/**
|
|
3962
|
+
* Returns the wallet's in-app browser URL template, preferring the v2
|
|
3963
|
+
* field. `inAppBrowser` is deprecated but some wallet book entries
|
|
3964
|
+
* still carry only the v1 value, so it acts as a fallback. Trailing
|
|
3965
|
+
* `?? undefined` collapses the schema's `string | null` typing down to
|
|
3966
|
+
* the `string | undefined` return contract.
|
|
3967
|
+
*
|
|
3968
|
+
* @param params.wallet - The wallet book wallet entry.
|
|
3969
|
+
* @returns The in-app browser URL, or `undefined` if neither field is set.
|
|
3970
|
+
* @not-instrumented
|
|
3971
|
+
*/
|
|
3972
|
+
const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wallet.mobile?.inAppBrowser ?? void 0;
|
|
3973
|
+
|
|
3974
|
+
//#endregion
|
|
3975
|
+
//#region src/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.ts
|
|
3976
|
+
/**
|
|
3977
|
+
* Builds the `inAppBrowser` catalogue options from the wallet book. A wallet
|
|
3978
|
+
* qualifies when it exposes a mobile in-app-browser URL — typically a
|
|
3979
|
+
* `cb_url={{encodedDappURI}}`-style template the customer fills in with the
|
|
3980
|
+
* current page URL before opening.
|
|
3981
|
+
*
|
|
3982
|
+
* Reuses the generic `shouldFilterWallet` rules — embedded sign-in methods
|
|
3983
|
+
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
3984
|
+
* "external wallet" stays consistent across option types.
|
|
3985
|
+
*
|
|
3986
|
+
* @param params.walletBook - The fetched wallet book.
|
|
3987
|
+
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
3988
|
+
* @not-instrumented
|
|
3989
|
+
*/
|
|
3990
|
+
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
3991
|
+
const result = [];
|
|
3992
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
3993
|
+
if (shouldFilterWallet({
|
|
3994
|
+
wallet,
|
|
3995
|
+
walletKey
|
|
3996
|
+
})) continue;
|
|
3997
|
+
const url = getInAppBrowserUrl({ wallet });
|
|
3998
|
+
if (!url) continue;
|
|
3999
|
+
result.push({
|
|
4000
|
+
option: {
|
|
4001
|
+
chain: getChainFromWalletSchema({
|
|
4002
|
+
wallet,
|
|
4003
|
+
walletKey
|
|
4004
|
+
}),
|
|
4005
|
+
type: "inAppBrowser",
|
|
4006
|
+
url
|
|
4007
|
+
},
|
|
4008
|
+
walletOptionKey: resolveWalletBookWalletOptionKey({
|
|
4009
|
+
wallet,
|
|
4010
|
+
walletKey
|
|
4011
|
+
})
|
|
4012
|
+
});
|
|
4013
|
+
}
|
|
4014
|
+
return result;
|
|
4015
|
+
};
|
|
4016
|
+
|
|
4017
|
+
//#endregion
|
|
4018
|
+
//#region src/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.ts
|
|
4019
|
+
const PLAY_STORE_URL_TEMPLATE = "https://play.google.com/store/apps/details?id=";
|
|
4020
|
+
const APP_STORE_URL_TEMPLATE = "https://apps.apple.com/app/";
|
|
4021
|
+
const CHROME_WEB_STORE_URL_TEMPLATE = "https://chrome.google.com/webstore/detail/";
|
|
4022
|
+
const FIREFOX_ADDONS_URL_TEMPLATE = "https://addons.mozilla.org/firefox/addon/";
|
|
4023
|
+
const EDGE_ADDONS_URL_TEMPLATE = "https://microsoftedge.microsoft.com/addons/detail/";
|
|
4024
|
+
/**
|
|
4025
|
+
* Builds the install/download URL bag for a wallet book entry. Returns the
|
|
4026
|
+
* concrete URLs assembled from each store's ID field — Play Store, App
|
|
4027
|
+
* Store, Chrome Web Store, Firefox Add-ons, Edge Add-ons — plus the wallet's
|
|
4028
|
+
* own `desktop.universal` / `desktop.native` URLs when set.
|
|
4029
|
+
*
|
|
4030
|
+
* Fields the wallet book does not carry are left undefined; callers should
|
|
4031
|
+
* skip emitting an installation option for a wallet whose URL bag is empty.
|
|
4032
|
+
*
|
|
4033
|
+
* @param params.wallet - The wallet book entry.
|
|
4034
|
+
* @returns The URL bag, omitting fields the wallet does not provide.
|
|
4035
|
+
* @not-instrumented
|
|
4036
|
+
*/
|
|
4037
|
+
const buildInstallationUrls = ({ wallet }) => {
|
|
4038
|
+
const androidId = wallet.mobile?.androidId;
|
|
4039
|
+
const iosId = wallet.mobile?.iosId;
|
|
4040
|
+
const chromeId = wallet.desktop?.chromeId;
|
|
4041
|
+
const firefoxId = wallet.desktop?.firefoxId;
|
|
4042
|
+
const edgeId = wallet.desktop?.edgeId;
|
|
4043
|
+
const native = wallet.desktop?.universal ?? wallet.desktop?.native;
|
|
4044
|
+
return {
|
|
4045
|
+
android: androidId ? `${PLAY_STORE_URL_TEMPLATE}${androidId}` : void 0,
|
|
4046
|
+
chrome: chromeId ? `${CHROME_WEB_STORE_URL_TEMPLATE}${chromeId}` : void 0,
|
|
4047
|
+
edge: edgeId ? `${EDGE_ADDONS_URL_TEMPLATE}${edgeId}` : void 0,
|
|
4048
|
+
firefox: firefoxId ? `${FIREFOX_ADDONS_URL_TEMPLATE}${firefoxId}` : void 0,
|
|
4049
|
+
ios: iosId ? `${APP_STORE_URL_TEMPLATE}${iosId}` : void 0,
|
|
4050
|
+
native: native || void 0
|
|
4051
|
+
};
|
|
4052
|
+
};
|
|
4053
|
+
|
|
4054
|
+
//#endregion
|
|
4055
|
+
//#region src/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.ts
|
|
4056
|
+
/**
|
|
4057
|
+
* `buildInstallationUrls` always returns an object, but it can be fully
|
|
4058
|
+
* `undefined`-valued when the wallet book entry has no installable surface.
|
|
4059
|
+
* Skip those wallets — emitting an empty URL bag helps nobody.
|
|
4060
|
+
*/
|
|
4061
|
+
const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
4062
|
+
/**
|
|
4063
|
+
* Collects install / download URLs for every wallet book entry that has
|
|
4064
|
+
* at least one installable surface, keyed by the wallet option key the
|
|
4065
|
+
* wallet groups under. The catalogue assembly step merges this map into
|
|
4066
|
+
* the per-key wallet option shell so `WalletOption.installationUrls` is
|
|
4067
|
+
* populated alongside (or instead of) `connectionOptions`.
|
|
4068
|
+
*
|
|
4069
|
+
* First-seen URLs win when multiple wallet book entries resolve to the
|
|
4070
|
+
* same wallet option key — wallet book authors put the most accurate
|
|
4071
|
+
* install links on the canonical entry, so the first-seen one is the
|
|
4072
|
+
* right pick.
|
|
4073
|
+
*
|
|
4074
|
+
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
4075
|
+
* not appear here either — they're not user-installable products.
|
|
4076
|
+
*
|
|
4077
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4078
|
+
* @returns A map from wallet option key to its install URL bag.
|
|
4079
|
+
* @not-instrumented
|
|
4080
|
+
*/
|
|
4081
|
+
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
4082
|
+
const map = /* @__PURE__ */ new Map();
|
|
4083
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
4084
|
+
if (shouldFilterWallet({
|
|
4085
|
+
wallet,
|
|
4086
|
+
walletKey
|
|
4087
|
+
})) continue;
|
|
4088
|
+
const urls = buildInstallationUrls({ wallet });
|
|
4089
|
+
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
4090
|
+
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
4091
|
+
wallet,
|
|
4092
|
+
walletKey
|
|
4093
|
+
});
|
|
4094
|
+
if (!map.has(walletOptionKey)) map.set(walletOptionKey, urls);
|
|
4095
|
+
}
|
|
4096
|
+
return map;
|
|
4097
|
+
};
|
|
4098
|
+
|
|
4099
|
+
//#endregion
|
|
4100
|
+
//#region src/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/resolveUriConnectionType/resolveUriConnectionType.ts
|
|
4101
|
+
/**
|
|
4102
|
+
* Picks the connection-option `type` discriminator for a wallet-book-
|
|
4103
|
+
* derived URI deeplink option. MetaMask is steered toward its own
|
|
4104
|
+
* MetaMask SDK URI connection extension (`metamaskSdkUri`) so we route
|
|
4105
|
+
* customers off generic WalletConnect for that wallet; every other
|
|
4106
|
+
* wallet uses the standard `walletConnect` discriminator.
|
|
4107
|
+
*
|
|
4108
|
+
* @param params.walletOptionKey - The resolved wallet option key.
|
|
4109
|
+
* @returns The connection-option discriminator to emit.
|
|
4110
|
+
* @not-instrumented
|
|
4111
|
+
*/
|
|
4112
|
+
const resolveUriConnectionType = ({ walletOptionKey }) => walletOptionKey === "metamask" ? "metamaskSdkUri" : "walletConnect";
|
|
4113
|
+
|
|
4114
|
+
//#endregion
|
|
4115
|
+
//#region src/modules/walletOptionsCatalogue/buildUriDeeplinkOptions/buildUriDeeplinkOptions.ts
|
|
4116
|
+
/**
|
|
4117
|
+
* A wallet only deserves a URI-deeplink catalogue option if it has at
|
|
4118
|
+
* least one mobile deeplink — that's the value-add the option provides
|
|
4119
|
+
* over the bare pairing URI. Wallets that exist in the wallet book but
|
|
4120
|
+
* don't expose a deeplink (rare, but present) are silently skipped.
|
|
4121
|
+
*/
|
|
4122
|
+
const hasUsableDeeplink = ({ wallet }) => Boolean(wallet.mobile?.native || wallet.mobile?.universal);
|
|
4123
|
+
/**
|
|
4124
|
+
* Builds the URI-deeplink catalogue options from a fetched wallet book.
|
|
4125
|
+
* Applies the WalletConnect-specific eligibility filter
|
|
4126
|
+
* (`shouldFilterWalletForWalletConnect`) so embedded wallets and entries
|
|
4127
|
+
* without `sign_v2` support are excluded — same surface as
|
|
4128
|
+
* `getWalletConnectCatalog`.
|
|
4129
|
+
*
|
|
4130
|
+
* Each emitted option carries the wallet's mobile deeplinks. Customers
|
|
4131
|
+
* combine these with their chain's connection URI via
|
|
4132
|
+
* `appendConnectionUriToDeeplink` to open the wallet's app:
|
|
4133
|
+
*
|
|
4134
|
+
* - `'walletConnect'`: mint via `connectWithWalletConnect<Chain>`.
|
|
4135
|
+
* - `'metamaskSdkUri'`: mint via `connectWithMetaMaskUriEvm` or
|
|
4136
|
+
* `connectWithMetaMaskUriSolana`. Emitted only for the MetaMask
|
|
4137
|
+
* wallet entry — see `resolveUriConnectionType`.
|
|
4138
|
+
*
|
|
4139
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4140
|
+
* @returns Tagged options paired with their wallet option keys.
|
|
4141
|
+
* @not-instrumented
|
|
4142
|
+
*/
|
|
4143
|
+
const buildUriDeeplinkOptions = ({ walletBook }) => {
|
|
4144
|
+
const result = [];
|
|
4145
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
4146
|
+
if (shouldFilterWalletForWalletConnect({
|
|
4147
|
+
wallet,
|
|
4148
|
+
walletKey
|
|
4149
|
+
})) continue;
|
|
4150
|
+
if (!hasUsableDeeplink({ wallet })) continue;
|
|
4151
|
+
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
4152
|
+
wallet,
|
|
4153
|
+
walletKey
|
|
4154
|
+
});
|
|
4155
|
+
const chain = getChainFromWalletSchema({
|
|
4156
|
+
wallet,
|
|
4157
|
+
walletKey
|
|
4158
|
+
});
|
|
4159
|
+
result.push({
|
|
4160
|
+
option: {
|
|
4161
|
+
chain,
|
|
4162
|
+
deeplinks: {
|
|
4163
|
+
native: wallet.mobile?.native,
|
|
4164
|
+
universal: wallet.mobile?.universal
|
|
4165
|
+
},
|
|
4166
|
+
type: resolveUriConnectionType({ walletOptionKey })
|
|
4167
|
+
},
|
|
4168
|
+
walletOptionKey
|
|
4169
|
+
});
|
|
4170
|
+
}
|
|
4171
|
+
return result;
|
|
4172
|
+
};
|
|
4173
|
+
|
|
4174
|
+
//#endregion
|
|
4175
|
+
//#region src/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.ts
|
|
4176
|
+
/**
|
|
4177
|
+
* Assembles a `WalletOption` for a resolved wallet option key, populated
|
|
4178
|
+
* with the connection options the transformers produced for it plus an
|
|
4179
|
+
* optional install / download URL bag.
|
|
4180
|
+
*
|
|
4181
|
+
* Display merge rules (provider self-announced metadata wins where set):
|
|
4182
|
+
*
|
|
4183
|
+
* - `name`: `displayOverride.name` ?? wallet book group name ?? bare key.
|
|
4184
|
+
* - `iconUrl`: `displayOverride.iconUrl` ?? wallet book group sprite URL ?? `''`.
|
|
4185
|
+
* - `primaryColor`: wallet book group brand color only (providers do not
|
|
4186
|
+
* ship a primary color in their announcement metadata).
|
|
4187
|
+
* - `installationUrls`: copied through if present.
|
|
4188
|
+
*
|
|
4189
|
+
* Why provider precedence: a registered wallet provider knows its own
|
|
4190
|
+
* brand best (EIP-6963 / Wallet Standard / vendor SDK announcement is the
|
|
4191
|
+
* wallet authoring its own identity). The wallet book fills in fields the
|
|
4192
|
+
* announcement does not carry — currently only `primaryColor`.
|
|
4193
|
+
*
|
|
4194
|
+
* @param params.connectionOptions - The connections to attach to this wallet option.
|
|
4195
|
+
* @param [params.displayOverride] - Provider-announced display info that overrides the wallet book's name and iconUrl.
|
|
4196
|
+
* @param [params.installationUrls] - Install/download URL bag for this wallet.
|
|
4197
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4198
|
+
* @param params.walletOptionKey - The wallet option key.
|
|
4199
|
+
* @returns The constructed wallet option.
|
|
4200
|
+
* @not-instrumented
|
|
4201
|
+
*/
|
|
4202
|
+
const buildWalletOption = ({ connectionOptions, displayOverride, installationUrls, walletBook, walletOptionKey }) => {
|
|
4203
|
+
const group = walletBook.groups[walletOptionKey];
|
|
4204
|
+
const groupSpriteId = group?.brand?.spriteId;
|
|
4205
|
+
const groupIconUrl = groupSpriteId ? getSpriteUrl({ spriteId: groupSpriteId }) : void 0;
|
|
4206
|
+
return {
|
|
4207
|
+
connectionOptions,
|
|
4208
|
+
iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? "",
|
|
4209
|
+
installationUrls,
|
|
4210
|
+
key: walletOptionKey,
|
|
4211
|
+
name: displayOverride?.name ?? group?.name ?? walletOptionKey,
|
|
4212
|
+
primaryColor: group?.brand?.primaryColor
|
|
4213
|
+
};
|
|
4214
|
+
};
|
|
4215
|
+
|
|
4216
|
+
//#endregion
|
|
4217
|
+
//#region src/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.ts
|
|
4218
|
+
/**
|
|
4219
|
+
* Maps a registered wallet provider's registration priority to the
|
|
4220
|
+
* `WithWalletProviderSource` value that should appear on its catalogue option.
|
|
4221
|
+
*
|
|
4222
|
+
* Priority mapping (set by each chain extension when it calls
|
|
4223
|
+
* `registry.register`):
|
|
4224
|
+
*
|
|
4225
|
+
* - `WALLET_SDK` → `'sdk'` — branded SDKs wrapped by chain extensions
|
|
4226
|
+
* (Base Account via `@base-org/account`, MetaMask Connect, …).
|
|
4227
|
+
* - `WALLET_SELF_ANNOUNCEMENT_STANDARD` → `'selfAnnounced'` — in-page
|
|
4228
|
+
* self-announcement standards (EIP-6963 on EVM, Wallet Standard on
|
|
4229
|
+
* Solana / Sui / …).
|
|
4230
|
+
* - `WINDOW_INJECT` → `'windowInjected'` — legacy `window.*` injection.
|
|
4231
|
+
*
|
|
4232
|
+
* Returns `undefined` for providers whose registration priority does not
|
|
4233
|
+
* correspond to a connectable external-wallet source — callers filter these
|
|
4234
|
+
* out before emitting catalogue options.
|
|
4235
|
+
*
|
|
4236
|
+
* @param params.entry - The registry entry to classify.
|
|
4237
|
+
* @returns The matching source, or `undefined` if this entry should not
|
|
4238
|
+
* surface a `withWalletProvider` option.
|
|
4239
|
+
* @not-instrumented
|
|
4240
|
+
*/
|
|
4241
|
+
const classifyWithWalletProviderSource = ({ entry }) => {
|
|
4242
|
+
const { priority } = entry;
|
|
4243
|
+
if (priority === require_getVerifiedCredentialForWalletAccount.WalletProviderPriority.WALLET_SDK) return "sdk";
|
|
4244
|
+
if (priority === require_getVerifiedCredentialForWalletAccount.WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD) return "selfAnnounced";
|
|
4245
|
+
if (priority === require_getVerifiedCredentialForWalletAccount.WalletProviderPriority.WINDOW_INJECT) return "windowInjected";
|
|
4246
|
+
};
|
|
4247
|
+
|
|
4248
|
+
//#endregion
|
|
4249
|
+
//#region src/modules/wallets/utils/stripChainSuffix/stripChainSuffix.ts
|
|
4250
|
+
/**
|
|
4251
|
+
* Removes the lowercased chain suffix that `normalizeWalletNameWithChain`
|
|
4252
|
+
* appends. Used by `findWalletOptionKeyForProviderKey` to recover the wallet
|
|
4253
|
+
* book wallet key candidate from a `walletProviderKey`. If the suffix is
|
|
4254
|
+
* not present (some chain extensions already bake the chain into the
|
|
4255
|
+
* display name), the input is returned unchanged.
|
|
4256
|
+
*
|
|
4257
|
+
* @param params.chain - The chain whose suffix should be stripped.
|
|
4258
|
+
* @param params.normalizedName - The normalized wallet-name-with-chain string.
|
|
4259
|
+
* @returns The name with the chain suffix removed, or the input unchanged.
|
|
4260
|
+
* @not-instrumented
|
|
4261
|
+
*/
|
|
4262
|
+
const stripChainSuffix = ({ chain, normalizedName }) => {
|
|
4263
|
+
const suffix = chain.toLowerCase();
|
|
4264
|
+
if (normalizedName.endsWith(suffix)) return normalizedName.slice(0, -suffix.length);
|
|
4265
|
+
return normalizedName;
|
|
4266
|
+
};
|
|
4267
|
+
|
|
4268
|
+
//#endregion
|
|
4269
|
+
//#region src/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.ts
|
|
4270
|
+
/**
|
|
4271
|
+
* Normalizes a wallet's self-announced `displayName` into a stable wallet
|
|
4272
|
+
* option key. Used by `findWalletOptionKeyForProviderKey` as the off-book
|
|
4273
|
+
* fallback — registered providers whose `walletProviderKey` does not
|
|
4274
|
+
* resolve to any wallet book entry still surface in the catalogue under a
|
|
4275
|
+
* key derived from the name they ship in their metadata.
|
|
4276
|
+
*
|
|
4277
|
+
* The normalization (lowercase + whitespace-strip) intentionally matches
|
|
4278
|
+
* how the legacy wallet book composes its `wallets.<key>` keys, so a
|
|
4279
|
+
* self-described provider's option will merge cleanly with its book entry
|
|
4280
|
+
* if one ever lands later.
|
|
4281
|
+
*
|
|
4282
|
+
* Multi-chain registrations of the same wallet (e.g. Phantom announced via
|
|
4283
|
+
* EIP-6963 on EVM and via Wallet Standard on Solana) collapse onto the
|
|
4284
|
+
* same wallet option through this normalization, since each registration
|
|
4285
|
+
* announces the same `displayName`.
|
|
4286
|
+
*
|
|
4287
|
+
* @param displayName - The provider's `metadata.displayName`.
|
|
4288
|
+
* @returns The normalized wallet option key (lowercased, no whitespace).
|
|
4289
|
+
* @not-instrumented
|
|
4290
|
+
*/
|
|
4291
|
+
const normalizeWalletDisplayName = (displayName) => displayName.toLowerCase().replace(/\s+/g, "");
|
|
4292
|
+
|
|
4293
|
+
//#endregion
|
|
4294
|
+
//#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.ts
|
|
4295
|
+
const normalize = (value) => value.toLowerCase().replace(/\s+/g, "");
|
|
4296
|
+
/**
|
|
4297
|
+
* Looks for a wallet book entry whose `name` or `shortName` normalizes to
|
|
4298
|
+
* the same string as `candidate`. Used as a fallback by
|
|
4299
|
+
* `findWalletOptionKeyForProviderKey` for providers whose
|
|
4300
|
+
* `walletProviderKey` strips down to a value that does not match any
|
|
4301
|
+
* `walletBook.wallets` key directly (e.g. an extension whose display name
|
|
4302
|
+
* happens to match the wallet's `shortName` instead of its book key).
|
|
4303
|
+
*
|
|
4304
|
+
* @param params.candidate - The lowercased, chain-suffix-stripped candidate.
|
|
4305
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4306
|
+
* @returns The matching wallet book wallet key, or `undefined`.
|
|
4307
|
+
* @not-instrumented
|
|
4308
|
+
*/
|
|
4309
|
+
const findByNameMatch = ({ candidate, walletBook }) => {
|
|
4310
|
+
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) if (normalize(wallet.name) === candidate || normalize(wallet.shortName) === candidate) return walletKey;
|
|
4311
|
+
};
|
|
4312
|
+
|
|
4313
|
+
//#endregion
|
|
4314
|
+
//#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.ts
|
|
4315
|
+
/**
|
|
4316
|
+
* Picks the wallet option (group) key for a wallet book wallet. The wallet
|
|
4317
|
+
* book carries the group association under a few different field names
|
|
4318
|
+
* (`group`, `chainGroup`, `walletGroup`) depending on the wallet's
|
|
4319
|
+
* provenance — this helper centralises the lookup. When none of those
|
|
4320
|
+
* fields are set, the wallet key itself acts as its own wallet option key.
|
|
4321
|
+
*
|
|
4322
|
+
* @param params.fallback - Wallet key to return if no group field is set.
|
|
4323
|
+
* @param params.wallet - The wallet book wallet entry.
|
|
4324
|
+
* @returns The resolved wallet option key.
|
|
4325
|
+
* @not-instrumented
|
|
4326
|
+
*/
|
|
4327
|
+
const resolveWalletOptionKey = ({ fallback, wallet }) => wallet.group ?? wallet.chainGroup ?? wallet.walletGroup ?? fallback;
|
|
4328
|
+
|
|
4329
|
+
//#endregion
|
|
4330
|
+
//#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.ts
|
|
4331
|
+
/**
|
|
4332
|
+
* Resolves a registered wallet provider to the wallet option key it should
|
|
4333
|
+
* be bucketed under. Always returns a key — providers with no wallet book
|
|
4334
|
+
* match fall back to their self-announced `metadata.displayName`, so the
|
|
4335
|
+
* catalogue surfaces them as self-described tiles instead of silently
|
|
4336
|
+
* dropping them.
|
|
4337
|
+
*
|
|
4338
|
+
* Resolution order (each step short-circuits on first hit):
|
|
4339
|
+
*
|
|
4340
|
+
* 1. **Direct wallet book lookup with chain suffix** — try
|
|
4341
|
+
* `walletBook.wallets[normalizedWalletNameWithChain]` as-is. Wallet
|
|
4342
|
+
* book entries are inconsistent about whether they keep the chain
|
|
4343
|
+
* suffix (e.g. `metamaskevm`) or strip it (e.g. `metamask`), so try
|
|
4344
|
+
* the suffixed form first.
|
|
4345
|
+
* 2. **Direct wallet book lookup without chain suffix** — strip the
|
|
4346
|
+
* suffix and retry.
|
|
4347
|
+
* 3. **Name match heuristic with chain suffix** — scan
|
|
4348
|
+
* `walletBook.wallets` for an entry whose normalized `name` or
|
|
4349
|
+
* `shortName` equals the suffixed candidate.
|
|
4350
|
+
* 4. **Name match heuristic without chain suffix** — same scan on the
|
|
4351
|
+
* stripped candidate.
|
|
4352
|
+
* 5. **Display-name fallback** — derive a stable key from
|
|
4353
|
+
* `walletProvider.metadata.displayName` via
|
|
4354
|
+
* {@link normalizeWalletDisplayName}. Multi-chain registrations of the
|
|
4355
|
+
* same self-described wallet (e.g. Phantom on EVM and Solana) collapse
|
|
4356
|
+
* onto the same tile because each announces the same display name.
|
|
4357
|
+
*
|
|
4358
|
+
* @param params.chain - The provider's chain (used to strip the suffix).
|
|
4359
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4360
|
+
* @param params.walletProvider - The registered wallet provider.
|
|
4361
|
+
* @returns The wallet option key for this provider.
|
|
4362
|
+
* @not-instrumented
|
|
4363
|
+
*/
|
|
4364
|
+
const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }) => {
|
|
4365
|
+
const { normalizedWalletNameWithChain } = require_getVerifiedCredentialForWalletAccount.splitWalletProviderKey(walletProvider.key);
|
|
4366
|
+
const candidates = [normalizedWalletNameWithChain, stripChainSuffix({
|
|
4367
|
+
chain,
|
|
4368
|
+
normalizedName: normalizedWalletNameWithChain
|
|
4369
|
+
})];
|
|
4370
|
+
for (const candidate of candidates) {
|
|
4371
|
+
const directHit = walletBook.wallets[candidate];
|
|
4372
|
+
if (directHit) return resolveWalletOptionKey({
|
|
4373
|
+
fallback: candidate,
|
|
4374
|
+
wallet: directHit
|
|
4375
|
+
});
|
|
4376
|
+
}
|
|
4377
|
+
for (const candidate of candidates) {
|
|
4378
|
+
const nameMatchKey = findByNameMatch({
|
|
4379
|
+
candidate,
|
|
4380
|
+
walletBook
|
|
4381
|
+
});
|
|
4382
|
+
if (nameMatchKey) return resolveWalletOptionKey({
|
|
4383
|
+
fallback: nameMatchKey,
|
|
4384
|
+
wallet: walletBook.wallets[nameMatchKey]
|
|
4385
|
+
});
|
|
4386
|
+
}
|
|
4387
|
+
return normalizeWalletDisplayName(walletProvider.metadata.displayName);
|
|
4388
|
+
};
|
|
4389
|
+
|
|
4390
|
+
//#endregion
|
|
4391
|
+
//#region src/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.ts
|
|
4392
|
+
/**
|
|
4393
|
+
* Converts each registered wallet provider entry into a
|
|
4394
|
+
* `WithWalletProviderConnectionOption` paired with its target wallet
|
|
4395
|
+
* option key and the provider's display override. Every classifiable
|
|
4396
|
+
* entry surfaces in the catalogue; the outer transformer uses the
|
|
4397
|
+
* carried `displayOverride` to override any wallet book branding for
|
|
4398
|
+
* that key (provider self-announcement wins over book).
|
|
4399
|
+
*
|
|
4400
|
+
* Entries whose registration priority is not recognised by
|
|
4401
|
+
* `classifyWithWalletProviderSource` are dropped from the catalogue and
|
|
4402
|
+
* an error is logged so Datadog surfaces the unknown registration path —
|
|
4403
|
+
* in production this should never happen, every chain extension is
|
|
4404
|
+
* expected to register with one of the documented priorities.
|
|
4405
|
+
*
|
|
4406
|
+
* @param params.entries - Snapshot of the registry's entries.
|
|
4407
|
+
* @param params.walletBook - The fetched wallet book.
|
|
4408
|
+
* @param client - The Dynamic client (used for logging unclassifiable entries).
|
|
4409
|
+
* @returns An array of tagged options, in input order.
|
|
4410
|
+
* @not-instrumented
|
|
4411
|
+
*/
|
|
4412
|
+
const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
4413
|
+
const result = [];
|
|
4414
|
+
for (const entry of entries) {
|
|
4415
|
+
const source = classifyWithWalletProviderSource({ entry });
|
|
4416
|
+
if (!source) {
|
|
4417
|
+
require_InvalidParamError.getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
|
|
4418
|
+
chain: entry.walletProvider.chain,
|
|
4419
|
+
displayName: entry.walletProvider.metadata.displayName,
|
|
4420
|
+
priority: entry.priority,
|
|
4421
|
+
walletProviderKey: entry.walletProvider.key,
|
|
4422
|
+
walletProviderType: entry.walletProvider.walletProviderType
|
|
4423
|
+
});
|
|
4424
|
+
continue;
|
|
4425
|
+
}
|
|
4426
|
+
const walletOptionKey = findWalletOptionKeyForProviderKey({
|
|
4427
|
+
chain: entry.walletProvider.chain,
|
|
4428
|
+
walletBook,
|
|
4429
|
+
walletProvider: entry.walletProvider
|
|
4430
|
+
});
|
|
4431
|
+
result.push({
|
|
4432
|
+
displayOverride: {
|
|
4433
|
+
iconUrl: entry.walletProvider.metadata.icon,
|
|
4434
|
+
name: entry.walletProvider.metadata.displayName
|
|
4435
|
+
},
|
|
4436
|
+
option: {
|
|
4437
|
+
chain: entry.walletProvider.chain,
|
|
4438
|
+
source,
|
|
4439
|
+
type: "withWalletProvider",
|
|
4440
|
+
walletProviderKey: entry.walletProvider.key
|
|
4441
|
+
},
|
|
4442
|
+
walletOptionKey
|
|
4443
|
+
});
|
|
4444
|
+
}
|
|
4445
|
+
return result;
|
|
4446
|
+
};
|
|
4447
|
+
|
|
4448
|
+
//#endregion
|
|
4449
|
+
//#region src/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.ts
|
|
4450
|
+
/**
|
|
4451
|
+
* Wallet option keys `getWalletOptionsCatalogue` drops before returning.
|
|
4452
|
+
* Curated, product-level suppression.
|
|
4453
|
+
*
|
|
4454
|
+
* Example: Base Account SDK is the recommended entry point for
|
|
4455
|
+
* Coinbase-managed users, so the legacy Coinbase Wallet entries are
|
|
4456
|
+
* suppressed in favor of the SDK-backed `baseaccount` tile. Both the
|
|
4457
|
+
* wallet book group key (`coinbase`) and the normalized display-name
|
|
4458
|
+
* key (`coinbasewallet`) are listed so suppression holds regardless of
|
|
4459
|
+
* how the resolver lands on a key.
|
|
4460
|
+
*
|
|
4461
|
+
* Used in: `getWalletOptionsCatalogue`.
|
|
4462
|
+
*/
|
|
4463
|
+
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
4464
|
+
|
|
4465
|
+
//#endregion
|
|
4466
|
+
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
4467
|
+
/**
|
|
4468
|
+
* Buckets tagged connection options by their wallet option key. Preserves
|
|
4469
|
+
* first-seen order so that the caller's choice of
|
|
4470
|
+
* `walletOptionOrdering: 'relevance'` naturally inherits the upstream input
|
|
4471
|
+
* order (wallet book order for walletConnect/inAppBrowser/installation,
|
|
4472
|
+
* registry order for withWalletProvider).
|
|
4473
|
+
*
|
|
4474
|
+
* Carries through the first-seen `displayOverride` per wallet option
|
|
4475
|
+
* key, so the shell builder can apply provider-announced metadata on
|
|
4476
|
+
* top of any wallet book entry.
|
|
4477
|
+
*
|
|
4478
|
+
* @param params.options - The tagged options to group.
|
|
4479
|
+
* @returns A map from wallet option key to its grouped option bucket,
|
|
4480
|
+
* iterable in first-seen order.
|
|
4481
|
+
* @not-instrumented
|
|
4482
|
+
*/
|
|
4483
|
+
const groupOptionsByWalletOption = ({ options }) => {
|
|
4484
|
+
const map = /* @__PURE__ */ new Map();
|
|
4485
|
+
for (const { displayOverride, option, walletOptionKey } of options) {
|
|
4486
|
+
const existing = map.get(walletOptionKey);
|
|
4487
|
+
if (existing) {
|
|
4488
|
+
existing.connectionOptions.push(option);
|
|
4489
|
+
if (!existing.displayOverride && displayOverride) existing.displayOverride = displayOverride;
|
|
4490
|
+
} else map.set(walletOptionKey, {
|
|
4491
|
+
connectionOptions: [option],
|
|
4492
|
+
displayOverride
|
|
4493
|
+
});
|
|
4494
|
+
}
|
|
4495
|
+
return map;
|
|
4496
|
+
};
|
|
4497
|
+
|
|
4498
|
+
//#endregion
|
|
4499
|
+
//#region src/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.ts
|
|
4500
|
+
/**
|
|
4501
|
+
* Numeric priority for each `WalletConnectionOption` type. Lower values rank
|
|
4502
|
+
* first. Used to sort each wallet option's `connectionOptions` array so the
|
|
4503
|
+
* best connection path lands at index 0. Has no bearing on how the outer
|
|
4504
|
+
* wallet-option list is ordered — that's controlled by
|
|
4505
|
+
* `WalletOptionOrdering`.
|
|
4506
|
+
*
|
|
4507
|
+
* `withWalletProvider > walletConnect / metamaskSdkUri > inAppBrowser`
|
|
4508
|
+
*/
|
|
4509
|
+
const CONNECTION_OPTION_PRIORITY = {
|
|
4510
|
+
inAppBrowser: 2,
|
|
4511
|
+
metamaskSdkUri: 1,
|
|
4512
|
+
walletConnect: 1,
|
|
4513
|
+
withWalletProvider: 0
|
|
4514
|
+
};
|
|
4515
|
+
/**
|
|
4516
|
+
* Returns the numeric priority of a `WalletConnectionOption` for sorting.
|
|
4517
|
+
* Lower numbers rank first.
|
|
4518
|
+
*
|
|
4519
|
+
* @param params.option - The connection option to inspect.
|
|
4520
|
+
* @returns The numeric priority — lower is better.
|
|
4521
|
+
* @not-instrumented
|
|
4522
|
+
*/
|
|
4523
|
+
const getConnectionOptionPriority = ({ option }) => CONNECTION_OPTION_PRIORITY[option.type];
|
|
4524
|
+
|
|
4525
|
+
//#endregion
|
|
4526
|
+
//#region src/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.ts
|
|
4527
|
+
/**
|
|
4528
|
+
* Sorts a wallet option's `connectionOptions` so the most preferred option lands at
|
|
4529
|
+
* index 0. Primary sort is by option-type priority
|
|
4530
|
+
* (`withWalletProvider` > URI deeplink > `inAppBrowser`);
|
|
4531
|
+
* within a type, ties break alphabetically by `chain` for deterministic
|
|
4532
|
+
* output across calls.
|
|
4533
|
+
*
|
|
4534
|
+
* Returns a new array — the input is not mutated.
|
|
4535
|
+
*
|
|
4536
|
+
* @param params.options - The options to sort.
|
|
4537
|
+
* @returns A new array in priority order.
|
|
4538
|
+
* @not-instrumented
|
|
4539
|
+
*/
|
|
4540
|
+
const sortConnectionOptions = ({ options }) => [...options].sort((a, b) => {
|
|
4541
|
+
const priorityDelta = getConnectionOptionPriority({ option: a }) - getConnectionOptionPriority({ option: b });
|
|
4542
|
+
if (priorityDelta !== 0) return priorityDelta;
|
|
4543
|
+
return a.chain.localeCompare(b.chain);
|
|
4544
|
+
});
|
|
4545
|
+
|
|
4546
|
+
//#endregion
|
|
4547
|
+
//#region src/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.ts
|
|
4548
|
+
/**
|
|
4549
|
+
* Hand-curated list of wallet book group keys that should surface at the top
|
|
4550
|
+
* of catalogue listings. Lower index = higher priority. Anything not in this
|
|
4551
|
+
* list falls through to the secondary sort (alphabetical by name).
|
|
4552
|
+
*
|
|
4553
|
+
* Used by `sortWalletOptions` (relevance mode) and by the react-demo's
|
|
4554
|
+
* WalletConnect picker. Keep both in sync when adding entries.
|
|
4555
|
+
*/
|
|
4556
|
+
const PRIORITY_WALLET_KEYS = [
|
|
4557
|
+
"metamask",
|
|
4558
|
+
"coinbase",
|
|
4559
|
+
"baseaccount",
|
|
4560
|
+
"phantom",
|
|
4561
|
+
"magiceden",
|
|
4562
|
+
"trust",
|
|
4563
|
+
"okxwallet",
|
|
4564
|
+
"rainbow",
|
|
4565
|
+
"argentx",
|
|
4566
|
+
"backpack",
|
|
4567
|
+
"xverse",
|
|
4568
|
+
"onekey",
|
|
4569
|
+
"solflare",
|
|
4570
|
+
"braavos",
|
|
4571
|
+
"brave",
|
|
4572
|
+
"unisat",
|
|
4573
|
+
"bitgetwallet",
|
|
4574
|
+
"coin98"
|
|
4575
|
+
];
|
|
4576
|
+
|
|
4577
|
+
//#endregion
|
|
4578
|
+
//#region src/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.ts
|
|
4579
|
+
/**
|
|
4580
|
+
* Returns the index of a wallet option in `PRIORITY_WALLET_KEYS`, or
|
|
4581
|
+
* `Number.POSITIVE_INFINITY` when the wallet is not in the hand-curated
|
|
4582
|
+
* priority list. Lower index = higher priority.
|
|
4583
|
+
*
|
|
4584
|
+
* @param params.walletOption - The wallet option to inspect.
|
|
4585
|
+
* @returns Numeric priority index — lower is better.
|
|
4586
|
+
* @not-instrumented
|
|
4587
|
+
*/
|
|
4588
|
+
const getPriorityIndex = ({ walletOption }) => {
|
|
4589
|
+
const index = PRIORITY_WALLET_KEYS.indexOf(walletOption.key);
|
|
4590
|
+
return index === -1 ? Number.POSITIVE_INFINITY : index;
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4593
|
+
//#endregion
|
|
4594
|
+
//#region src/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.ts
|
|
4595
|
+
/**
|
|
4596
|
+
* Compares two wallet options for relevance ordering: priority-list index
|
|
4597
|
+
* first, then alphabetical-by-name as the tie-break. Suitable for passing
|
|
4598
|
+
* straight to `Array.prototype.sort`.
|
|
4599
|
+
*
|
|
4600
|
+
* @param params.a - First wallet option.
|
|
4601
|
+
* @param params.b - Second wallet option.
|
|
4602
|
+
* @returns Negative when `a` ranks first, positive when `b` ranks first.
|
|
4603
|
+
* @not-instrumented
|
|
4604
|
+
*/
|
|
4605
|
+
const compareByRelevance = ({ a, b }) => {
|
|
4606
|
+
const aIndex = getPriorityIndex({ walletOption: a });
|
|
4607
|
+
const bIndex = getPriorityIndex({ walletOption: b });
|
|
4608
|
+
if (aIndex !== bIndex) return aIndex - bIndex;
|
|
4609
|
+
return a.name.localeCompare(b.name, void 0, { sensitivity: "base" });
|
|
4610
|
+
};
|
|
4611
|
+
|
|
4612
|
+
//#endregion
|
|
4613
|
+
//#region src/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.ts
|
|
4614
|
+
/**
|
|
4615
|
+
* True when the wallet option has at least one connection — i.e. the user
|
|
4616
|
+
* can sign in right now. Install-only wallet options surface in the
|
|
4617
|
+
* catalogue too (they carry `installationUrls`) but have an empty
|
|
4618
|
+
* `connectionOptions` array; this predicate distinguishes them from
|
|
4619
|
+
* actually connectable wallets in the relevance sort.
|
|
4620
|
+
*
|
|
4621
|
+
* @param params.walletOption - The wallet option to inspect.
|
|
4622
|
+
* @returns True when `connectionOptions` is non-empty.
|
|
4623
|
+
* @not-instrumented
|
|
4624
|
+
*/
|
|
4625
|
+
const hasAnyConnectionOption = ({ walletOption }) => walletOption.connectionOptions.length > 0;
|
|
4626
|
+
|
|
4627
|
+
//#endregion
|
|
4628
|
+
//#region src/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.ts
|
|
4629
|
+
/**
|
|
4630
|
+
* True when the wallet option has a `withWalletProvider` connection — i.e.
|
|
4631
|
+
* the user already has the wallet available in the page (browser extension,
|
|
4632
|
+
* Wallet Standard announcement, window injection, or an SDK-backed provider
|
|
4633
|
+
* one of our chain extensions registered). `connectionOptions` is
|
|
4634
|
+
* pre-sorted, so a registered provider always sits at index 0 when present.
|
|
4635
|
+
*
|
|
4636
|
+
* @param params.walletOption - The wallet option to inspect.
|
|
4637
|
+
* @returns True when an installed provider is available.
|
|
4638
|
+
* @not-instrumented
|
|
4639
|
+
*/
|
|
4640
|
+
const hasInstalledProvider = ({ walletOption }) => walletOption.connectionOptions[0]?.type === "withWalletProvider";
|
|
4641
|
+
|
|
4642
|
+
//#endregion
|
|
4643
|
+
//#region src/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.ts
|
|
4644
|
+
/**
|
|
4645
|
+
* Sorts the outer wallet-option list. This is the only ordering controlled
|
|
4646
|
+
* by the customer; the inner `connectionOptions` array of each wallet
|
|
4647
|
+
* option is ordered separately by `sortConnectionOptions` using a fixed
|
|
4648
|
+
* option-type priority.
|
|
4649
|
+
*
|
|
4650
|
+
* - `'relevance'` (default): bucket wallet options into three tiers, in
|
|
4651
|
+
* this order:
|
|
4652
|
+
* 1. **Installed provider** — user already has the wallet available
|
|
4653
|
+
* (`withWalletProvider` at index 0).
|
|
4654
|
+
* 2. **Connectable** — has at least one connection (URI deeplink
|
|
4655
|
+
* or `inAppBrowser`) but no installed provider.
|
|
4656
|
+
* 3. **Install-only** — no connection at all; only `installationUrls`.
|
|
4657
|
+
* Within each tier, rank by the hand-curated {@link PRIORITY_WALLET_KEYS}
|
|
4658
|
+
* list (MetaMask, Coinbase, Phantom, …); unknown wallets fall through to
|
|
4659
|
+
* alphabetical-by-name order at the tail of their tier.
|
|
4660
|
+
* - `'alphabetical'`: case-insensitive sort by wallet option `name`,
|
|
4661
|
+
* without bucketing.
|
|
4662
|
+
*
|
|
4663
|
+
* Returns a new array — the input is not mutated.
|
|
4664
|
+
*
|
|
4665
|
+
* @param params.walletOptions - The wallet options to sort.
|
|
4666
|
+
* @param params.ordering - The requested ordering.
|
|
4667
|
+
* @returns A new array in the requested order.
|
|
4668
|
+
* @not-instrumented
|
|
4669
|
+
*/
|
|
4670
|
+
const sortWalletOptions = ({ walletOptions, ordering }) => {
|
|
4671
|
+
if (ordering === "alphabetical") return [...walletOptions].sort((a, b) => a.name.localeCompare(b.name, void 0, { sensitivity: "base" }));
|
|
4672
|
+
const installed = [];
|
|
4673
|
+
const connectable = [];
|
|
4674
|
+
const installOnly = [];
|
|
4675
|
+
for (const walletOption of walletOptions) if (hasInstalledProvider({ walletOption })) installed.push(walletOption);
|
|
4676
|
+
else if (hasAnyConnectionOption({ walletOption })) connectable.push(walletOption);
|
|
4677
|
+
else installOnly.push(walletOption);
|
|
4678
|
+
installed.sort((a, b) => compareByRelevance({
|
|
4679
|
+
a,
|
|
4680
|
+
b
|
|
4681
|
+
}));
|
|
4682
|
+
connectable.sort((a, b) => compareByRelevance({
|
|
4683
|
+
a,
|
|
4684
|
+
b
|
|
4685
|
+
}));
|
|
4686
|
+
installOnly.sort((a, b) => compareByRelevance({
|
|
4687
|
+
a,
|
|
4688
|
+
b
|
|
4689
|
+
}));
|
|
4690
|
+
return [
|
|
4691
|
+
...installed,
|
|
4692
|
+
...connectable,
|
|
4693
|
+
...installOnly
|
|
4694
|
+
];
|
|
4695
|
+
};
|
|
4696
|
+
|
|
4697
|
+
//#endregion
|
|
4698
|
+
//#region src/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.ts
|
|
4699
|
+
const EMPTY_WALLET_BOOK = {
|
|
4700
|
+
groups: {},
|
|
4701
|
+
wallets: {}
|
|
4702
|
+
};
|
|
4703
|
+
/**
|
|
4704
|
+
* Returns the catalogue of external wallet options a user can sign in
|
|
4705
|
+
* with through this client. Always includes installed wallet providers;
|
|
4706
|
+
* pass `includeMobileOptions: true` to additionally surface
|
|
4707
|
+
* WalletConnect, in-app-browser, and install links.
|
|
4708
|
+
*
|
|
4709
|
+
* @param [params] - Inclusion flag + ordering preference.
|
|
4710
|
+
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4711
|
+
* @returns A promise that resolves to the wallet options catalogue.
|
|
4712
|
+
* @not-instrumented
|
|
4713
|
+
*/
|
|
4714
|
+
const getWalletOptionsCatalogue = async (params = {}, client = require_InvalidParamError.getDefaultClient()) => {
|
|
4715
|
+
const includeMobileOptions = params.includeMobileOptions ?? false;
|
|
4716
|
+
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
4717
|
+
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
4718
|
+
const allConnectionOptions = [];
|
|
4719
|
+
const entries = require_getVerifiedCredentialForWalletAccount.getWalletProviderRegistry(client).listProviderEntries();
|
|
4720
|
+
allConnectionOptions.push(...buildWithWalletProviderOptions({
|
|
4721
|
+
entries,
|
|
4722
|
+
walletBook
|
|
4723
|
+
}, client));
|
|
4724
|
+
if (includeMobileOptions) allConnectionOptions.push(...buildUriDeeplinkOptions({ walletBook }), ...buildInAppBrowserOptions({ walletBook }));
|
|
4725
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({ walletBook }) : /* @__PURE__ */ new Map();
|
|
4726
|
+
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
4727
|
+
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
4728
|
+
const walletOptions = [];
|
|
4729
|
+
for (const walletOptionKey of allWalletOptionKeys) {
|
|
4730
|
+
if (EXCLUDED_WALLET_OPTION_KEYS.has(walletOptionKey)) continue;
|
|
4731
|
+
const groupedEntry = grouped.get(walletOptionKey);
|
|
4732
|
+
const connectionOptions = groupedEntry ? sortConnectionOptions({ options: groupedEntry.connectionOptions }) : [];
|
|
4733
|
+
walletOptions.push(buildWalletOption({
|
|
4734
|
+
connectionOptions,
|
|
4735
|
+
displayOverride: groupedEntry?.displayOverride,
|
|
4736
|
+
installationUrls: installationUrlsByKey.get(walletOptionKey),
|
|
4737
|
+
walletBook,
|
|
4738
|
+
walletOptionKey
|
|
4739
|
+
}));
|
|
4740
|
+
}
|
|
4741
|
+
return sortWalletOptions({
|
|
4742
|
+
ordering: walletOptionOrdering,
|
|
4743
|
+
walletOptions
|
|
4744
|
+
});
|
|
4745
|
+
};
|
|
4746
|
+
|
|
3807
4747
|
//#endregion
|
|
3808
4748
|
//#region src/modules/user/updateUser/updateUser.ts
|
|
3809
4749
|
/**
|
|
@@ -4062,6 +5002,7 @@ const authenticateTotpMfaDevice = async ({ deviceId, code, createMfaTokenOptions
|
|
|
4062
5002
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
4063
5003
|
* @returns A promise that resolves to the newly generated recovery codes.
|
|
4064
5004
|
* @instrumented
|
|
5005
|
+
* @redact-params
|
|
4065
5006
|
*/
|
|
4066
5007
|
const createNewMfaRecoveryCodes = async (client = require_InvalidParamError.getDefaultClient()) => {
|
|
4067
5008
|
const core = require_InvalidParamError.getCore(client);
|
|
@@ -4077,7 +5018,8 @@ const __createNewMfaRecoveryCodes_wrapped = require_InvalidParamError.instrument
|
|
|
4077
5018
|
} catch {
|
|
4078
5019
|
return;
|
|
4079
5020
|
}
|
|
4080
|
-
}
|
|
5021
|
+
},
|
|
5022
|
+
redactAll: true
|
|
4081
5023
|
});
|
|
4082
5024
|
|
|
4083
5025
|
//#endregion
|
|
@@ -5304,6 +6246,7 @@ const verifyOTPForUserUpdate = async ({ otpVerification, verificationToken, requ
|
|
|
5304
6246
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
5305
6247
|
* @returns A promise that resolves to the verify response object upon successful verification.
|
|
5306
6248
|
* @instrumented
|
|
6249
|
+
* @redact-params
|
|
5307
6250
|
*/
|
|
5308
6251
|
const verifyOTP = async ({ otpVerification, verificationToken, requestedScopes }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
5309
6252
|
let response;
|
|
@@ -5329,7 +6272,8 @@ const __verifyOTP_wrapped = require_InvalidParamError.instrumentFunction({
|
|
|
5329
6272
|
} catch {
|
|
5330
6273
|
return;
|
|
5331
6274
|
}
|
|
5332
|
-
}
|
|
6275
|
+
},
|
|
6276
|
+
redactAll: true
|
|
5333
6277
|
});
|
|
5334
6278
|
|
|
5335
6279
|
//#endregion
|
|
@@ -5753,13 +6697,12 @@ const getAddressesWithTypesFromConnectionResult = (connectionResult) => {
|
|
|
5753
6697
|
* @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
|
|
5754
6698
|
* @returns A promise that resolves to the connected wallet account.
|
|
5755
6699
|
* @throws NoAddressFoundError If the request to connect was successful but no address is connected to your app.
|
|
5756
|
-
*
|
|
6700
|
+
* @instrumented
|
|
5757
6701
|
*/
|
|
5758
6702
|
const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWalletAccounts = true, hardwareWalletVendor }, client = require_InvalidParamError.getDefaultClient()) => {
|
|
5759
6703
|
const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderByKey({ walletProviderKey }, client);
|
|
5760
6704
|
assertWalletProviderMethodDefined(walletProvider, "connect");
|
|
5761
6705
|
const { addresses } = await walletProvider.connect();
|
|
5762
|
-
const currentAddresses = require_getVerifiedCredentialForWalletAccount.getWalletAccounts(client).map(({ address }) => address);
|
|
5763
6706
|
const mainAddress = addresses?.length ? addresses[0].address : null;
|
|
5764
6707
|
/**
|
|
5765
6708
|
* This error is thrown in case the wallet has no addresses connected
|
|
@@ -5767,27 +6710,25 @@ const connectWithWalletProvider = async ({ walletProviderKey, addToDynamicWallet
|
|
|
5767
6710
|
* user on the next steps.
|
|
5768
6711
|
*/
|
|
5769
6712
|
if (!mainAddress) throw new NoAddressFoundError();
|
|
5770
|
-
const
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
chain: walletProvider.chain,
|
|
5774
|
-
hardwareWalletVendor,
|
|
5775
|
-
id: require_getVerifiedCredentialForWalletAccount.formatWalletAccountId({
|
|
6713
|
+
const [reconciledWalletAccount] = require_getNetworkProviderFromNetworkId.reconcileWalletAccountsAgainstClient({
|
|
6714
|
+
addToDynamicWalletAccounts,
|
|
6715
|
+
walletAccounts: [{
|
|
5776
6716
|
address: mainAddress,
|
|
6717
|
+
addressesWithTypes: getAddressesWithTypesFromConnectionResult({ addresses }),
|
|
5777
6718
|
chain: walletProvider.chain,
|
|
6719
|
+
hardwareWalletVendor,
|
|
6720
|
+
id: require_getVerifiedCredentialForWalletAccount.formatWalletAccountId({
|
|
6721
|
+
address: mainAddress,
|
|
6722
|
+
chain: walletProvider.chain,
|
|
6723
|
+
walletProviderKey
|
|
6724
|
+
}),
|
|
6725
|
+
lastSelectedAt: null,
|
|
6726
|
+
verifiedCredentialId: null,
|
|
5778
6727
|
walletProviderKey
|
|
5779
|
-
}
|
|
5780
|
-
lastSelectedAt: null,
|
|
5781
|
-
verifiedCredentialId: null,
|
|
6728
|
+
}],
|
|
5782
6729
|
walletProviderKey
|
|
5783
|
-
};
|
|
5784
|
-
|
|
5785
|
-
if (addToDynamicWalletAccounts) {
|
|
5786
|
-
require_getNetworkProviderFromNetworkId.setUnverifiedWalletAccounts({ unverifiedWalletAccountsToUpdate: [walletAccount] }, client);
|
|
5787
|
-
require_getVerifiedCredentialForWalletAccount.emitWalletAccountsChangedEvent(client);
|
|
5788
|
-
require_getNetworkProviderFromNetworkId.createVisit({ walletAccount }, client);
|
|
5789
|
-
}
|
|
5790
|
-
return walletAccount;
|
|
6730
|
+
}, client);
|
|
6731
|
+
return reconciledWalletAccount;
|
|
5791
6732
|
};
|
|
5792
6733
|
const __connectWithWalletProvider_impl = connectWithWalletProvider;
|
|
5793
6734
|
const __connectWithWalletProvider_wrapped = require_InvalidParamError.instrumentFunction({
|
|
@@ -6766,6 +7707,7 @@ exports.WalletProviderMethodUnavailableError = WalletProviderMethodUnavailableEr
|
|
|
6766
7707
|
exports.acknowledgeRecoveryCodes = __acknowledgeRecoveryCodes_wrapped;
|
|
6767
7708
|
exports.addCoinbaseOnrampOrderEventListener = addCoinbaseOnrampOrderEventListener;
|
|
6768
7709
|
exports.addNetwork = __addNetwork_wrapped;
|
|
7710
|
+
exports.appendConnectionUriToDeeplink = appendConnectionUriToDeeplink;
|
|
6769
7711
|
exports.assertWalletAccountSigningAvailability = assertWalletAccountSigningAvailability;
|
|
6770
7712
|
exports.assertWalletProviderMethodDefined = assertWalletProviderMethodDefined;
|
|
6771
7713
|
exports.attachCheckoutTransactionSource = __attachCheckoutTransactionSource_wrapped;
|
|
@@ -6835,6 +7777,7 @@ exports.getWalletAccountFromAddress = getWalletAccountFromAddress;
|
|
|
6835
7777
|
exports.getWalletAccounts = require_getVerifiedCredentialForWalletAccount.getWalletAccounts;
|
|
6836
7778
|
exports.getWalletConnectCatalog = getWalletConnectCatalog;
|
|
6837
7779
|
exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
|
|
7780
|
+
exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
|
|
6838
7781
|
exports.getWalletProviderDataByKey = getWalletProviderDataByKey;
|
|
6839
7782
|
exports.hasAllGoogleDriveBackupScopes = hasAllGoogleDriveBackupScopes;
|
|
6840
7783
|
exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
|