@dynamic-labs-sdk/client 1.2.0 → 1.3.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.
Files changed (171) hide show
  1. package/dist/{InvalidParamError-Dhv4EhOy.native.esm.js → InvalidParamError-9kQBK3sP.native.esm.js} +2 -2
  2. package/dist/{InvalidParamError-Dhv4EhOy.native.esm.js.map → InvalidParamError-9kQBK3sP.native.esm.js.map} +1 -1
  3. package/dist/{InvalidParamError-CPzPxL0l.cjs → InvalidParamError-DQvZQdQ9.cjs} +3 -3
  4. package/dist/{InvalidParamError-CPzPxL0l.cjs.map → InvalidParamError-DQvZQdQ9.cjs.map} +1 -1
  5. package/dist/{InvalidParamError-BWWTxQ9d.esm.js → InvalidParamError-Za4cvW7K.esm.js} +2 -2
  6. package/dist/{InvalidParamError-BWWTxQ9d.esm.js.map → InvalidParamError-Za4cvW7K.esm.js.map} +1 -1
  7. package/dist/{NotWaasWalletAccountError-D_mLDrYD.native.esm.js → NotWaasWalletAccountError-BTMvHTA8.native.esm.js} +3 -3
  8. package/dist/{NotWaasWalletAccountError-D_mLDrYD.native.esm.js.map → NotWaasWalletAccountError-BTMvHTA8.native.esm.js.map} +1 -1
  9. package/dist/{NotWaasWalletAccountError-D1EuiYyR.esm.js → NotWaasWalletAccountError-By3Y4taq.esm.js} +3 -3
  10. package/dist/{NotWaasWalletAccountError-D1EuiYyR.esm.js.map → NotWaasWalletAccountError-By3Y4taq.esm.js.map} +1 -1
  11. package/dist/{NotWaasWalletAccountError-BcIbGm0s.cjs → NotWaasWalletAccountError-Ciq7b-Y6.cjs} +3 -3
  12. package/dist/{NotWaasWalletAccountError-BcIbGm0s.cjs.map → NotWaasWalletAccountError-Ciq7b-Y6.cjs.map} +1 -1
  13. package/dist/core.cjs +45 -5
  14. package/dist/core.cjs.map +1 -1
  15. package/dist/core.esm.js +45 -8
  16. package/dist/core.esm.js.map +1 -1
  17. package/dist/core.native.esm.js +43 -6
  18. package/dist/core.native.esm.js.map +1 -1
  19. package/dist/errors/ArrayMustNotBeEmptyError.d.ts +5 -0
  20. package/dist/errors/ArrayMustNotBeEmptyError.d.ts.map +1 -0
  21. package/dist/exports/core.d.ts +8 -0
  22. package/dist/exports/core.d.ts.map +1 -1
  23. package/dist/exports/index.d.ts +5 -0
  24. package/dist/exports/index.d.ts.map +1 -1
  25. package/dist/{getNetworkProviderFromNetworkId-D26TNjm4.cjs → getNetworkProviderFromNetworkId-BA0CHZzu.cjs} +30 -4
  26. package/dist/getNetworkProviderFromNetworkId-BA0CHZzu.cjs.map +1 -0
  27. package/dist/{getNetworkProviderFromNetworkId-VkHaRqMa.native.esm.js → getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js} +25 -5
  28. package/dist/getNetworkProviderFromNetworkId-COptFPwJ.native.esm.js.map +1 -0
  29. package/dist/{getNetworkProviderFromNetworkId-C9QzgcLs.esm.js → getNetworkProviderFromNetworkId-RWcIZDgC.esm.js} +29 -9
  30. package/dist/getNetworkProviderFromNetworkId-RWcIZDgC.esm.js.map +1 -0
  31. package/dist/{getSignedSessionId-D52QC0hh.cjs → getSignedSessionId-BCU987hO.cjs} +3 -3
  32. package/dist/{getSignedSessionId-D52QC0hh.cjs.map → getSignedSessionId-BCU987hO.cjs.map} +1 -1
  33. package/dist/{getSignedSessionId-L0T26uTy.native.esm.js → getSignedSessionId-DzNCj6g_.native.esm.js} +3 -3
  34. package/dist/{getSignedSessionId-L0T26uTy.native.esm.js.map → getSignedSessionId-DzNCj6g_.native.esm.js.map} +1 -1
  35. package/dist/{getSignedSessionId-DcJl2sy8.esm.js → getSignedSessionId-la6RXITX.esm.js} +3 -3
  36. package/dist/{getSignedSessionId-DcJl2sy8.esm.js.map → getSignedSessionId-la6RXITX.esm.js.map} +1 -1
  37. package/dist/{getVerifiedCredentialForWalletAccount-Cm2e3Boz.esm.js → getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js} +3 -2
  38. package/dist/getVerifiedCredentialForWalletAccount-DKJcLLHq.native.esm.js.map +1 -0
  39. package/dist/{getVerifiedCredentialForWalletAccount-C94BZhqL.cjs → getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs} +4 -3
  40. package/dist/getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs.map +1 -0
  41. package/dist/{getVerifiedCredentialForWalletAccount-CMEe9e1b.native.esm.js → getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js} +3 -2
  42. package/dist/getVerifiedCredentialForWalletAccount-Ozctwnyv.esm.js.map +1 -0
  43. package/dist/index.cjs +967 -18
  44. package/dist/index.cjs.map +1 -1
  45. package/dist/index.esm.js +968 -22
  46. package/dist/index.esm.js.map +1 -1
  47. package/dist/index.native.esm.js +970 -24
  48. package/dist/index.native.esm.js.map +1 -1
  49. package/dist/{isMfaRequiredForAction-vbGFqLFc.esm.js → isMfaRequiredForAction-C1u4Z__n.esm.js} +2 -2
  50. package/dist/{isMfaRequiredForAction-vbGFqLFc.esm.js.map → isMfaRequiredForAction-C1u4Z__n.esm.js.map} +1 -1
  51. package/dist/{isMfaRequiredForAction-kxGzZLB_.cjs → isMfaRequiredForAction-CMClgbT0.cjs} +2 -2
  52. package/dist/{isMfaRequiredForAction-kxGzZLB_.cjs.map → isMfaRequiredForAction-CMClgbT0.cjs.map} +1 -1
  53. package/dist/{isMfaRequiredForAction-B6kjcIA2.native.esm.js → isMfaRequiredForAction-DSX-TV2z.native.esm.js} +2 -2
  54. package/dist/{isMfaRequiredForAction-B6kjcIA2.native.esm.js.map → isMfaRequiredForAction-DSX-TV2z.native.esm.js.map} +1 -1
  55. package/dist/modules/balances/getBalances/getBalances.d.ts +22 -10
  56. package/dist/modules/balances/getBalances/getBalances.d.ts.map +1 -1
  57. package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts +6 -2
  58. package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts.map +1 -1
  59. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.d.ts +26 -0
  60. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.d.ts.map +1 -0
  61. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/index.d.ts +2 -0
  62. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/index.d.ts.map +1 -0
  63. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.d.ts +28 -0
  64. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.d.ts.map +1 -0
  65. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/index.d.ts +2 -0
  66. package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/index.d.ts.map +1 -0
  67. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/index.d.ts +2 -0
  68. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/{shouldFilterWallet → shouldFilterWalletForWalletConnect}/index.d.ts.map +1 -1
  69. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.d.ts +13 -0
  70. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.d.ts.map +1 -0
  71. package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/index.d.ts +2 -0
  72. package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/index.d.ts.map +1 -0
  73. package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.d.ts +26 -0
  74. package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.d.ts.map +1 -0
  75. package/dist/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.d.ts +10 -0
  76. package/dist/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.d.ts.map +1 -0
  77. package/dist/modules/legacyWalletBook/shouldFilterWallet/index.d.ts +3 -0
  78. package/dist/modules/legacyWalletBook/shouldFilterWallet/index.d.ts.map +1 -0
  79. package/dist/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.d.ts +34 -0
  80. package/dist/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.d.ts.map +1 -0
  81. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts +22 -0
  82. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts.map +1 -0
  83. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.d.ts +18 -0
  84. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.d.ts.map +1 -0
  85. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/index.d.ts +2 -0
  86. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/index.d.ts.map +1 -0
  87. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/index.d.ts +2 -0
  88. package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/index.d.ts.map +1 -0
  89. package/dist/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.d.ts +21 -0
  90. package/dist/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.d.ts.map +1 -0
  91. package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts +27 -0
  92. package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts.map +1 -0
  93. package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts +23 -0
  94. package/dist/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.d.ts.map +1 -0
  95. package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts +39 -0
  96. package/dist/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.d.ts.map +1 -0
  97. package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts +54 -0
  98. package/dist/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.d.ts.map +1 -0
  99. package/dist/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.d.ts +31 -0
  100. package/dist/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.d.ts.map +1 -0
  101. package/dist/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.d.ts +18 -0
  102. package/dist/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.d.ts.map +1 -0
  103. package/dist/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.d.ts +15 -0
  104. package/dist/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.d.ts.map +1 -0
  105. package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.d.ts +21 -0
  106. package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.d.ts.map +1 -0
  107. package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.d.ts +44 -0
  108. package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.d.ts.map +1 -0
  109. package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.d.ts +20 -0
  110. package/dist/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.d.ts.map +1 -0
  111. package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts +15 -0
  112. package/dist/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.d.ts.map +1 -0
  113. package/dist/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.d.ts +16 -0
  114. package/dist/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.d.ts.map +1 -0
  115. package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +24 -0
  116. package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -0
  117. package/dist/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.d.ts +49 -0
  118. package/dist/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.d.ts.map +1 -0
  119. package/dist/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.d.ts +18 -0
  120. package/dist/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.d.ts.map +1 -0
  121. package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts +18 -0
  122. package/dist/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.d.ts.map +1 -0
  123. package/dist/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.d.ts +23 -0
  124. package/dist/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.d.ts.map +1 -0
  125. package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts +22 -0
  126. package/dist/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.d.ts.map +1 -0
  127. package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts +20 -0
  128. package/dist/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.d.ts.map +1 -0
  129. package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts +34 -0
  130. package/dist/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.d.ts.map +1 -0
  131. package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts +164 -0
  132. package/dist/modules/walletOptionsCatalogue/walletOptionsCatalogue.types.d.ts.map +1 -0
  133. package/dist/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/createSignInMessageStatement.d.ts.map +1 -1
  134. package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
  135. package/dist/modules/wallets/utils/stripChainSuffix/stripChainSuffix.d.ts +20 -0
  136. package/dist/modules/wallets/utils/stripChainSuffix/stripChainSuffix.d.ts.map +1 -0
  137. package/dist/modules/wallets/walletProviderRegistry/createWalletProviderRegistry/createWalletProviderRegistry.d.ts.map +1 -1
  138. package/dist/modules/wallets/walletProviderRegistry/index.d.ts +1 -1
  139. package/dist/modules/wallets/walletProviderRegistry/index.d.ts.map +1 -1
  140. package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts +19 -0
  141. package/dist/modules/wallets/walletProviderRegistry/walletProviderRegistry.types.d.ts.map +1 -1
  142. package/dist/modules/wallets/walletProviderUriConnection.types.d.ts +23 -0
  143. package/dist/modules/wallets/walletProviderUriConnection.types.d.ts.map +1 -0
  144. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  145. package/dist/utils/assertNonEmptyArray/assertNonEmptyArray.d.ts +19 -0
  146. package/dist/utils/assertNonEmptyArray/assertNonEmptyArray.d.ts.map +1 -0
  147. package/dist/utils/assertNonEmptyArray/index.d.ts +2 -0
  148. package/dist/utils/assertNonEmptyArray/index.d.ts.map +1 -0
  149. package/dist/utils/getAppMetadata/getAppMetadata.d.ts +16 -0
  150. package/dist/utils/getAppMetadata/getAppMetadata.d.ts.map +1 -0
  151. package/dist/utils/getAppMetadata/index.d.ts +3 -0
  152. package/dist/utils/getAppMetadata/index.d.ts.map +1 -0
  153. package/dist/waas.cjs +6 -5
  154. package/dist/waas.cjs.map +1 -1
  155. package/dist/waas.esm.js +5 -4
  156. package/dist/waas.esm.js.map +1 -1
  157. package/dist/waas.native.esm.js +5 -4
  158. package/dist/waas.native.esm.js.map +1 -1
  159. package/dist/waasCore.cjs +4 -4
  160. package/dist/waasCore.esm.js +3 -3
  161. package/dist/waasCore.native.esm.js +3 -3
  162. package/package.json +3 -3
  163. package/dist/getNetworkProviderFromNetworkId-C9QzgcLs.esm.js.map +0 -1
  164. package/dist/getNetworkProviderFromNetworkId-D26TNjm4.cjs.map +0 -1
  165. package/dist/getNetworkProviderFromNetworkId-VkHaRqMa.native.esm.js.map +0 -1
  166. package/dist/getVerifiedCredentialForWalletAccount-C94BZhqL.cjs.map +0 -1
  167. package/dist/getVerifiedCredentialForWalletAccount-CMEe9e1b.native.esm.js.map +0 -1
  168. package/dist/getVerifiedCredentialForWalletAccount-Cm2e3Boz.esm.js.map +0 -1
  169. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/index.d.ts +0 -2
  170. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/shouldFilterWallet.d.ts +0 -21
  171. 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-D26TNjm4.cjs');
