@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.native.esm.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { $ as NONCE_POOL_SIZE, A as onEvent, B as splitWalletProviderKey, D as getWalletProviderRegistry, E as WalletProviderPriority, Et as version, H as isUserMissingMfaAuth, I as getChainFromVerifiedCredentialChain, J as getNonce, L as CHAINS_INFO_MAP, N as getWalletAccounts, O as emitEvent, Q as createLocalStorageAdapter, R as formatWalletAccountId, St as BaseError, T as getWalletProviders, Tt as name, X as updateNoncePoolStorage, Y as fetchAndStoreNonces, Z as createStorageKeySchema, _t as getPlatform, a as instrumentFunction, at as InvalidExternalAuthError, c as getUserAgent, d as updateAuthFromVerifyResponse, et as UnauthorizedError, f as upsertElevatedAccessToken, ft as isCookieEnabled, g as checkAndRaiseWalletAccountsChangedEvent, gt as randomString, h as InvalidParamError, ht as getElevatedAccessToken, i as __refreshAuth_wrapped, it as LinkCredentialError, j as onceEvent, k as offEvent, l as getOperatingSystem, lt as DYNAMIC_ICONIC_SPRITE_URL, m as decodeJwt, mt as ValueMustBeDefinedError, n as NoWalletProviderFoundError, nt as MfaRateLimitedError, o as scrubParameters, ot as APIError, p as parseElevatedAccessToken, pt as assertDefined, r as createApiClient, rt as MfaInvalidOtpError, s as DEFAULT_PII_FIELDS, t as getWalletProviderFromWalletAccount, tt as SandboxMaximumThresholdReachedError, u as extractSessionId, ut as SDK_API_CORE_VERSION, v as initializeWaasClientsForEagerRecovery, vt as getDefaultClient, wt as TokenScope, xt as getCore, yt as setDefaultClient, z as normalizeAddress } from "./apiClient-
|
|
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, G as createStorage, H as getBuffer, I as FETCH_PROJECT_SETTINGS_TRACKER_KEY, 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 subscribeWithSelector, V as isServerSideRendering, W as isEqualShallow, _ as getAppMetadata, a as
|
|
5
|
-
import { a as retryOnFail, i as isSignedIn, n as generateSessionKeys, o as getVerifiedCredentialForWalletAccount, r as fetchProjectSettings, s as getWalletProviderByKey, t as __logoutWithReason_wrapped } from "./logoutWithReason-
|
|
6
|
-
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
7
|
-
import { a as WaasRbacStaleRetryUnsafeError, i as preconnectWaasIframe, n as isPendingRecoveryCodesAcknowledgment, o as WaasOnboardingIncompleteError, r as isDeviceRegistrationRequired, s as WaasLoadFailedError, t as isUserOnboardingComplete } from "./isUserOnboardingComplete-
|
|
1
|
+
import { $ as NONCE_POOL_SIZE, A as onEvent, B as splitWalletProviderKey, D as getWalletProviderRegistry, E as WalletProviderPriority, Et as version, H as isUserMissingMfaAuth, I as getChainFromVerifiedCredentialChain, J as getNonce, L as CHAINS_INFO_MAP, N as getWalletAccounts, O as emitEvent, Q as createLocalStorageAdapter, R as formatWalletAccountId, St as BaseError, T as getWalletProviders, Tt as name, X as updateNoncePoolStorage, Y as fetchAndStoreNonces, Z as createStorageKeySchema, _t as getPlatform, a as instrumentFunction, at as InvalidExternalAuthError, c as getUserAgent, d as updateAuthFromVerifyResponse, et as UnauthorizedError, f as upsertElevatedAccessToken, ft as isCookieEnabled, g as checkAndRaiseWalletAccountsChangedEvent, gt as randomString, h as InvalidParamError, ht as getElevatedAccessToken, i as __refreshAuth_wrapped, it as LinkCredentialError, j as onceEvent, k as offEvent, l as getOperatingSystem, lt as DYNAMIC_ICONIC_SPRITE_URL, m as decodeJwt, mt as ValueMustBeDefinedError, n as NoWalletProviderFoundError, nt as MfaRateLimitedError, o as scrubParameters, ot as APIError, p as parseElevatedAccessToken, pt as assertDefined, r as createApiClient, rt as MfaInvalidOtpError, s as DEFAULT_PII_FIELDS, t as getWalletProviderFromWalletAccount, tt as SandboxMaximumThresholdReachedError, u as extractSessionId, ut as SDK_API_CORE_VERSION, v as initializeWaasClientsForEagerRecovery, vt as getDefaultClient, wt as TokenScope, xt as getCore, yt as setDefaultClient, z as normalizeAddress } from "./apiClient-BZfdx9fH.native.esm.js";
|
|
2
|
+
import { a as TransactionBroadcastError, i as NotWaasWalletAccountError } from "./migrateFromFireblocks-BxPgqhbu.native.esm.js";
|
|
3
|
+
import { Q as WaasChainEnum } from "./waas-DidjjQjB.native.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, G as createStorage, H as getBuffer, I as FETCH_PROJECT_SETTINGS_TRACKER_KEY, 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 subscribeWithSelector, V as isServerSideRendering, W as isEqualShallow, _ as getAppMetadata, a as removeUnverifiedWalletAccount, b as WalletAlreadyLinkedToAnotherUserError, c as reconcileWalletAccountsAgainstClient, d as createVisit, f as getNetworkProviderBuilderRegistry, g as isCaptchaRequired, h as consumeCaptchaToken, i as verifyMessageSignatureOwnership, j as createCrossTabBroadcast, k as createLogger, l as updateWalletProviderKeysForVerifiedCredentials, m as __setCaptchaToken_wrapped, o as createSignInMessageStatement, p as hasExtension, r as getNetworksData, s as formatSignInMessage, t as getNetworkProviderFromNetworkId, u as setUnverifiedWalletAccounts, v as MethodNotImplementedError, w as createRealtimeService, x as NoNetworkProvidersError, y as WalletScreeningBlockedError, z as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY } from "./getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js";
|
|
5
|
+
import { a as retryOnFail, i as isSignedIn, n as generateSessionKeys, o as getVerifiedCredentialForWalletAccount, r as fetchProjectSettings, s as getWalletProviderByKey, t as __logoutWithReason_wrapped } from "./logoutWithReason-BcWQGREO.native.esm.js";
|
|
6
|
+
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-CC7bjhqy.native.esm.js";
|
|
7
|
+
import { a as WaasRbacStaleRetryUnsafeError, i as preconnectWaasIframe, n as isPendingRecoveryCodesAcknowledgment, o as WaasOnboardingIncompleteError, r as isDeviceRegistrationRequired, s as WaasLoadFailedError, t as isUserOnboardingComplete } from "./isUserOnboardingComplete-BIjk67vX.native.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";
|
|
11
11
|
import { Linking } from "react-native";
|
|
12
|
-
import { EventEmitter
|
|
12
|
+
import { EventEmitter } from "eventemitter3";
|
|
13
13
|
import { Passkey } from "react-native-passkey";
|
|
14
14
|
|
|
15
15
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -632,7 +632,7 @@ const createAsyncTrack = () => {
|
|
|
632
632
|
* This ensures no process is missed (as it would throw when tracked on a different node tick).
|
|
633
633
|
*/
|
|
634
634
|
let isTrackEnabled = true;
|
|
635
|
-
const eventEmitter = new EventEmitter
|
|
635
|
+
const eventEmitter = new EventEmitter();
|
|
636
636
|
const allSettledPromise = createDeferredPromise();
|
|
637
637
|
const tracker = /* @__PURE__ */ new Map();
|
|
638
638
|
/**
|
|
@@ -7367,6 +7367,77 @@ const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
|
7367
7367
|
if (isChromeBrowser()) return installationUrls.chrome;
|
|
7368
7368
|
};
|
|
7369
7369
|
|
|
7370
|
+
//#endregion
|
|
7371
|
+
//#region src/modules/wallets/networks/getEnabledChains/getEnabledChains.ts
|
|
7372
|
+
/**
|
|
7373
|
+
* Returns the chains this client can operate on — a chain is enabled once
|
|
7374
|
+
* one of its extensions has been added (`addEvmExtension`,
|
|
7375
|
+
* `addSolanaExtension`, …), since every chain extension registers a
|
|
7376
|
+
* network provider builder for its chain.
|
|
7377
|
+
*
|
|
7378
|
+
* Reading the builder registry keeps chain awareness out of the client
|
|
7379
|
+
* package: the set is whatever the extensions registered, so no
|
|
7380
|
+
* chain-specific branch is needed here.
|
|
7381
|
+
*
|
|
7382
|
+
* @param client - The Dynamic client instance.
|
|
7383
|
+
* @returns The set of chains the client has an extension for.
|
|
7384
|
+
* @example
|
|
7385
|
+
* ```typescript
|
|
7386
|
+
* // client created with addEvmExtension only
|
|
7387
|
+
* getEnabledChains(client); // Set { 'EVM' }
|
|
7388
|
+
* ```
|
|
7389
|
+
* @see {@link getNetworkProviderBuilderRegistry} for the registry the chains are read from.
|
|
7390
|
+
* @see {@link getNetworkProviders} for the other consumer of that registry.
|
|
7391
|
+
* @notInstrumented
|
|
7392
|
+
*/
|
|
7393
|
+
const getEnabledChains = (client) => {
|
|
7394
|
+
const networkProviderBuilderRegistry = getNetworkProviderBuilderRegistry(client);
|
|
7395
|
+
return new Set(networkProviderBuilderRegistry.get().keys());
|
|
7396
|
+
};
|
|
7397
|
+
|
|
7398
|
+
//#endregion
|
|
7399
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7400
|
+
/**
|
|
7401
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
7402
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7403
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7404
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7405
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7406
|
+
*
|
|
7407
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7408
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7409
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
7410
|
+
* one option.
|
|
7411
|
+
*
|
|
7412
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
7413
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7414
|
+
* @returns Ordered, deduped array of Chains.
|
|
7415
|
+
* @notInstrumented
|
|
7416
|
+
*/
|
|
7417
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7418
|
+
const chains = /* @__PURE__ */ new Set();
|
|
7419
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
7420
|
+
if (!entry.chain) continue;
|
|
7421
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7422
|
+
if (chain) chains.add(chain);
|
|
7423
|
+
}
|
|
7424
|
+
for (const identifier of wallet.chains ?? []) {
|
|
7425
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7426
|
+
try {
|
|
7427
|
+
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
7428
|
+
chains.add(chain);
|
|
7429
|
+
} catch {}
|
|
7430
|
+
}
|
|
7431
|
+
if (chains.size === 0) {
|
|
7432
|
+
const chain = getChainFromWalletSchema({
|
|
7433
|
+
wallet,
|
|
7434
|
+
walletKey
|
|
7435
|
+
});
|
|
7436
|
+
chains.add(chain);
|
|
7437
|
+
}
|
|
7438
|
+
return Array.from(chains);
|
|
7439
|
+
};
|
|
7440
|
+
|
|
7370
7441
|
//#endregion
|
|
7371
7442
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
7372
7443
|
/**
|
|
@@ -7412,11 +7483,17 @@ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wall
|
|
|
7412
7483
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
7413
7484
|
* "external wallet" stays consistent across option types.
|
|
7414
7485
|
*
|
|
7486
|
+
* A wallet's in-app browser opens a single session, so it emits one option
|
|
7487
|
+
* tagged with the first chain it advertises that the client has an
|
|
7488
|
+
* extension for — a multi-chain wallet is still reachable when only one of
|
|
7489
|
+
* its chains is enabled.
|
|
7490
|
+
*
|
|
7491
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7415
7492
|
* @param params.walletBook - The fetched wallet book.
|
|
7416
7493
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
7417
7494
|
* @notInstrumented
|
|
7418
7495
|
*/
|
|
7419
|
-
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
7496
|
+
const buildInAppBrowserOptions = ({ enabledChains, walletBook }) => {
|
|
7420
7497
|
const result = [];
|
|
7421
7498
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7422
7499
|
if (shouldFilterWallet({
|
|
@@ -7425,12 +7502,14 @@ const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
|
7425
7502
|
})) continue;
|
|
7426
7503
|
const url = getInAppBrowserUrl({ wallet });
|
|
7427
7504
|
if (!url) continue;
|
|
7505
|
+
const chain = getChainsFromWalletSchema({
|
|
7506
|
+
wallet,
|
|
7507
|
+
walletKey
|
|
7508
|
+
}).find((advertisedChain) => enabledChains.has(advertisedChain));
|
|
7509
|
+
if (!chain) continue;
|
|
7428
7510
|
result.push({
|
|
7429
7511
|
option: {
|
|
7430
|
-
chain
|
|
7431
|
-
wallet,
|
|
7432
|
-
walletKey
|
|
7433
|
-
}),
|
|
7512
|
+
chain,
|
|
7434
7513
|
type: "inAppBrowser",
|
|
7435
7514
|
url
|
|
7436
7515
|
},
|
|
@@ -7503,17 +7582,25 @@ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
|
7503
7582
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
7504
7583
|
* not appear here either — they're not user-installable products.
|
|
7505
7584
|
*
|
|
7585
|
+
* Wallets that advertise no chain this client has an extension for are
|
|
7586
|
+
* skipped: installing them would not make them connectable.
|
|
7587
|
+
*
|
|
7588
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7506
7589
|
* @param params.walletBook - The fetched wallet book.
|
|
7507
7590
|
* @returns A map from wallet option key to its install URL bag.
|
|
7508
7591
|
* @notInstrumented
|
|
7509
7592
|
*/
|
|
7510
|
-
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
7593
|
+
const buildInstallationUrlsByWalletOptionKey = ({ enabledChains, walletBook }) => {
|
|
7511
7594
|
const map = /* @__PURE__ */ new Map();
|
|
7512
7595
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7513
7596
|
if (shouldFilterWallet({
|
|
7514
7597
|
wallet,
|
|
7515
7598
|
walletKey
|
|
7516
7599
|
})) continue;
|
|
7600
|
+
if (!getChainsFromWalletSchema({
|
|
7601
|
+
wallet,
|
|
7602
|
+
walletKey
|
|
7603
|
+
}).some((chain) => enabledChains.has(chain))) continue;
|
|
7517
7604
|
const urls = buildInstallationUrls({ wallet });
|
|
7518
7605
|
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
7519
7606
|
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
@@ -7605,49 +7692,6 @@ const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
|
7605
7692
|
return [];
|
|
7606
7693
|
};
|
|
7607
7694
|
|
|
7608
|
-
//#endregion
|
|
7609
|
-
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7610
|
-
/**
|
|
7611
|
-
* Returns every chain a wallet book entry advertises support for —
|
|
7612
|
-
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7613
|
-
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7614
|
-
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7615
|
-
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7616
|
-
*
|
|
7617
|
-
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7618
|
-
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7619
|
-
* never returns an empty array — every eligible wallet emits at least
|
|
7620
|
-
* one option.
|
|
7621
|
-
*
|
|
7622
|
-
* @param params.wallet - The wallet schema from the wallet book.
|
|
7623
|
-
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7624
|
-
* @returns Ordered, deduped array of Chains.
|
|
7625
|
-
* @notInstrumented
|
|
7626
|
-
*/
|
|
7627
|
-
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7628
|
-
const chains = /* @__PURE__ */ new Set();
|
|
7629
|
-
for (const entry of wallet.injectedConfig ?? []) {
|
|
7630
|
-
if (!entry.chain) continue;
|
|
7631
|
-
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7632
|
-
if (chain) chains.add(chain);
|
|
7633
|
-
}
|
|
7634
|
-
for (const identifier of wallet.chains ?? []) {
|
|
7635
|
-
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7636
|
-
try {
|
|
7637
|
-
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
7638
|
-
chains.add(chain);
|
|
7639
|
-
} catch {}
|
|
7640
|
-
}
|
|
7641
|
-
if (chains.size === 0) {
|
|
7642
|
-
const chain = getChainFromWalletSchema({
|
|
7643
|
-
wallet,
|
|
7644
|
-
walletKey
|
|
7645
|
-
});
|
|
7646
|
-
chains.add(chain);
|
|
7647
|
-
}
|
|
7648
|
-
return Array.from(chains);
|
|
7649
|
-
};
|
|
7650
|
-
|
|
7651
7695
|
//#endregion
|
|
7652
7696
|
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
7653
7697
|
/**
|
|
@@ -8032,6 +8076,31 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
8032
8076
|
*/
|
|
8033
8077
|
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
8034
8078
|
|
|
8079
|
+
//#endregion
|
|
8080
|
+
//#region src/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.ts
|
|
8081
|
+
/**
|
|
8082
|
+
* Drops options whose chain has no extension on this client. The wallet
|
|
8083
|
+
* book advertises every chain a wallet supports, so options derived from
|
|
8084
|
+
* it have to be narrowed to the chains the client can actually connect
|
|
8085
|
+
* on — otherwise the catalogue surfaces a connection the customer has no
|
|
8086
|
+
* primitive to drive.
|
|
8087
|
+
*
|
|
8088
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
8089
|
+
* @param params.options - The tagged options to narrow.
|
|
8090
|
+
* @returns The options on enabled chains, in input order.
|
|
8091
|
+
* @example
|
|
8092
|
+
* ```typescript
|
|
8093
|
+
* filterConnectionOptionsByEnabledChains({
|
|
8094
|
+
* enabledChains: new Set(['EVM']),
|
|
8095
|
+
* options: [evmOption, solOption],
|
|
8096
|
+
* }); // [evmOption]
|
|
8097
|
+
* ```
|
|
8098
|
+
* @see {@link getEnabledChains} for how the enabled chains are derived.
|
|
8099
|
+
* @see {@link getWalletOptionsCatalogue} for the catalogue that applies this filter.
|
|
8100
|
+
* @notInstrumented
|
|
8101
|
+
*/
|
|
8102
|
+
const filterConnectionOptionsByEnabledChains = ({ enabledChains, options }) => options.filter(({ option }) => enabledChains.has(option.chain));
|
|
8103
|
+
|
|
8035
8104
|
//#endregion
|
|
8036
8105
|
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
8037
8106
|
/**
|
|
@@ -8276,6 +8345,10 @@ const EMPTY_WALLET_BOOK = {
|
|
|
8276
8345
|
* pass `includeMobileOptions: true` to additionally surface
|
|
8277
8346
|
* WalletConnect, in-app-browser, and install links.
|
|
8278
8347
|
*
|
|
8348
|
+
* Options sourced from the wallet book are scoped to the chains this
|
|
8349
|
+
* client has an extension for — a wallet is only surfaced on chains the
|
|
8350
|
+
* customer can actually connect on.
|
|
8351
|
+
*
|
|
8279
8352
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
8280
8353
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
8281
8354
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -8291,6 +8364,7 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8291
8364
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
8292
8365
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
8293
8366
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
8367
|
+
const enabledChains = getEnabledChains(client);
|
|
8294
8368
|
const allConnectionOptions = [];
|
|
8295
8369
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
8296
8370
|
const entries = getWalletProviderRegistry(client).listProviderEntries();
|
|
@@ -8300,11 +8374,22 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8300
8374
|
}, client));
|
|
8301
8375
|
}
|
|
8302
8376
|
if (includeMobileOptions) {
|
|
8303
|
-
|
|
8304
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8305
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8377
|
+
const walletBookOptions = [];
|
|
8378
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) walletBookOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
8379
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) walletBookOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
8380
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) walletBookOptions.push(...buildInAppBrowserOptions({
|
|
8381
|
+
enabledChains,
|
|
8382
|
+
walletBook
|
|
8383
|
+
}));
|
|
8384
|
+
allConnectionOptions.push(...filterConnectionOptionsByEnabledChains({
|
|
8385
|
+
enabledChains,
|
|
8386
|
+
options: walletBookOptions
|
|
8387
|
+
}));
|
|
8306
8388
|
}
|
|
8307
|
-
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8389
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8390
|
+
enabledChains,
|
|
8391
|
+
walletBook
|
|
8392
|
+
}) : /* @__PURE__ */ new Map();
|
|
8308
8393
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
8309
8394
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
8310
8395
|
const walletOptions = [];
|