@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.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
|
|
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
|
|
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
|
/**
|
|
@@ -676,11 +676,6 @@ const createAsyncTrack = () => {
|
|
|
676
676
|
};
|
|
677
677
|
};
|
|
678
678
|
|
|
679
|
-
//#endregion
|
|
680
|
-
//#region src/services/eventEmitter/createEventEmitter.ts
|
|
681
|
-
/** @notInstrumented */
|
|
682
|
-
const createEventEmitter = () => new EventEmitter();
|
|
683
|
-
|
|
684
679
|
//#endregion
|
|
685
680
|
//#region src/errors/UnavailableInServerSideError.ts
|
|
686
681
|
var UnavailableInServerSideError = class extends BaseError {
|
|
@@ -7372,6 +7367,77 @@ const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
|
7372
7367
|
if (isChromeBrowser()) return installationUrls.chrome;
|
|
7373
7368
|
};
|
|
7374
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
|
+
|
|
7375
7441
|
//#endregion
|
|
7376
7442
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
7377
7443
|
/**
|
|
@@ -7417,11 +7483,17 @@ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wall
|
|
|
7417
7483
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
7418
7484
|
* "external wallet" stays consistent across option types.
|
|
7419
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.
|
|
7420
7492
|
* @param params.walletBook - The fetched wallet book.
|
|
7421
7493
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
7422
7494
|
* @notInstrumented
|
|
7423
7495
|
*/
|
|
7424
|
-
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
7496
|
+
const buildInAppBrowserOptions = ({ enabledChains, walletBook }) => {
|
|
7425
7497
|
const result = [];
|
|
7426
7498
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7427
7499
|
if (shouldFilterWallet({
|
|
@@ -7430,12 +7502,14 @@ const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
|
7430
7502
|
})) continue;
|
|
7431
7503
|
const url = getInAppBrowserUrl({ wallet });
|
|
7432
7504
|
if (!url) continue;
|
|
7505
|
+
const chain = getChainsFromWalletSchema({
|
|
7506
|
+
wallet,
|
|
7507
|
+
walletKey
|
|
7508
|
+
}).find((advertisedChain) => enabledChains.has(advertisedChain));
|
|
7509
|
+
if (!chain) continue;
|
|
7433
7510
|
result.push({
|
|
7434
7511
|
option: {
|
|
7435
|
-
chain
|
|
7436
|
-
wallet,
|
|
7437
|
-
walletKey
|
|
7438
|
-
}),
|
|
7512
|
+
chain,
|
|
7439
7513
|
type: "inAppBrowser",
|
|
7440
7514
|
url
|
|
7441
7515
|
},
|
|
@@ -7508,17 +7582,25 @@ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
|
7508
7582
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
7509
7583
|
* not appear here either — they're not user-installable products.
|
|
7510
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.
|
|
7511
7589
|
* @param params.walletBook - The fetched wallet book.
|
|
7512
7590
|
* @returns A map from wallet option key to its install URL bag.
|
|
7513
7591
|
* @notInstrumented
|
|
7514
7592
|
*/
|
|
7515
|
-
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
7593
|
+
const buildInstallationUrlsByWalletOptionKey = ({ enabledChains, walletBook }) => {
|
|
7516
7594
|
const map = /* @__PURE__ */ new Map();
|
|
7517
7595
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7518
7596
|
if (shouldFilterWallet({
|
|
7519
7597
|
wallet,
|
|
7520
7598
|
walletKey
|
|
7521
7599
|
})) continue;
|
|
7600
|
+
if (!getChainsFromWalletSchema({
|
|
7601
|
+
wallet,
|
|
7602
|
+
walletKey
|
|
7603
|
+
}).some((chain) => enabledChains.has(chain))) continue;
|
|
7522
7604
|
const urls = buildInstallationUrls({ wallet });
|
|
7523
7605
|
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
7524
7606
|
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
@@ -7610,49 +7692,6 @@ const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
|
7610
7692
|
return [];
|
|
7611
7693
|
};
|
|
7612
7694
|
|
|
7613
|
-
//#endregion
|
|
7614
|
-
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7615
|
-
/**
|
|
7616
|
-
* Returns every chain a wallet book entry advertises support for —
|
|
7617
|
-
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7618
|
-
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7619
|
-
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7620
|
-
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7621
|
-
*
|
|
7622
|
-
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7623
|
-
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7624
|
-
* never returns an empty array — every eligible wallet emits at least
|
|
7625
|
-
* one option.
|
|
7626
|
-
*
|
|
7627
|
-
* @param params.wallet - The wallet schema from the wallet book.
|
|
7628
|
-
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7629
|
-
* @returns Ordered, deduped array of Chains.
|
|
7630
|
-
* @notInstrumented
|
|
7631
|
-
*/
|
|
7632
|
-
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7633
|
-
const chains = /* @__PURE__ */ new Set();
|
|
7634
|
-
for (const entry of wallet.injectedConfig ?? []) {
|
|
7635
|
-
if (!entry.chain) continue;
|
|
7636
|
-
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7637
|
-
if (chain) chains.add(chain);
|
|
7638
|
-
}
|
|
7639
|
-
for (const identifier of wallet.chains ?? []) {
|
|
7640
|
-
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7641
|
-
try {
|
|
7642
|
-
const chain = getChainFromVerifiedCredentialChain(prefix);
|
|
7643
|
-
chains.add(chain);
|
|
7644
|
-
} catch {}
|
|
7645
|
-
}
|
|
7646
|
-
if (chains.size === 0) {
|
|
7647
|
-
const chain = getChainFromWalletSchema({
|
|
7648
|
-
wallet,
|
|
7649
|
-
walletKey
|
|
7650
|
-
});
|
|
7651
|
-
chains.add(chain);
|
|
7652
|
-
}
|
|
7653
|
-
return Array.from(chains);
|
|
7654
|
-
};
|
|
7655
|
-
|
|
7656
7695
|
//#endregion
|
|
7657
7696
|
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
7658
7697
|
/**
|
|
@@ -8037,6 +8076,31 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
8037
8076
|
*/
|
|
8038
8077
|
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
8039
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
|
+
|
|
8040
8104
|
//#endregion
|
|
8041
8105
|
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
8042
8106
|
/**
|
|
@@ -8281,6 +8345,10 @@ const EMPTY_WALLET_BOOK = {
|
|
|
8281
8345
|
* pass `includeMobileOptions: true` to additionally surface
|
|
8282
8346
|
* WalletConnect, in-app-browser, and install links.
|
|
8283
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
|
+
*
|
|
8284
8352
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
8285
8353
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
8286
8354
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -8296,6 +8364,7 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8296
8364
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
8297
8365
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
8298
8366
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
8367
|
+
const enabledChains = getEnabledChains(client);
|
|
8299
8368
|
const allConnectionOptions = [];
|
|
8300
8369
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
8301
8370
|
const entries = getWalletProviderRegistry(client).listProviderEntries();
|
|
@@ -8305,11 +8374,22 @@ const getWalletOptionsCatalogue = async (params = {}, client = getDefaultClient(
|
|
|
8305
8374
|
}, client));
|
|
8306
8375
|
}
|
|
8307
8376
|
if (includeMobileOptions) {
|
|
8308
|
-
|
|
8309
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8310
|
-
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
|
+
}));
|
|
8311
8388
|
}
|
|
8312
|
-
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8389
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8390
|
+
enabledChains,
|
|
8391
|
+
walletBook
|
|
8392
|
+
}) : /* @__PURE__ */ new Map();
|
|
8313
8393
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
8314
8394
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
8315
8395
|
const walletOptions = [];
|