@dynamic-labs-sdk/client 1.31.0 → 1.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{apiClient-DpzKqY39.native.esm.js → apiClient-BZfdx9fH.native.esm.js} +2 -2
- package/dist/{apiClient-DpzKqY39.native.esm.js.map → apiClient-BZfdx9fH.native.esm.js.map} +1 -1
- 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 +8 -8
- package/dist/core.native.esm.js.map +1 -1
- package/dist/exports/core.d.ts +4 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +1 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BN2jUhHm.esm.js → getNetworkProviderFromNetworkId-CbMpiSub.esm.js} +24 -20
- package/dist/{getNetworkProviderFromNetworkId-BN2jUhHm.esm.js.map → getNetworkProviderFromNetworkId-CbMpiSub.esm.js.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-BoNAPSjx.cjs → getNetworkProviderFromNetworkId-DNIuJp20.cjs} +23 -19
- package/dist/{getNetworkProviderFromNetworkId-BoNAPSjx.cjs.map → getNetworkProviderFromNetworkId-DNIuJp20.cjs.map} +1 -1
- package/dist/{getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js → getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js} +30 -26
- package/dist/getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-9ADIJCl1.cjs → getSignedSessionId--wpV_VKs.cjs} +3 -3
- package/dist/{getSignedSessionId-9ADIJCl1.cjs.map → getSignedSessionId--wpV_VKs.cjs.map} +1 -1
- package/dist/{getSignedSessionId-DxpqG4pv.esm.js → getSignedSessionId-DHn6yhGX.esm.js} +3 -3
- package/dist/{getSignedSessionId-DxpqG4pv.esm.js.map → getSignedSessionId-DHn6yhGX.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-Dr4Ic68X.native.esm.js → getSignedSessionId-DKKSCpj9.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-Dr4Ic68X.native.esm.js.map → getSignedSessionId-DKKSCpj9.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-C2o5idph.cjs → getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-C2o5idph.cjs.map → getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js → getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-Cjwoeej7.esm.js.map → getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js.map} +1 -1
- package/dist/index.cjs +145 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +145 -60
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +147 -62
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-DuSU67yq.native.esm.js → isMfaRequiredForAction-CC7bjhqy.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-DuSU67yq.native.esm.js.map → isMfaRequiredForAction-CC7bjhqy.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-BIBmJbV9.esm.js → isMfaRequiredForAction-D1a1Nudo.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BIBmJbV9.esm.js.map → isMfaRequiredForAction-D1a1Nudo.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-yM84r7l7.cjs → isMfaRequiredForAction-YjJLLFFs.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-yM84r7l7.cjs.map → isMfaRequiredForAction-YjJLLFFs.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-DCIlkCub.native.esm.js → isUserOnboardingComplete-BIjk67vX.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DCIlkCub.native.esm.js.map → isUserOnboardingComplete-BIjk67vX.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-BRTOnK8V.cjs → isUserOnboardingComplete-C2ZuLDT9.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-BRTOnK8V.cjs.map → isUserOnboardingComplete-C2ZuLDT9.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-B2Ha2dkP.esm.js → isUserOnboardingComplete-C4bE5xqM.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-B2Ha2dkP.esm.js.map → isUserOnboardingComplete-C4bE5xqM.esm.js.map} +1 -1
- package/dist/{logoutWithReason-HqGlUccb.native.esm.js → logoutWithReason-BcWQGREO.native.esm.js} +2 -2
- package/dist/{logoutWithReason-HqGlUccb.native.esm.js.map → logoutWithReason-BcWQGREO.native.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DV89zJmJ.esm.js → logoutWithReason-BqsgA8gI.esm.js} +2 -2
- package/dist/{logoutWithReason-DV89zJmJ.esm.js.map → logoutWithReason-BqsgA8gI.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DlA15deT.cjs → logoutWithReason-D6ruPOvJ.cjs} +2 -2
- package/dist/{logoutWithReason-DlA15deT.cjs.map → logoutWithReason-D6ruPOvJ.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-DnQsGmIW.native.esm.js → migrateFromFireblocks-BxPgqhbu.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-DnQsGmIW.native.esm.js.map → migrateFromFireblocks-BxPgqhbu.native.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-CqIpxGRS.cjs → migrateFromFireblocks-CCNTDCmW.cjs} +2 -2
- package/dist/{migrateFromFireblocks-CqIpxGRS.cjs.map → migrateFromFireblocks-CCNTDCmW.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js → migrateFromFireblocks-zazAx6WV.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-CiOS4_Nq.esm.js.map → migrateFromFireblocks-zazAx6WV.esm.js.map} +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts +9 -1
- package/dist/modules/walletOptionsCatalogue/buildInAppBrowserOptions/buildInAppBrowserOptions.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts +7 -1
- package/dist/modules/walletOptionsCatalogue/buildInstallationUrlsByWalletOptionKey/buildInstallationUrlsByWalletOptionKey.d.ts.map +1 -1
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.d.ts +30 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts +2 -0
- package/dist/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/index.d.ts.map +1 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts +4 -0
- package/dist/modules/walletOptionsCatalogue/getWalletOptionsCatalogue/getWalletOptionsCatalogue.d.ts.map +1 -1
- package/dist/modules/wallets/networks/getEnabledChains/getEnabledChains.d.ts +25 -0
- package/dist/modules/wallets/networks/getEnabledChains/getEnabledChains.d.ts.map +1 -0
- package/dist/modules/wallets/networks/getEnabledChains/index.d.ts +2 -0
- package/dist/modules/wallets/networks/getEnabledChains/index.d.ts.map +1 -0
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.d.ts +2 -1
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/createNetworkProviderBuilderRegistry/createNetworkProviderBuilderRegistry.d.ts.map +1 -1
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/events.d.ts +16 -0
- package/dist/modules/wallets/networks/networkProviderBuilderRegistry/events.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/{waas-CUDgU2pl.esm.js → waas-C2PbR02F.esm.js} +4 -4
- package/dist/{waas-CUDgU2pl.esm.js.map → waas-C2PbR02F.esm.js.map} +1 -1
- package/dist/{waas-CkQYVo6U.native.esm.js → waas-DidjjQjB.native.esm.js} +4 -4
- package/dist/{waas-CkQYVo6U.native.esm.js.map → waas-DidjjQjB.native.esm.js.map} +1 -1
- package/dist/{waas-BOKafCeH.cjs → waas-ZWlJHeXc.cjs} +4 -4
- package/dist/{waas-BOKafCeH.cjs.map → waas-ZWlJHeXc.cjs.map} +1 -1
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +4 -4
- package/dist/waas.native.esm.js +4 -4
- package/dist/waasCore.cjs +5 -5
- package/dist/waasCore.esm.js +5 -5
- package/dist/waasCore.native.esm.js +5 -5
- package/package.json +2 -2
- package/dist/getNetworkProviderFromNetworkId-DUym3Qq0.native.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { $ as updateNoncePoolStorage, A as getWalletProviders, C as initializeWaasClientsForEagerRecovery, Ct as BaseError, Et as version, F as onEvent, G as splitWalletProviderKey, H as CHAINS_INFO_MAP, I as onceEvent, M as getWalletProviderRegistry, N as emitEvent, P as offEvent, Q as fetchAndStoreNonces, R as getWalletAccounts, St as getCore, Tt as name, U as formatWalletAccountId, V as getChainFromVerifiedCredentialChain, W as normalizeAddress, Z as getNonce, _ as upsertElevatedAccessToken, _t as randomString, a as retryOnFail, at as MfaInvalidOtpError, b as InvalidParamError, bt as setDefaultClient, c as createApiClient, ct as APIError, d as scrubParameters, dt as SDK_API_CORE_VERSION, et as createStorageKeySchema, f as DEFAULT_PII_FIELDS, g as updateAuthFromVerifyResponse, gt as getElevatedAccessToken, h as extractSessionId, ht as ValueMustBeDefinedError, i as isSignedIn, it as MfaRateLimitedError, j as WalletProviderPriority, l as __refreshAuth_wrapped, m as getOperatingSystem, mt as assertDefined, n as generateSessionKeys, nt as UnauthorizedError, o as getWalletProviderFromWalletAccount, ot as LinkCredentialError, p as getUserAgent, pt as isCookieEnabled, q as isUserMissingMfaAuth, r as fetchProjectSettings, rt as SandboxMaximumThresholdReachedError, s as NoWalletProviderFoundError, st as InvalidExternalAuthError, t as __logoutWithReason_wrapped, tt as NONCE_POOL_SIZE, u as instrumentFunction, ut as DYNAMIC_ICONIC_SPRITE_URL, v as parseElevatedAccessToken, vt as getPlatform, wt as TokenScope, x as checkAndRaiseWalletAccountsChangedEvent, y as decodeJwt, yt as getDefaultClient } from "./logoutWithReason-
|
|
2
|
-
import { a as TransactionBroadcastError, i as NotWaasWalletAccountError } from "./migrateFromFireblocks-
|
|
3
|
-
import { Q as WaasChainEnum } from "./waas-
|
|
4
|
-
import { A as createEventEmitter, B as REFRESH_USER_STATE_FROM_VALID_TOKEN_TRACKER_KEY, C as getKeychainIndexedDBName, D as assertSafeNavigationUrl, E as createKeychainService, F as createAppForegroundSubscriber, H as subscribeWithSelector, I as FETCH_PROJECT_SETTINGS_TRACKER_KEY, J as UnavailableInServerSideError, K as createLocalStorageAdapter, L as GENERATE_SESSION_KEYS_TRACKER_KEY, N as CannotTrackError, P as createDeferredPromise, R as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, S as MergeAccountsConfirmationError, T as assertSafeDeeplinkUrl, U as isEqualShallow, V as getBuffer, W as createStorage, _ as consumeCaptchaToken, a as
|
|
5
|
-
import { n as getWalletProviderByKey, t as getVerifiedCredentialForWalletAccount } from "./getVerifiedCredentialForWalletAccount-
|
|
6
|
-
import { a as WaasRbacStaleRetryUnsafeError, i as preconnectWaasIframe, n as isPendingRecoveryCodesAcknowledgment, o as WaasOnboardingIncompleteError, r as isDeviceRegistrationRequired, s as WaasLoadFailedError, t as isUserOnboardingComplete } from "./isUserOnboardingComplete-
|
|
7
|
-
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
1
|
+
import { $ as updateNoncePoolStorage, A as getWalletProviders, C as initializeWaasClientsForEagerRecovery, Ct as BaseError, Et as version, F as onEvent, G as splitWalletProviderKey, H as CHAINS_INFO_MAP, I as onceEvent, M as getWalletProviderRegistry, N as emitEvent, P as offEvent, Q as fetchAndStoreNonces, R as getWalletAccounts, St as getCore, Tt as name, U as formatWalletAccountId, V as getChainFromVerifiedCredentialChain, W as normalizeAddress, Z as getNonce, _ as upsertElevatedAccessToken, _t as randomString, a as retryOnFail, at as MfaInvalidOtpError, b as InvalidParamError, bt as setDefaultClient, c as createApiClient, ct as APIError, d as scrubParameters, dt as SDK_API_CORE_VERSION, et as createStorageKeySchema, f as DEFAULT_PII_FIELDS, g as updateAuthFromVerifyResponse, gt as getElevatedAccessToken, h as extractSessionId, ht as ValueMustBeDefinedError, i as isSignedIn, it as MfaRateLimitedError, j as WalletProviderPriority, l as __refreshAuth_wrapped, m as getOperatingSystem, mt as assertDefined, n as generateSessionKeys, nt as UnauthorizedError, o as getWalletProviderFromWalletAccount, ot as LinkCredentialError, p as getUserAgent, pt as isCookieEnabled, q as isUserMissingMfaAuth, r as fetchProjectSettings, rt as SandboxMaximumThresholdReachedError, s as NoWalletProviderFoundError, st as InvalidExternalAuthError, t as __logoutWithReason_wrapped, tt as NONCE_POOL_SIZE, u as instrumentFunction, ut as DYNAMIC_ICONIC_SPRITE_URL, v as parseElevatedAccessToken, vt as getPlatform, wt as TokenScope, x as checkAndRaiseWalletAccountsChangedEvent, y as decodeJwt, yt as getDefaultClient } from "./logoutWithReason-BqsgA8gI.esm.js";
|
|
2
|
+
import { a as TransactionBroadcastError, i as NotWaasWalletAccountError } from "./migrateFromFireblocks-zazAx6WV.esm.js";
|
|
3
|
+
import { Q as WaasChainEnum } from "./waas-C2PbR02F.esm.js";
|
|
4
|
+
import { A as createEventEmitter, B as REFRESH_USER_STATE_FROM_VALID_TOKEN_TRACKER_KEY, C as getKeychainIndexedDBName, D as assertSafeNavigationUrl, E as createKeychainService, F as createAppForegroundSubscriber, H as subscribeWithSelector, I as FETCH_PROJECT_SETTINGS_TRACKER_KEY, J as UnavailableInServerSideError, K as createLocalStorageAdapter, L as GENERATE_SESSION_KEYS_TRACKER_KEY, N as CannotTrackError, P as createDeferredPromise, R as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, S as MergeAccountsConfirmationError, T as assertSafeDeeplinkUrl, U as isEqualShallow, V as getBuffer, W as createStorage, _ as consumeCaptchaToken, a as removeUnverifiedWalletAccount, b as WalletAlreadyLinkedToAnotherUserError, c as getAppMetadata, d as setUnverifiedWalletAccounts, f as createVisit, g as MethodNotImplementedError, h as __setCaptchaToken_wrapped, i as verifyMessageSignatureOwnership, j as createCrossTabBroadcast, k as createLogger, l as reconcileWalletAccountsAgainstClient, m as hasExtension, o as createSignInMessageStatement, p as getNetworkProviderBuilderRegistry, q as isServerSideRendering, r as getNetworksData, s as formatSignInMessage, t as getNetworkProviderFromNetworkId, u as updateWalletProviderKeysForVerifiedCredentials, v as isCaptchaRequired, w as createRealtimeService, x as NoNetworkProvidersError, y as WalletScreeningBlockedError, z as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY } from "./getNetworkProviderFromNetworkId-CbMpiSub.esm.js";
|
|
5
|
+
import { n as getWalletProviderByKey, t as getVerifiedCredentialForWalletAccount } from "./getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js";
|
|
6
|
+
import { a as WaasRbacStaleRetryUnsafeError, i as preconnectWaasIframe, n as isPendingRecoveryCodesAcknowledgment, o as WaasOnboardingIncompleteError, r as isDeviceRegistrationRequired, s as WaasLoadFailedError, t as isUserOnboardingComplete } from "./isUserOnboardingComplete-C4bE5xqM.esm.js";
|
|
7
|
+
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-D1a1Nudo.esm.js";
|
|
8
8
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
9
9
|
import { AuthModeEnum, CaptchaProviderEnum as CaptchaProviderEnum$1, ChainEnum, ExchangeKeyEnum, JwtVerifiedCredentialFormatEnum as JwtVerifiedCredentialFormatEnum$1, MFAAction as MFAAction$1, MfaBackupCodeAcknowledgement, ProviderEnum as ProviderEnum$1, TokenScope as TokenScope$1, WaasBackupOptionsEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
10
10
|
import * as z from "zod/mini";
|
|
@@ -7340,6 +7340,77 @@ const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
|
7340
7340
|
if (isChromeBrowser()) return installationUrls.chrome;
|
|
7341
7341
|
};
|
|
7342
7342
|
|
|
7343
|
+
//#endregion
|
|
7344
|
+
//#region src/modules/wallets/networks/getEnabledChains/getEnabledChains.ts
|
|
7345
|
+
/**
|
|
7346
|
+
* Returns the chains this client can operate on — a chain is enabled once
|
|
7347
|
+
* one of its extensions has been added (`addEvmExtension`,
|
|
7348
|
+
* `addSolanaExtension`, …), since every chain extension registers a
|
|
7349
|
+
* network provider builder for its chain.
|
|
7350
|
+
*
|
|
7351
|
+
* Reading the builder registry keeps chain awareness out of the client
|
|
7352
|
+
* package: the set is whatever the extensions registered, so no
|
|
7353
|
+
* chain-specific branch is needed here.
|
|
7354
|
+
*
|
|
7355
|
+
* @param client - The Dynamic client instance.
|
|
7356
|
+
* @returns The set of chains the client has an extension for.
|
|
7357
|
+
* @example
|
|
7358
|
+
* ```typescript
|
|
7359
|
+
* // client created with addEvmExtension only
|
|
7360
|
+
* getEnabledChains(client); // Set { 'EVM' }
|
|
7361
|
+
* ```
|
|
7362
|
+
* @see {@link getNetworkProviderBuilderRegistry} for the registry the chains are read from.
|
|
7363
|
+
* @see {@link getNetworkProviders} for the other consumer of that registry.
|
|
7364
|
+
* @notInstrumented
|
|
7365
|
+
*/
|
|
7366
|
+
const getEnabledChains = (client) => {
|
|
7367
|
+
const networkProviderBuilderRegistry = getNetworkProviderBuilderRegistry(client);
|
|
7368
|
+
return new Set(networkProviderBuilderRegistry.get().keys());
|
|
7369
|
+
};
|
|
7370
|
+
|
|
7371
|
+
//#endregion
|
|
7372
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7373
|
+
/**
|
|
7374
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
7375
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7376
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7377
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7378
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7379
|
+
*
|
|
7380
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7381
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7382
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
7383
|
+
* one option.
|
|
7384
|
+
*
|
|
7385
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
7386
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7387
|
+
* @returns Ordered, deduped array of Chains.
|
|
7388
|
+
* @notInstrumented
|
|
7389
|
+
*/
|
|
7390
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7391
|
+
const chains = /* @__PURE__ */ new Set();
|
|
7392
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
7393
|
+
if (!entry.chain) continue;
|
|
7394
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7395
|
+
if (chain) chains.add(chain);
|
|
7396
|
+
}
|
|
7397
|
+
for (const identifier of wallet.chains ?? []) {
|
|
7398
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7399
|
+
try {
|
|
7400
|
+
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
7401
|
+
chains.add(chain);
|
|
7402
|
+
} catch {}
|
|
7403
|
+
}
|
|
7404
|
+
if (chains.size === 0) {
|
|
7405
|
+
const chain = getChainFromWalletSchema({
|
|
7406
|
+
wallet,
|
|
7407
|
+
walletKey
|
|
7408
|
+
});
|
|
7409
|
+
chains.add(chain);
|
|
7410
|
+
}
|
|
7411
|
+
return Array.from(chains);
|
|
7412
|
+
};
|
|
7413
|
+
|
|
7343
7414
|
//#endregion
|
|
7344
7415
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
7345
7416
|
/**
|
|
@@ -7385,11 +7456,17 @@ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wall
|
|
|
7385
7456
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
7386
7457
|
* "external wallet" stays consistent across option types.
|
|
7387
7458
|
*
|
|
7459
|
+
* A wallet's in-app browser opens a single session, so it emits one option
|
|
7460
|
+
* tagged with the first chain it advertises that the client has an
|
|
7461
|
+
* extension for — a multi-chain wallet is still reachable when only one of
|
|
7462
|
+
* its chains is enabled.
|
|
7463
|
+
*
|
|
7464
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7388
7465
|
* @param params.walletBook - The fetched wallet book.
|
|
7389
7466
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
7390
7467
|
* @notInstrumented
|
|
7391
7468
|
*/
|
|
7392
|
-
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
7469
|
+
const buildInAppBrowserOptions = ({ enabledChains, walletBook }) => {
|
|
7393
7470
|
const result = [];
|
|
7394
7471
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7395
7472
|
if (shouldFilterWallet({
|
|
@@ -7398,12 +7475,14 @@ const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
|
7398
7475
|
})) continue;
|
|
7399
7476
|
const url = getInAppBrowserUrl({ wallet });
|
|
7400
7477
|
if (!url) continue;
|
|
7478
|
+
const chain = getChainsFromWalletSchema({
|
|
7479
|
+
wallet,
|
|
7480
|
+
walletKey
|
|
7481
|
+
}).find((advertisedChain) => enabledChains.has(advertisedChain));
|
|
7482
|
+
if (!chain) continue;
|
|
7401
7483
|
result.push({
|
|
7402
7484
|
option: {
|
|
7403
|
-
chain
|
|
7404
|
-
wallet,
|
|
7405
|
-
walletKey
|
|
7406
|
-
}),
|
|
7485
|
+
chain,
|
|
7407
7486
|
type: "inAppBrowser",
|
|
7408
7487
|
url
|
|
7409
7488
|
},
|
|
@@ -7476,17 +7555,25 @@ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
|
7476
7555
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
7477
7556
|
* not appear here either — they're not user-installable products.
|
|
7478
7557
|
*
|
|
7558
|
+
* Wallets that advertise no chain this client has an extension for are
|
|
7559
|
+
* skipped: installing them would not make them connectable.
|
|
7560
|
+
*
|
|
7561
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7479
7562
|
* @param params.walletBook - The fetched wallet book.
|
|
7480
7563
|
* @returns A map from wallet option key to its install URL bag.
|
|
7481
7564
|
* @notInstrumented
|
|
7482
7565
|
*/
|
|
7483
|
-
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
7566
|
+
const buildInstallationUrlsByWalletOptionKey = ({ enabledChains, walletBook }) => {
|
|
7484
7567
|
const map = /* @__PURE__ */ new Map();
|
|
7485
7568
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7486
7569
|
if (shouldFilterWallet({
|
|
7487
7570
|
wallet,
|
|
7488
7571
|
walletKey
|
|
7489
7572
|
})) continue;
|
|
7573
|
+
if (!getChainsFromWalletSchema({
|
|
7574
|
+
wallet,
|
|
7575
|
+
walletKey
|
|
7576
|
+
}).some((chain) => enabledChains.has(chain))) continue;
|
|
7490
7577
|
const urls = buildInstallationUrls({ wallet });
|
|
7491
7578
|
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
7492
7579
|
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
@@ -7578,49 +7665,6 @@ const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
|
7578
7665
|
return [];
|
|
7579
7666
|
};
|
|
7580
7667
|
|
|
7581
|
-
//#endregion
|
|
7582
|
-
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7583
|
-
/**
|
|
7584
|
-
* Returns every chain a wallet book entry advertises support for —
|
|
7585
|
-
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7586
|
-
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7587
|
-
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7588
|
-
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7589
|
-
*
|
|
7590
|
-
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7591
|
-
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7592
|
-
* never returns an empty array — every eligible wallet emits at least
|
|
7593
|
-
* one option.
|
|
7594
|
-
*
|
|
7595
|
-
* @param params.wallet - The wallet schema from the wallet book.
|
|
7596
|
-
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7597
|
-
* @returns Ordered, deduped array of Chains.
|
|
7598
|
-
* @notInstrumented
|
|
7599
|
-
*/
|
|
7600
|
-
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7601
|
-
const chains = /* @__PURE__ */ new Set();
|
|
7602
|
-
for (const entry of wallet.injectedConfig ?? []) {
|
|
7603
|
-
if (!entry.chain) continue;
|
|
7604
|
-
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7605
|
-
if (chain) chains.add(chain);
|
|
7606
|
-
}
|
|
7607
|
-
for (const identifier of wallet.chains ?? []) {
|
|
7608
|
-
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7609
|
-
try {
|
|
7610
|
-
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
7611
|
-
chains.add(chain);
|
|
7612
|
-
} catch {}
|
|
7613
|
-
}
|
|
7614
|
-
if (chains.size === 0) {
|
|
7615
|
-
const chain = getChainFromWalletSchema({
|
|
7616
|
-
wallet,
|
|
7617
|
-
walletKey
|
|
7618
|
-
});
|
|
7619
|
-
chains.add(chain);
|
|
7620
|
-
}
|
|
7621
|
-
return Array.from(chains);
|
|
7622
|
-
};
|
|
7623
|
-
|
|
7624
7668
|
//#endregion
|
|
7625
7669
|
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
7626
7670
|
/**
|
|
@@ -8005,6 +8049,31 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
8005
8049
|
*/
|
|
8006
8050
|
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
8007
8051
|
|
|
8052
|
+
//#endregion
|
|
8053
|
+
//#region src/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.ts
|
|
8054
|
+
/**
|
|
8055
|
+
* Drops options whose chain has no extension on this client. The wallet
|
|
8056
|
+
* book advertises every chain a wallet supports, so options derived from
|
|
8057
|
+
* it have to be narrowed to the chains the client can actually connect
|
|
8058
|
+
* on — otherwise the catalogue surfaces a connection the customer has no
|
|
8059
|
+
* primitive to drive.
|
|
8060
|
+
*
|
|
8061
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
8062
|
+
* @param params.options - The tagged options to narrow.
|
|
8063
|
+
* @returns The options on enabled chains, in input order.
|
|
8064
|
+
* @example
|
|
8065
|
+
* ```typescript
|
|
8066
|
+
* filterConnectionOptionsByEnabledChains({
|
|
8067
|
+
* enabledChains: new Set(['EVM']),
|
|
8068
|
+
* options: [evmOption, solOption],
|
|
8069
|
+
* }); // [evmOption]
|
|
8070
|
+
* ```
|
|
8071
|
+
* @see {@link getEnabledChains} for how the enabled chains are derived.
|
|
8072
|
+
* @see {@link getWalletOptionsCatalogue} for the catalogue that applies this filter.
|
|
8073
|
+
* @notInstrumented
|
|
8074
|
+
*/
|
|
8075
|
+
const filterConnectionOptionsByEnabledChains = ({ enabledChains, options }) => options.filter(({ option }) => enabledChains.has(option.chain));
|
|
8076
|
+
|
|
8008
8077
|
//#endregion
|
|
8009
8078
|
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
8010
8079
|
/**
|
|
@@ -8249,6 +8318,10 @@ const EMPTY_WALLET_BOOK = {
|
|
|
8249
8318
|
* pass `includeMobileOptions: true` to additionally surface
|
|
8250
8319
|
* WalletConnect, in-app-browser, and install links.
|
|
8251
8320
|
*
|
|
8321
|
+
* Options sourced from the wallet book are scoped to the chains this
|
|
8322
|
+
* client has an extension for — a wallet is only surfaced on chains the
|
|
8323
|
+
* customer can actually connect on.
|
|
8324
|
+
*
|
|
8252
8325
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
8253
8326
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
8254
8327
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -8264,6 +8337,7 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8264
8337
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
8265
8338
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
8266
8339
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
8340
|
+
const enabledChains = getEnabledChains(client);
|
|
8267
8341
|
const allConnectionOptions = [];
|
|
8268
8342
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
8269
8343
|
const entries = getWalletProviderRegistry(client).listProviderEntries();
|
|
@@ -8273,11 +8347,22 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8273
8347
|
}, client));
|
|
8274
8348
|
}
|
|
8275
8349
|
if (includeMobileOptions) {
|
|
8276
|
-
|
|
8277
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8278
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8350
|
+
const walletBookOptions = [];
|
|
8351
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) walletBookOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
8352
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) walletBookOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
8353
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) walletBookOptions.push(...buildInAppBrowserOptions({
|
|
8354
|
+
enabledChains,
|
|
8355
|
+
walletBook
|
|
8356
|
+
}));
|
|
8357
|
+
allConnectionOptions.push(...filterConnectionOptionsByEnabledChains({
|
|
8358
|
+
enabledChains,
|
|
8359
|
+
options: walletBookOptions
|
|
8360
|
+
}));
|
|
8279
8361
|
}
|
|
8280
|
-
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8362
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8363
|
+
enabledChains,
|
|
8364
|
+
walletBook
|
|
8365
|
+
}) : /* @__PURE__ */ new Map();
|
|
8281
8366
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
8282
8367
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
8283
8368
|
const walletOptions = [];
|