2
- const require_InvalidParamError = require('./InvalidParamError-CPzPxL0l.cjs');
3
- const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-C94BZhqL.cjs');
4
- const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-BcIbGm0s.cjs');
5
- const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-kxGzZLB_.cjs');
1
+ const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-BA0CHZzu.cjs');
2
+ const require_InvalidParamError = require('./InvalidParamError-DQvZQdQ9.cjs');
3
+ const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-DSSDwOyq.cjs');
4
+ const require_NotWaasWalletAccountError = require('./NotWaasWalletAccountError-Ciq7b-Y6.cjs');
5
+ const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-CMClgbT0.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");
@@ -2290,10 +2290,10 @@ const __unlinkSocialAccount_wrapped = require_InvalidParamError.instrumentFuncti
2290
2290
  * @returns A promise that resolves to an array of token balances.
2291
2291
  * @not-instrumented
2292
2292
  */
2293
- const getBalances = async ({ walletAccount, networkId, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
2293
+ const getBalances = async ({ walletAccount, networkId, networkIds, includePrices, includeNative, filterSpamTokens, whitelistedContracts, forceRefresh }, client = require_InvalidParamError.getDefaultClient()) => {
2294
2294
  const core = require_InvalidParamError.getCore(client);
2295
2295
  const apiClient = require_InvalidParamError.createApiClient({}, client);
2296
- if (!networkId) {
2296
+ if (!networkId && !networkIds) {
2297
2297
  const activeNetworkId = await require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client).getActiveNetworkId();
2298
2298
  networkId = Number(activeNetworkId.networkId);
2299
2299
  }
@@ -2306,6 +2306,7 @@ const getBalances = async ({ walletAccount, networkId, includePrices, includeNat
2306
2306
  includeNative,
2307
2307
  includePrices,
2308
2308
  networkId,
2309
+ networkIds,
2309
2310
  whitelistedContracts
2310
2311
  });
2311
2312
  };
@@ -3375,10 +3376,12 @@ const fetchLegacyWalletBook = async (client) => {
3375
3376
  };
3376
3377
 
3377
3378
  //#endregion
3378
- //#region src/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWallet/shouldFilterWallet.ts
3379
+ //#region src/modules/legacyWalletBook/shouldFilterWallet/shouldFilterWallet.ts
3379
3380
  /**
3380
- * Embedded wallet keys that should be filtered out from the WalletConnect catalog.
3381
- * These wallets are not meant to be displayed in wallet selection lists.
3381
+ * Embedded wallet keys that should be filtered out from any external-wallet
3382
+ * catalogue. These wallets are not products the user "connects" to from the
3383
+ * wallet selection list — they are embedded sign-in methods that live behind
3384
+ * different SDK entry points.
3382
3385
  * @not-instrumented
3383
3386
  */
3384
3387
  const EMBEDDED_WALLET_KEYS = [
@@ -3394,19 +3397,48 @@ const EMBEDDED_WALLET_KEYS = [
3394
3397
  "mpcwallet"
3395
3398
  ];
3396
3399
  /**
3397
- * Checks if a wallet should be filtered out from the WalletConnect catalog.
3400
+ * Generic "is this wallet eligible for an external-wallet catalogue" check.
3401
+ * Filters out:
3402
+ *
3403
+ * 1. Embedded sign-in methods (see {@link EMBEDDED_WALLET_KEYS}).
3404
+ * 2. Wallets that only ship a browser-extension injection (`injectedConfig`)
3405
+ * with no mobile or desktop links — these have no surface a customer
3406
+ * catalogue UI can drive to.
3407
+ *
3408
+ * Channel-specific eligibility (WalletConnect support, in-app browser URL,
3409
+ * installation links, …) is the caller's responsibility — wrap this helper
3410
+ * with an additional check, e.g.
3411
+ * {@link shouldFilterWalletForWalletConnect}.
3398
3412
  *
3399
3413
  * @returns True if the wallet should be filtered out, false otherwise.
3400
3414
  * @not-instrumented
3401
3415
  */
3402
3416
  const shouldFilterWallet = ({ wallet, walletKey }) => {
3403
3417
  if (EMBEDDED_WALLET_KEYS.includes(walletKey)) return true;
3404
- if (!wallet.walletConnect || !wallet.walletConnect.sdks.includes("sign_v2")) return true;
3405
3418
  const hasInjectedConfig = wallet.injectedConfig && wallet.injectedConfig.length > 0;
3406
3419
  const hasMobileLinks = Boolean(wallet.mobile?.androidId || wallet.mobile?.iosId || wallet.mobile?.native || wallet.mobile?.universal);
3407
3420
  const hasDesktopLinks = Boolean(wallet.desktop?.chromeId || wallet.desktop?.edgeId || wallet.desktop?.firefoxId || wallet.desktop?.operaId || wallet.desktop?.safariId || wallet.desktop?.universal);
3408
- if (hasInjectedConfig && !hasMobileLinks && !hasDesktopLinks) return true;
3409
- return false;
3421
+ return Boolean(hasInjectedConfig && !hasMobileLinks && !hasDesktopLinks);
3422
+ };
3423
+
3424
+ //#endregion
3425
+ //#region src/modules/legacyWalletBook/getWalletConnectCatalog/shouldFilterWalletForWalletConnect/shouldFilterWalletForWalletConnect.ts
3426
+ /**
3427
+ * WalletConnect-specific filter. Applies the generic
3428
+ * {@link shouldFilterWallet} eligibility rules and additionally drops
3429
+ * wallets that do not advertise WalletConnect `sign_v2` support — the
3430
+ * protocol version Dynamic pairs against.
3431
+ *
3432
+ * @returns True if the wallet should be excluded from the WalletConnect
3433
+ * catalog, false otherwise.
3434
+ * @not-instrumented
3435
+ */
3436
+ const shouldFilterWalletForWalletConnect = ({ wallet, walletKey }) => {
3437
+ if (shouldFilterWallet({
3438
+ wallet,
3439
+ walletKey
3440
+ })) return true;
3441
+ return !wallet.walletConnect?.sdks.includes("sign_v2");
3410
3442
  };
3411
3443
 
3412
3444
  //#endregion
@@ -3614,7 +3646,7 @@ const transformWalletBook = ({ walletBook }) => {
3614
3646
  for (const [groupKey, group] of Object.entries(walletBook.groups)) groups[groupKey] = transformGroup({ group });
3615
3647
  const wallets = {};
3616
3648
  for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
3617
- if (shouldFilterWallet({
3649
+ if (shouldFilterWalletForWalletConnect({
3618
3650
  wallet,
3619
3651
  walletKey
3620
3652
  })) continue;
@@ -3646,6 +3678,118 @@ const getWalletConnectCatalog = async (client = require_InvalidParamError.getDef
3646
3678
  return transformWalletBook({ walletBook: await fetchLegacyWalletBook(client) });
3647
3679
  };
3648
3680
 
3681
+ //#endregion
3682
+ //#region src/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.ts
3683
+ const normalize$1 = (value) => value.toLowerCase().replace(/\s+/g, "").replace(/wallet/g, "");
3684
+ /**
3685
+ * Returns the wallet providers that belong to the same wallet group as the
3686
+ * given WalletConnect catalog entry. Useful for de-duplicating "installed"
3687
+ * vs "available via WalletConnect" wallets when rendering a combined list.
3688
+ *
3689
+ * Matching is done on normalized identifiers — lowercased, whitespace removed,
3690
+ * and the literal substring "wallet" stripped — so that variations like:
3691
+ * - catalog key `"trust"` + catalog name `"Trust Wallet"`
3692
+ * - provider `groupKey: "trustwallet"` + `displayName: "Trust Wallet"`
3693
+ * collapse into a single match.
3694
+ *
3695
+ * @param params.catalogGroupKey - Key of the catalog group (e.g. `"metamask"`).
3696
+ * @param [params.catalogGroupName] - Optional display name (e.g. `"Trust Wallet"`); matched as a fallback when the key is opaque.
3697
+ * @param params.walletProviders - Currently available wallet providers (from `getAvailableWalletProvidersData`).
3698
+ * @returns The subset of `walletProviders` that match the catalog group.
3699
+ * @not-instrumented
3700
+ */
3701
+ const matchWalletProvidersToCatalogGroup = ({ catalogGroupKey, catalogGroupName, walletProviders }) => {
3702
+ const targets = new Set([normalize$1(catalogGroupKey)]);
3703
+ if (catalogGroupName) targets.add(normalize$1(catalogGroupName));
3704
+ return walletProviders.filter((provider) => {
3705
+ return [normalize$1(provider.groupKey), normalize$1(provider.metadata.displayName)].some((candidate) => targets.has(candidate));
3706
+ });
3707
+ };
3708
+
3709
+ //#endregion
3710
+ //#region src/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.ts
3711
+ /**
3712
+ * Scans the catalog and returns the set of group identifiers for which at
3713
+ * least one installed wallet provider matches.
3714
+ *
3715
+ * Walks the catalog twice on purpose:
3716
+ * - First through `wallets`, to cover wallets that point to a `groupId`
3717
+ * with no matching entry in `groups` (we fall back to the wallet's own
3718
+ * name for matching in that case).
3719
+ * - Then through `groups`, to catch orphan group entries that have no
3720
+ * wallet referencing them.
3721
+ *
3722
+ * The check is skipped for any group already known to be installed, so a
3723
+ * multi-chain wallet (same `groupId` across EVM + SOL entries) only runs
3724
+ * the match once.
3725
+ *
3726
+ * @not-instrumented
3727
+ */
3728
+ const collectInstalledGroupIds = ({ catalog, walletProviders }) => {
3729
+ const installedGroupIds = /* @__PURE__ */ new Set();
3730
+ for (const [walletKey, wallet] of Object.entries(catalog.wallets)) {
3731
+ const groupId = wallet.groupId || walletKey;
3732
+ if (installedGroupIds.has(groupId)) continue;
3733
+ if (matchWalletProvidersToCatalogGroup({
3734
+ catalogGroupKey: groupId,
3735
+ catalogGroupName: catalog.groups[groupId]?.name || wallet.name,
3736
+ walletProviders
3737
+ }).length > 0) installedGroupIds.add(groupId);
3738
+ }
3739
+ for (const [groupKey, group] of Object.entries(catalog.groups)) {
3740
+ if (installedGroupIds.has(groupKey)) continue;
3741
+ if (matchWalletProvidersToCatalogGroup({
3742
+ catalogGroupKey: groupKey,
3743
+ catalogGroupName: group.name,
3744
+ walletProviders
3745
+ }).length > 0) installedGroupIds.add(groupKey);
3746
+ }
3747
+ return installedGroupIds;
3748
+ };
3749
+
3750
+ //#endregion
3751
+ //#region src/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.ts
3752
+ /**
3753
+ * Returns a new WalletConnect catalog with the wallets and groups that the
3754
+ * user already has installed removed.
3755
+ *
3756
+ * Useful when rendering a combined wallet list (installed + WalletConnect
3757
+ * catalog) where each wallet should appear exactly once: installed wallets
3758
+ * win and the corresponding catalog entries get hidden.
3759
+ *
3760
+ * Matching is delegated to {@link collectInstalledGroupIds}, so a single
3761
+ * installed provider removes every wallet that shares its group — e.g. an
3762
+ * installed MetaMask hides both the EVM and SOL catalog entries.
3763
+ *
3764
+ * The original catalog object is not mutated.
3765
+ *
3766
+ * @param params.catalog - The full WalletConnect catalog (typically from `getWalletConnectCatalog`).
3767
+ * @param params.walletProviders - Currently available wallet providers.
3768
+ * @returns A new catalog with only the wallets and groups the user does not have installed.
3769
+ * @not-instrumented
3770
+ */
3771
+ const excludeInstalledFromCatalog = ({ catalog, walletProviders }) => {
3772
+ const installedGroupIds = collectInstalledGroupIds({
3773
+ catalog,
3774
+ walletProviders
3775
+ });
3776
+ const wallets = {};
3777
+ for (const [walletKey, wallet] of Object.entries(catalog.wallets)) {
3778
+ const groupId = wallet.groupId || walletKey;
3779
+ if (installedGroupIds.has(groupId)) continue;
3780
+ wallets[walletKey] = wallet;
3781
+ }
3782
+ const groups = {};
3783
+ for (const [groupKey, group] of Object.entries(catalog.groups)) {
3784
+ if (installedGroupIds.has(groupKey)) continue;
3785
+ groups[groupKey] = group;
3786
+ }
3787
+ return {
3788
+ groups,
3789
+ wallets
3790
+ };
3791
+ };
3792
+
3649
3793
  //#endregion
3650
3794
  //#region src/modules/wallets/walletProvider/extractChainFromNormalizedName/extractChainFromNormalizedName.ts
3651
3795
  /**
@@ -3692,6 +3836,808 @@ const getWalletConnectCatalogWalletByWalletProviderKey = async ({ walletProvider
3692
3836
  }
3693
3837
  };
3694
3838
 
3839
+ //#endregion
3840
+ //#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
3841
+ /**
3842
+ * Resolves which wallet option (group) a wallet book entry belongs to. Used
3843
+ * by the catalogue's wallet-book-driven transformers (`walletConnect`,
3844
+ * `inAppBrowser`, `installation`) to bucket their emitted options.
3845
+ *
3846
+ * Wallet book entries inconsistently use `group` / `chainGroup` /
3847
+ * `walletGroup` for the same idea. The wallet key itself acts as the wallet
3848
+ * option key when no group field is set.
3849
+ *
3850
+ * @param params.wallet - The wallet entry.
3851
+ * @param params.walletKey - The wallet's key in `walletBook.wallets`.
3852
+ * @returns The wallet option key.
3853
+ * @not-instrumented
3854
+ */
3855
+ const resolveWalletBookWalletOptionKey = ({ wallet, walletKey }) => wallet.group ?? wallet.chainGroup ?? wallet.walletGroup ?? walletKey;
3856
+
3857
+ //#endregion
3858
+ //#region src/modules/walletOptionsCatalogue/buildInAppBrowserOptions/getInAppBrowserUrl/getInAppBrowserUrl.ts
3859
+ /**
3860
+ * Returns the wallet's in-app browser URL template, preferring the v2
3861
+ * field. `inAppBrowser` is deprecated but some wallet book entries
3862
+ * still carry only the v1 value, so it acts as a fallback. Trailing
3863
+ * `?? undefined` collapses the schema's `string | null` typing down to
3864
+ * the `string | undefined` return contract.
3865
+ *
3866
+ * @param params.wallet - The wallet book wallet entry.
3867
+ * @returns The in-app browser URL, or `undefined` if neither field is set.
3868
+ * @not-instrumented
3869
+ */
3870
+ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wallet.mobile?.inAppBrowser ?? void 0;
3871
+
3872
+ //#endregion
3873
+ //#region src/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.ts
3874
+ /**
3875
+ * Builds the `inAppBrowser` catalogue options from the wallet book. A wallet
3876
+ * qualifies when it exposes a mobile in-app-browser URL — typically a
3877
+ * `cb_url={{encodedDappURI}}`-style template the customer fills in with the
3878
+ * current page URL before opening.
3879
+ *
3880
+ * Reuses the generic `shouldFilterWallet` rules — embedded sign-in methods
3881
+ * and injected-only wallets are dropped — so the catalogue's notion of
3882
+ * "external wallet" stays consistent across option types.
3883
+ *
3884
+ * @param params.walletBook - The fetched wallet book.
3885
+ * @returns Tagged `inAppBrowser` options paired with their wallet option keys.
3886
+ * @not-instrumented
3887
+ */
3888
+ const buildInAppBrowserOptions = ({ walletBook }) => {
3889
+ const result = [];
3890
+ for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
3891
+ if (shouldFilterWallet({
3892
+ wallet,
3893
+ walletKey
3894
+ })) continue;
3895
+ const url = getInAppBrowserUrl({ wallet });
3896
+ if (!url) continue;
3897
+ result.push({
3898
+ option: {
3899
+ chain: getChainFromWalletSchema({
3900
+ wallet,
3901
+ walletKey
3902
+ }),
3903
+ type: "inAppBrowser",
3904
+ url
3905
+ },
3906
+ walletOptionKey: resolveWalletBookWalletOptionKey({
3907
+ wallet,
3908
+ walletKey
3909
+ })
3910
+ });
3911
+ }
3912
+ return result;
3913
+ };
3914
+
3915
+ //#endregion
3916
+ //#region src/modules/walletOptionsCatalogue/buildInstallationUrls/buildInstallationUrls.ts
3917
+ const PLAY_STORE_URL_TEMPLATE = "https://play.google.com/store/apps/details?id=";
3918
+ const APP_STORE_URL_TEMPLATE = "https://apps.apple.com/app/";
3919
+ const CHROME_WEB_STORE_URL_TEMPLATE = "https://chrome.google.com/webstore/detail/";
3920
+ const FIREFOX_ADDONS_URL_TEMPLATE = "https://addons.mozilla.org/firefox/addon/";
3921
+ const EDGE_ADDONS_URL_TEMPLATE = "https://microsoftedge.microsoft.com/addons/detail/";
3922
+ /**
3923
+ * Builds the install/download URL bag for a wallet book entry. Returns the
3924
+ * concrete URLs assembled from each store's ID field — Play Store, App
3925
+ * Store, Chrome Web Store, Firefox Add-ons, Edge Add-ons — plus the wallet's
3926
+ * own `desktop.universal` / `desktop.native` URLs when set.
3927
+ *
3928
+ * Fields the wallet book does not carry are left undefined; callers should
3929
+ * skip emitting an installation option for a wallet whose URL bag is empty.
3930
+ *
3931
+ * @param params.wallet - The wallet book entry.
3932
+ * @returns The URL bag, omitting fields the wallet does not provide.
3933
+ * @not-instrumented
3934
+ */
3935
+ const buildInstallationUrls = ({ wallet }) => {
3936
+ const androidId = wallet.mobile?.androidId;
3937
+ const iosId = wallet.mobile?.iosId;
3938
+ const chromeId = wallet.desktop?.chromeId;
3939
+ const firefoxId = wallet.desktop?.firefoxId;
3940
+ const edgeId = wallet.desktop?.edgeId;
3941
+ const native = wallet.desktop?.universal ?? wallet.desktop?.native;
3942
+ return {
3943
+ android: androidId ? `${PLAY_STORE_URL_TEMPLATE}${androidId}` : void 0,
3944
+ chrome: chromeId ? `${CHROME_WEB_STORE_URL_TEMPLATE}${chromeId}` : void 0,
3945
+ edge: edgeId ? `${EDGE_ADDONS_URL_TEMPLATE}${edgeId}` : void 0,
3946
+ firefox: firefoxId ? `${FIREFOX_ADDONS_URL_TEMPLATE}${firefoxId}` : void 0,
3947
+ ios: iosId ? `${APP_STORE_URL_TEMPLATE}${iosId}` : void 0,
3948
+ native: native || void 0
3949
+ };
3950
+ };
3951
+
3952
+ //#endregion
3953
+ //#region src/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.ts
3954
+ /**
3955
+ * `buildInstallationUrls` always returns an object, but it can be fully
3956
+ * `undefined`-valued when the wallet book entry has no installable surface.
3957
+ * Skip those wallets — emitting an empty URL bag helps nobody.
3958
+ */
3959
+ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
3960
+ /**
3961
+ * Collects install / download URLs for every wallet book entry that has
3962
+ * at least one installable surface, keyed by the wallet option key the
3963
+ * wallet groups under. The catalogue assembly step merges this map into
3964
+ * the per-key wallet option shell so `WalletOption.installationUrls` is
3965
+ * populated alongside (or instead of) `connectionOptions`.
3966
+ *
3967
+ * First-seen URLs win when multiple wallet book entries resolve to the
3968
+ * same wallet option key — wallet book authors put the most accurate
3969
+ * install links on the canonical entry, so the first-seen one is the
3970
+ * right pick.
3971
+ *
3972
+ * Reuses the generic `shouldFilterWallet` rules so embedded wallets do
3973
+ * not appear here either — they're not user-installable products.
3974
+ *
3975
+ * @param params.walletBook - The fetched wallet book.
3976
+ * @returns A map from wallet option key to its install URL bag.
3977
+ * @not-instrumented
3978
+ */
3979
+ const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
3980
+ const map = /* @__PURE__ */ new Map();
3981
+ for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
3982
+ if (shouldFilterWallet({
3983
+ wallet,
3984
+ walletKey
3985
+ })) continue;
3986
+ const urls = buildInstallationUrls({ wallet });
3987
+ if (!hasAnyInstallationUrl({ urls })) continue;
3988
+ const walletOptionKey = resolveWalletBookWalletOptionKey({
3989
+ wallet,
3990
+ walletKey
3991
+ });
3992
+ if (!map.has(walletOptionKey)) map.set(walletOptionKey, urls);
3993
+ }
3994
+ return map;
3995
+ };
3996
+
3997
+ //#endregion
3998
+ //#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
3999
+ /**
4000
+ * A wallet only deserves a `walletConnect` catalogue option if it has at
4001
+ * least one mobile deeplink — that's the value-add the option provides over
4002
+ * the bare WC pairing URI. Wallets that exist in the wallet book but don't
4003
+ * expose a deeplink (rare, but present) are silently skipped.
4004
+ */
4005
+ const hasUsableDeeplink = ({ wallet }) => Boolean(wallet.mobile?.native || wallet.mobile?.universal);
4006
+ /**
4007
+ * Builds the `walletConnect` catalogue options from a fetched wallet book.
4008
+ * Applies the WalletConnect-specific eligibility filter
4009
+ * (`shouldFilterWalletForWalletConnect`) so embedded wallets and entries
4010
+ * without `sign_v2` support are excluded — same surface as
4011
+ * `getWalletConnectCatalog`.
4012
+ *
4013
+ * Each emitted option carries the wallet's mobile deeplinks. Customers
4014
+ * combine these with their chain's `connectWithWalletConnect<Chain>` URI via
4015
+ * `appendWalletConnectUriToDeepLink` to open the wallet's app.
4016
+ *
4017
+ * @param params.walletBook - The fetched wallet book.
4018
+ * @returns Tagged `walletConnect` options paired with their wallet option keys.
4019
+ * @not-instrumented
4020
+ */
4021
+ const buildWalletConnectOptions = ({ walletBook }) => {
4022
+ const result = [];
4023
+ for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
4024
+ if (shouldFilterWalletForWalletConnect({
4025
+ wallet,
4026
+ walletKey
4027
+ })) continue;
4028
+ if (!hasUsableDeeplink({ wallet })) continue;
4029
+ const walletOptionKey = resolveWalletBookWalletOptionKey({
4030
+ wallet,
4031
+ walletKey
4032
+ });
4033
+ const chain = getChainFromWalletSchema({
4034
+ wallet,
4035
+ walletKey
4036
+ });
4037
+ result.push({
4038
+ option: {
4039
+ chain,
4040
+ deeplinks: {
4041
+ native: wallet.mobile?.native,
4042
+ universal: wallet.mobile?.universal
4043
+ },
4044
+ type: "walletConnect"
4045
+ },
4046
+ walletOptionKey
4047
+ });
4048
+ }
4049
+ return result;
4050
+ };
4051
+
4052
+ //#endregion
4053
+ //#region src/modules/walletOptionsCatalogue/buildWalletOption/buildWalletOption.ts
4054
+ /**
4055
+ * Assembles a `WalletOption` for a resolved wallet option key, populated
4056
+ * with the connection options the transformers produced for it plus an
4057
+ * optional install / download URL bag.
4058
+ *
4059
+ * Display merge rules (provider self-announced metadata wins where set):
4060
+ *
4061
+ * - `name`: `displayOverride.name` ?? wallet book group name ?? bare key.
4062
+ * - `iconUrl`: `displayOverride.iconUrl` ?? wallet book group sprite URL ?? `''`.
4063
+ * - `primaryColor`: wallet book group brand color only (providers do not
4064
+ * ship a primary color in their announcement metadata).
4065
+ * - `installationUrls`: copied through if present.
4066
+ *
4067
+ * Why provider precedence: a registered wallet provider knows its own
4068
+ * brand best (EIP-6963 / Wallet Standard / vendor SDK announcement is the
4069
+ * wallet authoring its own identity). The wallet book fills in fields the
4070
+ * announcement does not carry — currently only `primaryColor`.
4071
+ *
4072
+ * @param params.connectionOptions - The connections to attach to this wallet option.
4073
+ * @param [params.displayOverride] - Provider-announced display info that overrides the wallet book's name and iconUrl.
4074
+ * @param [params.installationUrls] - Install/download URL bag for this wallet.
4075
+ * @param params.walletBook - The fetched wallet book.
4076
+ * @param params.walletOptionKey - The wallet option key.
4077
+ * @returns The constructed wallet option.
4078
+ * @not-instrumented
4079
+ */
4080
+ const buildWalletOption = ({ connectionOptions, displayOverride, installationUrls, walletBook, walletOptionKey }) => {
4081
+ const group = walletBook.groups[walletOptionKey];
4082
+ const groupSpriteId = group?.brand?.spriteId;
4083
+ const groupIconUrl = groupSpriteId ? getSpriteUrl({ spriteId: groupSpriteId }) : void 0;
4084
+ return {
4085
+ connectionOptions,
4086
+ iconUrl: displayOverride?.iconUrl ?? groupIconUrl ?? "",
4087
+ installationUrls,
4088
+ key: walletOptionKey,
4089
+ name: displayOverride?.name ?? group?.name ?? walletOptionKey,
4090
+ primaryColor: group?.brand?.primaryColor
4091
+ };
4092
+ };
4093
+
4094
+ //#endregion
4095
+ //#region src/modules/walletOptionsCatalogue/classifyWithWalletProviderSource/classifyWithWalletProviderSource.ts
4096
+ /**
4097
+ * Maps a registered wallet provider's registration priority to the
4098
+ * `WithWalletProviderSource` value that should appear on its catalogue option.
4099
+ *
4100
+ * Priority mapping (set by each chain extension when it calls
4101
+ * `registry.register`):
4102
+ *
4103
+ * - `WALLET_SDK` → `'sdk'` — branded SDKs wrapped by chain extensions
4104
+ * (Base Account via `@base-org/account`, MetaMask Connect, …).
4105
+ * - `WALLET_SELF_ANNOUNCEMENT_STANDARD` → `'selfAnnounced'` — in-page
4106
+ * self-announcement standards (EIP-6963 on EVM, Wallet Standard on
4107
+ * Solana / Sui / …).
4108
+ * - `WINDOW_INJECT` → `'windowInjected'` — legacy `window.*` injection.
4109
+ *
4110
+ * Returns `undefined` for providers whose registration priority does not
4111
+ * correspond to a connectable external-wallet source — callers filter these
4112
+ * out before emitting catalogue options.
4113
+ *
4114
+ * @param params.entry - The registry entry to classify.
4115
+ * @returns The matching source, or `undefined` if this entry should not
4116
+ * surface a `withWalletProvider` option.
4117
+ * @not-instrumented
4118
+ */
4119
+ const classifyWithWalletProviderSource = ({ entry }) => {
4120
+ const { priority } = entry;
4121
+ if (priority === require_getVerifiedCredentialForWalletAccount.WalletProviderPriority.WALLET_SDK) return "sdk";
4122
+ if (priority === require_getVerifiedCredentialForWalletAccount.WalletProviderPriority.WALLET_SELF_ANNOUNCEMENT_STANDARD) return "selfAnnounced";
4123
+ if (priority === require_getVerifiedCredentialForWalletAccount.WalletProviderPriority.WINDOW_INJECT) return "windowInjected";
4124
+ };
4125
+
4126
+ //#endregion
4127
+ //#region src/modules/wallets/utils/stripChainSuffix/stripChainSuffix.ts
4128
+ /**
4129
+ * Removes the lowercased chain suffix that `normalizeWalletNameWithChain`
4130
+ * appends. Used by `findWalletOptionKeyForProviderKey` to recover the wallet
4131
+ * book wallet key candidate from a `walletProviderKey`. If the suffix is
4132
+ * not present (some chain extensions already bake the chain into the
4133
+ * display name), the input is returned unchanged.
4134
+ *
4135
+ * @param params.chain - The chain whose suffix should be stripped.
4136
+ * @param params.normalizedName - The normalized wallet-name-with-chain string.
4137
+ * @returns The name with the chain suffix removed, or the input unchanged.
4138
+ * @not-instrumented
4139
+ */
4140
+ const stripChainSuffix = ({ chain, normalizedName }) => {
4141
+ const suffix = chain.toLowerCase();
4142
+ if (normalizedName.endsWith(suffix)) return normalizedName.slice(0, -suffix.length);
4143
+ return normalizedName;
4144
+ };
4145
+
4146
+ //#endregion
4147
+ //#region src/modules/walletOptionsCatalogue/normalizeWalletDisplayName/normalizeWalletDisplayName.ts
4148
+ /**
4149
+ * Normalizes a wallet's self-announced `displayName` into a stable wallet
4150
+ * option key. Used by `findWalletOptionKeyForProviderKey` as the off-book
4151
+ * fallback — registered providers whose `walletProviderKey` does not
4152
+ * resolve to any wallet book entry still surface in the catalogue under a
4153
+ * key derived from the name they ship in their metadata.
4154
+ *
4155
+ * The normalization (lowercase + whitespace-strip) intentionally matches
4156
+ * how the legacy wallet book composes its `wallets.<key>` keys, so a
4157
+ * self-described provider's option will merge cleanly with its book entry
4158
+ * if one ever lands later.
4159
+ *
4160
+ * Multi-chain registrations of the same wallet (e.g. Phantom announced via
4161
+ * EIP-6963 on EVM and via Wallet Standard on Solana) collapse onto the
4162
+ * same wallet option through this normalization, since each registration
4163
+ * announces the same `displayName`.
4164
+ *
4165
+ * @param displayName - The provider's `metadata.displayName`.
4166
+ * @returns The normalized wallet option key (lowercased, no whitespace).
4167
+ * @not-instrumented
4168
+ */
4169
+ const normalizeWalletDisplayName = (displayName) => displayName.toLowerCase().replace(/\s+/g, "");
4170
+
4171
+ //#endregion
4172
+ //#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findByNameMatch/findByNameMatch.ts
4173
+ const normalize = (value) => value.toLowerCase().replace(/\s+/g, "");
4174
+ /**
4175
+ * Looks for a wallet book entry whose `name` or `shortName` normalizes to
4176
+ * the same string as `candidate`. Used as a fallback by
4177
+ * `findWalletOptionKeyForProviderKey` for providers whose
4178
+ * `walletProviderKey` strips down to a value that does not match any
4179
+ * `walletBook.wallets` key directly (e.g. an extension whose display name
4180
+ * happens to match the wallet's `shortName` instead of its book key).
4181
+ *
4182
+ * @param params.candidate - The lowercased, chain-suffix-stripped candidate.
4183
+ * @param params.walletBook - The fetched wallet book.
4184
+ * @returns The matching wallet book wallet key, or `undefined`.
4185
+ * @not-instrumented
4186
+ */
4187
+ const findByNameMatch = ({ candidate, walletBook }) => {
4188
+ for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) if (normalize(wallet.name) === candidate || normalize(wallet.shortName) === candidate) return walletKey;
4189
+ };
4190
+
4191
+ //#endregion
4192
+ //#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/resolveWalletOptionKey/resolveWalletOptionKey.ts
4193
+ /**
4194
+ * Picks the wallet option (group) key for a wallet book wallet. The wallet
4195
+ * book carries the group association under a few different field names
4196
+ * (`group`, `chainGroup`, `walletGroup`) depending on the wallet's
4197
+ * provenance — this helper centralises the lookup. When none of those
4198
+ * fields are set, the wallet key itself acts as its own wallet option key.
4199
+ *
4200
+ * @param params.fallback - Wallet key to return if no group field is set.
4201
+ * @param params.wallet - The wallet book wallet entry.
4202
+ * @returns The resolved wallet option key.
4203
+ * @not-instrumented
4204
+ */
4205
+ const resolveWalletOptionKey = ({ fallback, wallet }) => wallet.group ?? wallet.chainGroup ?? wallet.walletGroup ?? fallback;
4206
+
4207
+ //#endregion
4208
+ //#region src/modules/walletOptionsCatalogue/findWalletOptionKeyForProviderKey/findWalletOptionKeyForProviderKey.ts
4209
+ /**
4210
+ * Resolves a registered wallet provider to the wallet option key it should
4211
+ * be bucketed under. Always returns a key — providers with no wallet book
4212
+ * match fall back to their self-announced `metadata.displayName`, so the
4213
+ * catalogue surfaces them as self-described tiles instead of silently
4214
+ * dropping them.
4215
+ *
4216
+ * Resolution order (each step short-circuits on first hit):
4217
+ *
4218
+ * 1. **Direct wallet book lookup with chain suffix** — try
4219
+ * `walletBook.wallets[normalizedWalletNameWithChain]` as-is. Wallet
4220
+ * book entries are inconsistent about whether they keep the chain
4221
+ * suffix (e.g. `metamaskevm`) or strip it (e.g. `metamask`), so try
4222
+ * the suffixed form first.
4223
+ * 2. **Direct wallet book lookup without chain suffix** — strip the
4224
+ * suffix and retry.
4225
+ * 3. **Name match heuristic with chain suffix** — scan
4226
+ * `walletBook.wallets` for an entry whose normalized `name` or
4227
+ * `shortName` equals the suffixed candidate.
4228
+ * 4. **Name match heuristic without chain suffix** — same scan on the
4229
+ * stripped candidate.
4230
+ * 5. **Display-name fallback** — derive a stable key from
4231
+ * `walletProvider.metadata.displayName` via
4232
+ * {@link normalizeWalletDisplayName}. Multi-chain registrations of the
4233
+ * same self-described wallet (e.g. Phantom on EVM and Solana) collapse
4234
+ * onto the same tile because each announces the same display name.
4235
+ *
4236
+ * @param params.chain - The provider's chain (used to strip the suffix).
4237
+ * @param params.walletBook - The fetched wallet book.
4238
+ * @param params.walletProvider - The registered wallet provider.
4239
+ * @returns The wallet option key for this provider.
4240
+ * @not-instrumented
4241
+ */
4242
+ const findWalletOptionKeyForProviderKey = ({ chain, walletBook, walletProvider }) => {
4243
+ const { normalizedWalletNameWithChain } = require_getVerifiedCredentialForWalletAccount.splitWalletProviderKey(walletProvider.key);
4244
+ const candidates = [normalizedWalletNameWithChain, stripChainSuffix({
4245
+ chain,
4246
+ normalizedName: normalizedWalletNameWithChain
4247
+ })];
4248
+ for (const candidate of candidates) {
4249
+ const directHit = walletBook.wallets[candidate];
4250
+ if (directHit) return resolveWalletOptionKey({
4251
+ fallback: candidate,
4252
+ wallet: directHit
4253
+ });
4254
+ }
4255
+ for (const candidate of candidates) {
4256
+ const nameMatchKey = findByNameMatch({
4257
+ candidate,
4258
+ walletBook
4259
+ });
4260
+ if (nameMatchKey) return resolveWalletOptionKey({
4261
+ fallback: nameMatchKey,
4262
+ wallet: walletBook.wallets[nameMatchKey]
4263
+ });
4264
+ }
4265
+ return normalizeWalletDisplayName(walletProvider.metadata.displayName);
4266
+ };
4267
+
4268
+ //#endregion
4269
+ //#region src/modules/walletOptionsCatalogue/buildWithWalletProviderOptions/buildWithWalletProviderOptions.ts
4270
+ /**
4271
+ * Converts each registered wallet provider entry into a
4272
+ * `WithWalletProviderConnectionOption` paired with its target wallet
4273
+ * option key and the provider's display override. Every classifiable
4274
+ * entry surfaces in the catalogue; the outer transformer uses the
4275
+ * carried `displayOverride` to override any wallet book branding for
4276
+ * that key (provider self-announcement wins over book).
4277
+ *
4278
+ * Entries whose registration priority is not recognised by
4279
+ * `classifyWithWalletProviderSource` are dropped from the catalogue and
4280
+ * an error is logged so Datadog surfaces the unknown registration path —
4281
+ * in production this should never happen, every chain extension is
4282
+ * expected to register with one of the documented priorities.
4283
+ *
4284
+ * @param params.entries - Snapshot of the registry's entries.
4285
+ * @param params.walletBook - The fetched wallet book.
4286
+ * @param client - The Dynamic client (used for logging unclassifiable entries).
4287
+ * @returns An array of tagged options, in input order.
4288
+ * @not-instrumented
4289
+ */
4290
+ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
4291
+ const result = [];
4292
+ for (const entry of entries) {
4293
+ const source = classifyWithWalletProviderSource({ entry });
4294
+ if (!source) {
4295
+ require_InvalidParamError.getCore(client).logger.error("buildWithWalletProviderOptions: registered wallet provider has an unrecognised priority — unable to identify how this wallet was registered", {
4296
+ chain: entry.walletProvider.chain,
4297
+ displayName: entry.walletProvider.metadata.displayName,
4298
+ priority: entry.priority,
4299
+ walletProviderKey: entry.walletProvider.key,
4300
+ walletProviderType: entry.walletProvider.walletProviderType
4301
+ });
4302
+ continue;
4303
+ }
4304
+ const walletOptionKey = findWalletOptionKeyForProviderKey({
4305
+ chain: entry.walletProvider.chain,
4306
+ walletBook,
4307
+ walletProvider: entry.walletProvider
4308
+ });
4309
+ result.push({
4310
+ displayOverride: {
4311
+ iconUrl: entry.walletProvider.metadata.icon,
4312
+ name: entry.walletProvider.metadata.displayName
4313
+ },
4314
+ option: {
4315
+ chain: entry.walletProvider.chain,
4316
+ source,
4317
+ type: "withWalletProvider",
4318
+ walletProviderKey: entry.walletProvider.key
4319
+ },
4320
+ walletOptionKey
4321
+ });
4322
+ }
4323
+ return result;
4324
+ };
4325
+
4326
+ //#endregion
4327
+ //#region src/modules/walletOptionsCatalogue/excludedWalletOptionKeys/excludedWalletOptionKeys.ts
4328
+ /**
4329
+ * Wallet option keys `getWalletOptionsCatalogue` drops before returning.
4330
+ * Curated, product-level suppression.
4331
+ *
4332
+ * Example: Base Account SDK is the recommended entry point for
4333
+ * Coinbase-managed users, so the legacy Coinbase Wallet entries are
4334
+ * suppressed in favor of the SDK-backed `baseaccount` tile. Both the
4335
+ * wallet book group key (`coinbase`) and the normalized display-name
4336
+ * key (`coinbasewallet`) are listed so suppression holds regardless of
4337
+ * how the resolver lands on a key.
4338
+ *
4339
+ * Used in: `getWalletOptionsCatalogue`.
4340
+ */
4341
+ const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
4342
+
4343
+ //#endregion
4344
+ //#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
4345
+ /**
4346
+ * Buckets tagged connection options by their wallet option key. Preserves
4347
+ * first-seen order so that the caller's choice of
4348
+ * `walletOptionOrdering: 'relevance'` naturally inherits the upstream input
4349
+ * order (wallet book order for walletConnect/inAppBrowser/installation,
4350
+ * registry order for withWalletProvider).
4351
+ *
4352
+ * Carries through the first-seen `displayOverride` per wallet option
4353
+ * key, so the shell builder can apply provider-announced metadata on
4354
+ * top of any wallet book entry.
4355
+ *
4356
+ * @param params.options - The tagged options to group.
4357
+ * @returns A map from wallet option key to its grouped option bucket,
4358
+ * iterable in first-seen order.
4359
+ * @not-instrumented
4360
+ */
4361
+ const groupOptionsByWalletOption = ({ options }) => {
4362
+ const map = /* @__PURE__ */ new Map();
4363
+ for (const { displayOverride, option, walletOptionKey } of options) {
4364
+ const existing = map.get(walletOptionKey);
4365
+ if (existing) {
4366
+ existing.connectionOptions.push(option);
4367
+ if (!existing.displayOverride && displayOverride) existing.displayOverride = displayOverride;
4368
+ } else map.set(walletOptionKey, {
4369
+ connectionOptions: [option],
4370
+ displayOverride
4371
+ });
4372
+ }
4373
+ return map;
4374
+ };
4375
+
4376
+ //#endregion
4377
+ //#region src/modules/walletOptionsCatalogue/getConnectionOptionPriority/getConnectionOptionPriority.ts
4378
+ /**
4379
+ * Numeric priority for each `WalletConnectionOption` type. Lower values rank
4380
+ * first. Used to sort each wallet option's `connectionOptions` array so the
4381
+ * best connection path lands at index 0. Has no bearing on how the outer
4382
+ * wallet-option list is ordered — that's controlled by
4383
+ * `WalletOptionOrdering`.
4384
+ *
4385
+ * `withWalletProvider > walletConnect > inAppBrowser`
4386
+ */
4387
+ const CONNECTION_OPTION_PRIORITY = {
4388
+ inAppBrowser: 2,
4389
+ walletConnect: 1,
4390
+ withWalletProvider: 0
4391
+ };
4392
+ /**
4393
+ * Returns the numeric priority of a `WalletConnectionOption` for sorting.
4394
+ * Lower numbers rank first.
4395
+ *
4396
+ * @param params.option - The connection option to inspect.
4397
+ * @returns The numeric priority — lower is better.
4398
+ * @not-instrumented
4399
+ */
4400
+ const getConnectionOptionPriority = ({ option }) => CONNECTION_OPTION_PRIORITY[option.type];
4401
+
4402
+ //#endregion
4403
+ //#region src/modules/walletOptionsCatalogue/sortConnectionOptions/sortConnectionOptions.ts
4404
+ /**
4405
+ * Sorts a wallet option's `connectionOptions` so the most preferred option lands at
4406
+ * index 0. Primary sort is by option-type priority
4407
+ * (`withWalletProvider` > `walletConnect` > `inAppBrowser`);
4408
+ * within a type, ties break alphabetically by `chain` for deterministic
4409
+ * output across calls.
4410
+ *
4411
+ * Returns a new array — the input is not mutated.
4412
+ *
4413
+ * @param params.options - The options to sort.
4414
+ * @returns A new array in priority order.
4415
+ * @not-instrumented
4416
+ */
4417
+ const sortConnectionOptions = ({ options }) => [...options].sort((a, b) => {
4418
+ const priorityDelta = getConnectionOptionPriority({ option: a }) - getConnectionOptionPriority({ option: b });
4419
+ if (priorityDelta !== 0) return priorityDelta;
4420
+ return a.chain.localeCompare(b.chain);
4421
+ });
4422
+
4423
+ //#endregion
4424
+ //#region src/modules/legacyWalletBook/priorityWalletKeys/priorityWalletKeys.ts
4425
+ /**
4426
+ * Hand-curated list of wallet book group keys that should surface at the top
4427
+ * of catalogue listings. Lower index = higher priority. Anything not in this
4428
+ * list falls through to the secondary sort (alphabetical by name).
4429
+ *
4430
+ * Used by `sortWalletOptions` (relevance mode) and by the react-demo's
4431
+ * WalletConnect picker. Keep both in sync when adding entries.
4432
+ */
4433
+ const PRIORITY_WALLET_KEYS = [
4434
+ "metamask",
4435
+ "coinbase",
4436
+ "baseaccount",
4437
+ "phantom",
4438
+ "magiceden",
4439
+ "trust",
4440
+ "okxwallet",
4441
+ "rainbow",
4442
+ "argentx",
4443
+ "backpack",
4444
+ "xverse",
4445
+ "onekey",
4446
+ "solflare",
4447
+ "braavos",
4448
+ "brave",
4449
+ "unisat",
4450
+ "bitgetwallet",
4451
+ "coin98"
4452
+ ];
4453
+
4454
+ //#endregion
4455
+ //#region src/modules/walletOptionsCatalogue/getPriorityIndex/getPriorityIndex.ts
4456
+ /**
4457
+ * Returns the index of a wallet option in `PRIORITY_WALLET_KEYS`, or
4458
+ * `Number.POSITIVE_INFINITY` when the wallet is not in the hand-curated
4459
+ * priority list. Lower index = higher priority.
4460
+ *
4461
+ * @param params.walletOption - The wallet option to inspect.
4462
+ * @returns Numeric priority index — lower is better.
4463
+ * @not-instrumented
4464
+ */
4465
+ const getPriorityIndex = ({ walletOption }) => {
4466
+ const index = PRIORITY_WALLET_KEYS.indexOf(walletOption.key);
4467
+ return index === -1 ? Number.POSITIVE_INFINITY : index;
4468
+ };
4469
+
4470
+ //#endregion
4471
+ //#region src/modules/walletOptionsCatalogue/compareByRelevance/compareByRelevance.ts
4472
+ /**
4473
+ * Compares two wallet options for relevance ordering: priority-list index
4474
+ * first, then alphabetical-by-name as the tie-break. Suitable for passing
4475
+ * straight to `Array.prototype.sort`.
4476
+ *
4477
+ * @param params.a - First wallet option.
4478
+ * @param params.b - Second wallet option.
4479
+ * @returns Negative when `a` ranks first, positive when `b` ranks first.
4480
+ * @not-instrumented
4481
+ */
4482
+ const compareByRelevance = ({ a, b }) => {
4483
+ const aIndex = getPriorityIndex({ walletOption: a });
4484
+ const bIndex = getPriorityIndex({ walletOption: b });
4485
+ if (aIndex !== bIndex) return aIndex - bIndex;
4486
+ return a.name.localeCompare(b.name, void 0, { sensitivity: "base" });
4487
+ };
4488
+
4489
+ //#endregion
4490
+ //#region src/modules/walletOptionsCatalogue/hasAnyConnectionOption/hasAnyConnectionOption.ts
4491
+ /**
4492
+ * True when the wallet option has at least one connection — i.e. the user
4493
+ * can sign in right now. Install-only wallet options surface in the
4494
+ * catalogue too (they carry `installationUrls`) but have an empty
4495
+ * `connectionOptions` array; this predicate distinguishes them from
4496
+ * actually connectable wallets in the relevance sort.
4497
+ *
4498
+ * @param params.walletOption - The wallet option to inspect.
4499
+ * @returns True when `connectionOptions` is non-empty.
4500
+ * @not-instrumented
4501
+ */
4502
+ const hasAnyConnectionOption = ({ walletOption }) => walletOption.connectionOptions.length > 0;
4503
+
4504
+ //#endregion
4505
+ //#region src/modules/walletOptionsCatalogue/hasInstalledProvider/hasInstalledProvider.ts
4506
+ /**
4507
+ * True when the wallet option has a `withWalletProvider` connection — i.e.
4508
+ * the user already has the wallet available in the page (browser extension,
4509
+ * Wallet Standard announcement, window injection, or an SDK-backed provider
4510
+ * one of our chain extensions registered). `connectionOptions` is
4511
+ * pre-sorted, so a registered provider always sits at index 0 when present.
4512
+ *
4513
+ * @param params.walletOption - The wallet option to inspect.
4514
+ * @returns True when an installed provider is available.
4515
+ * @not-instrumented
4516
+ */
4517
+ const hasInstalledProvider = ({ walletOption }) => walletOption.connectionOptions[0]?.type === "withWalletProvider";
4518
+
4519
+ //#endregion
4520
+ //#region src/modules/walletOptionsCatalogue/sortWalletOptions/sortWalletOptions.ts
4521
+ /**
4522
+ * Sorts the outer wallet-option list. This is the only ordering controlled
4523
+ * by the customer; the inner `connectionOptions` array of each wallet
4524
+ * option is ordered separately by `sortConnectionOptions` using a fixed
4525
+ * option-type priority.
4526
+ *
4527
+ * - `'relevance'` (default): bucket wallet options into three tiers, in
4528
+ * this order:
4529
+ * 1. **Installed provider** — user already has the wallet available
4530
+ * (`withWalletProvider` at index 0).
4531
+ * 2. **Connectable** — has at least one connection (`walletConnect`
4532
+ * or `inAppBrowser`) but no installed provider.
4533
+ * 3. **Install-only** — no connection at all; only `installationUrls`.
4534
+ * Within each tier, rank by the hand-curated {@link PRIORITY_WALLET_KEYS}
4535
+ * list (MetaMask, Coinbase, Phantom, …); unknown wallets fall through to
4536
+ * alphabetical-by-name order at the tail of their tier.
4537
+ * - `'alphabetical'`: case-insensitive sort by wallet option `name`,
4538
+ * without bucketing.
4539
+ *
4540
+ * Returns a new array — the input is not mutated.
4541
+ *
4542
+ * @param params.walletOptions - The wallet options to sort.
4543
+ * @param params.ordering - The requested ordering.
4544
+ * @returns A new array in the requested order.
4545
+ * @not-instrumented
4546
+ */
4547
+ const sortWalletOptions = ({ walletOptions, ordering }) => {
4548
+ if (ordering === "alphabetical") return [...walletOptions].sort((a, b) => a.name.localeCompare(b.name, void 0, { sensitivity: "base" }));
4549
+ const installed = [];
4550
+ const connectable = [];
4551
+ const installOnly = [];
4552
+ for (const walletOption of walletOptions) if (hasInstalledProvider({ walletOption })) installed.push(walletOption);
4553
+ else if (hasAnyConnectionOption({ walletOption })) connectable.push(walletOption);
4554
+ else installOnly.push(walletOption);
4555
+ installed.sort((a, b) => compareByRelevance({
4556
+ a,
4557
+ b
4558
+ }));
4559
+ connectable.sort((a, b) => compareByRelevance({
4560
+ a,
4561
+ b
4562
+ }));
4563
+ installOnly.sort((a, b) => compareByRelevance({
4564
+ a,
4565
+ b
4566
+ }));
4567
+ return [
4568
+ ...installed,
4569
+ ...connectable,
4570
+ ...installOnly
4571
+ ];
4572
+ };
4573
+
4574
+ //#endregion
4575
+ //#region src/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.ts
4576
+ const EMPTY_WALLET_BOOK = {
4577
+ groups: {},
4578
+ wallets: {}
4579
+ };
4580
+ /**
4581
+ * Returns a catalogue of the external wallet options a user can sign in
4582
+ * with through this client. Each wallet option carries an ordered
4583
+ * `connectionOptions` array — `withWalletProvider` (direct), `walletConnect`
4584
+ * (deeplink/QR), or `inAppBrowser` (mobile webview). Wallet options without
4585
+ * any matching connections are omitted.
4586
+ *
4587
+ * `includeWithWalletProvider` defaults to `true`; all other inclusion flags
4588
+ * are opt-in. `walletOptionOrdering` defaults to `'relevance'` (Dynamic's
4589
+ * recommended order); pass `'alphabetical'` to sort by wallet option name
4590
+ * within each option-priority tier.
4591
+ *
4592
+ * The wallet book is fetched only when an enabled flag needs it
4593
+ * (`includeWalletConnect`, `includeInAppBrowser`). Calls that only need
4594
+ * `includeWithWalletProvider` skip the fetch entirely.
4595
+ *
4596
+ * @param [params] - Inclusion flags + ordering preference.
4597
+ * @param [client] - The Dynamic client instance. Only required when using multiple Dynamic clients.
4598
+ * @returns A promise that resolves to the wallet options catalogue.
4599
+ * @not-instrumented
4600
+ */
4601
+ const getWalletOptionsCatalogue = async (params = {}, client = require_InvalidParamError.getDefaultClient()) => {
4602
+ const includeWithWalletProvider = params.includeWithWalletProvider ?? true;
4603
+ const includeWalletConnect = params.includeWalletConnect ?? false;
4604
+ const includeInAppBrowser = params.includeInAppBrowser ?? false;
4605
+ const includeInstallation = params.includeInstallation ?? false;
4606
+ const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
4607
+ if (!includeWithWalletProvider && !includeWalletConnect && !includeInAppBrowser && !includeInstallation) return [];
4608
+ const walletBook = includeWalletConnect || includeInAppBrowser || includeInstallation ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
4609
+ const allConnectionOptions = [];
4610
+ if (includeWithWalletProvider) {
4611
+ const entries = require_getVerifiedCredentialForWalletAccount.getWalletProviderRegistry(client).listProviderEntries();
4612
+ allConnectionOptions.push(...buildWithWalletProviderOptions({
4613
+ entries,
4614
+ walletBook
4615
+ }, client));
4616
+ }
4617
+ if (includeWalletConnect) allConnectionOptions.push(...buildWalletConnectOptions({ walletBook }));
4618
+ if (includeInAppBrowser) allConnectionOptions.push(...buildInAppBrowserOptions({ walletBook }));
4619
+ const installationUrlsByKey = includeInstallation ? buildInstallationUrlsByWalletOptionKey({ walletBook }) : /* @__PURE__ */ new Map();
4620
+ const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
4621
+ const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
4622
+ const walletOptions = [];
4623
+ for (const walletOptionKey of allWalletOptionKeys) {
4624
+ if (EXCLUDED_WALLET_OPTION_KEYS.has(walletOptionKey)) continue;
4625
+ const groupedEntry = grouped.get(walletOptionKey);
4626
+ const connectionOptions = groupedEntry ? sortConnectionOptions({ options: groupedEntry.connectionOptions }) : [];
4627
+ walletOptions.push(buildWalletOption({
4628
+ connectionOptions,
4629
+ displayOverride: groupedEntry?.displayOverride,
4630
+ installationUrls: installationUrlsByKey.get(walletOptionKey),
4631
+ walletBook,
4632
+ walletOptionKey
4633
+ }));
4634
+ }
4635
+ return sortWalletOptions({
4636
+ ordering: walletOptionOrdering,
4637
+ walletOptions
4638
+ });
4639
+ };
4640
+
3695
4641
  //#endregion
3696
4642
  //#region src/modules/user/updateUser/updateUser.ts
3697
4643
  /**
@@ -5721,9 +6667,9 @@ const getChainIdForAccountVerification = async ({ walletProvider }) => {
5721
6667
  /** @not-instrumented */
5722
6668
  const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client) => {
5723
6669
  const core = require_InvalidParamError.getCore(client);
5724
- const universalLink = core.metadata?.universalLink;
5725
- require_InvalidParamError.assertDefined(universalLink, "Universal link is not set");
5726
- const url = new URL(universalLink);
6670
+ const { appUniversalLink } = require_getNetworkProviderFromNetworkId.getAppMetadata(client);
6671
+ require_InvalidParamError.assertDefined(appUniversalLink, "Universal link is not set");
6672
+ const url = new URL(appUniversalLink);
5727
6673
  const domain = url.host;
5728
6674
  const nonce = nonceOverride ?? await require_InvalidParamError.getNonce(client);
5729
6675
  const walletProvider = require_getVerifiedCredentialForWalletAccount.getWalletProviderFromWalletAccount({ walletAccount }, client);
@@ -6684,6 +7630,7 @@ exports.deleteUser = __deleteUser_wrapped;
6684
7630
  exports.detectDeviceRegistrationRedirect = detectDeviceRegistrationRedirect;
6685
7631
  exports.detectOAuthRedirect = detectOAuthRedirect;
6686
7632
  exports.detectSocialRedirectUrl = detectSocialRedirectUrl;
7633
+ exports.excludeInstalledFromCatalog = excludeInstalledFromCatalog;
6687
7634
  exports.executeSwapTransaction = __executeSwapTransaction_wrapped;
6688
7635
  exports.fetchProjectSettings = require_getNetworkProviderFromNetworkId.fetchProjectSettings;
6689
7636
  exports.findMissingGoogleDriveBackupScopes = findMissingGoogleDriveBackupScopes;
@@ -6722,6 +7669,7 @@ exports.getWalletAccountFromAddress = getWalletAccountFromAddress;
6722
7669
  exports.getWalletAccounts = require_getVerifiedCredentialForWalletAccount.getWalletAccounts;
6723
7670
  exports.getWalletConnectCatalog = getWalletConnectCatalog;
6724
7671
  exports.getWalletConnectCatalogWalletByWalletProviderKey = getWalletConnectCatalogWalletByWalletProviderKey;
7672
+ exports.getWalletOptionsCatalogue = getWalletOptionsCatalogue;
6725
7673
  exports.getWalletProviderDataByKey = getWalletProviderDataByKey;
6726
7674
  exports.hasAllGoogleDriveBackupScopes = hasAllGoogleDriveBackupScopes;
6727
7675
  exports.hasExtension = require_getNetworkProviderFromNetworkId.hasExtension;
@@ -6740,6 +7688,7 @@ exports.isUserMissingMfaAuth = require_getVerifiedCredentialForWalletAccount.isU
6740
7688
  exports.isUserOnboardingComplete = isUserOnboardingComplete;
6741
7689
  exports.isWalletAccountVerified = isWalletAccountVerified;
6742
7690
  exports.logout = logout;
7691
+ exports.matchWalletProvidersToCatalogGroup = matchWalletProvidersToCatalogGroup;
6743
7692
  exports.offEvent = require_getVerifiedCredentialForWalletAccount.offEvent;
6744
7693
  exports.offWalletProviderEvent = offWalletProviderEvent;
6745
7694
  exports.onEvent = require_getVerifiedCredentialForWalletAccount.onEvent;