@dynamic-labs-sdk/client 1.1.0 → 1.2.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/{InvalidParamError-DhJgtQpd.native.esm.js → InvalidParamError-BYnLW_9s.native.esm.js} +4 -3
- package/dist/{InvalidParamError-DhJgtQpd.native.esm.js.map → InvalidParamError-BYnLW_9s.native.esm.js.map} +1 -1
- package/dist/{InvalidParamError-npqWDmHK.cjs → InvalidParamError-CEykJlaG.cjs} +5 -4
- package/dist/{InvalidParamError-npqWDmHK.cjs.map → InvalidParamError-CEykJlaG.cjs.map} +1 -1
- package/dist/{InvalidParamError-CUtneR2C.esm.js → InvalidParamError-uluG140m.esm.js} +4 -3
- package/dist/{InvalidParamError-CUtneR2C.esm.js.map → InvalidParamError-uluG140m.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-DNsfrdqb.native.esm.js → NotWaasWalletAccountError-33QOxTKa.native.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-DNsfrdqb.native.esm.js.map → NotWaasWalletAccountError-33QOxTKa.native.esm.js.map} +1 -1
- package/dist/{NotWaasWalletAccountError-DQMUFxVA.cjs → NotWaasWalletAccountError-BNdbbGX7.cjs} +3 -3
- package/dist/{NotWaasWalletAccountError-DQMUFxVA.cjs.map → NotWaasWalletAccountError-BNdbbGX7.cjs.map} +1 -1
- package/dist/{NotWaasWalletAccountError-CBWqf4i9.esm.js → NotWaasWalletAccountError-DmlwWvy0.esm.js} +3 -3
- package/dist/{NotWaasWalletAccountError-CBWqf4i9.esm.js.map → NotWaasWalletAccountError-DmlwWvy0.esm.js.map} +1 -1
- package/dist/core.cjs +45 -5
- package/dist/core.cjs.map +1 -1
- package/dist/core.esm.js +43 -6
- package/dist/core.esm.js.map +1 -1
- package/dist/core.native.esm.js +43 -6
- package/dist/core.native.esm.js.map +1 -1
- package/dist/errors/ArrayMustNotBeEmptyError.d.ts +5 -0
- package/dist/errors/ArrayMustNotBeEmptyError.d.ts.map +1 -0
- package/dist/exports/core.d.ts +8 -0
- package/dist/exports/core.d.ts.map +1 -1
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getNetworkProviderFromNetworkId-Bom70gO7.cjs → getNetworkProviderFromNetworkId-BOCwNNMm.cjs} +30 -4
- package/dist/getNetworkProviderFromNetworkId-BOCwNNMm.cjs.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-CUq8PCx4.esm.js → getNetworkProviderFromNetworkId-CS1GXEp6.esm.js} +25 -5
- package/dist/getNetworkProviderFromNetworkId-CS1GXEp6.esm.js.map +1 -0
- package/dist/{getNetworkProviderFromNetworkId-BDQFxu7W.native.esm.js → getNetworkProviderFromNetworkId-a0atbFHU.native.esm.js} +25 -5
- package/dist/getNetworkProviderFromNetworkId-a0atbFHU.native.esm.js.map +1 -0
- package/dist/{getSignedSessionId-DJMc4Lqq.cjs → getSignedSessionId-B42gT4xk.cjs} +3 -3
- package/dist/{getSignedSessionId-DJMc4Lqq.cjs.map → getSignedSessionId-B42gT4xk.cjs.map} +1 -1
- package/dist/{getSignedSessionId-CEXsWxED.esm.js → getSignedSessionId-D1Oh4604.esm.js} +3 -3
- package/dist/{getSignedSessionId-CEXsWxED.esm.js.map → getSignedSessionId-D1Oh4604.esm.js.map} +1 -1
- package/dist/{getSignedSessionId-CwWWFs-u.native.esm.js → getSignedSessionId-zHtJOVpY.native.esm.js} +3 -3
- package/dist/{getSignedSessionId-CwWWFs-u.native.esm.js.map → getSignedSessionId-zHtJOVpY.native.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-CFM4DCjx.cjs → getVerifiedCredentialForWalletAccount-B-IhZJuM.cjs} +3 -3
- package/dist/{getVerifiedCredentialForWalletAccount-CFM4DCjx.cjs.map → getVerifiedCredentialForWalletAccount-B-IhZJuM.cjs.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-yXaRG2Fh.esm.js → getVerifiedCredentialForWalletAccount-BkaECPL_.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-yXaRG2Fh.esm.js.map → getVerifiedCredentialForWalletAccount-BkaECPL_.esm.js.map} +1 -1
- package/dist/{getVerifiedCredentialForWalletAccount-C1OKaks3.native.esm.js → getVerifiedCredentialForWalletAccount-CEvtJ3xW.native.esm.js} +2 -2
- package/dist/{getVerifiedCredentialForWalletAccount-C1OKaks3.native.esm.js.map → getVerifiedCredentialForWalletAccount-CEvtJ3xW.native.esm.js.map} +1 -1
- package/dist/index.cjs +157 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.esm.js +156 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.native.esm.js +161 -20
- package/dist/index.native.esm.js.map +1 -1
- package/dist/{isMfaRequiredForAction-BSs7TCpj.native.esm.js → isMfaRequiredForAction-BfabCDxI.native.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BSs7TCpj.native.esm.js.map → isMfaRequiredForAction-BfabCDxI.native.esm.js.map} +1 -1
- package/dist/{isMfaRequiredForAction-DaTNpgxR.cjs → isMfaRequiredForAction-CJvFP4oN.cjs} +2 -2
- package/dist/{isMfaRequiredForAction-DaTNpgxR.cjs.map → isMfaRequiredForAction-CJvFP4oN.cjs.map} +1 -1
- package/dist/{isMfaRequiredForAction-BIrnPkrM.esm.js → isMfaRequiredForAction-G7SXCZ5L.esm.js} +2 -2
- package/dist/{isMfaRequiredForAction-BIrnPkrM.esm.js.map → isMfaRequiredForAction-G7SXCZ5L.esm.js.map} +1 -1
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts +9 -1
- package/dist/modules/checkout/getCheckoutTransactionQuote/getCheckoutTransactionQuote.d.ts.map +1 -1
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.d.ts +26 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.d.ts +28 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/excludeInstalledFromCatalog/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/index.d.ts +2 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/index.d.ts.map +1 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.d.ts +26 -0
- package/dist/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.d.ts.map +1 -0
- package/dist/modules/swap/executeSwapTransaction/executeSwapTransaction.d.ts.map +1 -1
- package/dist/modules/swap/utils/ensureCorrectActiveNetwork/ensureCorrectActiveNetwork.d.ts +15 -0
- package/dist/modules/swap/utils/ensureCorrectActiveNetwork/ensureCorrectActiveNetwork.d.ts.map +1 -0
- package/dist/modules/swap/utils/ensureCorrectActiveNetwork/index.d.ts +2 -0
- package/dist/modules/swap/utils/ensureCorrectActiveNetwork/index.d.ts.map +1 -0
- package/dist/modules/wallets/utils/getSignInMessage/createSignInMessageStatement/createSignInMessageStatement.d.ts.map +1 -1
- package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/assertNonEmptyArray/assertNonEmptyArray.d.ts +19 -0
- package/dist/utils/assertNonEmptyArray/assertNonEmptyArray.d.ts.map +1 -0
- package/dist/utils/assertNonEmptyArray/index.d.ts +2 -0
- package/dist/utils/assertNonEmptyArray/index.d.ts.map +1 -0
- package/dist/utils/getAppMetadata/getAppMetadata.d.ts +16 -0
- package/dist/utils/getAppMetadata/getAppMetadata.d.ts.map +1 -0
- package/dist/utils/getAppMetadata/index.d.ts +3 -0
- package/dist/utils/getAppMetadata/index.d.ts.map +1 -0
- package/dist/waas.cjs +4 -4
- package/dist/waas.esm.js +3 -3
- package/dist/waas.native.esm.js +3 -3
- package/dist/waasCore.cjs +4 -4
- package/dist/waasCore.esm.js +3 -3
- package/dist/waasCore.native.esm.js +3 -3
- package/package.json +5 -4
- package/dist/getNetworkProviderFromNetworkId-BDQFxu7W.native.esm.js.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-Bom70gO7.cjs.map +0 -1
- package/dist/getNetworkProviderFromNetworkId-CUq8PCx4.esm.js.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { A as extractSessionId, B as name, C as isCookieEnabled, D as instrumentFunction, E as __getElevatedAccessToken_wrapped, F as getDefaultClient, I as setDefaultClient, O as DEFAULT_PII_FIELDS, P as NONCE_POOL_SIZE, R as BaseError, T as ValueMustBeDefinedError, V as version, _ as MfaRateLimitedError, a as DYNAMIC_ICONIC_SPRITE_URL, b as InvalidExternalAuthError, c as CHAINS_INFO_MAP, d as UnauthorizedError, g as SandboxMaximumThresholdReachedError, h as getNonce, j as randomString, k as getUserAgent, l as fetchAndStoreNonces, o as SDK_API_CORE_VERSION, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as createApiClient, v as MfaInvalidOtpError, w as assertDefined, x as APIError, y as LinkCredentialError, z as getCore } from "./InvalidParamError-
|
|
2
|
-
import { A as
|
|
3
|
-
import { A as onceEvent, C as formatWalletAccountId, D as emitEvent, O as offEvent, T as splitWalletProviderKey, a as parseElevatedAccessToken, b as getWalletAccounts, d as isUserMissingMfaAuth, f as checkAndRaiseWalletAccountsChangedEvent, h as getWalletProviderFromWalletAccount, i as upsertElevatedAccessToken, k as onEvent, n as getWalletProviderByKey, o as restoreUserSharesForAllWalletAccounts, p as emitWalletAccountsChangedEvent, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as getWalletProviders, w as normalizeAddress, y as NoWalletProviderFoundError } from "./getVerifiedCredentialForWalletAccount-
|
|
4
|
-
import { n as __refreshAuth_wrapped, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-
|
|
5
|
-
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-
|
|
1
|
+
import { A as extractSessionId, B as name, C as isCookieEnabled, D as instrumentFunction, E as __getElevatedAccessToken_wrapped, F as getDefaultClient, I as setDefaultClient, O as DEFAULT_PII_FIELDS, P as NONCE_POOL_SIZE, R as BaseError, T as ValueMustBeDefinedError, V as version, _ as MfaRateLimitedError, a as DYNAMIC_ICONIC_SPRITE_URL, b as InvalidExternalAuthError, c as CHAINS_INFO_MAP, d as UnauthorizedError, g as SandboxMaximumThresholdReachedError, h as getNonce, j as randomString, k as getUserAgent, l as fetchAndStoreNonces, o as SDK_API_CORE_VERSION, s as getChainFromVerifiedCredentialChain, t as InvalidParamError, u as createApiClient, v as MfaInvalidOtpError, w as assertDefined, x as APIError, y as LinkCredentialError, z as getCore } from "./InvalidParamError-uluG140m.esm.js";
|
|
2
|
+
import { A as INITIALIZE_STORAGE_SYNC_TRACKER_KEY, C as createLogger, D as createDeferredPromise, E as CannotTrackError, F as __logoutWithReason_wrapped, G as isEqualShallow, H as isSignedIn, I as generateSessionKeys, L as fetchProjectSettings, M as REFRESH_USER_STATE_FROM_VALID_TOKEN_TRACKER_KEY, N as isServerSideRendering, O as FETCH_PROJECT_SETTINGS_TRACKER_KEY, P as getBuffer, R as createStorageKeySchema, S as createKeychainService, U as retryOnFail, V as createLocalStorageAdapter, W as subscribeWithSelector, _ as MethodNotImplementedError, a as updateWalletProviderKeysForVerifiedCredentials, b as getKeychainIndexedDBName, c as createSignInMessageStatement, d as setUnverifiedWalletAccounts, f as createVisit, g as isCaptchaRequired, h as consumeCaptchaToken, i as getNetworksData, j as REFRESH_USER_STATE_FROM_COOKIE_TRACKER_KEY, k as GENERATE_SESSION_KEYS_TRACKER_KEY, l as formatSignInMessage, m as __setCaptchaToken_wrapped, o as verifyMessageSignatureOwnership, p as hasExtension, s as removeUnverifiedWalletAccount, t as getNetworkProviderFromNetworkId, u as getAppMetadata, v as WalletAlreadyLinkedToAnotherUserError, w as createCrossTabBroadcast, x as createRealtimeService, y as NoNetworkProvidersError, z as createStorage } from "./getNetworkProviderFromNetworkId-CS1GXEp6.esm.js";
|
|
3
|
+
import { A as onceEvent, C as formatWalletAccountId, D as emitEvent, O as offEvent, T as splitWalletProviderKey, a as parseElevatedAccessToken, b as getWalletAccounts, d as isUserMissingMfaAuth, f as checkAndRaiseWalletAccountsChangedEvent, h as getWalletProviderFromWalletAccount, i as upsertElevatedAccessToken, k as onEvent, n as getWalletProviderByKey, o as restoreUserSharesForAllWalletAccounts, p as emitWalletAccountsChangedEvent, r as updateAuthFromVerifyResponse, t as getVerifiedCredentialForWalletAccount, u as getWalletProviders, w as normalizeAddress, y as NoWalletProviderFoundError } from "./getVerifiedCredentialForWalletAccount-BkaECPL_.esm.js";
|
|
4
|
+
import { n as __refreshAuth_wrapped, t as NotWaasWalletAccountError } from "./NotWaasWalletAccountError-DmlwWvy0.esm.js";
|
|
5
|
+
import { n as getMfaMethods, r as __consumeMfaToken_wrapped, t as isMfaRequiredForAction } from "./isMfaRequiredForAction-G7SXCZ5L.esm.js";
|
|
6
6
|
import { assertPackageVersion } from "@dynamic-labs-sdk/assert-package-version";
|
|
7
7
|
import { AuthModeEnum, ExchangeKeyEnum, JwtVerifiedCredentialFormatEnum, MFAAction, MfaBackupCodeAcknowledgement, ProviderEnum, TokenScope, WaasBackupOptionsEnum, WalletProviderEnum } from "@dynamic-labs/sdk-api-core";
|
|
8
8
|
import * as z from "zod/mini";
|
|
@@ -2550,11 +2550,12 @@ const getCheckoutTransaction = async ({ transactionId }, client = getDefaultClie
|
|
|
2550
2550
|
* @returns The updated checkout transaction with quote data
|
|
2551
2551
|
* @not-instrumented
|
|
2552
2552
|
*/
|
|
2553
|
-
const getCheckoutTransactionQuote = async ({ fromTokenAddress, slippage, transactionId }, client = getDefaultClient()) => {
|
|
2553
|
+
const getCheckoutTransactionQuote = async ({ fromChainId, fromTokenAddress, slippage, transactionId }, client = getDefaultClient()) => {
|
|
2554
2554
|
const { apiClient, environmentId, sessionToken } = await createCheckoutApiClient({ transactionId }, client);
|
|
2555
2555
|
return apiClient.quoteCheckoutTransaction({
|
|
2556
2556
|
environmentId,
|
|
2557
2557
|
quoteRequest: {
|
|
2558
|
+
fromChainId,
|
|
2558
2559
|
fromTokenAddress,
|
|
2559
2560
|
slippage
|
|
2560
2561
|
},
|
|
@@ -2635,6 +2636,35 @@ const SWAP_SUPPORTED_CHAINS = [
|
|
|
2635
2636
|
"TRON"
|
|
2636
2637
|
];
|
|
2637
2638
|
|
|
2639
|
+
//#endregion
|
|
2640
|
+
//#region src/modules/swap/utils/ensureCorrectActiveNetwork/ensureCorrectActiveNetwork.ts
|
|
2641
|
+
/**
|
|
2642
|
+
* Ensures the wallet provider is on the correct active network if possible.
|
|
2643
|
+
* If the wallet provider is not on the correct active network, it will try to switch to the correct active network.
|
|
2644
|
+
* It's not a blocker, so it will just log the error and skip the step if it fails.
|
|
2645
|
+
*
|
|
2646
|
+
* @not-instrumented
|
|
2647
|
+
*/
|
|
2648
|
+
const ensureCorrectActiveNetwork = async ({ requiredNetworkId, walletProvider }, client) => {
|
|
2649
|
+
const { logger } = getCore(client);
|
|
2650
|
+
if (!requiredNetworkId || !walletProvider.switchActiveNetwork) return;
|
|
2651
|
+
logger.debug("[ensureCorrectActiveNetwork] Required network id", requiredNetworkId);
|
|
2652
|
+
try {
|
|
2653
|
+
const { networkId: activeNetworkId } = await walletProvider.getActiveNetworkId();
|
|
2654
|
+
logger.debug("[ensureCorrectActiveNetwork] Check if should switch network", {
|
|
2655
|
+
activeNetworkId,
|
|
2656
|
+
requiredNetworkId
|
|
2657
|
+
});
|
|
2658
|
+
if (!activeNetworkId || activeNetworkId === requiredNetworkId) {
|
|
2659
|
+
logger.debug("[ensureCorrectActiveNetwork] No active network id found or active network id is the same as the required network id - skipping this step");
|
|
2660
|
+
return;
|
|
2661
|
+
}
|
|
2662
|
+
await walletProvider.switchActiveNetwork({ networkId: requiredNetworkId });
|
|
2663
|
+
} catch (error) {
|
|
2664
|
+
logger.debug("[ensureCorrectActiveNetwork] Error getting active network id or switching network - skipping this step", error);
|
|
2665
|
+
}
|
|
2666
|
+
};
|
|
2667
|
+
|
|
2638
2668
|
//#endregion
|
|
2639
2669
|
//#region src/modules/swap/executeSwapTransaction/executeSwapTransaction.ts
|
|
2640
2670
|
/**
|
|
@@ -2649,11 +2679,10 @@ const executeSwapTransaction = async ({ walletAccount, signingPayload, onStepCha
|
|
|
2649
2679
|
if (!SWAP_SUPPORTED_CHAINS.includes(walletAccount.chain)) throw new InvalidParamError(`Chain ${walletAccount.chain} is not supported for swap transactions`);
|
|
2650
2680
|
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
2651
2681
|
assertWalletProviderMethodDefined(walletProvider, "executeSwapTransaction");
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
}
|
|
2682
|
+
await ensureCorrectActiveNetwork({
|
|
2683
|
+
requiredNetworkId: signingPayload.chainId,
|
|
2684
|
+
walletProvider
|
|
2685
|
+
}, client);
|
|
2657
2686
|
const { transactionHash } = await walletProvider.executeSwapTransaction({
|
|
2658
2687
|
onStepChange,
|
|
2659
2688
|
signingPayload,
|
|
@@ -3615,6 +3644,118 @@ const getWalletConnectCatalog = async (client = getDefaultClient()) => {
|
|
|
3615
3644
|
return transformWalletBook({ walletBook: await fetchLegacyWalletBook(client) });
|
|
3616
3645
|
};
|
|
3617
3646
|
|
|
3647
|
+
//#endregion
|
|
3648
|
+
//#region src/modules/legacyWalletBook/matchWalletProvidersToCatalogGroup/matchWalletProvidersToCatalogGroup.ts
|
|
3649
|
+
const normalize = (value) => value.toLowerCase().replace(/\s+/g, "").replace(/wallet/g, "");
|
|
3650
|
+
/**
|
|
3651
|
+
* Returns the wallet providers that belong to the same wallet group as the
|
|
3652
|
+
* given WalletConnect catalog entry. Useful for de-duplicating "installed"
|
|
3653
|
+
* vs "available via WalletConnect" wallets when rendering a combined list.
|
|
3654
|
+
*
|
|
3655
|
+
* Matching is done on normalized identifiers — lowercased, whitespace removed,
|
|
3656
|
+
* and the literal substring "wallet" stripped — so that variations like:
|
|
3657
|
+
* - catalog key `"trust"` + catalog name `"Trust Wallet"`
|
|
3658
|
+
* - provider `groupKey: "trustwallet"` + `displayName: "Trust Wallet"`
|
|
3659
|
+
* collapse into a single match.
|
|
3660
|
+
*
|
|
3661
|
+
* @param params.catalogGroupKey - Key of the catalog group (e.g. `"metamask"`).
|
|
3662
|
+
* @param [params.catalogGroupName] - Optional display name (e.g. `"Trust Wallet"`); matched as a fallback when the key is opaque.
|
|
3663
|
+
* @param params.walletProviders - Currently available wallet providers (from `getAvailableWalletProvidersData`).
|
|
3664
|
+
* @returns The subset of `walletProviders` that match the catalog group.
|
|
3665
|
+
* @not-instrumented
|
|
3666
|
+
*/
|
|
3667
|
+
const matchWalletProvidersToCatalogGroup = ({ catalogGroupKey, catalogGroupName, walletProviders }) => {
|
|
3668
|
+
const targets = new Set([normalize(catalogGroupKey)]);
|
|
3669
|
+
if (catalogGroupName) targets.add(normalize(catalogGroupName));
|
|
3670
|
+
return walletProviders.filter((provider) => {
|
|
3671
|
+
return [normalize(provider.groupKey), normalize(provider.metadata.displayName)].some((candidate) => targets.has(candidate));
|
|
3672
|
+
});
|
|
3673
|
+
};
|
|
3674
|
+
|
|
3675
|
+
//#endregion
|
|
3676
|
+
//#region src/modules/legacyWalletBook/excludeInstalledFromCatalog/collectInstalledGroupIds/collectInstalledGroupIds.ts
|
|
3677
|
+
/**
|
|
3678
|
+
* Scans the catalog and returns the set of group identifiers for which at
|
|
3679
|
+
* least one installed wallet provider matches.
|
|
3680
|
+
*
|
|
3681
|
+
* Walks the catalog twice on purpose:
|
|
3682
|
+
* - First through `wallets`, to cover wallets that point to a `groupId`
|
|
3683
|
+
* with no matching entry in `groups` (we fall back to the wallet's own
|
|
3684
|
+
* name for matching in that case).
|
|
3685
|
+
* - Then through `groups`, to catch orphan group entries that have no
|
|
3686
|
+
* wallet referencing them.
|
|
3687
|
+
*
|
|
3688
|
+
* The check is skipped for any group already known to be installed, so a
|
|
3689
|
+
* multi-chain wallet (same `groupId` across EVM + SOL entries) only runs
|
|
3690
|
+
* the match once.
|
|
3691
|
+
*
|
|
3692
|
+
* @not-instrumented
|
|
3693
|
+
*/
|
|
3694
|
+
const collectInstalledGroupIds = ({ catalog, walletProviders }) => {
|
|
3695
|
+
const installedGroupIds = /* @__PURE__ */ new Set();
|
|
3696
|
+
for (const [walletKey, wallet] of Object.entries(catalog.wallets)) {
|
|
3697
|
+
const groupId = wallet.groupId || walletKey;
|
|
3698
|
+
if (installedGroupIds.has(groupId)) continue;
|
|
3699
|
+
if (matchWalletProvidersToCatalogGroup({
|
|
3700
|
+
catalogGroupKey: groupId,
|
|
3701
|
+
catalogGroupName: catalog.groups[groupId]?.name || wallet.name,
|
|
3702
|
+
walletProviders
|
|
3703
|
+
}).length > 0) installedGroupIds.add(groupId);
|
|
3704
|
+
}
|
|
3705
|
+
for (const [groupKey, group] of Object.entries(catalog.groups)) {
|
|
3706
|
+
if (installedGroupIds.has(groupKey)) continue;
|
|
3707
|
+
if (matchWalletProvidersToCatalogGroup({
|
|
3708
|
+
catalogGroupKey: groupKey,
|
|
3709
|
+
catalogGroupName: group.name,
|
|
3710
|
+
walletProviders
|
|
3711
|
+
}).length > 0) installedGroupIds.add(groupKey);
|
|
3712
|
+
}
|
|
3713
|
+
return installedGroupIds;
|
|
3714
|
+
};
|
|
3715
|
+
|
|
3716
|
+
//#endregion
|
|
3717
|
+
//#region src/modules/legacyWalletBook/excludeInstalledFromCatalog/excludeInstalledFromCatalog.ts
|
|
3718
|
+
/**
|
|
3719
|
+
* Returns a new WalletConnect catalog with the wallets and groups that the
|
|
3720
|
+
* user already has installed removed.
|
|
3721
|
+
*
|
|
3722
|
+
* Useful when rendering a combined wallet list (installed + WalletConnect
|
|
3723
|
+
* catalog) where each wallet should appear exactly once: installed wallets
|
|
3724
|
+
* win and the corresponding catalog entries get hidden.
|
|
3725
|
+
*
|
|
3726
|
+
* Matching is delegated to {@link collectInstalledGroupIds}, so a single
|
|
3727
|
+
* installed provider removes every wallet that shares its group — e.g. an
|
|
3728
|
+
* installed MetaMask hides both the EVM and SOL catalog entries.
|
|
3729
|
+
*
|
|
3730
|
+
* The original catalog object is not mutated.
|
|
3731
|
+
*
|
|
3732
|
+
* @param params.catalog - The full WalletConnect catalog (typically from `getWalletConnectCatalog`).
|
|
3733
|
+
* @param params.walletProviders - Currently available wallet providers.
|
|
3734
|
+
* @returns A new catalog with only the wallets and groups the user does not have installed.
|
|
3735
|
+
* @not-instrumented
|
|
3736
|
+
*/
|
|
3737
|
+
const excludeInstalledFromCatalog = ({ catalog, walletProviders }) => {
|
|
3738
|
+
const installedGroupIds = collectInstalledGroupIds({
|
|
3739
|
+
catalog,
|
|
3740
|
+
walletProviders
|
|
3741
|
+
});
|
|
3742
|
+
const wallets = {};
|
|
3743
|
+
for (const [walletKey, wallet] of Object.entries(catalog.wallets)) {
|
|
3744
|
+
const groupId = wallet.groupId || walletKey;
|
|
3745
|
+
if (installedGroupIds.has(groupId)) continue;
|
|
3746
|
+
wallets[walletKey] = wallet;
|
|
3747
|
+
}
|
|
3748
|
+
const groups = {};
|
|
3749
|
+
for (const [groupKey, group] of Object.entries(catalog.groups)) {
|
|
3750
|
+
if (installedGroupIds.has(groupKey)) continue;
|
|
3751
|
+
groups[groupKey] = group;
|
|
3752
|
+
}
|
|
3753
|
+
return {
|
|
3754
|
+
groups,
|
|
3755
|
+
wallets
|
|
3756
|
+
};
|
|
3757
|
+
};
|
|
3758
|
+
|
|
3618
3759
|
//#endregion
|
|
3619
3760
|
//#region src/modules/wallets/walletProvider/extractChainFromNormalizedName/extractChainFromNormalizedName.ts
|
|
3620
3761
|
/**
|
|
@@ -5690,9 +5831,9 @@ const getChainIdForAccountVerification = async ({ walletProvider }) => {
|
|
|
5690
5831
|
/** @not-instrumented */
|
|
5691
5832
|
const getSignInMessage = async ({ nonce: nonceOverride, walletAccount }, client) => {
|
|
5692
5833
|
const core = getCore(client);
|
|
5693
|
-
const
|
|
5694
|
-
assertDefined(
|
|
5695
|
-
const url = new URL(
|
|
5834
|
+
const { appUniversalLink } = getAppMetadata(client);
|
|
5835
|
+
assertDefined(appUniversalLink, "Universal link is not set");
|
|
5836
|
+
const url = new URL(appUniversalLink);
|
|
5696
5837
|
const domain = url.host;
|
|
5697
5838
|
const nonce = nonceOverride ?? await getNonce(client);
|
|
5698
5839
|
const walletProvider = getWalletProviderFromWalletAccount({ walletAccount }, client);
|
|
@@ -6575,5 +6716,5 @@ const parseUserAgent = ({ userAgent }) => {
|
|
|
6575
6716
|
assertPackageVersion(name, version);
|
|
6576
6717
|
|
|
6577
6718
|
//#endregion
|
|
6578
|
-
export { BaseError, CheckoutSessionTokenMissingError, ClientAlreadyInitializedError, DeeplinkConnectAndVerifyUnsupportedError, FeeEstimationFailedError, GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, InvalidSocialCallbackOriginError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, TokenSwapError, UnauthorizedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserCancelledSocialPopUpError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, __acknowledgeRecoveryCodes_wrapped as acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, __addNetwork_wrapped as addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, __attachCheckoutTransactionSource_wrapped as attachCheckoutTransactionSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, __authenticateWithSocial_wrapped as authenticateWithSocial, __broadcastCheckoutTransaction_wrapped as broadcastCheckoutTransaction, canConnectWithHardwareWallet, __cancelCheckoutTransaction_wrapped as cancelCheckoutTransaction, __checkStepUpAuth_wrapped as checkStepUpAuth, __completeDeviceRegistration_wrapped as completeDeviceRegistration, __completeSocialAuthentication_wrapped as completeSocialAuthentication, __completeSocialRedirect_wrapped as completeSocialRedirect, __confirmTransaction_wrapped as confirmTransaction, __connectAndVerifyWithWalletProvider_wrapped as connectAndVerifyWithWalletProvider, __connectWithWalletProvider_wrapped as connectWithWalletProvider, __consumeMfaToken_wrapped as consumeMfaToken, __createCheckoutTransaction_wrapped as createCheckoutTransaction, __createCoinbaseOnrampOrder_wrapped as createCoinbaseOnrampOrder, __createCryptoDotComPayment_wrapped as createCryptoDotComPayment, __createDynamicClient_wrapped as createDynamicClient, __createKrakenExchangeTransfer_wrapped as createKrakenExchangeTransfer, __createNewMfaRecoveryCodes_wrapped as createNewMfaRecoveryCodes, __deleteMfaDevice_wrapped as deleteMfaDevice, __deletePasskey_wrapped as deletePasskey, __deleteUser_wrapped as deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, detectSocialRedirectUrl, __executeSwapTransaction_wrapped as executeSwapTransaction, fetchProjectSettings, findMissingGoogleDriveBackupScopes, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getBalances, getCheckoutTransaction, getCheckoutTransactionQuote, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, __getElevatedAccessToken_wrapped as getElevatedAccessToken, __getGoogleDriveBackupReadiness_wrapped as getGoogleDriveBackupReadiness, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getRegisteredDevices, getSwapQuote, getSwapStatus, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletProviderDataByKey, hasAllGoogleDriveBackupScopes, hasExtension, __initializeClient_wrapped as initializeClient, isCaptchaRequired, isDeeplinkWalletProvider, isDeviceRegistrationRequired, isHardwareWalletAccount, isInsufficientGoogleDriveScopesError, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, parseUserAgent, __prepareCheckoutTransaction_wrapped as prepareCheckoutTransaction, __proveWalletAccountOwnership_wrapped as proveWalletAccountOwnership, __refreshAuth_wrapped as refreshAuth, __refreshUser_wrapped as refreshUser, __registerPasskey_wrapped as registerPasskey, __registerTotpMfaDevice_wrapped as registerTotpMfaDevice, __removeWalletAccount_wrapped as removeWalletAccount, __requestExternalAuthElevatedToken_wrapped as requestExternalAuthElevatedToken, requiresConversion, __revokeAllRegisteredDevices_wrapped as revokeAllRegisteredDevices, __revokeRegisteredDevice_wrapped as revokeRegisteredDevice, __selectPrimaryWalletAccount_wrapped as selectPrimaryWalletAccount, __sendEmailOTP_wrapped as sendEmailOTP, __sendSmsOTP_wrapped as sendSmsOTP, __setCaptchaToken_wrapped as setCaptchaToken, __setDefaultMfaDevice_wrapped as setDefaultMfaDevice, __setInstrumentationEnabled_wrapped as setInstrumentationEnabled, __signInWithExternalJwt_wrapped as signInWithExternalJwt, __signInWithPasskey_wrapped as signInWithPasskey, __signInWithSocialPopUp_wrapped as signInWithSocialPopUp, __signInWithSocialRedirect_wrapped as signInWithSocialRedirect, __signMessage_wrapped as signMessage, __submitCheckoutTransaction_wrapped as submitCheckoutTransaction, supportedCountries, __switchActiveNetwork_wrapped as switchActiveNetwork, trackCheckoutTransaction, __transferAmount_wrapped as transferAmount, __transferWalletAccount_wrapped as transferWalletAccount, __unlinkSocialAccount_wrapped as unlinkSocialAccount, __updateUser_wrapped as updateUser, __verifyOTP_wrapped as verifyOTP, __verifyWalletAccount_wrapped as verifyWalletAccount, waitForClientInitialized };
|
|
6719
|
+
export { BaseError, CheckoutSessionTokenMissingError, ClientAlreadyInitializedError, DeeplinkConnectAndVerifyUnsupportedError, FeeEstimationFailedError, GOOGLE_DRIVE_BACKUP_REQUIRED_SCOPES, InvalidDeviceRegistrationRedirectError, InvalidExternalAuthError, InvalidParamError, InvalidRedirectStorageStateError, InvalidSocialCallbackOriginError, LinkCredentialError, MFAAction, MfaInvalidOtpError, MfaRateLimitedError, MissingRedirectStorageStateError, MissingSocialUrlParamError, MissingUserVerificationError, NetworkAddingUnavailableError, NetworkNotAddedError, NetworkSwitchingUnavailableError, NoAddressFoundError, NoNetworkProvidersError, NoPasskeyCredentialsFoundError, NoSmartWalletAccountSignerFoundError, NoWebAuthNSupportError, NotWaasWalletAccountError, SandboxMaximumThresholdReachedError, SimulationFailedError, TokenSwapError, UnauthorizedError, UnavailableInServerSideError, UnrecognizedNetworkError, UserCancelledSocialPopUpError, UserNotAuthenticatedError, UserRejectedError, WalletAccountAlreadyVerifiedError, WalletAccountNotSelectedError, WalletAlreadyLinkedToAnotherUserError, WalletProviderMethodUnavailableError, __acknowledgeRecoveryCodes_wrapped as acknowledgeRecoveryCodes, addCoinbaseOnrampOrderEventListener, __addNetwork_wrapped as addNetwork, assertWalletAccountSigningAvailability, assertWalletProviderMethodDefined, __attachCheckoutTransactionSource_wrapped as attachCheckoutTransactionSource, authenticateMfaRecoveryCode, authenticatePasskeyMFA, authenticateTotpMfaDevice, __authenticateWithSocial_wrapped as authenticateWithSocial, __broadcastCheckoutTransaction_wrapped as broadcastCheckoutTransaction, canConnectWithHardwareWallet, __cancelCheckoutTransaction_wrapped as cancelCheckoutTransaction, __checkStepUpAuth_wrapped as checkStepUpAuth, __completeDeviceRegistration_wrapped as completeDeviceRegistration, __completeSocialAuthentication_wrapped as completeSocialAuthentication, __completeSocialRedirect_wrapped as completeSocialRedirect, __confirmTransaction_wrapped as confirmTransaction, __connectAndVerifyWithWalletProvider_wrapped as connectAndVerifyWithWalletProvider, __connectWithWalletProvider_wrapped as connectWithWalletProvider, __consumeMfaToken_wrapped as consumeMfaToken, __createCheckoutTransaction_wrapped as createCheckoutTransaction, __createCoinbaseOnrampOrder_wrapped as createCoinbaseOnrampOrder, __createCryptoDotComPayment_wrapped as createCryptoDotComPayment, __createDynamicClient_wrapped as createDynamicClient, __createKrakenExchangeTransfer_wrapped as createKrakenExchangeTransfer, __createNewMfaRecoveryCodes_wrapped as createNewMfaRecoveryCodes, __deleteMfaDevice_wrapped as deleteMfaDevice, __deletePasskey_wrapped as deletePasskey, __deleteUser_wrapped as deleteUser, detectDeviceRegistrationRedirect, detectOAuthRedirect, detectSocialRedirectUrl, excludeInstalledFromCatalog, __executeSwapTransaction_wrapped as executeSwapTransaction, fetchProjectSettings, findMissingGoogleDriveBackupScopes, getActiveNetworkData, getActiveNetworkId, getAvailableWalletProvidersData, getBalance, getBalanceForAddress, getBalances, getCheckoutTransaction, getCheckoutTransactionQuote, getCoinbaseBuyUrl, getConnectedAddresses, getDefaultClient, getDeviceRegistrationTokenFromUrl, __getElevatedAccessToken_wrapped as getElevatedAccessToken, __getGoogleDriveBackupReadiness_wrapped as getGoogleDriveBackupReadiness, getKrakenAccounts, getKrakenWhitelistedAddresses, getMfaDevices, getMfaMethods, getMfaRecoveryCodes, getMissingVerificationForCoinbaseOnrampOrder, getMultichainBalances, getNetworksData, getOwnerWalletAccountForSmartWalletAccount, getPasskeys, getPrimaryWalletAccount, getRegisteredDevices, getSwapQuote, getSwapStatus, getTransactionHistory, getUserSocialAccounts, getWalletAccountAddressByType, getWalletAccountFromAddress, getWalletAccounts, getWalletConnectCatalog, getWalletConnectCatalogWalletByWalletProviderKey, getWalletProviderDataByKey, hasAllGoogleDriveBackupScopes, hasExtension, __initializeClient_wrapped as initializeClient, isCaptchaRequired, isDeeplinkWalletProvider, isDeviceRegistrationRequired, isHardwareWalletAccount, isInsufficientGoogleDriveScopesError, isMfaRequiredForAction, isMobile, isPendingRecoveryCodesAcknowledgment, isProgrammaticNetworkSwitchAvailable, isSignedIn, isUserMissingMfaAuth, isUserOnboardingComplete, isWalletAccountVerified, logout, matchWalletProvidersToCatalogGroup, offEvent, offWalletProviderEvent, onEvent, onWalletProviderEvent, onceEvent, parseUserAgent, __prepareCheckoutTransaction_wrapped as prepareCheckoutTransaction, __proveWalletAccountOwnership_wrapped as proveWalletAccountOwnership, __refreshAuth_wrapped as refreshAuth, __refreshUser_wrapped as refreshUser, __registerPasskey_wrapped as registerPasskey, __registerTotpMfaDevice_wrapped as registerTotpMfaDevice, __removeWalletAccount_wrapped as removeWalletAccount, __requestExternalAuthElevatedToken_wrapped as requestExternalAuthElevatedToken, requiresConversion, __revokeAllRegisteredDevices_wrapped as revokeAllRegisteredDevices, __revokeRegisteredDevice_wrapped as revokeRegisteredDevice, __selectPrimaryWalletAccount_wrapped as selectPrimaryWalletAccount, __sendEmailOTP_wrapped as sendEmailOTP, __sendSmsOTP_wrapped as sendSmsOTP, __setCaptchaToken_wrapped as setCaptchaToken, __setDefaultMfaDevice_wrapped as setDefaultMfaDevice, __setInstrumentationEnabled_wrapped as setInstrumentationEnabled, __signInWithExternalJwt_wrapped as signInWithExternalJwt, __signInWithPasskey_wrapped as signInWithPasskey, __signInWithSocialPopUp_wrapped as signInWithSocialPopUp, __signInWithSocialRedirect_wrapped as signInWithSocialRedirect, __signMessage_wrapped as signMessage, __submitCheckoutTransaction_wrapped as submitCheckoutTransaction, supportedCountries, __switchActiveNetwork_wrapped as switchActiveNetwork, trackCheckoutTransaction, __transferAmount_wrapped as transferAmount, __transferWalletAccount_wrapped as transferWalletAccount, __unlinkSocialAccount_wrapped as unlinkSocialAccount, __updateUser_wrapped as updateUser, __verifyOTP_wrapped as verifyOTP, __verifyWalletAccount_wrapped as verifyWalletAccount, waitForClientInitialized };
|
|
6579
6720
|
//# sourceMappingURL=index.esm.js.map
|