@dynamic-labs-sdk/client 1.30.3 → 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-BAKktP8E.native.esm.js → apiClient-BZfdx9fH.native.esm.js} +2 -2
- package/dist/{apiClient-BAKktP8E.native.esm.js.map → apiClient-BZfdx9fH.native.esm.js.map} +1 -1
- package/dist/core.cjs +66 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +64 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +66 -8
- package/dist/core.native.esm.js.map +1 -1
- package/dist/exports/core.d.ts +10 -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-CHlaSDGa.esm.js → getNetworkProviderFromNetworkId-CbMpiSub.esm.js} +29 -20
- package/dist/getNetworkProviderFromNetworkId-CbMpiSub.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-D3308b6r.cjs → getNetworkProviderFromNetworkId-DNIuJp20.cjs} +34 -19
- package/dist/getNetworkProviderFromNetworkId-DNIuJp20.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-Bk5ssM29.native.esm.js → getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js} +34 -25
- package/dist/getNetworkProviderFromNetworkId-DRA4M5Ab.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-CW2VWZxK.cjs → getSignedSessionId--wpV_VKs.cjs} +3 -3
- package/dist/{getSignedSessionId-CW2VWZxK.cjs.map → getSignedSessionId--wpV_VKs.cjs.map} +1 -1
- package/dist/{getSignedSessionId-B_iFJpYg.esm.js → getSignedSessionId-DHn6yhGX.esm.js} +3 -3
- package/dist/{getSignedSessionId-B_iFJpYg.esm.js.map → getSignedSessionId-DHn6yhGX.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-D-KMuDMG.native.esm.js → getSignedSessionId-DKKSCpj9.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-D-KMuDMG.native.esm.js.map → getSignedSessionId-DKKSCpj9.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-DZS1-K7H.cjs → getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-DZS1-K7H.cjs.map → getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-Dqb6bpAF.esm.js → getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-Dqb6bpAF.esm.js.map → getVerifiedCredentialForWalletAccount-C_GcjgC8.esm.js.map} +1 -1
- package/dist/index.cjs +146 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +146 -66
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +147 -67
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BvYKQLus.native.esm.js → isMfaRequiredForAction-CC7bjhqy.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BvYKQLus.native.esm.js.map → isMfaRequiredForAction-CC7bjhqy.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-B0pOYhvq.esm.js → isMfaRequiredForAction-D1a1Nudo.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-B0pOYhvq.esm.js.map → isMfaRequiredForAction-D1a1Nudo.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-BSclknqX.cjs → isMfaRequiredForAction-YjJLLFFs.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-BSclknqX.cjs.map → isMfaRequiredForAction-YjJLLFFs.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-CfG3LQ6q.native.esm.js → isUserOnboardingComplete-BIjk67vX.native.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-CfG3LQ6q.native.esm.js.map → isUserOnboardingComplete-BIjk67vX.native.esm.js.map} +1 -1
- package/dist/{isUserOnboardingComplete-CwZbDdOC.cjs → isUserOnboardingComplete-C2ZuLDT9.cjs} +3 -3
- package/dist/{isUserOnboardingComplete-CwZbDdOC.cjs.map → isUserOnboardingComplete-C2ZuLDT9.cjs.map} +1 -1
- package/dist/{isUserOnboardingComplete-DtGJK_dW.esm.js → isUserOnboardingComplete-C4bE5xqM.esm.js} +3 -3
- package/dist/{isUserOnboardingComplete-DtGJK_dW.esm.js.map → isUserOnboardingComplete-C4bE5xqM.esm.js.map} +1 -1
- package/dist/{logoutWithReason-vnu8SeVK.native.esm.js → logoutWithReason-BcWQGREO.native.esm.js} +2 -2
- package/dist/{logoutWithReason-vnu8SeVK.native.esm.js.map → logoutWithReason-BcWQGREO.native.esm.js.map} +1 -1
- package/dist/{logoutWithReason-CIsCVAUE.esm.js → logoutWithReason-BqsgA8gI.esm.js} +2 -2
- package/dist/{logoutWithReason-CIsCVAUE.esm.js.map → logoutWithReason-BqsgA8gI.esm.js.map} +1 -1
- package/dist/{logoutWithReason-DEM0fiik.cjs → logoutWithReason-D6ruPOvJ.cjs} +2 -2
- package/dist/{logoutWithReason-DEM0fiik.cjs.map → logoutWithReason-D6ruPOvJ.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-BvDbMJWJ.native.esm.js → migrateFromFireblocks-BxPgqhbu.native.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-BvDbMJWJ.native.esm.js.map → migrateFromFireblocks-BxPgqhbu.native.esm.js.map} +1 -1
- package/dist/{migrateFromFireblocks-BOx3tLrP.cjs → migrateFromFireblocks-CCNTDCmW.cjs} +2 -2
- package/dist/{migrateFromFireblocks-BOx3tLrP.cjs.map → migrateFromFireblocks-CCNTDCmW.cjs.map} +1 -1
- package/dist/{migrateFromFireblocks-_Vt4cY3Y.esm.js → migrateFromFireblocks-zazAx6WV.esm.js} +2 -2
- package/dist/{migrateFromFireblocks-_Vt4cY3Y.esm.js.map → migrateFromFireblocks-zazAx6WV.esm.js.map} +1 -1
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts +4 -2
- package/dist/modules/waas/businessAccounts/addBusinessAccountSigner/addBusinessAccountSigner.d.ts.map +1 -1
- package/dist/modules/waas/createWaasProvider/createWaasProvider.d.ts.map +1 -1
- package/dist/modules/waas/waas.types.d.ts +1 -0
- package/dist/modules/waas/waas.types.d.ts.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/services/eventEmitter/createEventEmitter.d.ts +3 -2
- package/dist/services/eventEmitter/createEventEmitter.d.ts.map +1 -1
- package/dist/services/eventEmitter/index.d.ts +1 -1
- package/dist/services/eventEmitter/index.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/createSequenceQueue/createSequenceQueue.d.ts +52 -0
- package/dist/utils/createSequenceQueue/createSequenceQueue.d.ts.map +1 -0
- package/dist/utils/createSequenceQueue/index.d.ts +3 -0
- package/dist/utils/createSequenceQueue/index.d.ts.map +1 -0
- package/dist/{waas-CBrqSieN.esm.js → waas-C2PbR02F.esm.js} +8 -6
- package/dist/waas-C2PbR02F.esm.js.map +1 -0
- package/dist/{waas-ChgbzsYO.native.esm.js → waas-DidjjQjB.native.esm.js} +8 -6
- package/dist/waas-DidjjQjB.native.esm.js.map +1 -0
- package/dist/{waas-BYn7tsbq.cjs → waas-ZWlJHeXc.cjs} +8 -6
- package/dist/waas-ZWlJHeXc.cjs.map +1 -0
- 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 +18 -16
- package/dist/waasCore.cjs.map +1 -1
- package/dist/waasCore.esm.js +18 -16
- package/dist/waasCore.esm.js.map +1 -1
- package/dist/waasCore.native.esm.js +18 -16
- package/dist/waasCore.native.esm.js.map +1 -1
- package/package.json +4 -4
- package/dist/getNetworkProviderFromNetworkId-Bk5ssM29.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CHlaSDGa.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-D3308b6r.cjs.map +0 -1
- package/dist/waas-BYn7tsbq.cjs.map +0 -1
- package/dist/waas-CBrqSieN.esm.js.map +0 -1
- package/dist/waas-ChgbzsYO.native.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
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";
|
|
11
|
-
import
|
|
11
|
+
import { EventEmitter as EventEmitter$1 } from "eventemitter3";
|
|
12
12
|
import { browserSupportsWebAuthn, startAuthentication, startRegistration } from "@simplewebauthn/browser";
|
|
13
13
|
|
|
14
14
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -675,11 +675,6 @@ const createAsyncTrack = () => {
|
|
|
675
675
|
};
|
|
676
676
|
};
|
|
677
677
|
|
|
678
|
-
//#endregion
|
|
679
|
-
//#region src/services/eventEmitter/createEventEmitter.ts
|
|
680
|
-
/** @notInstrumented */
|
|
681
|
-
const createEventEmitter = () => new EventEmitter();
|
|
682
|
-
|
|
683
678
|
//#endregion
|
|
684
679
|
//#region src/services/fetch/createWebFetch.ts
|
|
685
680
|
/**
|
|
@@ -7345,6 +7340,77 @@ const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
|
7345
7340
|
if (isChromeBrowser()) return installationUrls.chrome;
|
|
7346
7341
|
};
|
|
7347
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
|
+
|
|
7348
7414
|
//#endregion
|
|
7349
7415
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
7350
7416
|
/**
|
|
@@ -7390,11 +7456,17 @@ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wall
|
|
|
7390
7456
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
7391
7457
|
* "external wallet" stays consistent across option types.
|
|
7392
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.
|
|
7393
7465
|
* @param params.walletBook - The fetched wallet book.
|
|
7394
7466
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
7395
7467
|
* @notInstrumented
|
|
7396
7468
|
*/
|
|
7397
|
-
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
7469
|
+
const buildInAppBrowserOptions = ({ enabledChains, walletBook }) => {
|
|
7398
7470
|
const result = [];
|
|
7399
7471
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7400
7472
|
if (shouldFilterWallet({
|
|
@@ -7403,12 +7475,14 @@ const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
|
7403
7475
|
})) continue;
|
|
7404
7476
|
const url = getInAppBrowserUrl({ wallet });
|
|
7405
7477
|
if (!url) continue;
|
|
7478
|
+
const chain = getChainsFromWalletSchema({
|
|
7479
|
+
wallet,
|
|
7480
|
+
walletKey
|
|
7481
|
+
}).find((advertisedChain) => enabledChains.has(advertisedChain));
|
|
7482
|
+
if (!chain) continue;
|
|
7406
7483
|
result.push({
|
|
7407
7484
|
option: {
|
|
7408
|
-
chain
|
|
7409
|
-
wallet,
|
|
7410
|
-
walletKey
|
|
7411
|
-
}),
|
|
7485
|
+
chain,
|
|
7412
7486
|
type: "inAppBrowser",
|
|
7413
7487
|
url
|
|
7414
7488
|
},
|
|
@@ -7481,17 +7555,25 @@ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
|
7481
7555
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
7482
7556
|
* not appear here either — they're not user-installable products.
|
|
7483
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.
|
|
7484
7562
|
* @param params.walletBook - The fetched wallet book.
|
|
7485
7563
|
* @returns A map from wallet option key to its install URL bag.
|
|
7486
7564
|
* @notInstrumented
|
|
7487
7565
|
*/
|
|
7488
|
-
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
7566
|
+
const buildInstallationUrlsByWalletOptionKey = ({ enabledChains, walletBook }) => {
|
|
7489
7567
|
const map = /* @__PURE__ */ new Map();
|
|
7490
7568
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7491
7569
|
if (shouldFilterWallet({
|
|
7492
7570
|
wallet,
|
|
7493
7571
|
walletKey
|
|
7494
7572
|
})) continue;
|
|
7573
|
+
if (!getChainsFromWalletSchema({
|
|
7574
|
+
wallet,
|
|
7575
|
+
walletKey
|
|
7576
|
+
}).some((chain) => enabledChains.has(chain))) continue;
|
|
7495
7577
|
const urls = buildInstallationUrls({ wallet });
|
|
7496
7578
|
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
7497
7579
|
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
@@ -7583,49 +7665,6 @@ const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
|
7583
7665
|
return [];
|
|
7584
7666
|
};
|
|
7585
7667
|
|
|
7586
|
-
//#endregion
|
|
7587
|
-
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7588
|
-
/**
|
|
7589
|
-
* Returns every chain a wallet book entry advertises support for —
|
|
7590
|
-
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7591
|
-
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7592
|
-
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7593
|
-
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7594
|
-
*
|
|
7595
|
-
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7596
|
-
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7597
|
-
* never returns an empty array — every eligible wallet emits at least
|
|
7598
|
-
* one option.
|
|
7599
|
-
*
|
|
7600
|
-
* @param params.wallet - The wallet schema from the wallet book.
|
|
7601
|
-
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7602
|
-
* @returns Ordered, deduped array of Chains.
|
|
7603
|
-
* @notInstrumented
|
|
7604
|
-
*/
|
|
7605
|
-
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7606
|
-
const chains = /* @__PURE__ */ new Set();
|
|
7607
|
-
for (const entry of wallet.injectedConfig ?? []) {
|
|
7608
|
-
if (!entry.chain) continue;
|
|
7609
|
-
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7610
|
-
if (chain) chains.add(chain);
|
|
7611
|
-
}
|
|
7612
|
-
for (const identifier of wallet.chains ?? []) {
|
|
7613
|
-
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7614
|
-
try {
|
|
7615
|
-
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
7616
|
-
chains.add(chain);
|
|
7617
|
-
} catch {}
|
|
7618
|
-
}
|
|
7619
|
-
if (chains.size === 0) {
|
|
7620
|
-
const chain = getChainFromWalletSchema({
|
|
7621
|
-
wallet,
|
|
7622
|
-
walletKey
|
|
7623
|
-
});
|
|
7624
|
-
chains.add(chain);
|
|
7625
|
-
}
|
|
7626
|
-
return Array.from(chains);
|
|
7627
|
-
};
|
|
7628
|
-
|
|
7629
7668
|
//#endregion
|
|
7630
7669
|
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
7631
7670
|
/**
|
|
@@ -8010,6 +8049,31 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
8010
8049
|
*/
|
|
8011
8050
|
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
8012
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
|
+
|
|
8013
8077
|
//#endregion
|
|
8014
8078
|
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
8015
8079
|
/**
|
|
@@ -8254,6 +8318,10 @@ const EMPTY_WALLET_BOOK = {
|
|
|
8254
8318
|
* pass `includeMobileOptions: true` to additionally surface
|
|
8255
8319
|
* WalletConnect, in-app-browser, and install links.
|
|
8256
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
|
+
*
|
|
8257
8325
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
8258
8326
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
8259
8327
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -8269,6 +8337,7 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8269
8337
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
8270
8338
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
8271
8339
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
8340
|
+
const enabledChains = getEnabledChains(client);
|
|
8272
8341
|
const allConnectionOptions = [];
|
|
8273
8342
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
8274
8343
|
const entries = getWalletProviderRegistry(client).listProviderEntries();
|
|
@@ -8278,11 +8347,22 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8278
8347
|
}, client));
|
|
8279
8348
|
}
|
|
8280
8349
|
if (includeMobileOptions) {
|
|
8281
|
-
|
|
8282
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8283
|
-
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
|
+
}));
|
|
8284
8361
|
}
|
|
8285
|
-
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8362
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8363
|
+
enabledChains,
|
|
8364
|
+
walletBook
|
|
8365
|
+
}) : /* @__PURE__ */ new Map();
|
|
8286
8366
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
8287
8367
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
8288
8368
|
const walletOptions = [];
|