@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.cjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
const require_logoutWithReason = require('./logoutWithReason-
|
|
2
|
-
const require_migrateFromFireblocks = require('./migrateFromFireblocks-
|
|
3
|
-
const require_waas = require('./waas-
|
|
4
|
-
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-
|
|
5
|
-
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-
|
|
6
|
-
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-
|
|
7
|
-
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-
|
|
1
|
+
const require_logoutWithReason = require('./logoutWithReason-D6ruPOvJ.cjs');
|
|
2
|
+
const require_migrateFromFireblocks = require('./migrateFromFireblocks-CCNTDCmW.cjs');
|
|
3
|
+
const require_waas = require('./waas-ZWlJHeXc.cjs');
|
|
4
|
+
const require_getNetworkProviderFromNetworkId = require('./getNetworkProviderFromNetworkId-DNIuJp20.cjs');
|
|
5
|
+
const require_getVerifiedCredentialForWalletAccount = require('./getVerifiedCredentialForWalletAccount-B5LUGiDP.cjs');
|
|
6
|
+
const require_isUserOnboardingComplete = require('./isUserOnboardingComplete-C2ZuLDT9.cjs');
|
|
7
|
+
const require_isMfaRequiredForAction = require('./isMfaRequiredForAction-YjJLLFFs.cjs');
|
|
8
8
|
let _dynamic_labs_sdk_assert_package_version = require("@dynamic-labs-sdk/assert-package-version");
|
|
9
9
|
let _dynamic_labs_sdk_api_core = require("@dynamic-labs/sdk-api-core");
|
|
10
10
|
let zod_mini = require("zod/mini");
|
|
11
11
|
zod_mini = require_logoutWithReason.__toESM(zod_mini);
|
|
12
12
|
let eventemitter3 = require("eventemitter3");
|
|
13
|
-
eventemitter3 = require_logoutWithReason.__toESM(eventemitter3);
|
|
14
13
|
let _simplewebauthn_browser = require("@simplewebauthn/browser");
|
|
15
14
|
|
|
16
15
|
//#region src/modules/state/raiseStateEvents/events.ts
|
|
@@ -677,11 +676,6 @@ const createAsyncTrack = () => {
|
|
|
677
676
|
};
|
|
678
677
|
};
|
|
679
678
|
|
|
680
|
-
//#endregion
|
|
681
|
-
//#region src/services/eventEmitter/createEventEmitter.ts
|
|
682
|
-
/** @notInstrumented */
|
|
683
|
-
const createEventEmitter = () => new eventemitter3.default();
|
|
684
|
-
|
|
685
679
|
//#endregion
|
|
686
680
|
//#region src/services/fetch/createWebFetch.ts
|
|
687
681
|
/**
|
|
@@ -1047,7 +1041,7 @@ const createCore = (config) => {
|
|
|
1047
1041
|
const navigate = config.coreConfig?.navigate ?? createNavigationHandler();
|
|
1048
1042
|
const state = createObservableState(getInitialState);
|
|
1049
1043
|
const debouncedMutex = createDebouncedMutex();
|
|
1050
|
-
const eventEmitter = createEventEmitter();
|
|
1044
|
+
const eventEmitter = require_getNetworkProviderFromNetworkId.createEventEmitter();
|
|
1051
1045
|
const initTrack = createAsyncTrack();
|
|
1052
1046
|
const sdkSessionId = require_logoutWithReason.randomString({ length: 32 });
|
|
1053
1047
|
const instrumentation = createInstrumentation({ config: config.instrumentation });
|
|
@@ -7347,6 +7341,77 @@ const getInstallationLinkForCurrentPlatform = ({ installationUrls }) => {
|
|
|
7347
7341
|
if (isChromeBrowser()) return installationUrls.chrome;
|
|
7348
7342
|
};
|
|
7349
7343
|
|
|
7344
|
+
//#endregion
|
|
7345
|
+
//#region src/modules/wallets/networks/getEnabledChains/getEnabledChains.ts
|
|
7346
|
+
/**
|
|
7347
|
+
* Returns the chains this client can operate on — a chain is enabled once
|
|
7348
|
+
* one of its extensions has been added (`addEvmExtension`,
|
|
7349
|
+
* `addSolanaExtension`, …), since every chain extension registers a
|
|
7350
|
+
* network provider builder for its chain.
|
|
7351
|
+
*
|
|
7352
|
+
* Reading the builder registry keeps chain awareness out of the client
|
|
7353
|
+
* package: the set is whatever the extensions registered, so no
|
|
7354
|
+
* chain-specific branch is needed here.
|
|
7355
|
+
*
|
|
7356
|
+
* @param client - The Dynamic client instance.
|
|
7357
|
+
* @returns The set of chains the client has an extension for.
|
|
7358
|
+
* @example
|
|
7359
|
+
* ```typescript
|
|
7360
|
+
* // client created with addEvmExtension only
|
|
7361
|
+
* getEnabledChains(client); // Set { 'EVM' }
|
|
7362
|
+
* ```
|
|
7363
|
+
* @see {@link getNetworkProviderBuilderRegistry} for the registry the chains are read from.
|
|
7364
|
+
* @see {@link getNetworkProviders} for the other consumer of that registry.
|
|
7365
|
+
* @notInstrumented
|
|
7366
|
+
*/
|
|
7367
|
+
const getEnabledChains = (client) => {
|
|
7368
|
+
const networkProviderBuilderRegistry = require_getNetworkProviderFromNetworkId.getNetworkProviderBuilderRegistry(client);
|
|
7369
|
+
return new Set(networkProviderBuilderRegistry.get().keys());
|
|
7370
|
+
};
|
|
7371
|
+
|
|
7372
|
+
//#endregion
|
|
7373
|
+
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7374
|
+
/**
|
|
7375
|
+
* Returns every chain a wallet book entry advertises support for —
|
|
7376
|
+
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7377
|
+
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7378
|
+
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7379
|
+
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7380
|
+
*
|
|
7381
|
+
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7382
|
+
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7383
|
+
* never returns an empty array — every eligible wallet emits at least
|
|
7384
|
+
* one option.
|
|
7385
|
+
*
|
|
7386
|
+
* @param params.wallet - The wallet schema from the wallet book.
|
|
7387
|
+
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7388
|
+
* @returns Ordered, deduped array of Chains.
|
|
7389
|
+
* @notInstrumented
|
|
7390
|
+
*/
|
|
7391
|
+
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7392
|
+
const chains = /* @__PURE__ */ new Set();
|
|
7393
|
+
for (const entry of wallet.injectedConfig ?? []) {
|
|
7394
|
+
if (!entry.chain) continue;
|
|
7395
|
+
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7396
|
+
if (chain) chains.add(chain);
|
|
7397
|
+
}
|
|
7398
|
+
for (const identifier of wallet.chains ?? []) {
|
|
7399
|
+
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7400
|
+
try {
|
|
7401
|
+
const chain = require_logoutWithReason.getChainFromVerifiedCredentialChain(prefix);
|
|
7402
|
+
chains.add(chain);
|
|
7403
|
+
} catch {}
|
|
7404
|
+
}
|
|
7405
|
+
if (chains.size === 0) {
|
|
7406
|
+
const chain = getChainFromWalletSchema({
|
|
7407
|
+
wallet,
|
|
7408
|
+
walletKey
|
|
7409
|
+
});
|
|
7410
|
+
chains.add(chain);
|
|
7411
|
+
}
|
|
7412
|
+
return Array.from(chains);
|
|
7413
|
+
};
|
|
7414
|
+
|
|
7350
7415
|
//#endregion
|
|
7351
7416
|
//#region src/modules/walletOptionsCatalogue/resolveWalletBookWalletOptionKey/resolveWalletBookWalletOptionKey.ts
|
|
7352
7417
|
/**
|
|
@@ -7392,11 +7457,17 @@ const getInAppBrowserUrl = ({ wallet }) => wallet.mobile?.inAppBrowserV2 ?? wall
|
|
|
7392
7457
|
* and injected-only wallets are dropped — so the catalogue's notion of
|
|
7393
7458
|
* "external wallet" stays consistent across option types.
|
|
7394
7459
|
*
|
|
7460
|
+
* A wallet's in-app browser opens a single session, so it emits one option
|
|
7461
|
+
* tagged with the first chain it advertises that the client has an
|
|
7462
|
+
* extension for — a multi-chain wallet is still reachable when only one of
|
|
7463
|
+
* its chains is enabled.
|
|
7464
|
+
*
|
|
7465
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7395
7466
|
* @param params.walletBook - The fetched wallet book.
|
|
7396
7467
|
* @returns Tagged `inAppBrowser` options paired with their wallet option keys.
|
|
7397
7468
|
* @notInstrumented
|
|
7398
7469
|
*/
|
|
7399
|
-
const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
7470
|
+
const buildInAppBrowserOptions = ({ enabledChains, walletBook }) => {
|
|
7400
7471
|
const result = [];
|
|
7401
7472
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7402
7473
|
if (shouldFilterWallet({
|
|
@@ -7405,12 +7476,14 @@ const buildInAppBrowserOptions = ({ walletBook }) => {
|
|
|
7405
7476
|
})) continue;
|
|
7406
7477
|
const url = getInAppBrowserUrl({ wallet });
|
|
7407
7478
|
if (!url) continue;
|
|
7479
|
+
const chain = getChainsFromWalletSchema({
|
|
7480
|
+
wallet,
|
|
7481
|
+
walletKey
|
|
7482
|
+
}).find((advertisedChain) => enabledChains.has(advertisedChain));
|
|
7483
|
+
if (!chain) continue;
|
|
7408
7484
|
result.push({
|
|
7409
7485
|
option: {
|
|
7410
|
-
chain
|
|
7411
|
-
wallet,
|
|
7412
|
-
walletKey
|
|
7413
|
-
}),
|
|
7486
|
+
chain,
|
|
7414
7487
|
type: "inAppBrowser",
|
|
7415
7488
|
url
|
|
7416
7489
|
},
|
|
@@ -7483,17 +7556,25 @@ const hasAnyInstallationUrl = ({ urls }) => Object.values(urls).some(Boolean);
|
|
|
7483
7556
|
* Reuses the generic `shouldFilterWallet` rules so embedded wallets do
|
|
7484
7557
|
* not appear here either — they're not user-installable products.
|
|
7485
7558
|
*
|
|
7559
|
+
* Wallets that advertise no chain this client has an extension for are
|
|
7560
|
+
* skipped: installing them would not make them connectable.
|
|
7561
|
+
*
|
|
7562
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
7486
7563
|
* @param params.walletBook - The fetched wallet book.
|
|
7487
7564
|
* @returns A map from wallet option key to its install URL bag.
|
|
7488
7565
|
* @notInstrumented
|
|
7489
7566
|
*/
|
|
7490
|
-
const buildInstallationUrlsByWalletOptionKey = ({ walletBook }) => {
|
|
7567
|
+
const buildInstallationUrlsByWalletOptionKey = ({ enabledChains, walletBook }) => {
|
|
7491
7568
|
const map = /* @__PURE__ */ new Map();
|
|
7492
7569
|
for (const [walletKey, wallet] of Object.entries(walletBook.wallets)) {
|
|
7493
7570
|
if (shouldFilterWallet({
|
|
7494
7571
|
wallet,
|
|
7495
7572
|
walletKey
|
|
7496
7573
|
})) continue;
|
|
7574
|
+
if (!getChainsFromWalletSchema({
|
|
7575
|
+
wallet,
|
|
7576
|
+
walletKey
|
|
7577
|
+
}).some((chain) => enabledChains.has(chain))) continue;
|
|
7497
7578
|
const urls = buildInstallationUrls({ wallet });
|
|
7498
7579
|
if (!hasAnyInstallationUrl({ urls })) continue;
|
|
7499
7580
|
const walletOptionKey = resolveWalletBookWalletOptionKey({
|
|
@@ -7585,49 +7666,6 @@ const buildMetaMaskSdkUriOptions = ({ walletBook }) => {
|
|
|
7585
7666
|
return [];
|
|
7586
7667
|
};
|
|
7587
7668
|
|
|
7588
|
-
//#endregion
|
|
7589
|
-
//#region src/modules/legacyWalletBook/getWalletConnectCatalog/getChainsFromWalletSchema/getChainsFromWalletSchema.ts
|
|
7590
|
-
/**
|
|
7591
|
-
* Returns every chain a wallet book entry advertises support for —
|
|
7592
|
-
* deduped, in `injectedConfig` order, then `chains` order. Used by the
|
|
7593
|
-
* catalogue's WalletConnect builder so a multi-chain wallet (e.g. Trust
|
|
7594
|
-
* supports EVM + SOL) gets one option per chain rather than one option
|
|
7595
|
-
* for whichever chain `getChainFromWalletSchema` happened to pick first.
|
|
7596
|
-
*
|
|
7597
|
-
* Falls back to {@link getChainFromWalletSchema}'s single-result behavior
|
|
7598
|
-
* (`['EVM']` default) when neither field is populated, so the helper
|
|
7599
|
-
* never returns an empty array — every eligible wallet emits at least
|
|
7600
|
-
* one option.
|
|
7601
|
-
*
|
|
7602
|
-
* @param params.wallet - The wallet schema from the wallet book.
|
|
7603
|
-
* @param [params.walletKey] - The wallet key identifier (used as last-resort fallback).
|
|
7604
|
-
* @returns Ordered, deduped array of Chains.
|
|
7605
|
-
* @notInstrumented
|
|
7606
|
-
*/
|
|
7607
|
-
const getChainsFromWalletSchema = ({ wallet, walletKey }) => {
|
|
7608
|
-
const chains = /* @__PURE__ */ new Set();
|
|
7609
|
-
for (const entry of wallet.injectedConfig ?? []) {
|
|
7610
|
-
if (!entry.chain) continue;
|
|
7611
|
-
const chain = getChainFromWalletBookIdentifier({ identifier: entry.chain });
|
|
7612
|
-
if (chain) chains.add(chain);
|
|
7613
|
-
}
|
|
7614
|
-
for (const identifier of wallet.chains ?? []) {
|
|
7615
|
-
const prefix = extractChainPrefix({ chainIdentifier: identifier });
|
|
7616
|
-
try {
|
|
7617
|
-
const chain = require_logoutWithReason.getChainFromVerifiedCredentialChain(prefix);
|
|
7618
|
-
chains.add(chain);
|
|
7619
|
-
} catch {}
|
|
7620
|
-
}
|
|
7621
|
-
if (chains.size === 0) {
|
|
7622
|
-
const chain = getChainFromWalletSchema({
|
|
7623
|
-
wallet,
|
|
7624
|
-
walletKey
|
|
7625
|
-
});
|
|
7626
|
-
chains.add(chain);
|
|
7627
|
-
}
|
|
7628
|
-
return Array.from(chains);
|
|
7629
|
-
};
|
|
7630
|
-
|
|
7631
7669
|
//#endregion
|
|
7632
7670
|
//#region src/modules/walletOptionsCatalogue/buildWalletConnectOptions/buildWalletConnectOptions.ts
|
|
7633
7671
|
/**
|
|
@@ -8012,6 +8050,31 @@ const buildWithWalletProviderOptions = ({ entries, walletBook }, client) => {
|
|
|
8012
8050
|
*/
|
|
8013
8051
|
const EXCLUDED_WALLET_OPTION_KEYS = new Set(["coinbase", "coinbasewallet"]);
|
|
8014
8052
|
|
|
8053
|
+
//#endregion
|
|
8054
|
+
//#region src/modules/walletOptionsCatalogue/filterConnectionOptionsByEnabledChains/filterConnectionOptionsByEnabledChains.ts
|
|
8055
|
+
/**
|
|
8056
|
+
* Drops options whose chain has no extension on this client. The wallet
|
|
8057
|
+
* book advertises every chain a wallet supports, so options derived from
|
|
8058
|
+
* it have to be narrowed to the chains the client can actually connect
|
|
8059
|
+
* on — otherwise the catalogue surfaces a connection the customer has no
|
|
8060
|
+
* primitive to drive.
|
|
8061
|
+
*
|
|
8062
|
+
* @param params.enabledChains - Chains the client has an extension for.
|
|
8063
|
+
* @param params.options - The tagged options to narrow.
|
|
8064
|
+
* @returns The options on enabled chains, in input order.
|
|
8065
|
+
* @example
|
|
8066
|
+
* ```typescript
|
|
8067
|
+
* filterConnectionOptionsByEnabledChains({
|
|
8068
|
+
* enabledChains: new Set(['EVM']),
|
|
8069
|
+
* options: [evmOption, solOption],
|
|
8070
|
+
* }); // [evmOption]
|
|
8071
|
+
* ```
|
|
8072
|
+
* @see {@link getEnabledChains} for how the enabled chains are derived.
|
|
8073
|
+
* @see {@link getWalletOptionsCatalogue} for the catalogue that applies this filter.
|
|
8074
|
+
* @notInstrumented
|
|
8075
|
+
*/
|
|
8076
|
+
const filterConnectionOptionsByEnabledChains = ({ enabledChains, options }) => options.filter(({ option }) => enabledChains.has(option.chain));
|
|
8077
|
+
|
|
8015
8078
|
//#endregion
|
|
8016
8079
|
//#region src/modules/walletOptionsCatalogue/groupOptionsByWalletOption/groupOptionsByWalletOption.ts
|
|
8017
8080
|
/**
|
|
@@ -8256,6 +8319,10 @@ const EMPTY_WALLET_BOOK = {
|
|
|
8256
8319
|
* pass `includeMobileOptions: true` to additionally surface
|
|
8257
8320
|
* WalletConnect, in-app-browser, and install links.
|
|
8258
8321
|
*
|
|
8322
|
+
* Options sourced from the wallet book are scoped to the chains this
|
|
8323
|
+
* client has an extension for — a wallet is only surfaced on chains the
|
|
8324
|
+
* customer can actually connect on.
|
|
8325
|
+
*
|
|
8259
8326
|
* Pass `excludedConnectionOptionTypes` to drop specific connection types
|
|
8260
8327
|
* from the catalogue (e.g. `['inAppBrowser']` on desktop). Wallets whose
|
|
8261
8328
|
* only connection was an excluded type fall through to the install-only
|
|
@@ -8271,6 +8338,7 @@ const getWalletOptionsCatalogue = async (params = {}, client = require_logoutWit
|
|
|
8271
8338
|
const walletOptionOrdering = params.walletOptionOrdering ?? "relevance";
|
|
8272
8339
|
const excludedConnectionOptionTypes = new Set(params.excludedConnectionOptionTypes ?? []);
|
|
8273
8340
|
const walletBook = includeMobileOptions ? await fetchLegacyWalletBook(client) : EMPTY_WALLET_BOOK;
|
|
8341
|
+
const enabledChains = getEnabledChains(client);
|
|
8274
8342
|
const allConnectionOptions = [];
|
|
8275
8343
|
if (!excludedConnectionOptionTypes.has("withWalletProvider")) {
|
|
8276
8344
|
const entries = require_logoutWithReason.getWalletProviderRegistry(client).listProviderEntries();
|
|
@@ -8280,11 +8348,22 @@ const getWalletOptionsCatalogue = async (params = {}, client = require_logoutWit
|
|
|
8280
8348
|
}, client));
|
|
8281
8349
|
}
|
|
8282
8350
|
if (includeMobileOptions) {
|
|
8283
|
-
|
|
8284
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8285
|
-
if (!excludedConnectionOptionTypes.has("
|
|
8351
|
+
const walletBookOptions = [];
|
|
8352
|
+
if (!excludedConnectionOptionTypes.has("walletConnect")) walletBookOptions.push(...buildWalletConnectOptions({ walletBook }));
|
|
8353
|
+
if (!excludedConnectionOptionTypes.has("metamaskSdkUri")) walletBookOptions.push(...buildMetaMaskSdkUriOptions({ walletBook }));
|
|
8354
|
+
if (!excludedConnectionOptionTypes.has("inAppBrowser")) walletBookOptions.push(...buildInAppBrowserOptions({
|
|
8355
|
+
enabledChains,
|
|
8356
|
+
walletBook
|
|
8357
|
+
}));
|
|
8358
|
+
allConnectionOptions.push(...filterConnectionOptionsByEnabledChains({
|
|
8359
|
+
enabledChains,
|
|
8360
|
+
options: walletBookOptions
|
|
8361
|
+
}));
|
|
8286
8362
|
}
|
|
8287
|
-
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8363
|
+
const installationUrlsByKey = includeMobileOptions ? buildInstallationUrlsByWalletOptionKey({
|
|
8364
|
+
enabledChains,
|
|
8365
|
+
walletBook
|
|
8366
|
+
}) : /* @__PURE__ */ new Map();
|
|
8288
8367
|
const grouped = groupOptionsByWalletOption({ options: allConnectionOptions });
|
|
8289
8368
|
const allWalletOptionKeys = new Set([...grouped.keys(), ...installationUrlsByKey.keys()]);
|
|
8290
8369
|
const walletOptions = [];
|